Commit Graph

13918 Commits

Author SHA1 Message Date
Karel Zak 40f8c5e47e include: add some missing licence stuff to header files
It's mostly wrappers for compatibility and another trivial stuff etc.
Let's keep it as public domain to make it more portable to LGPL, GPL
and BSD code.

Signed-off-by: Karel Zak <kzak@redhat.com>
CC: Sami Kerola <kerolasa@iki.fi>
CC: Ruediger Meier <ruediger.meier@ga-group.nl>
2020-01-13 10:39:52 +01:00
John Baublitz c54f54d680 libblkid: Fix documentation in libblkid header 2020-01-10 12:05:46 +01:00
Karel Zak bb607cb3b2 docs: fix typos [fossies codespell scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-09 10:18:16 +01:00
Luca Boccassi e7924c4f15 libmount: do not obscure return code when checking verity options
In some corner cases, the return code was being overwritten without
being checked
2020-01-08 12:59:23 +01:00
Karel Zak b6c1eccc43 build-sys: release++ (v2.35-rc2)
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-08 10:28:29 +01:00
Karel Zak 3ebb5d4b45 docs: update v2.35-ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-08 10:26:12 +01:00
Karel Zak 11bde9881c docs: update AUTHORS file
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-08 10:22:55 +01:00
Karel Zak 5110732a7a po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-08 10:16:57 +01:00
Karel Zak 9650cebc7d Merge branch 'fix-xfs-external-log' of https://github.com/mfoliveira/util-linux 2020-01-08 09:53:32 +01:00
Karel Zak e72eea70c4 libblkid: check status for the current CDROM slot
It's probably more safer.

Reported-by: Michal Suchánek <msuchanek@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-08 09:23:04 +01:00
Mauricio Faria de Oliveira d756af7d64 libblkid: (xfs) external log: check for regular xfs on more sectors
The xfs external log probe only checks for regular xfs on sector zero,
but then checks for valid log record headers on all first 512 sectors.

This can incorrectly detect an xfs external log if a regular xfs (i.e.
with internal log) is shifted by up to 512 sectors; it may happen with
bcache and LVM1 for example, as the regular xfs is found later in disk.

This results in ambivalent filesystem detection, thus no UUID for udev.

Fix this problem by checking for regular xfs on all sectors considered
by the xfs external log probe.

Test-case with bcache:
---

    $ IMG=bcache-backing-device.img
    $ dd if=/dev/zero of=$IMG bs=1G count=0 seek=1
    $ DEV=$(sudo losetup --find --show $IMG)

    $ sudo make-bcache -B $DEV

    $ sudo mkfs.xfs -d agsize=16m -l agnum=0 -f /dev/bcache0

    $ sudo LD_LIBRARY_PATH=./.libs ./wipefs /dev/bcache0
    DEVICE  OFFSET TYPE UUID                                 LABEL
    bcache0 0x0    xfs  9f6dfa9d-4488-46f7-906b-dcfc96027cfe

    $ echo 1 | sudo tee /sys/block/bcache0/bcache/stop

    $ sudo hexdump -C $DEV | grep -m2 -e XFSB -e 'fe ed ba be'
    00002000  58 46 53 42 00 00 10 00  00 00 00 00 00 03 f0 00  |XFSB............|
    00007000  fe ed ba be 00 00 00 01  00 00 00 02 00 00 00 14  |................|

  Without patch:

    $ sudo LD_LIBRARY_PATH=./.libs ./wipefs $DEV
    DEVICE OFFSET TYPE             UUID                                 LABEL
    loop0  0x1018 bcache           23da3ba9-2467-453d-b020-06f02c947190
    loop0  0x7000 xfs_external_log

  With patch:

    $ sudo LD_LIBRARY_PATH=./.libs ./wipefs $DEV
    DEVICE OFFSET TYPE             UUID                                 LABEL
    loop0  0x1018 bcache           23da3ba9-2467-453d-b020-06f02c947190

Test-case with LVM1:
---

    $ IMG=lvm-backing-device.img
    $ dd if=/dev/zero of=$IMG bs=1G count=0 seek=1
    $ DEV=$(sudo losetup --find --show $IMG)

    $ sudo lvm pvcreate -M1 $DEV
    $ sudo lvm vgcreate -M1 lvm-vg-test $DEV
    $ sudo lvm lvcreate  lvm-vg-test --name lvm-lv-test --extents 100%VG

    $ sudo mkfs.xfs -d agsize=16m -l agnum=0 -f /dev/mapper/lvm--vg--test-lvm--lv--test

    $ sudo LD_LIBRARY_PATH=./.libs ./wipefs /dev/mapper/lvm--vg--test-lvm--lv--test
    DEVICE                      OFFSET TYPE UUID                                 LABEL
    lvm--vg--test-lvm--lv--test 0x0    xfs  451ba725-8394-4ebe-9b49-fc5f4a99667f

    $ sudo lvchange -an lvm-vg-test

    $ sudo hexdump -C $DEV | grep -m2 -e XFSB -e 'fe ed ba be'
    00020000  58 46 53 42 00 00 10 00  00 00 00 00 00 03 f0 00  |XFSB............|
    00025000  fe ed ba be 00 00 00 01  00 00 00 02 00 00 00 14  |................|

  Without patch:

    $ sudo LD_LIBRARY_PATH=./.libs ./wipefs $DEV
    DEVICE OFFSET  TYPE             UUID                                   LABEL
    loop0  0x0     LVM1_member      agUhNT-9f42-Z30B-Z4Ew-skWd-3h3a-tWMY0A
    loop0  0x25000 xfs_external_log

  With patch:

    $ sudo LD_LIBRARY_PATH=./.libs ./wipefs $DEV
    DEVICE OFFSET TYPE        UUID                                   LABEL
    loop0  0x0    LVM1_member agUhNT-9f42-Z30B-Z4Ew-skWd-3h3a-tWMY0A

Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
2020-01-07 19:25:57 -03:00
Karel Zak dc30fd4383 libblkid: check for medium on CDMROMs probing
The commit 39f5af2598 introduces
O_NONBLOCK to avoid the tray close on open(). The side effect is that
open() is successful when there is no medium.

This is usually no problem for standard tools because the next read()
will fail. Unfortunately, libblkid ignores I/O errors for (and only
for) CDROMs to support some crazy hybrid data+audio disks. The final
result is many I/O errors in system log when O_NONBLOCK is enabled.

This patch add CDROM_DRIVE_STATUS to stop probing when there is no
disk or when the tray is open.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1787973
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-07 16:48:34 +01:00
Karel Zak 4ae96cf77b tests: mark mdadm tests as TS_KNOWN_FAIL
It seems recent changes in mdadm make things a little bit unstable for
some users. Let's mark the tests temporary as TS_KNOWN_FAIL until we
get more information.

Addresses: https://github.com/karelzak/util-linux/issues/906
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-07 11:41:01 +01:00
Karel Zak d7197d19e1 po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-06 14:21:12 +01:00
Karel Zak 24cee7157a docs: update year in libs docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-06 12:59:45 +01:00
Karel Zak 261cf85627 cal: (man) make -w, -m and --iso relation more obvious
Reported-by: Leah Neukirchen <leah@vuxu.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-03 12:04:00 +01:00
Karel Zak d511011c22 docs: add irqtop to TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-03 11:12:19 +01:00
Karel Zak 6b0094d0c1 libmount: improve X-mount.mkdir for non-root users
Since v2.35 mount(8) drops suid on -EPERM and repeat necessary actions
before mount(2) syscall. This patch also improves this behavior for
X-mount.mkdir too.

mount(8):
 * return -EPERM on sanitize_paths() rather than call err()
 * call suid_drop() on failed sanitize_paths()
 * update man page

libmount:
 * mnt_context_prepare_target() refactoring
 * return -EPERM when in restricted mode for X-mount.mkdir

Fixed version:
 /home/kzak/mnt-foo   sr.net.home:/home/kzak   fuse.sshfs noauto,X-mount.mkdir

 $ mount /home/kzak/mnt-foo
 kzak@sr.net.home's password:

 $ /home/projects/util-linux/util-linux  findmnt /home/kzak/mnt-foo
 TARGET             SOURCE                 FSTYPE     OPTIONS
 /home/kzak/mnt-foo sr.net.home:/home/kzak fuse.sshfs rw,nosuid,nodev,relatime,user_id=1000,group_id=1000

Addresses: https://github.com/systemd/systemd/issues/14418
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-03 10:48:09 +01:00
Karel Zak d0c4300682 libfdisk: (MBR) use 0xEA partition type by BootLoaderSpecification
Let's use 0xEA for "Linux extended boot" rather than for "Rufus alignment".

References: https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-02 15:16:54 +01:00
Karel Zak dac28f83e8 docs: add non-signalfd PTY request to TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-02 14:48:23 +01:00
Karel Zak 64d06881ca Merge branch 'fix-map-current-user-shortopt' of https://github.com/mat8913/util-linux
* 'fix-map-current-user-shortopt' of https://github.com/mat8913/util-linux:
  unshare: fix --map-current-user short option (-c)
2020-01-02 14:16:04 +01:00
Karel Zak a00516ade9 docs: add bjd-pfq to AUTHORS (rev.c co-author)
Addresses: https://github.com/karelzak/util-linux/issues/803
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-02 12:55:32 +01:00
Matthew Harm Bekkema 033e473508 unshare: fix --map-current-user short option (-c)
'c' was missing from the optstring, causing the error:

    $ unshare --user -c
    unshare: invalid option -- 'c'
    Try 'unshare --help' for more information.

Fixes: 4175f29e62 ("unshare: add --map-current-user option")
Signed-off-by: Matthew Harm Bekkema <id@mbekkema.name>
2020-01-02 00:19:45 +11:00
Karel Zak 9418ba6d05 agetty: keep freed issue file pointer zeroized
References: https://bugzilla.redhat.com/show_bug.cgi?id=1784536
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-20 15:05:33 +01:00
Karel Zak 63f8c66af8 Merge branch 'master' of https://github.com/dsd/util-linux
* 'master' of https://github.com/dsd/util-linux:
  libblkid: improve identification of ISO9660 partition
  isosize: move ISO size functions into a shared header
2019-12-20 12:55:49 +01:00
Karel Zak 653d1c8110 tests: (fdisk) make sure we use the same sizes for MD devices
It seems on some kernels MD can return error if the devices in RAID
have different size

 # mdadm -q --create /dev/md8 --chunk=64 --level=0 --raid-devices=2 /dev/sda1 /dev/sda2
 mdadm: RUN_ARRAY failed: Unknown error 524

 # dmesg
 ...
 [ 1485.148435] md/raid0:md8: cannot assemble multi-zone RAID0 with default_layout setting
 [ 1485.152306] md/raid0: please set raid.default_layout to 1 or 2
 [ 1485.154050] md: pers->run() failed ...
 [ 1485.154104] md: md8 stopped.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-17 18:10:31 +01:00
Karel Zak 5202d809b6 Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux:
  libblkid: udf: Fix reporting UDF 2.60 revision for Mac OS X disks
2019-12-17 12:34:18 +01:00
Bjarni Ingi Gislason 37f26093c9 doc: howto-man-page.txt: Use font macros instead of font escapes
Use font macros instead of font escapes (\f[BIPR]).

  The escape '\c' ("connect to next input text")
is used to join the output of two macros without a space character.
This is similar to the '\' escape at the end of a line.

  Font escapes make the text more difficult to read.

###
  Changes based on:

  Use a macro to change to the italic font,
instead of \fI [1], if possible.
  The macros have the italic corrections,
but "\c" removes the "\/" part.

  Or

add the italic corrections.
[1] man-pages(7) [Debian package "manpages"]

###

Change a HYPHEN-MINUS (code 0x55, 2D) to a minus (\-), if in front of a

1) name for an option

