The current implementation of the function does not care if the device
is whole-disk device or partition, all is loopdev. This is regression
as the original is_loopdev() version was based on whole-disk devices
major numbers only.
Fixes: https://github.com/karelzak/util-linux/issues/1202
Signed-off-by: Karel Zak <kzak@redhat.com>
Because the headings are aligned with tabs the fields must
always be a multiple of 8 characters. Moreover if the field
values are shorter than 8 characters, extra tabs must be
inserted before the succeding field to keep alignment.
swapon parses /proc/swaps, generated by the Linux kernel in
mm/swapfile.c. Its function swap_show() and its recent fix in
commit 6f7939405f61de7d0da7f6c90182e96c4f5ff6c1 were used as
inspiration for this commit.
Additionally inform the translators about the requirements of
formatting and relationship between the heading and entry strings.
Otherwise, sfdisk would error out on its own dump, as first-lba would be
earlier than "plausible" assuming the default table size.
This is because it did not look for `table-length` when using an sfdisk
script. This means that using `--dump` on a valid image, could not be
unserialized back into a valid image.
This is helpful in exotic situations, where a partition has to be
created earlier than the conventional "first-lba" (2048). For example,
on Allwinner A64 boards, where a firmware is stored at LBA16. With this
it is possible to ask for `first-lba` at or earlier than 16, by reducing
the number of entries to e.g. 48.
It's seems detection by BLKRRPART is broken in recent kernels
(probably regression), and it's also overkill to force kernel re-read
all and generate all the events. It seems more elegant to use O_EXCL.
Signed-off-by: Karel Zak <kzak@redhat.com>
The prlimit description are always defined as static strings, but it
seems better to make the code more readable and robust for static
analyzers and readers.
Fix also missing gettext() call for description help.
Fixes: https://github.com/karelzak/util-linux/issues/1277
Signed-off-by: Karel Zak <kzak@redhat.com>
open()+stat() does not work for example after su(1) (from root to
non-root). It seems better to use only stat() to get the current
terminal status.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1906157
Signed-off-by: Karel Zak <kzak@redhat.com>
The current libblkid ignores FAT when created on the same whole-disk
device as valid MBR. This restriction is not compatible with many
devices (like USB flash disk) created by Windows or the latest
dosfstools where the first partition is used for entire device and
where is also valid FAT. The filesystem is accessible from partition
as well as from whole-disk device.
The conclusion (between util-linux, dosfstools and udisks) is that
libblkid has to provide all details, not hide anything and the proper
policy (hide/show) has to be implemented by udisks (or so).
CC: Tomáš Bžatek <tbzatek@redhat.com>
CC: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
The expert command 'D'ump skips zeros when print label hexdump on
terminal, but for non-terminal it prints all buffer. It seems
better to use the same semantic everywhere and skip zeros.
Signed-off-by: Karel Zak <kzak@redhat.com>