Commit Graph

12527 Commits

Author SHA1 Message Date
Takeshi Hamasaki 9cc302161a po: update ja.po (from translationproject.org) 2018-03-21 13:12:16 +01:00
Frédéric Marchal 176b8b2c8f po: update fr.po (from translationproject.org) 2018-03-21 13:12:16 +01:00
Lauri Nurmi f5a83f5c4e po: update fi.po (from translationproject.org) 2018-03-21 13:12:16 +01:00
Antonio Ceballos Roa a70ad822cc po: update es.po (from translationproject.org) 2018-03-21 13:12:16 +01:00
Petr Písař 6d386f2c61 po: update cs.po (from translationproject.org) 2018-03-21 13:12:16 +01:00
Karel Zak 51684b312e tests: use libtool to execute with valgrind
The libtool based build system uses scripts rather than real binaries
in $top_builddir. It's necessary to use libtool --mode=execute to call
valgrind for the real binary (from .libs/).

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-21 12:23:22 +01:00
Karel Zak 5a2b7739b0 tests: update lsmem
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 19:06:22 +01:00
Gerald Schaefer 49834246f5 lsmem: fix total online/offline memory calculation
lsmem currently calculates the total online/offline memory by iterating
over all lsmem->blocks. Depending on the lsmem options, there may be
only one lsmem->block, because all sysfs memory blocks could be merged
into one. In this case, the calculation is wrong, because the individual
online/offline state of the sysfs memory blocks is not preserved, but
rather lsmem->blocks[0].state is set to the state of the first sysfs
memory block, typically MEMORY_STATE_ONLINE (at least on s390).

This means that "Total offline memory" will always be calculated as 0
in such cases, e.g. when using "lsmem --summary", or any options that
would merge the table output to one line, like "lsmem -o RANGE":

~# lsmem --summary
Memory block size:         1G
Total online memory:      20G
Total offline memory:      0B

Adding the "-a" option shows the real summary, since there is no block
merging going on, and the calculation is therefore correct:

~# lsmem -a --summary
Memory block size:         1G
Total online memory:      16G
Total offline memory:      4G

Fix this by moving the online/offline calculation into the loop that
is iterating over all sysfs memory blocks, instead of iterating over
potentially merged lsmem->blocks.

Reported-by: Alexander Klein <alkl@linux.vnet.ibm.com>
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
2018-03-20 18:57:07 +01:00
Karel Zak 1b692a26f7 libmount: (docs) update year
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 18:56:06 +01:00
Karel Zak cd42d02ff2 libfdisk: (docs) update year
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 18:55:49 +01:00
Karel Zak ab0ede8619 libsmartcols: (docs) update year
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 18:55:36 +01:00
Karel Zak edc1c90cb9 lib/randutils: don't break on EAGAIN, use usleep()
The current code uses lose_counter to make more attempts to read
random numbers. It seems better to wait a moment between attempts to
avoid busy loop (we do the same in all-io.h).

The worst case is 1 second delay for all random_get_bytes() on systems
with uninitialized entropy pool -- for example you call sfdisk (MBR Id
or GPT UUIDs) on very first boot, etc. In this case it will use libc
rand() as a fallback solution.

Note that we do not use random numbers for security sensitive things
like keys or so. It's used for random based UUIDs etc.

Addresses: https://github.com/karelzak/util-linux/pull/603
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 14:17:24 +01:00
Karel Zak 6ffdfda846 tests: add /proc/swaps libmount parser test
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 13:34:31 +01:00
Karel Zak 83212eb3df libmount: fix example in docs
Addresses: https://github.com/karelzak/util-linux/issues/599
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 13:31:19 +01:00
Karel Zak b25f3c15c2 libmount: deallocate on /proc/swaps parse error
Addresses: https://github.com/karelzak/util-linux/issues/596
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 12:52:16 +01:00
Karel Zak 4c9e4ce83c libmount: make sure we deallocate on parse error
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 12:20:05 +01:00
Karel Zak a0357292b5 fstrim: fix fs.h and mount.h collision
Unfortunately, old version of the file linux/fs.h defines MS_*
macros, so the file cannot be included together with sys/mount.h.

We include sys/mount.h from libmount.h now.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 11:42:34 +01:00
Karel Zak b1813c59c0 libmount: make libmount.h more robust
Let's include sys/mount.h to be sure that our local libmount fallbacks
are not used by default to avoid possible conflicts with later included
sys/mount.h.