2) negative number to be printed.

###

Wrong distance between sentences or protect the indicator.

a) Separate the sentences and subordinate clauses;
each begins on a new line.
See man-pages(7) [package "manpages"] and "info groff".

Or

b) Adjust space between sentences (two spaces),

c) or protect the indicator by adding "\&" after it.

The "indicator" is an "end-of-sentence character" (.!?).

  The amount of space between sentences in the output can then be
controlled with the ".ss" request.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2019-12-17 12:32:43 +01:00
Bjarni Ingi Gislason 1c4c602427 man pages: Change a HYPHEN-MINUS (-) to a minus (\-) for options and numbers
Change a HYPHEN-MINUS (code 0x55, 2D) to a minus (\-), if in front of

1) a name of an option

2) a negative number to be printed.

  See man-pages(7) [Debian package "manpages"].

  The output from "nroff" is unchanged.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2019-12-17 12:32:43 +01:00
Bjarni Ingi Gislason eb02489380 man pages: Add a comma after "e.g." and "i.e."
Add a comma (,) after "e.g." and "i.e.", or use English words
(man-pages(7) [package "manpages"]).

  Abbreviation points should be protected (usually with the
non-printing, zero width character '\&') from being interpreted as an
end of sentence, if they are not, and that independent of their current
place on the line.

  This is important when typing, as one does not usually know in
