Karel Zak [Tue, 19 Dec 2017 12:46:35 +0000 (13:46 +0100)]
tests: don't use mount.<type> helpers in mount-by-pattern tests
The test behavior is fragile if depends on external helpers. Let's
keep it based on mount(2) only. The test will be faster too.
Note that "mount -t <pattern>" does not behaviour as expected with
helpers. We need to try another helper if the current one ends with
status=1 (waitpid()). Now it returns status from the first helper.
Reported-by: Ruediger Meier <sweet_f_a@gmx.de> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 12 Dec 2017 12:19:36 +0000 (13:19 +0100)]
libsmartcols: don't add blank padding after left aligned title
Let's use the same semantic for the title as for the last column in
the table. If aligned on left, table is not "maxout" and title padding
symbol is undefined (or blank) then keep title as short as possible.
Addresses: https://github.com/karelzak/util-linux/issues/549 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 28 Nov 2017 09:53:35 +0000 (10:53 +0100)]
nsenter: fix compiler warning [-Wuninitialized]
sys-utils/nsenter.c: In function ‘is_same_namespace’:
sys-utils/nsenter.c:170:2: warning: ‘b_ino’ may be used uninitialized in this function [-Wuninitialized]
sys-utils/nsenter.c:170:2: warning: ‘a_ino’ may be used uninitialized in this function [-Wuninitialized]
Karel Zak [Mon, 27 Nov 2017 11:37:53 +0000 (12:37 +0100)]
rtcwake: fix sys vs. rtc time delta usage
srett commented:
After some head scratching why relative wakeup using -s always works
while -t didn't seem to work at all I discovered that the adjustment
for time difference between sys and rtc is actually inverted when
writing the alarm (code for -m show reading is fine), so if the RTC
lags 10 minutes behind, the alarm will be shifted into the future by
10 minutes, resulting in a wakeup that is 20 minutes late.
Addresses: https://github.com/karelzak/util-linux/issues/544 Signed-off-by: Karel Zak <kzak@redhat.com>
commit f0a0ce7 makes debug mode implicit for the --test option.
Using the previous command syntax of --test and --debug
together invokes the undocumented Level 2 debugging when
setting the RTC. This can cause many thousands of lines of
output like: 1510967983.499968 < 1510967983.500000 (-0.000032)
Fix: bump Level 2 debugging to Level 9, just before the
other undocumented Level 10. This makes it improbable for
the development debug levels to be accessed unintentionally.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Potential partition start should be aligned to cylinders. So fdisk
wouldn't consider partition's last cylinder remains as eligible space
for new partition start.
Although iso-8601 specifies years as 4 digits, it allows
them to be wider.
The current POSIX year width is limited by 'int tm_year'
at 10 digits plus a negative sign.
That, and the possibility of nanosecond time makes the
widest POSIX iso-8601 time 41 characters. Plus the \0
string terminator yields a buffer size of 42.
Pali Rohár [Thu, 9 Nov 2017 18:03:34 +0000 (19:03 +0100)]
libblkid: vfat: Fix reading labels which starts with byte 0x05
When FAT directory entry has leading byte 0x05 it is interpreted as byte
0xE5. This is how FAT stores file name which starts with byte 0xE5 as
leading byte in 0xE5 in FAT directory entry means that file slot is empty.
Joshua Watt [Mon, 6 Nov 2017 22:25:36 +0000 (16:25 -0600)]
libmount: Allow MNT_FORCE and MNT_DETACH at umount
MNT_FORCE and MNT_DETACH are orthogonal in the Linux kernel, so both may
be specified without any problems. Even if there were a problem with
this combination, it should be up to the kernel to take the correct
action or report an error.
Luca Ceresoli [Tue, 7 Nov 2017 13:39:09 +0000 (14:39 +0100)]
md5: declare byteReverse as static
byteReverse() is an internal function in md5.c, and is not exposed via
any header file, but it is not declared as static. This is a problem
with the md5.c file since it is copied more or less verbatim in other
programs (fontconfig and pjsip among others), causing a link error
when linking two of them together.
Roddy Shuler [Fri, 3 Nov 2017 04:22:51 +0000 (21:22 -0700)]
libfdisk: Fix uninitialized structure
Without this, 'sfdisk -d' with certain filenames would lead to
reading an 's' from the 'type' field in fdisk_reset_labelitem
and cause a crash due to prematurely freeing the 'data.str' field.
The utility fsck.cramfs is prone to a bus error on file systems for
big endian systems with non-standard header sizes. While calculating
the crc32 checksum, it does not properly handle a possible offset
for bootcodes, resulting in out of boundary access of mmap'ed area.
You can trigger the issue with the following commands:
libfdisk: (sun) fix creation of whole disk partition
sun_add_partition() allowed the 1st sector to be 0 for the 3rd partition
only if that sector was free or if other partitions covered the whole
disk. Now it's always allowed for the 1st sector to be set to 0 for
the 3rd partition.
[kzak@redhat.com: - print info about "wholedisk" before "First sector" dialog for 3rd partition
- default to 0 for 3rd partition start sector]
Signed-off-by: Mikhail Vorobyov <m.vorobyov@cs.msu.ru> Signed-off-by: Karel Zak <kzak@redhat.com>
Kevin Locke [Mon, 30 Oct 2017 19:50:51 +0000 (13:50 -0600)]
bash-completion: Exclude /dev/fd from fsck find
When the bash-completion for fsck runs `find -L /dev/ -type b` it
descends into /dev/fd after opening '.' as file descriptor 3. This
causes find to search through /dev/fd/3/ which includes everything below
the current directory, which can take a very long time.
To avoid this, prune /dev/fd in the find expression.
Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
Milan Broz [Mon, 23 Oct 2017 14:26:51 +0000 (16:26 +0200)]
blkid: Add support for LUKS2 and new LABEL attributes.
This patch adds support for detection of a LUKS2 superblock.
LUKS2 is new version of Linux Unified Key Setup for encrypted
block devices.
LUKS2 contains a binary header and then JSON area for metadata.
Blkid should only parse the binary part, including newly available
optional LABEL and SUBSYSTEM fields.
LABEL is similar to filesystem label. The SUBSYSTEM field is
in principle, just a second label and can be used for specific udev rules
(for example if you have some 3rd party system that activates
volumes automatically, you can mark devices using this attribute).
Both labels are optional.
The magic string and UUID location are intentionally on the same offset
as LUKS v1, so even unpatched blkid now recognizes LUKS2.
Anyway, the code should not parse other versions of the header, so we now
explicitly check for header version and support only version 1 and 2.
Karel Zak [Wed, 11 Oct 2017 10:35:24 +0000 (12:35 +0200)]
logger: allow to reconnect on initial failed connect too
The current code sets noact flag if unix socked connection failed. This is ugly.
We want to reconnect always in all cases (well, except --socket-error=on).
Karel Zak [Tue, 10 Oct 2017 11:56:30 +0000 (13:56 +0200)]
logger: reconnect on failed send()
The libc syslog() reconnects on failed send(). We need the same thing
as logger(1) is expected as long time running tool. For example
recommended Apache configuration is:
Karel Zak [Mon, 2 Oct 2017 11:44:29 +0000 (13:44 +0200)]
libmount: add human compatible message for EBADMSG errno
mount: /media/sdb5: mount(2) system call failed: Bad message.
is really ugly for end users. It seems XFS, extN (etc) use EBADMSG for
bad checksums. For network or pseudo filesystems continue to use "Bad
message" error...
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1496764 Signed-off-by: Karel Zak <kzak@redhat.com>