Addresses: https://github.com/systemd/systemd/pull/8452
Reported-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 10:59:56 +01:00
Carlo Caione a9cf659e05 lib/randutils: Do not block on getrandom()
In Endless we have hit a problem when using 'sfdisk' on the really first
boot to automatically expand the rootfs partition. On this platform
'sfdisk' is blocking on getrandom() because not enough random bytes are
available. This is an ARM platform without a hwrng.

We fix this passing GRND_NONBLOCK to getrandom(). 'sfdisk' will use the
best entropy it has available and fallback only as necessary.

Signed-off-by: Carlo Caione <carlo@endlessm.com>
2018-03-19 14:06:09 +01:00
Karel Zak 655776a2c1 mcookie: (man) add note about getrandom()
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-19 14:03:33 +01:00
Karel Zak dcb22a598d Merge branch 'master' of https://github.com/dirkmueller/util-linux
* 'master' of https://github.com/dirkmueller/util-linux:
  Avoid crash in min/max caculation when cpu#0 being offline
2018-03-19 12:53:22 +01:00
Karel Zak 5109589cc5 mount: (man) be explicit about bind operation
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-19 11:46:11 +01:00
Ruediger Meier 9ca02cf52d tests: consolidate ts_device_has UUID or LABEL
Regarding parallel root checks ...

 - fix: add a few missing "udevadm settle" where we are using LABELs or UUIDs

 - introduce ts_udevadm_settle():
    * Still trivial implementation. The idea is to use it in future for all
      tests instead of directly calling "udevadm settle". So we could add debug
      messages, wait for specific events, add code for non-udev systems or even
      use "udevadm --{start,stop}-exec-queue" to be really sure what we are
      doing and why using udevadm at all.
    * The currently unused args may be used in future and show the code reader
      already now why we are calling "udevadm settle" at all.
    * So far this patch only affects swapon/, mount/, libmount/ tests, and is
      only about UUIDs and LABELs, but may be continued later for "partitions",
      "md devices", whatever.
    * We are calling ts_udevadm_settle() right *before* we need a LABEL or
      UUID, not just *after* we created one. This may be a bit better for
      speed and shows the code reader which command would fail without settle.

 - function ts_device_has_uuid() is unused now, we trust blkid(1). Renamed to
   ts_is_uuid() in case we would need it again.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-19 11:46:11 +01:00
Ruediger Meier ec182d8b9d tests: fix grep expressions for devices
ts_is_mounted "/dev/loop1" returned true if /dev/loop17 was
mounted. A very annoying source of sporadic failures since
many years. This issue became more visible since running the
checks in parallel, which increases the probability to get
bigger loop device numbers.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-19 11:46:11 +01:00
Ruediger Meier 07b1ea7c44 tests: handle xargs errors and invalid args
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-19 11:46:11 +01:00
ahmogit 8bd926d9fc column: update column.1
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-19 11:45:53 +01:00
Dirk Mueller 95f09bc63c Avoid crash in min/max caculation when cpu#0 being offline
When cpu#0 is offline, atof(NULL) is called which causes
a segfault or endless loop depending on implementation
circumstances. So instead of implicitely assumping that the
first cpu is always available, do the presence checks for
all including the first one.
2018-03-17 13:22:13 +01:00
Tony Asleson 80ec018c6a libblkid: ignore private Stratis devices
[kzak@redhat.com: - tiny coding style changes]

References: 20e1c3dc03
Signed-off-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-09 13:34:42 +01:00
Karel Zak e34dcfb69d docs: add new idea to TODO list
Addresses: https://github.com/karelzak/util-linux/issues/593
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-09 10:56:14 +01:00
Karel Zak b9656e409a libuuid: make "CONFORMING TO" man sections more explicit
Addresses: https://github.com/karelzak/util-linux/issues/592
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-09 10:49:46 +01:00
Karel Zak c4127289f2 Merge branch 'setpriv-example' of https://github.com/yrro/util-linux
* 'setpriv-example' of https://github.com/yrro/util-linux:
  setpriv: add example section
  setpriv: include --init-groups in the list of options that can be specified with --[re]gid
  setpriv: improve description in man page