advance when the editor jumps to a new line.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2019-12-17 12:32:43 +01:00
Bjarni Ingi Gislason 2fb684f004 man pages: Fix misuse of two-fonts macros
Two-fonts macros are made for two or more arguments.

  Remove space at end of lines in the files "term-utils/{script.1,
scriptlive.1, scriptreplay.1}".

  Put "\-\-summary" to the correct indent in the file
"term-utils/script.1"

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2019-12-17 12:32:43 +01:00
Bjarni Ingi Gislason 47da68f1c9 man pages: Make the number of .RS/.RE equal
Add or remove one of the pairs .RS/.RE to make their number equal.

  The output from "nroff" and "groff" is unchanged.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2019-12-17 12:32:43 +01:00
Karel Zak b2ef43864f tests: (chfn) force to bash
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-16 15:27:45 +01:00
Karel Zak 1cb82714ce travis: fix sudo command line
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-16 14:29:33 +01:00
Radka Skvarilova 02238bff66 tests: add new test for chfn gecos
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1743555
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-16 13:22:29 +01:00
Daniel Drake fc84bc0a46 libblkid: improve identification of ISO9660 partition
Recent changes to the iso9660 handler attempt to better handle the case
where the media has both an ordinary ISO9660 filesystem, and a partition
table with a partition entry pointing at the ISO9660 filesystem.

