Commit Graph

7399 Commits

Author SHA1 Message Date
Karel Zak 4b01c5a142 fallocate: fix missing sentinel for is_nul()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-19 14:26:52 +01:00
Karel Zak 53e6896ab8 libblkid: add extra checks to XFS prober
The current code rely on XFS magic string only. It seems too fragile.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-19 13:27:56 +01:00
Karel Zak c4172cc3bb fallocate: code optimalizations
Based on Pádraig Brady review:

 * use is_nul() from coreutils rather then memcmp()

 * always call skip_hole() (SEEK_DATA)

 * fix possible overflows

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-19 10:48:16 +01:00
Karel Zak c12eff4ce0 fallocate: use POSIX_FADV_DONTNEED to discard cached data
The patch discard cached data in 1MiB (or bigger) steps.

Thanks to Pádraig Brady.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-18 13:01:52 +01:00
Karel Zak db5f00bc88 fallocate: use SEEK_DATA on already sparse files
It's more efficient to skip already known holes by SEEK_DATA (seek to
the next area with data).

Thanks to Pádraig Brady.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-18 11:38:47 +01:00
Karel Zak 9b1b6ed187 fallocate: fix man page synopsis
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 15:34:08 +01:00
Karel Zak 6855da75f3 build-sys: enable parallel tests for make check
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 15:07:41 +01:00
Sami Kerola 40e6f7a063 tests: make tests to run parallel
Unarguably this change makes test output to be more messy, but when I
compare run time tells with clear numbers parallel is quicker.  For me
the quickness is important factor.  Running test suite always after a
change is preferrably quick, and if something is indicated to be broken
it is ok to spend time in drilling down what happen.

$ time ./tests/run.sh --parallel=5
[...]
real    1m48.037s

Same without parallelization.

$ time ./tests/run.sh
real    3m16.687s

The default is changed to be parallel, where job count is same as number
of CPUs.

[kzak@redhat.com: - propagate --parallel into function.sh
                  - don't use extra title for non-parallel execution
                  - disable by default]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 15:01:02 +01:00
Karel Zak 67ef06d71d tests: fdisk now prints SGI system partitions too
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 14:34:31 +01:00
Karel Zak 65bb09be76 tests: update libmount tabdiff tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 14:32:22 +01:00
Karel Zak 093407a585 tests: update ionice test
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 14:30:03 +01:00
Sami Kerola be091dee66 isosize: make --divisor to require argument
Silly bug, only the short option -d allowed divisor argument.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-17 14:16:21 +01:00
Sami Kerola e55db6a862 tests: add isosize --sectors and --divisor tests
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-17 14:16:21 +01:00
Sami Kerola 799e584245 isosize: move file name printing after error determination
Earlier the filename printing was buffered, and exit at error made output
to appear in front of prompt.  Output below demonstrates the brokenness.

prompt> isosize /etc /
isosize: /etc: might not be an ISO filesystem
isosize: read error on /etc: Is a directory
/etc: prompt>

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-17 14:04:41 +01:00
Sami Kerola fce72f96d0 swaplabel: wrong version number in check
$ swaplabel /dev/sda2
swaplabel: /dev/sda2: unsupported swap version '1'

The mkswap does not allow any other version, so swaplabel(8) must be
wrong.

Reference: https://github.com/karelzak/util-linux/blob/master/disk-utils/mkswap.c#L520
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-17 14:04:40 +01:00
Sami Kerola 272f2ea49f tests: align last.1 with recent phantom detection
None existing account is not still-logged-in but gone mysteriously,
assuming wtmp logout markup is missing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-17 14:04:39 +01:00
Sami Kerola 100af0035e docs: make hexdump.1 color specification easier to understand
Fix also spacing, input line lenghts, and troff table for data that is a
table.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-17 14:04:37 +01:00
Sami Kerola 052a6cf285 tools: add usage information to checkconfig.sh
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-17 14:04:35 +01:00
Sami Kerola e130ce53ce tests: avoid executing dirname(1) command
Bash parameter expansion does the same thing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-17 13:55:41 +01:00
Karel Zak 67958a167d tests: fix trailing spaces in cal(1) stuff
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 13:40:03 +01:00
Thomas Bächler 2e358a901f libmount: initialize *root to NULL in mnt_table_get_root_fs
mnt_table_get_root_fs only works when *root is set to NULL. This
is not only undocumented, but also unintuitive. Fix it by initializing
*root inside mnt_table_get_root_fs.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 13:36:47 +01:00
Karel Zak 270ab78a0c su: don't use kill(0, ...) when propagate signal
The current code uses kill(0, caught_signal) after regular
signal cleanup and before exit (all just to make shells happy).