2018-03-09 10:30:53 +01:00
Ruediger Meier a2db0b1aae tests: add ipcslimits lock
These two tests conflict. Interestingly, this is our first lock for
a non-root check.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-09 09:57:23 +01:00
Ruediger Meier c16590f2ee tests: fix losetup race
Also avoid some "no-reentrant" tests.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-09 09:57:23 +01:00
Ruediger Meier fbba676998 travis: homebrew/dupes was deprecated
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-09 09:57:23 +01:00
Sam Morris 1aed71e514 setpriv: add example section 2018-03-08 16:31:59 +00:00
Sam Morris a7e6a6b43a setpriv: include --init-groups in the list of options that can be specified with --[re]gid 2018-03-08 16:21:48 +00:00
Sam Morris 64eca6406f setpriv: improve description in man page 2018-03-08 16:21:48 +00:00
Ruediger Meier 539b0b09ea tests: re-introduce bash 3 compatibility (OSX)
Bash 4 is now almost 10 years old and it seemed to be fine in 613a337e
to use associative arrays. Unfortunately OSX will probably never update
to 4 because of GPLv3. We don't want to lose our travis OSX build and
use plain arrays again.

BTW remove that "informative warnings" about unlocked resources. They
were only silent so far because of a bug. Any system where scsi_debug
is broken would print a lot of these warnings. This also tells us that
we could even stop calling ts_unlock() explicitly. Just exiting the
tests would be good enough.

Note that currently flock(1) is not available on our OSX build anyways.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-08 12:04:44 +01:00
Karel Zak 7c79c3418e docs: add remount-all idea to TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-08 11:30:29 +01:00
Ruediger Meier 5917d17f0d travis: use parallel root checks
Also improve CPU count detection for tests.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-07 20:49:25 +01:00
Ruediger Meier 55a680c17f tests: dont't timeout flock
The only situation where we would block endless is if another parallel test
has the lock and hangs for another reason. This means that the other test
would still keep hanging even if we timeout here. The user would have to
interrupt the other test or the whole test-suite anyways.