Rather than assuming the presence of a partition table means that there
is an ISO9660 partition, check that such a partition exists before
deciding upon which device the metadata should be presented. One real
world example of this is the grub-mkrescue image format; add a unit test
to cover that.

Secondly, even if we find an appropriate entry in the partition table,
verify that we actually have a device that corresponds to the partition
where we would then proceed to expose this metadata. In the case of a
CD/DVD (i.e. /dev/sr0) we would not normally expect to see devices
corresponding to the partitions, in that case the ISO metadata should be
presented on the whole disk (/dev/sr0).

Fixes: 7ef86a0891 ("libblkid: improve handling of ISO files with partition tables")
Link: https://bugzilla.redhat.com/show_bug.cgi?id=1783066
Signed-off-by: Daniel Drake <drake@endlessm.com>
2019-12-16 14:29:24 +08:00
Daniel Drake 1f10f4afec isosize: move ISO size functions into a shared header
Move the helper functions that parse ISO data & sector size info into
a separate, shared header.

These will addtionally be used by libblkid's iso9660 parser.

Signed-off-by: Daniel Drake <drake@endlessm.com>
2019-12-16 14:29:24 +08:00
Pali Rohár 92fc937ba4 libblkid: udf: Fix reporting UDF 2.60 revision for Mac OS X disks
Apple's newfs_udf, when creating UDF 2.60 disks, sets value 2.50 into
both Minimum UDF Read Revision and Minimum UDF Write Revision fields in
LVIDIU. And sets 2.60 value into UDF revision field in LVD descriptor.

So to correctly parse and set blkid ID_FS_VERSION field, use maximum value
from Minimum UDF Read Revision in LVIDIU, Minimum UDF Write Revision in
LVDIU and UDF revision in LVD descriptor.

This commit also adds a testing UDF 2.60 disk image with 4K sectors created
by Apple's newfs_udf to verify that ID_FS_VERSION is set correctly to 2.60.
2019-12-15 12:55:41 +01:00
Karel Zak 3d3280ef15 Merge branch 'release-prep' of https://github.com/kerolasa/util-linux 2019-12-12 12:39:18 +01:00
Patrick Steinhardt c0274f8add agetty: return proper value if compiled without ISSUEDIR support
If agetty is compiled without support for ISSUEDIR, then it implements
a stub for `issuedir_read` that simply does nothing. In fact it does
too little, as it doesn't have a proper return statement even though the
function returns an integer.

Fix the issue by always returning `1` from `issuedir_read`. This
is the same error code that the real implementation of that function
returns in case it cannot open the directory and is thus a sensible
default to pretend that the directory doesn't exist.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
2019-12-12 12:22:28 +01:00
Sami Kerola ac407b1650
script: fix typos [codespell]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-12-11 19:53:14 +00:00
Sami Kerola 543f6b6cfc
man: improve script and scriptreplay formatting style
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-12-11 19:52:20 +00:00
Sami Kerola 6b62a608b2
bash-completion: update script, scriptlive, and scriptreplay files
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-12-11 19:19:21 +00:00
Samuel Thibault 393f266c76 build-sys: make scriptlive optional
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-11 13:24:25 +01:00
Karel Zak 6d67d84319 build-sys: release++ (v2.35-rc1)
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-11 10:55:14 +01:00
Karel Zak 8b8985dd1b docs: add v2.35-ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-11 10:52:51 +01:00
Karel Zak 10dcb8d133 Merge branch 'dmverity_options' of https://github.com/bluca/util-linux
* 'dmverity_options' of https://github.com/bluca/util-linux:
  verity: add support for Forward Error Correction options
  verity: ensure that hash_device and root_hash[_file] are passed together or not at all
  verity: add new verity.roothashfile option
2019-12-10 14:46:13 +01:00
Karel Zak 225c4ff92a docs: update AUTHORS file
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-10 14:08:26 +01:00
Karel Zak d462a45d76 po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-10 14:04:50 +01:00
Pedro Albuquerque 7e148b5a31 po: add pt.po (from translationproject.org) 2019-12-10 13:57:19 +01:00