Unfortunately, kill(0, ...) is a bad idea. It seems better to use
kill(getpid(), ...) otherwise we kill our parent process too.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1063887
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 13:22:30 +01:00
Karel Zak 5980048edd libmount: make the mountinfo parser more robust
... sorry, the previous change to the parser was too stupid.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 13:17:47 +01:00
Karel Zak c6f462ffac libmount: accept (deleted) path suffix in mountinfo file
Addresses: debian bug #711183
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 13:12:23 +01:00
Masatake YAMATO bd2ff3d2d9 ionice: add the way to specify the target processes with pgid and uid
ioprio_get and ioprio_set system call accept not only process ID but
also process group ID(pgid) and user ID(uid) to specify the target
process(es).  However, ionice command accepts only process ID.  With
this patch a user can specify the target processes with pgid(-P
option) and uid(-u option).

[kzak@redhat.com: - tiny cleanup in usage()]

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 11:44:12 +01:00
Karel Zak d6cecc3fba fallocate: improve --dig-holes
* don't use --length to specify hole size, always use stat.st_blksize

 * use --offset and --length to specify offset within the file (like
   another fallocate operations)

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-17 11:13:54 +01:00
Karel Zak 782c290c5c fallocate: add --verbose, clean up usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-14 14:37:51 +01:00
Rodrigo Campos 24b2a479fd fallocate: Add "--dig-holes" option
This option tries to detect chunk of '\0's and punch a hole, making the file
sparse in-place.

[kzak@redhat.com: - fix coding style, use xalloc.h and err.h]

Signed-off-by: Rodrigo Campos <rodrigo@sdfg.com.ar>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-14 11:31:12 +01:00
Rodrigo Campos bcd9315d4b fallocate: Hide #ifdef tricks to call fallocate in a function
Future patches will add more calls to fallocate(), so it will be useful to have
all these tricks inside a function.

The error message when fallocate is not supported is slightly changed: the file
name is not printed as a prefix because is not available in the context of the
function. Also, to only print one of the two possible errors (as happens when
using directly exit()), an else clause was added.

Signed-off-by: Rodrigo Campos <rodrigo@sdfg.com.ar>
2014-02-14 11:00:41 +01:00
Rodrigo Campos a8d10d1c9d fallocate: Clarify that space can also be deallocated
The functionality is already there, with --punch-hole, but the text was for the
preallocation case only.

Signed-off-by: Rodrigo Campos <rodrigo@sdfg.com.ar>
2014-02-14 11:00:38 +01:00
Jesper Dahl Nyerup 7f1d483638 scriptreplay: Add --maxdelay option.
This option caps the delay between updates, to avoid long pauses in
transcript playback.

Signed-off-by: Jesper Dahl Nyerup <nyerup@one.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-10 19:24:28 +01:00
Sami Kerola 0c6dc4b99f cal: remove unnecessary static variables
Not in use since commit 95f4adde86.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-10 19:09:37 +01:00
Phillip Susi e8f3480354 renice: correct max priority in renice man page
The man page stated that the PRIO_MAX is 20.  While this
is correct, the header definition is wrong and the max
value is actually 19.

[kzak@redhat.com: - remove PRIO_MAX from man page, kernel syscalls
                    use hardcoded numbers for the priority limits]

Signed-off-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-10 19:02:36 +01:00
Phillip Susi c12e066233 mount: remove obsolete and confusing statement from mount.8
The wording was confusing and suidperl has gone the way
of the dodo, and really didn't need mentionting in mount.8.

Signed-off-by: Phillip Susi <psusi@ubuntu.com>
2014-02-10 18:58:53 +01:00
Phillip Susi b5ab5bec73 fix mkfs --verbose and man page
mkfs did not actually accept the long form --verbose option.
Also the man page seemed to indicate that version/verbose/help
options were passed to the filesystem specific utility when this
is not the case.