Note that we would certainly run into any timeout when using --parallel=200,
so that all scsi tests start the same time.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-07 19:12:54 +01:00
Ruediger Meier b0d9114a61 tests: don't use unlocked resources
The test-suite did not survive when flock timeouts after 30s because
then ts_cleanup_on_exit() may use resources (e.g. rmmod scsi_debug)
while not having the lock.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-07 19:11:36 +01:00
Ruediger Meier 613a337ed4 tests: don't lock fd 1 (stdout), don't use /proc/$$/fd
On debian-kfreebsd we've locked stdout which messed up our test logs. Using
/proc/*/fd/ is not portable. Even ts_init's test for "/proc/self/fd"
does not help because /proc/*/fd behaves strange here:

  $ ls -l  /proc/$$/fd
  lr--r--r-- 1 rudi user 0 Mar  6 23:11 /proc/2194/fd -> unknown
  $ file /proc/$$/fd
  /proc/2194/fd: broken symbolic link to `unknown'
  ## wtf?
  $ test -d /proc/$$/fd; echo $?
  0
  $ ls -l  /proc/$$/fd/
  ls: cannot access /proc/2194/fd/: No such file or directory
  ## but
  $ ls -l  /proc/self/fd/
  total 0
  cr-xr-xr-x 1 root root 0, 3 Mar  6 19:39 0
  cr-xr-xr-x 1 root root 0, 4 Mar  6 19:39 1
  cr-xr-xr-x 1 root root 0, 5 Mar  6 19:39 2
  cr-xr-xr-x 1 root root 0, 6 Mar  6 19:39 3

This is how this patch changes the test output:

[...]
         blkid: partitions probing: [06] sgi                  ... OK
         blkid: partitions probing: [07] sun                  ... OK
         blkid: partitions probing                            ... OK (all 7 sub-tests PASSED)
-ls: cannot access /proc/66215/fd/: No such file or directory
+        blkid: mbr-wholedisk                                 ... SKIPPED (missing scsi_debug module (dry-run))
         blkid: MD raid0 (whole-disks)                        ... SKIPPED (losetup not found)
         blkid: MD raid1 (last partition)                     ... SKIPPED (missing in PATH: mdadm)
         blkid: MD raid1 (whole-disks)                        ... SKIPPED (losetup not found)
@@ -343,11 +343,11 @@
         dmesg: facilities                                    ... SKIPPED (test_dmesg not found)
         dmesg: indentation                                   ... SKIPPED (test_dmesg not found)
         eject: umount                                        ... SKIPPED (eject not found)
-ls: cannot access /proc/69561/fd/: No such file or directory
-ls: cannot access /proc/69609/fd/: No such file or directory
+        fdisk: align 512/4K                                  ... SKIPPED (missing scsi_debug module (dry-run))
+        fdisk: align 512/4K +alignment_offset                ... SKIPPED (missing scsi_debug module (dry-run))
         fdisk: align 512/4K +MD                              ... SKIPPED (missing in PATH: mdadm)
         fdisk: align 512/512                                 ... SKIPPED (losetup not found)
[...]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-07 18:41:04 +01:00
Ruediger Meier aa00f7441d tests: add wierd sleep for libmount/context
I still don't understand why this helps to fix these tests on my system.
udevadm settle had no positive effect. Adding the sleeps before
"is_mounted" also didn't fixed that, that's amazing!?

Below the test log, very often seen on my system since a long time:

-------------------- util-linux regression tests --------------------

                    For development purpose only.
                 Don't execute on production system!

       kernel: 4.4.104-39-default

     libmount: context: [01] mount-by-devname                ... OK
     libmount: context: [02] umount-by-devname               ... OK
     libmount: context: [03] mount-by-label                  ... OK
     libmount: context: [04] umount-by-mountpoint            ... OK
     libmount: context: [05] mount-by-uuid                   ... FAILED (libmount/context-mount-by-uuid)
     libmount: context: [06] mount-flags                     ... FAILED (libmount/context-mount-flags)
     libmount: context: [07] mount-loopdev                   ... OK
     libmount: context: [08] x-mount.mkdir                   ... OK
     libmount: context: [09] X-mount.mkdir                   ... OK
     libmount: context                                       ... FAILED (2 from 9 sub-tests)

---------------------------------------------------------------------
  1 tests of 17 FAILED
---------------------------------------------------------------------

rudi@zappa:~/devel/util-linux/build> cat tests/diff/libmount/context-mount-by-uuid
--- /home/rudi/devel/util-linux/tests/expected/libmount/context-mount-by-uuid   2017-07-03 12:20:24.144845538 +0200
+++ /home/rudi/devel/util-linux/build/tests/output/libmount/context-mount-by-uuid       2018-01-24 00:42:18.549444408 +0100
@@ -1,2 +1,3 @@
 successfully mounted
-successfully umounted
+failed to umount
+FAILED [rc=16]/dev/sdb1 still mounted

rudi@zappa:~/devel/util-linux/build> cat tests/diff/libmount/context-mount-flags
--- /home/rudi/devel/util-linux/tests/expected/libmount/context-mount-flags     2017-07-03 12:20:24.148845497 +0200
+++ /home/rudi/devel/util-linux/build/tests/output/libmount/context-mount-flags 2018-01-24 00:42:18.725442931 +0100
@@ -1,5 +1,5 @@
+test_mount_context: failed to mount: Device or resource busy
+FAILED [rc=16]rw,relatime
 successfully mounted
-ro,nosuid,noexec
-successfully mounted
-rw,nosuid,noexec
+rw,relatime
 successfully umounted

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-07 18:36:17 +01:00
Ruediger Meier 80ea6e24f3 tests: add some more udevadm settle
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-07 18:36:11 +01:00
Ruediger Meier 277d61b9f4 travis: enable osx root checks
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-07 18:31:55 +01:00
Karel Zak 48ff1a52ed Merge branch 'setpriv-caps' of https://github.com/yrro/util-linux 2018-03-07 12:41:13 +01:00
Karel Zak 2446d0487f uuidd: cosmetic coding style change
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-07 11:53:15 +01:00
Ruediger Meier eb10dbc159 uuidd: don't truncate long socket paths
This was the error
  uuidd: couldn't bind unix socket /var/tmp/portage/sys-apps/util-linux-2.31.1/work/util-linux-2.31.1-abi_x86_64.amd64/tests/output/uuid/uuiddkOcTUuoZ7kaP3: Address already in use

because the socket path was truncated to 108 chars which was luckily
an existing directory.

Now we abort early with "uuidd: socket name too long: ... "

Reported-by: Thomas Deutschmann <whissi@gentoo.org>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-03-07 11:50:05 +01:00
Sam Morris 35e953e04a setpriv: fix manpage typo
The example given in the man page didn't work. Judging by commit
db663995bd, --inh-caps= used to be called
--caps= but the man page was not updated after the change was made.
2018-03-06 17:05:38 +00:00