]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
6 years agobuild-sys: release++ (v2.30.2) v2.30.2
Karel Zak [Thu, 21 Sep 2017 09:29:34 +0000 (11:29 +0200)] 
build-sys: release++ (v2.30.2)

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodocs: update v2.30.2-ReleaseNotes
Karel Zak [Thu, 21 Sep 2017 09:27:50 +0000 (11:27 +0200)] 
docs: update v2.30.2-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodocs: update AUTHORS file
Karel Zak [Thu, 21 Sep 2017 09:26:13 +0000 (11:26 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agopo: merge changes
Karel Zak [Thu, 21 Sep 2017 09:24:57 +0000 (11:24 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agopo: fix ipcrm translation error fr.po
Karel Zak [Wed, 20 Sep 2017 10:14:42 +0000 (12:14 +0200)] 
po: fix ipcrm translation error fr.po

Addresses: https://github.com/karelzak/util-linux/issues/512
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agopo: update fr.po (from translationproject.org)
Stéphane Aulery [Thu, 21 Sep 2017 09:12:29 +0000 (11:12 +0200)] 
po: update fr.po (from translationproject.org)

6 years agopo: update es.po (from translationproject.org)
Antonio Ceballos Roa [Thu, 21 Sep 2017 09:12:29 +0000 (11:12 +0200)] 
po: update es.po (from translationproject.org)

6 years agopo: update cs.po (from translationproject.org)
Petr Písař [Thu, 21 Sep 2017 09:12:29 +0000 (11:12 +0200)] 
po: update cs.po (from translationproject.org)

6 years agoswaplabel: fix --disable-libuuid compilation
Karel Zak [Fri, 15 Sep 2017 11:30:40 +0000 (13:30 +0200)] 
swaplabel: fix --disable-libuuid compilation

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibfdisk: fix fdisk_reset_partition() leaking *_chs strings.
Vaclav Dolezal [Tue, 15 Aug 2017 08:02:45 +0000 (10:02 +0200)] 
libfdisk: fix fdisk_reset_partition() leaking *_chs strings.

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
6 years agolibfdisk: fix two potential memory errors.
Vaclav Dolezal [Mon, 14 Aug 2017 10:57:52 +0000 (12:57 +0200)] 
libfdisk: fix two potential memory errors.

Fixes one leak and one unchecked allocation error.

[kzak@redhat.com: - don't call fdisk_ask_menu_get_result()
                    after failed fdisk_do_ask()]

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibfdisk: (dos) use size-=1 when alignment not used later
Karel Zak [Tue, 22 Aug 2017 12:54:27 +0000 (14:54 +0200)] 
libfdisk: (dos) use size-=1 when alignment not used later

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibfdisk: (gpt) fix size-1 error
Karel Zak [Tue, 22 Aug 2017 12:48:14 +0000 (14:48 +0200)] 
libfdisk: (gpt) fix size-1 error

If partition does not require alignment, then don't call LBA align
function and don't use size-=1 (fdisk_align_lba_in_range() returns
unmodified size and we call size=-1 more than once for the same size).

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolslogins: be more explicit with -g in man page
Karel Zak [Fri, 18 Aug 2017 08:29:54 +0000 (10:29 +0200)] 
lslogins: be more explicit with -g in man page

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolslogins: ignore non-existing users
Karel Zak [Fri, 18 Aug 2017 08:23:38 +0000 (10:23 +0200)] 
lslogins: ignore non-existing users

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodmesg: fix delimiter calculation
Karel Zak [Wed, 16 Aug 2017 12:15:56 +0000 (14:15 +0200)] 
dmesg: fix delimiter calculation

Reported-by: Laszlo Varkonyi <vlsoftsystems@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibblkid: fix compiler warning [-Wformat-truncation=]
Karel Zak [Wed, 16 Aug 2017 09:55:57 +0000 (11:55 +0200)] 
libblkid: fix compiler warning [-Wformat-truncation=]

The MBR partition pseudo-UUID is generated from table ID and partition
partno. The final UUID size limit is 37 bytes. The table ID has to be
restricted to keep compiler happy (for MBR the table ID is 8 bytes
as string).

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agocfdisk: add missing 0x7F key mapping
Karel Zak [Tue, 15 Aug 2017 12:03:43 +0000 (14:03 +0200)] 
cfdisk: add missing 0x7F key mapping

Addresses: https://github.com/karelzak/util-linux/issues/499
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoblockdev: document --setro more properly
Karel Zak [Mon, 14 Aug 2017 09:30:37 +0000 (11:30 +0200)] 
blockdev: document --setro more properly

Addresses: https://github.com/karelzak/util-linux/issues/498
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/randutils: reset lose counter
Karel Zak [Mon, 14 Aug 2017 08:56:08 +0000 (10:56 +0200)] 
lib/randutils: reset lose counter

It's probaly good idea to reset lose counter when we fallback from
getrandom() to /dev/urandom.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/randutils: improve getrandom() usage
Karel Zak [Mon, 14 Aug 2017 08:33:06 +0000 (10:33 +0200)] 
lib/randutils: improve getrandom() usage

The getrandom() does not have to return all requested bytes (missing
entropy or when interrupted by signal). The current implementation in
util-linux stupidly asks for all random data again, rather than only
for missing bytes.

The current code also does not care if we repeat our requests for
ever; that's bad.

This patch uses the same way as we already use for reading from
/dev/urandom. It means:

 * repeat getrandom() for only missing bytes
 * limit number of unsuccessful request (16 times)
 * fallback to /dev/urandom on ENOSYS (old kernel or so...)

Addresses: https://github.com/karelzak/util-linux/issues/496
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/randutils.c: More paranoia in getrandom() call.
Christopher James Halse Rogers [Mon, 7 Aug 2017 06:10:51 +0000 (16:10 +1000)] 
lib/randutils.c: More paranoia in getrandom() call.

If getrandom() is called with nbytes ≥ 256 then it can return with less than the requested
bytes filled.

In this case we *could* adjust the buffer by the number of bytes actually read, but it's
simpler to just redo the call.

6 years agolib/randutils.c: Fall back gracefully when kernel doesn't support getrandom(2).
Christopher James Halse Rogers [Mon, 7 Aug 2017 06:07:54 +0000 (16:07 +1000)] 
lib/randutils.c: Fall back gracefully when kernel doesn't support getrandom(2).

The 3.16 kernel is supported until 2020, and various distros have kernels of the same
vintage. It's entirely possible for code built against newer headers to be run against
these kernels, so fall-back to the old “read /dev/{u,}random” method if the kernel doesn'
support getrandom()

6 years agofstab(5): mention how tabs are escaped
Andreas Henriksson [Thu, 27 Jul 2017 21:00:15 +0000 (23:00 +0200)] 
fstab(5): mention how tabs are escaped

Someone requested explicitly mentioning how tabs are escaped,
in addition to the already existing spaces example.

Addresses: https://bugs.debian.org/580047
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
6 years agowdctl: do not call fsync(2) when closing watchdog device
Sami Kerola [Sun, 23 Jul 2017 21:20:37 +0000 (22:20 +0100)] 
wdctl: do not call fsync(2) when closing watchdog device

This removes bogus write failed warning.

$ wdctl
wdctl: write failed: Invalid argument
Device:        /dev/watchdog
[...]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
6 years agolibblkid: don't check for size on UBI (char dev)
Karel Zak [Tue, 11 Jul 2017 10:17:40 +0000 (12:17 +0200)] 
libblkid: don't check for size on UBI (char dev)

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agologin: use IPv4 on IPv4-mapping-to-IPv6
Karel Zak [Tue, 4 Jul 2017 10:50:39 +0000 (12:50 +0200)] 
login: use IPv4 on IPv4-mapping-to-IPv6

It seems that on some systems (e.g. RHEL7) the libc function
getaddrinfo() is not able to translate ::ffff: address to IPv4. The
result is 0.0.0.0 host address in the last(1) and utmpdump(1) output.

 /sbin/login -h "::ffff:192.168.1.7"

utmpdump:

  [7] [03926] [1   ] [user1   ] [pts/1       ] [::ffff:192.168.1.7  ] [0.0.0.0        ] [Thu May 12 17:49:50 2016    ]

Not sure if this is about order of the getaddrinfo() results, system
configuration or libc version. It's irrelevant for login(1). We have
to be robust enough to write usable address to log files everywhere.

The solution is to detect IPv4-mapping-to-IPv6 and use IPv4 for utmp.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1296233
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agobuild-sys: release++ (v2.30.1) v2.30.1
Karel Zak [Thu, 20 Jul 2017 09:21:59 +0000 (11:21 +0200)] 
build-sys: release++ (v2.30.1)

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodocs: update v2.30.1-ReleaseNotes
Karel Zak [Thu, 20 Jul 2017 09:20:44 +0000 (11:20 +0200)] 
docs: update v2.30.1-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodocs: update AUTHORS file
Karel Zak [Thu, 20 Jul 2017 09:19:04 +0000 (11:19 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agopo: merge changes
Karel Zak [Thu, 20 Jul 2017 09:17:47 +0000 (11:17 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agopo: update pt_BR.po (from translationproject.org)
Rafael Fontenelle [Thu, 20 Jul 2017 09:08:09 +0000 (11:08 +0200)] 
po: update pt_BR.po (from translationproject.org)

6 years agopo: update da.po (from translationproject.org)
Joe Hansen [Thu, 20 Jul 2017 09:08:09 +0000 (11:08 +0200)] 
po: update da.po (from translationproject.org)

6 years agotests: update build-sys non-widechar test
Karel Zak [Thu, 20 Jul 2017 09:02:35 +0000 (11:02 +0200)] 
tests: update build-sys non-widechar test

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agocolumn: fix compilation when libc lacks wide-character support
Carlos Santos [Thu, 29 Jun 2017 10:55:42 +0000 (07:55 -0300)] 
column: fix compilation when libc lacks wide-character support

Commit 4762ae9d removed mtsafe_strtok() but left behind calls to wcstok
and wcspbrk. This leads to build failures when libc does not have the
wide-character functions, like some uClibc builds.

Solve the problem by using strtok_r and strpbrk when HAVE_WIDECHAR is
not defined.

Fixes:
  http://autobuild.buildroot.net/results/fd8a1a8e0cef3aeed9588540e8e663664f6b43aa
  http://autobuild.buildroot.net/results/5ad73ea8b471321988c50d80a5e50d4504151dd6
  http://autobuild.buildroot.net/results/04411b7280dc51ecd51236967981a42352bbeb3e

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
6 years agocfdisk: simplify ncurses includes
Karel Zak [Thu, 20 Jul 2017 08:43:19 +0000 (10:43 +0200)] 
cfdisk: simplify ncurses includes

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibmount: make mnt_context_is_fs_mounted work for /proc
Ivan Delalande [Fri, 7 Jul 2017 01:27:11 +0000 (18:27 -0700)] 
libmount: make mnt_context_is_fs_mounted work for /proc

Assume that /proc is not mounted instead of returning an error when we
are unable to open the mounts and mountinfo files in /proc. Also set
cxt->mtab back to NULL so that it gets properly parsed when we check if
the next filesystem is mounted.

The goal is to have mount -a work when /proc is not mounted, typically
with /proc on the first line of fstab.

Signed-off-by: Ivan Delalande <colona@arista.com>
6 years agolibblkid: don't use CDROM_GET_CAPABILITY ioctl for DM devices
Karel Zak [Wed, 12 Jul 2017 12:35:53 +0000 (14:35 +0200)] 
libblkid: don't use CDROM_GET_CAPABILITY ioctl for DM devices

For some reason kernel commit e980f62353c697cbf0c4325e43df6e44399aeb64
add extra warning when the ioctl is used for DM devices. It seems we
can avoid this ioctl when the device has dm/uuid.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1469532
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotest: update PMBR hex dumps
Karel Zak [Mon, 17 Jul 2017 09:36:28 +0000 (11:36 +0200)] 
test: update PMBR hex dumps

The commit 8ffa3b651d7e74acba8f1d831b7f68fdb3c66aae has fixed PMBR
CHS addresses initialization to be more close to UEFI standard.

-000001c0  01 00 ee fe ff ff 01 00  00 00 ff 8f 01 00 00 00
+000001c0  02 00 ee ff ff ff 01 00  00 00 ff 8f 01 00 00 00

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibfdisk: make fdisk compliant to UEFI/GPT specification on PMBR
Karel Zak [Fri, 14 Jul 2017 10:48:18 +0000 (12:48 +0200)] 
libfdisk: make fdisk compliant to UEFI/GPT specification on PMBR

The PMBR partition record should be StartingCHS=0x002000 (0/0/2)
and EndingCHS=0xFFFFFF (1023/255/63)

Addresses: https://github.com/karelzak/util-linux/issues/485
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibfdisk: (dos) accept start for log.partitions on template
Karel Zak [Tue, 11 Jul 2017 12:24:32 +0000 (14:24 +0200)] 
libfdisk: (dos) accept start for log.partitions on template

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibfdisk: (dos) cleanup template based partitioning
Karel Zak [Tue, 11 Jul 2017 10:25:02 +0000 (12:25 +0200)] 
libfdisk: (dos) cleanup template based partitioning

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodmesg: print only 2 hex digits for each hex-escaped byte
Ivan Delalande [Wed, 21 Jun 2017 23:43:05 +0000 (16:43 -0700)] 
dmesg: print only 2 hex digits for each hex-escaped byte

As buf is passed as a signed char buffer in fwrite_hex, fprintf will
print every byte from 0x80 as a signed-extended int causing each of
these bytes to be printed as "\xffffff80" and such, which can be pretty
confusing. Force fprintf to use the argument as a char to make it print
only 2 digits, e.g. "\x80".

Signed-off-by: Ivan Delalande <colona@arista.com>
6 years agowipefs: exit on failed erase
Karel Zak [Wed, 21 Jun 2017 08:53:28 +0000 (10:53 +0200)] 
wipefs: exit on failed erase

The current behavior is to report error and continue, it seems strange:

# blockdev --setro /dev/sdc

# wipefs -a /dev/sdc
wipefs: /dev/sdc: failed to erase xfs magic string at offset 0x00000000: Operation not permitted
/dev/sdc: 4 bytes were erased at offset 0x00000000 (xfs): 58 46 53 42
                          ^^^^^^^^^^^
                           not true

The patch calls err() to exit.

Reported-by: Vratislav Podzimek <vpodzime@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibfdisk: (dos) be more verbose on partno -ERANGE error
Karel Zak [Mon, 19 Jun 2017 12:32:59 +0000 (14:32 +0200)] 
libfdisk: (dos) be more verbose on partno -ERANGE error

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agomount: fix man page typo (--bind,ro)
Karel Zak [Mon, 19 Jun 2017 09:49:51 +0000 (11:49 +0200)] 
mount: fix man page typo (--bind,ro)

Addresses: https://github.com/karelzak/util-linux/issues/464
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agofstrim: prefer earlier mounted filesystems
Alex Ivanov [Thu, 15 Jun 2017 08:26:25 +0000 (11:26 +0300)] 
fstrim: prefer earlier mounted filesystems

fstrim --all is broken in a way that if there is a bind mount for some filesystem,
that filesystem will not be trimmed. This is especially critical for e.g.
NixOS distribution, which needs bind mount within root fs:
https://github.com/NixOS/nixos/blob/master/modules/system/boot/stage-2-init.sh#L55

Currently for a given filesystem during "de-duplication by source and root" phase,
an early mounted fs path is filtered (e.g. "/"), while later mounted fs path is kept
(e.g. "/nix/store") though anyway discarded later (since it's an overlaying mount).
This leads to skipped trimming.

So flip this behaviour. Should also help for other types of overlaying mounts.

Reference:
https://github.com/karelzak/util-linux/blob/stable/v2.29/libmount/src/tab.c#L715

Signed-off-by: Alex Ivanov <yourbestfriend@openmailbox.org>
6 years agotests: Add UDF hdd images with blocksize 1024 and 4096 created by Linux mkudffs 1.3
Pali Rohár [Wed, 14 Jun 2017 21:29:03 +0000 (23:29 +0200)] 
tests: Add UDF hdd images with blocksize 1024 and 4096 created by Linux mkudffs 1.3

$ dd if=/dev/zero of=udf-hdd-mkudffs-1.3-4.img bs=1M count=10
$ mkudffs -l Label -b 1024 udf-hdd-mkudffs-1.3-4.img

$ dd if=/dev/zero of=udf-hdd-mkudffs-1.3-5.img bs=1M count=10
$ mkudffs -l Label -b 4096 udf-hdd-mkudffs-1.3-5.img

6 years agolibblkid: udf: Fix detection of UDF images with block size 1024 and 4096
Pali Rohár [Wed, 14 Jun 2017 21:15:14 +0000 (23:15 +0200)] 
libblkid: udf: Fix detection of UDF images with block size 1024 and 4096

When detecting block size of UDF filesystem, try to use also block size
512, 1024, 2048 and 4096. This would allow blkid to detect UDF filesystem
in image file created from 4K hard disk (which should have UDF block size
4096).

Before this patch only UDF images with block size of 512 and 2048 were
detected as only block size from blkid_probe_get_sectorsize() and 2048 were
used (blkid_probe_get_sectorsize() returns for disk images 512).

6 years agotests: fix fincore, don't use variable COLUMNS
Ruediger Meier [Sun, 11 Jun 2017 18:45:14 +0000 (20:45 +0200)] 
tests: fix fincore, don't use variable COLUMNS

COLUMNS is automatically set by bash and may result in stupid
errors like

  fincore: unknown column: 160

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
6 years agolscpu: cleanup DMI detection return codes
Karel Zak [Tue, 13 Jun 2017 10:15:11 +0000 (12:15 +0200)] 
lscpu: cleanup DMI detection return codes

Michal wrote:
 There is weird mix of logic in lscpu-dmi.c which sometimes returns 0 and
 sometimes -1 on error. Since most checks are if (rc) goto done; this
 bails out early on error skipping some detection methods. Further, in
 lscpu.c all following detections are guarder by if(hyper) so returning
 -1 causes all following methods to be skipped.

Reported-by: Michal Suchanek <msuchanek@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agopylibmount: NULL terminate kwlist in Context_init
Zac Medico [Thu, 8 Jun 2017 00:21:33 +0000 (17:21 -0700)] 
pylibmount: NULL terminate kwlist in Context_init

Fixes a segfault observed with python3.6.

6 years agoumount: add note about NFS and -c to umount.8
Karel Zak [Tue, 6 Jun 2017 10:05:14 +0000 (12:05 +0200)] 
umount: add note about NFS and -c to umount.8

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoumount: never 'stat' the path when "-c" is given.
NeilBrown [Mon, 5 Jun 2017 02:32:58 +0000 (12:32 +1000)] 
umount: never 'stat' the path when "-c" is given.

It is currently not possible to reliably and automatically
unmount an NFS filesystem. If the server is not available, the
umount command will hang.

The hang can be avoided by using "-l" or "-f", but neither
of these are appropriate for automatic use such as by an
automounter (e.g automountd or systemd).

"-l" will unmount even if the filesystem is in use, which
an automounter generally doesn't want.  If the filesystem
is in use, then the umount should fail.

"-f" can cause the filesystem to abort pending transactions
which might break filesystem semantics.  This can be useful
in the hands of a sysadmin, but not when used by an
automatic tool.

umount has another option, "-c" aka "--no-canonicalize"
which avoids some "stat" calls.
Currently this doesn't avoid all calls to
canonicalize_path()
as
  mnt_context_prepare_umount() ->
    lookup_umount_fs() ->
      mnt_context_find_umount_fs() ->
        mnt_context_get_mtab_for_target() ->
  mnt_resolve_path() ->
    canonicalize_path_and_cache() ->
      canonicalize_path()

leads to that function being called.

The "-c" option could be taken to mean "I know what I'm
doing, this really is the path to a mount point, I just want
you to unmount it".  Given that, it seems suitable to
extend this to avoid all 'stat' calls on the mountpoint.

It is already appropriate for any automount program to pass
"-c" to "umount", so they can be changed to do so at any
time.
With the patch below, "-c" will result in the mountpoint
never being "stat"ed, so umount won't hang on an
inaccessible server.

This isn't quite sufficient, for NFS at least, as the usage
of libmount in umount.nfs still calls 'stat' on the mount
point.
"-c" isn't passed to the umount helper, but it is reasonable
for such helpers to assume "-c" because "umount" will have
canonicalized the path when that is appropriate.

So, this patch treats "-c" much like "-l" and "-f" when
deciding whether it is safe to 'stat' the path.

Signed-off-by: NeilBrown <neilb@suse.com>
6 years agofdformat: clear progress message before printing "done"
Jakub Wilk [Fri, 2 Jun 2017 21:54:10 +0000 (23:54 +0200)] 
fdformat: clear progress message before printing "done"

Before:

    Formatting ... done1

After:

    Formatting ... done

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
6 years agoagetty: fix login name DEL/CTRL^U issue
Karel Zak [Fri, 23 Jun 2017 12:26:47 +0000 (14:26 +0200)] 
agetty: fix login name DEL/CTRL^U issue

agetty refresh prompt (/etc/issue file etc.) when requested by inotify
or netlink. For this purpose we monitor some file descriptors by
select().

The terminal input file descriptor is switched to non-canonical mode before
select(). The goal is to be informed about user activity before
new-line. The FD is immediately switched back to canonical mode when
activity is detected. The side effect is that all not-read-yet chars in
the input buffer are lost ... so we need to call read() before switch
to canonical mode to save the chars.

The original implementation has been based on TIOCSTI ioctl. It
returns already read chars back to the terminal input buffer to make
them useful for canonical mode. The problem was race (agetty writes to
input buffer in the same time as user) and result was reordered chars
in login name... so useless.

This issue has been later fixed by extra buffer (commit
790119b8850ae13bb4254c5096a54b2aeb355b20) for already read data.  And
TIOCSTI ioctl has been removed. Unfortunately this solution is also
wrong, because the buffer is maintained only by agetty and
inaccessible for terminal when user edit (by DEL/CTRL^U) login name in
canonical mode.

The solution is simple -- just don't try to be smart and keep terminal
in canonical mode all time (so terminal controls DEL, CTRL^U, etc) and
flush input buffer (=discard unread data) and ask user for login name
again after prompt reload.

The agetty reload is very rarely situation and for user it's pretty
obvious that he has to type login name again (as all terminal has been
clear+redraw).

Addresses: https://github.com/karelzak/util-linux/issues/454
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1464148
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolibfdisk: (dos) fix primary/logical logic when follow template
Karel Zak [Mon, 19 Jun 2017 09:41:02 +0000 (11:41 +0200)] 
libfdisk: (dos) fix primary/logical logic when follow template

This stupid bug has been introduced by e1cfb304 (v2.30) and it
disables to create extended partition by cfdisk :-(

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agobuild-sys: release++ (v2.30) v2.30
Karel Zak [Fri, 2 Jun 2017 10:22:29 +0000 (12:22 +0200)] 
build-sys: release++ (v2.30)

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodocs: update v2.30-ReleaseNotes
Karel Zak [Fri, 2 Jun 2017 10:20:19 +0000 (12:20 +0200)] 
docs: update v2.30-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodocs: update AUTHORS file
Karel Zak [Fri, 2 Jun 2017 10:16:08 +0000 (12:16 +0200)] 
docs: update AUTHORS file

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/pager: use xalloc
Karel Zak [Fri, 2 Jun 2017 10:07:36 +0000 (12:07 +0200)] 
lib/pager: use xalloc

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotests: update build-sys test
Karel Zak [Fri, 2 Jun 2017 10:03:46 +0000 (12:03 +0200)] 
tests: update build-sys test

The libtinfo is enough (and libncurses optional for cal).

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agopo: merge changes
Karel Zak [Fri, 2 Jun 2017 09:30:19 +0000 (11:30 +0200)] 
po: merge changes

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoMerge branch 'master' of https://github.com/yurchor/util-linux
Karel Zak [Fri, 2 Jun 2017 09:13:39 +0000 (11:13 +0200)] 
Merge branch 'master' of https://github.com/yurchor/util-linux

* 'master' of https://github.com/yurchor/util-linux:
  Fix minor typos

6 years agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Fri, 2 Jun 2017 09:08:30 +0000 (11:08 +0200)] 
po: update uk.po (from translationproject.org)

6 years agopo: update tr.po (from translationproject.org)
Mesutcan Kurt [Fri, 2 Jun 2017 09:08:30 +0000 (11:08 +0200)] 
po: update tr.po (from translationproject.org)

6 years agopo: update sv.po (from translationproject.org)
Sebastian Rasmussen [Fri, 2 Jun 2017 09:08:30 +0000 (11:08 +0200)] 
po: update sv.po (from translationproject.org)

6 years agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Fri, 2 Jun 2017 09:08:30 +0000 (11:08 +0200)] 
po: update pl.po (from translationproject.org)

6 years agopo: update ja.po (from translationproject.org)
Takeshi Hamasaki [Fri, 2 Jun 2017 09:08:30 +0000 (11:08 +0200)] 
po: update ja.po (from translationproject.org)

6 years agopo: update de.po (from translationproject.org)
Philipp Thomas [Fri, 2 Jun 2017 09:08:30 +0000 (11:08 +0200)] 
po: update de.po (from translationproject.org)

6 years agodocs: add information about mailing list rejection
J William Piggott [Thu, 1 Jun 2017 23:42:21 +0000 (19:42 -0400)] 
docs: add information about mailing list rejection

Signed-off-by: J William Piggott <elseifthen@gmx.com>
6 years agolib/pager: don't use pager if command not available
Karel Zak [Thu, 1 Jun 2017 12:20:20 +0000 (14:20 +0200)] 
lib/pager: don't use pager if command not available

for example:
 # PAGER=foo dmesg -H
 sh: foo: command not found

the same problem is we have with fdisk 'l' command:

 # PAGER=foo fdisk /dev/sda
 Welcome to fdisk (util-linux 2.30-rc2-33-41b71).
 ...
 Command (m for help): l
 sh: foo: command not found

It seems better to don't use pager at all if not available.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agoMerge branch 'travis-test' of https://github.com/rudimeier/util-linux
Karel Zak [Thu, 1 Jun 2017 10:30:14 +0000 (12:30 +0200)] 
Merge branch 'travis-test' of https://github.com/rudimeier/util-linux

* 'travis-test' of https://github.com/rudimeier/util-linux:
  tests: check for timeout command
  Revert "tests: use stdbuf when stderr and stdout is randomly ordered"

6 years agolscpu: make min/max freq arrays usage more robust
Karel Zak [Thu, 1 Jun 2017 10:15:23 +0000 (12:15 +0200)] 
lscpu: make min/max freq arrays usage more robust

The array members may be NULL on some architectures (e.g. AMD). Let's
be paranoid and check for the NULL independently on present/online
masks.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1457744
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotests: check for timeout command
Ruediger Meier [Thu, 1 Jun 2017 09:23:26 +0000 (11:23 +0200)] 
tests: check for timeout command

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
6 years agoRevert "tests: use stdbuf when stderr and stdout is randomly ordered"
Ruediger Meier [Thu, 1 Jun 2017 09:20:02 +0000 (11:20 +0200)] 
Revert "tests: use stdbuf when stderr and stdout is randomly ordered"

stdbuf does not seem to work reliable. Failed on travis/OSX

This reverts commit 398b3148bedee936ee0b012b3b6e82b20547f218.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
6 years agocolumn: add missed semicolons in case of !HAVE_WIDECHAR
Alexander Kuleshov [Mon, 29 May 2017 18:49:17 +0000 (00:49 +0600)] 
column: add missed semicolons in case of !HAVE_WIDECHAR

In other case we will get:

  error: expected ‘;’ before ‘}’ token

error.

Signed-off-by: Alexander Kuleshov <kuleshovmail@gmail.com>
6 years agoMerge branch 'travis-test' of https://github.com/rudimeier/util-linux
Karel Zak [Thu, 1 Jun 2017 08:49:12 +0000 (10:49 +0200)] 
Merge branch 'travis-test' of https://github.com/rudimeier/util-linux

* 'travis-test' of https://github.com/rudimeier/util-linux:
  misc: fix some warnings
  tests: handle non glibc error message for fallocate
  tests: use stdbuf when stderr and stdout is randomly ordered
  build-sys: fix library order when linking
  tests: avoid diff of diffs
  tests: grep's short option -A is more portable

6 years agomisc: fix some warnings
Ruediger Meier [Wed, 31 May 2017 21:58:11 +0000 (23:58 +0200)] 
misc: fix some warnings

sys-utils/prlimit.c: In function 'do_prlimit':
sys-utils/prlimit.c:367:16: warning: format '%ju' expects argument of type 'uintmax_t', but argument 2 has type 'rlim_t {aka long long unsigned int}' [-Wformat=]
     printf("<%ju", new->rlim_cur);

lib/plymouth-ctrl.c: In function 'open_un_socket_and_connect':
lib/plymouth-ctrl.c:88:20: warning: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types]
  ret = connect(fd, &su, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(su.sun_path+1));
                    ^
In file included from lib/plymouth-ctrl.c:35:0:
/usr/include/sys/socket.h:314:5: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *'
 int connect (int, const struct sockaddr *, socklen_t);

login-utils/last.c: In function 'list':
login-utils/last.c:506:54: warning: pointer targets in passing argument 4 of 'dns_lookup' differ in signedness [-Wpointer-sign]
   r = dns_lookup(domain, sizeof(domain), ctl->useip, p->ut_addr_v6);
                                                      ^
login-utils/last.c:291:12: note: expected 'int32_t * {aka int *}' but argument is of type 'unsigned int *'
 static int dns_lookup(char *result, int size, int useip, int32_t *a)
            ^~~~~~~~~~

In file included from sys-utils/hwclock-cmos.c:92:0:
sys-utils/hwclock.h:67:32: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
 extern double time_diff(struct timeval subtrahend, struct timeval subtractor);

misc-utils/test_uuidd.c: In function 'create_nthreads':
misc-utils/test_uuidd.c:187:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
        proc->pid, (int) th->tid, th->index));

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
6 years agotests: handle non glibc error message for fallocate
Ruediger Meier [Wed, 31 May 2017 21:32:07 +0000 (23:32 +0200)] 
tests: handle non glibc error message for fallocate

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
6 years agotests: use stdbuf when stderr and stdout is randomly ordered
Ruediger Meier [Thu, 1 Jun 2017 01:17:25 +0000 (03:17 +0200)] 
tests: use stdbuf when stderr and stdout is randomly ordered

glibc seems to flush stdout before stderr.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
6 years agobuild-sys: fix library order when linking
Ruediger Meier [Wed, 31 May 2017 19:02:12 +0000 (21:02 +0200)] 
build-sys: fix library order when linking

We got some errors on Alpine Linux where $LTLIBINTL is non-empty:

./.libs/libcommon.a(libcommon_la-blkdev.o): In function `open_blkdev_or_file':
lib/blkdev.c:282: undefined reference to `libintl_gettext
collect2: error: ld returned 1 exit status

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
6 years agotests: avoid diff of diffs
Ruediger Meier [Wed, 31 May 2017 20:21:46 +0000 (22:21 +0200)] 
tests: avoid diff of diffs

Certain diff implementations do not produce comparable output.

Noticed on Alpine Linux/busybox.

CC: Sami Kerola <kerolasa@iki.fi>
Reported-by: Assaf Gordon <assafgordon@gmail.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
6 years agotests: grep's short option -A is more portable
Ruediger Meier [Wed, 31 May 2017 18:59:04 +0000 (20:59 +0200)] 
tests: grep's short option -A is more portable

Noticed on Alpine Linux/busybox.

Reported-by: Assaf Gordon <assafgordon@gmail.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
6 years agodocs: move source-code-management.txt to README
J William Piggott [Tue, 30 May 2017 00:47:34 +0000 (20:47 -0400)] 
docs: move source-code-management.txt to README

source-code-management.txt and README had similar content so combine
them in README.

Change Documentation/source-code-management.txt references to README.

Remove Documentation/source-code-management.txt.

Move IRC Channel information to README

Expand information about git branches and tags in README.

Add workflow to README; written by Karel Zak <kzak@redhat.com>

Signed-off-by: J William Piggott <elseifthen@gmx.com>
6 years agodocs: update howto-contribute.txt
J William Piggott [Sun, 28 May 2017 22:30:11 +0000 (18:30 -0400)] 
docs: update howto-contribute.txt

This patch does not change any wording or grammar. It
only shuffles the order of things and adds a table of
contents. For example: it moves coding related bullet
points into the Coding Style Chapter; it groups email
related Chapters together, and so fourth.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
6 years agodocs: update howto-contribute.txt
J William Piggott [Sun, 28 May 2017 19:49:09 +0000 (15:49 -0400)] 
docs: update howto-contribute.txt

Grammar fixes and some clarification changes.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
6 years agodocs: update v2.30-ReleaseNotes
J William Piggott [Fri, 26 May 2017 17:53:26 +0000 (13:53 -0400)] 
docs: update v2.30-ReleaseNotes

Signed-off-by: J William Piggott <elseifthen@gmx.com>
6 years agobuild-sys: ncurses headers cleanup
Karel Zak [Wed, 31 May 2017 09:01:46 +0000 (11:01 +0200)] 
build-sys: ncurses headers cleanup

* assume ncursesw headers in ncursesw/ directory only
* prefer long paths, <term.h> and <ncurses.h> should be last
  possibility
* fix typos

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agocfdisk: fix compiler warning
Karel Zak [Wed, 31 May 2017 08:58:17 +0000 (10:58 +0200)] 
cfdisk: fix compiler warning

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agobuild-sys: prefer ncurses-config rather than pkg-config
Karel Zak [Wed, 31 May 2017 08:52:44 +0000 (10:52 +0200)] 
build-sys: prefer ncurses-config rather than pkg-config

If you have installed:

 ii  libncurses5:i386      5.9+20140913-1+b1  i386   shared libraries for terminal handling
 ii  libncurses5-dev:i386  5.9+20140913-1+b1  i386   developer's libraries for ncurses
 ii  libncursesw5:i386     5.9+20140913-1+b1  i386   shared libraries for terminal handling (wide character support)

then pkg-config blindly follows ncursesw although there are not header
files for this library. It seems better to use pkg-config as fallback
solution only.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agobuild-sys: require kernel headers on Linux
Karel Zak [Wed, 31 May 2017 07:35:32 +0000 (09:35 +0200)] 
build-sys: require kernel headers on Linux

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agodmesg: remove unnecessary header
Karel Zak [Wed, 31 May 2017 07:18:10 +0000 (09:18 +0200)] 
dmesg: remove unnecessary header

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/colors: fix test compilation
Karel Zak [Tue, 30 May 2017 23:29:25 +0000 (01:29 +0200)] 
lib/colors: fix test compilation

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotext-utils: use proper paths to term.h
Karel Zak [Tue, 30 May 2017 15:15:37 +0000 (17:15 +0200)] 
text-utils: use proper paths to term.h

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agocal: ncurses cleanup
Karel Zak [Tue, 30 May 2017 15:10:40 +0000 (17:10 +0200)] 
cal: ncurses cleanup

* use proper paths to term.h
* keep ncurses support optional
* link with TINFO_LIBS (-ltinfo), or fallback to NCURSES_LIBS (-ltinfo -lncurses)
* don't include unnecessary ncurses.h (term.h is enough)

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agolib/colors: ncurses cleanup
Karel Zak [Tue, 30 May 2017 15:10:40 +0000 (17:10 +0200)] 
lib/colors: ncurses cleanup

* use proper paths to term.h
* keep ncurses support optional
* link with TINFO_LIBS (-ltinfo), or fallback to NCURSES_LIBS (-ltinfo -lncurses)
* don't include unnecessary ncurses.h (term.h is enough)

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agobuild-sys: make ncurses detection more robust
Karel Zak [Tue, 30 May 2017 15:01:00 +0000 (17:01 +0200)] 
build-sys: make ncurses detection more robust

It seems Debina 8 is a little bit incompatible with us:

* ncurses-config is packaged in ncurses-bin where is *no* any
  development files! It means the script returns paths to not installed
  files (IMHO packaging bug)

  Fixed, we need to check for header files too.

* term.h is "everywhere" on Fedora:

<term.h>
<ncurses/term.h>
<ncursesw/term.h>

  Debian is more strict and uses <ncurses[w]/term.h> only.

  Fixed, we need #ifdef storm to use the correct path

 * libtinfo-dev does not contains any header files

 Fixed, we have to always require installed ncurses devel stuff to compile,
 but we can link with -ltinfo only (cal, ul, more, ...)

 * we don't use termcap for more(1)

Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotests: check for ps --ppid
Karel Zak [Tue, 30 May 2017 08:47:06 +0000 (10:47 +0200)] 
tests: check for ps --ppid

Reported-by: Assaf Gordon <assafgordon@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 years agotests: make /proc optional
Karel Zak [Tue, 30 May 2017 08:47:06 +0000 (10:47 +0200)] 
tests: make /proc optional

Reported-by: Assaf Gordon <assafgordon@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>