Signed-off-by: Phillip Susi <psusi@ubuntu.com>
2014-02-10 18:58:39 +01:00
Benno Schulenberg b2d97db8c8 hwclock: internationalizing the message of the used interface
In addition, do it in a single sentence instead of in two fragments.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-02-10 18:41:55 +01:00
Ville Skyttä ad1d426aea getopt.1: The usual doc dir is /usr/share/doc, not .../docs
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2014-02-10 18:38:39 +01:00
Andy Lutomirski d359c62ce9 setpriv: Fix --apparmor-profile
There were two bugs.  First, trying to access /proc/self/attr/exec
with O_CREAT | O_EXCL has no chance of working.  Second, it turns
out that the correct command to send is "exec", not "changeprofile".
Of course, there was no way to know this until:

    commit 3eea57c26e49a5add4c053a031cc2a1977b7c48e
    Author: John Johansen <john.johansen@canonical.com>
    Date:   Wed Feb 27 03:44:40 2013 -0800

        apparmor: fix setprocattr arg processing for onexec

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
2014-02-10 18:38:35 +01:00
Sami Kerola 404fa3f93c last: make session gone determination more robust
Earlier determination that used kill with signal zero to pid was prone to
false positive reports, due reuse of pid space and unrelated processes.
New function is_phantom() tries do a little bit better job, but fails to
be perfect.  It seems linking to gether utmp session start time or
terminal id with /proc/<pid>/ information is not as simple as one might
hope.

Reported-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-10 18:25:31 +01:00
Ondrej Oprala 098ab0778f hexdump: add highlighting support
[kzak@redhat.com: - fix coding style,
                  - use xalloc in all code,
		  - fix strtol usage]

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-10 16:01:37 +01:00
Karel Zak 68f7b572ba lib/color: add colorscheme parser 2014-02-10 14:50:12 +01:00
Karel Zak 5c6be57076 Merge branch 'master' of https://github.com/micha137/util-linux 2014-02-10 11:07:01 +01:00
Michael Marineau 4686ba17a8 lsblk: add PARTTYPE tag
To stay in sync with blkid add PARTTYPE as an available output column.
2014-02-10 10:47:21 +01:00
Sami Kerola c367cda936 tests: automatic whitespace trimming broke earlier commit
Setting in .gitconfig to do 'git apply --whitespace=fix' automatically
turned automation against user.

Frankencommit: 4d2f0d08f6
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-06 16:55:26 +01:00
Sami Kerola d64dde93a2 tests: cal(1) is year is limited to signed 32 bit value
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-06 16:55:25 +01:00
Sami Kerola 4a7424a5ef cal: limit year to 32 bit value
This is done to keep things simple, when considering tests, for both 64
and 32 bit architectures.  Setting the upper limit of a year value to to
2^31-1 (2147483646) should be enough for anyone.

Reported-by: Mike Frysinger <vapier@gentoo.org>
Reference: http://www.spinics.net/lists/util-linux-ng/msg08662.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-02-06 16:55:22 +01:00
Karel Zak c7a96884eb fsck: don't return error if fsck.<type> does not exist
The error message is expected for "really wanted" set of filesystems
(extN, ..), otherwise it does not make sense for filesystems like
btrfs or xfs.

Reported-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-06 16:44:53 +01:00
Karel Zak 99d7e17411 nsenter: fix set{gid,uid} order,drop supplementary groups
.. always, always setgid() before setuid()!

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1061751
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-06 14:14:50 +01:00
Karel Zak 3938c08cd5 dmesg: -w output not line-buffered
when writing to e.g. a pipe, output from dmesg -w can come many
minutes late due to buffering.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1060925
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-02-06 11:48:40 +01:00
Karel Zak 663bf04061 losetup: wait for udev
On system with /dev/lop-control the udevd creates /dev/loopN nodes.
It seems better to wait a moment after unsuccessful open(/dev/loopN)
and try it to open again.

The problem is pretty visible on systems where udevd also modifies
permission for loopN devices, then open() fails with EACCES when
losetup executed by non-root user (but user who is in "disk" group).

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1045432
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-24 13:58:40 +01:00