Commit Graph

14511 Commits

Author SHA1 Message Date
Mauricio Faria de Oliveira ff84ba8b03 rename: tests: add more symlink checks
Add a few checks to the symlink test, including for the fix
in commit 477239ce0d ("rename: fix regression for symlink
with non-existing target").

Tested with './tests/run.sh rename/symlink' before/after that
commit with FAILED/OK results (and '--show-diff') as expected:

After:
       rename: symlink check                  ... OK

Before:
       rename: symlink check                  ... FAILED (rename/symlink)

With --show-diff:

    diff-{{{
    --- /home/mfo/git/util-linux/tests/expected/rename/symlink	2020-07-14 15:21:06.412792160 -0300
    +++ /home/mfo/git/util-linux/tests/output/rename/symlink	2020-07-14 15:45:10.980927233 -0300
    @@ -3,5 +3,3 @@
     rename_slink.3: `old' -> `new'
     `rename_slink.1' -> `rename_symlink.1'
     target
    -`rename_slink.2' -> `rename_symlink.2'
    -target
    }}}-diff

    diff-{{{
    --- /home/mfo/git/util-linux/tests/expected/rename/symlink.err	2020-07-14 15:37:42.466207786 -0300
    +++ /home/mfo/git/util-linux/tests/output/rename/symlink.err	2020-07-14 15:45:10.984927251 -0300
    @@ -1 +1,2 @@
    +rename: rename_slink.2: not accessible: No such file or directory
     rename: rename_slink.3: No such file or directory
    }}}-diff

Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
2020-07-14 15:51:47 -03:00
Michael Kerrisk (man-pages) 70dae020c9 Manual pages: runuser.1, su.1: miscellaneous wording and formatting fixes
Various wording and formatting fixes. Nothing too contentnious, I think,
so I rolled these changes into one patch.

Since there is much common text in su.1 and runuser.1, I've combined
the changes to both pages into one patch, and, as far as possible,
ensured that changes to the common pieces of text match across the
two pages.

Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
2020-07-14 14:37:26 +02:00
Karel Zak cdc08221ac Manual pages: reword su.1 description
Reported-by: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 14:33:49 +02:00
Karel Zak 29e204d117 docs: reword others "allow to"
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 14:31:29 +02:00
Michael Kerrisk (man-pages) 4f68c8b179 Manual pages: various: reword "allow(s) to"
The wording "allow(s) to" is not grammatical English. Reword various
pages to use a more correct form such "can be use to" or "allows
the [noun] of".

Aklong the way, fix a few nearby wording errors in some pages.

Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
2020-07-14 14:08:54 +02:00
Michael Kerrisk (man-pages) 10fa311d3e Manual pages: login.1: various minor wording fixes
Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
2020-07-14 13:58:59 +02:00
Michael Kerrisk (man-pages) 62dcaec071 Manual pages: login.1: formatting fixes
Bold for command names; italic for pathnames, etc.

Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
2020-07-14 13:58:59 +02:00
Michael Kerrisk (man-pages) f0fd830ea8 Manual pages: login.1: SEE ALSO: add utmp(5), lastlog(8)
utmp and lastlog are referred to in the manual page, and thus deserve a
cross references in SEE ALSO.

Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
2020-07-14 13:58:59 +02:00
Michael Kerrisk (man-pages) c0de507ae5 manual pages: adjtime_config.5: format pathname with .I
Signed-off-by: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>
2020-07-14 13:58:59 +02:00
Karel Zak bb6561f1a7 build-sys: add --enable-werror to devel build scenarios
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 12:37:06 +02:00
Karel Zak 045e7efabd libsmartcols: (sample) remove unused variable
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 12:32:56 +02:00
Karel Zak 04e6ab9c1b libsmartcols: (sample) remove unnecessary check [coverity scan]
@str cannot be NULL ...

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 12:21:22 +02:00
Karel Zak f3a55c1fde libsmartcols: (sample) check scols_line_refer_data() return code [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 12:18:01 +02:00
Karel Zak fc701415c4 libuuid: (test) make sure UUID is terminated [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 12:15:47 +02:00
Karel Zak 59ba65df21 libsmartcols: (smaple) check scols_line_set_data() return code [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 12:03:11 +02:00
Karel Zak 7cdec9dff8 libuuid: (test) cleanup unused memory [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 11:56:15 +02:00
Karel Zak 86c45027d9 libuuid: (test) close fd [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 11:47:38 +02:00
Karel Zak f596692030 test_tiocsti: check ioctl() return code [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 11:43:38 +02:00
Karel Zak 8aedaf592e libsmartcols: (sample) check scols_line_set_data() return code [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 11:36:23 +02:00
Milan Broz e19e522df0 lsblk: Add SERIAL column to the SCSI output mode.
If there are several identical disks, disk serial number can help
to distinguish exact drive.

This could be helpful in debugging RAID failures and similar problems.

Signed-off-by: Milan Broz <gmazyland@gmail.com>
2020-07-14 10:37:56 +02:00
Bjarni Ingi Gislason ed554da252 docs: misc-utils: change "allows to <verb>" to "allows <verb>ing"
The web site "lintian.debian.org" shows some examples of "allows to",
which are changed to "allows one to".

  I chose here to use gerund.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2020-07-14 10:37:54 +02:00
Bjarni Ingi Gislason 39063fbe89 Subject: docs: disk-utils: change "allows to <verb>" to "allows <verb>ing"
The web site "lintian.debian.org" shows some examples of "allows to",
which are changed to "allows one to".

  I chose here to use gerund.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2020-07-14 10:37:52 +02:00
Bjarni Ingi Gislason db850f3c19 Subject: docs: remove unnecessary paragraph macros
Remove a second paragraph macro (.TP, .PP) as it does not change the
output (.SS/.PP) or it adds an extra empty line (.TP/.TP)

  Warning from "mandoc -Tlint":

mandoc: ./sys-utils/hwclock.8.in:299:2: WARNING: line scope broken: TP breaks TP
mandoc: ./sys-utils/hwclock.8.in:459:2: WARNING: skipping paragraph macro: PP after SS
mandoc: ./sys-utils/hwclock.8.in:543:2: WARNING: skipping paragraph macro: PP after SS
mandoc: ./sys-utils/hwclock.8.in:574:2: WARNING: skipping paragraph macro: PP after SS
mandoc: ./sys-utils/hwclock.8.in:673:2: WARNING: skipping paragraph macro: PP after SS
mandoc: ./sys-utils/hwclock.8.in:721:2: WARNING: skipping paragraph macro: PP after SS

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2020-07-14 10:37:49 +02:00
Bjarni Ingi Gislason b11861d7a0 Subject: docs: change from nofill to fill mode
Change request nofill mode to fill mode.

  Warning from "mandoc -Tlint":

mandoc: ./misc-utils/uuidd.8.in:81:2: STYLE: fill mode already disabled, skipping: nf

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2020-07-14 10:37:47 +02:00
Bjarni Ingi Gislason 0d0d6f1a69 docs: remove trailing space in strings
Trim trailing space in strings.

  There is no change in the output of "nroff" and "groff".

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2020-07-14 10:37:45 +02:00
Karel Zak 76afb76fdf Merge branch 'coverity' of https://github.com/evverx/util-linux
* 'coverity' of https://github.com/evverx/util-linux:
  docs: mention Coverity Scan and the Fossies codespell report
  travis: integrate util-linux with Coverity Scan
2020-07-14 10:26:44 +02:00
Karel Zak e318673775 Merge branch 'osx' of https://github.com/evverx/util-linux 2020-07-14 10:25:27 +02:00
Evgeny Vereshchagin 2092de0ff5 docs: mention Coverity Scan and the Fossies codespell report
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-07-13 20:32:57 +00:00
Evgeny Vereshchagin 07919e55b0 travis: integrate util-linux with Coverity Scan
For this to work, a daily cron job running on the master branch
should be added: https://docs.travis-ci.com/user/cron-jobs/

The report can found at https://scan.coverity.com/projects/karelzak-util-linux

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-07-13 19:54:48 +00:00
Yuri Chornoivan aa1c7a7686 More typo fixes by fossies 2020-07-13 15:33:42 +03:00
Evgeny Vereshchagin b7abdc2dd5 travis: switch to a newer version of macOS
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-07-10 15:58:06 +00:00
Yuri Chornoivan 311e33afef Fix minor typos 2020-07-09 20:14:32 +03:00
Karel Zak 1f4009146a build-sys: release++ (v2.36-rc2)
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-09 12:20:57 +02:00
Karel Zak aaa3502334 docs: update v2.36-ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-09 12:18:44 +02:00
Karel Zak 383130fc5f docs: update AUTHORS file
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-09 12:15:33 +02:00
Karel Zak 00675fd5f0 po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-09 12:13:54 +02:00
Karel Zak c0eb43f7d3 docs: update ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-09 11:55:05 +02:00
Karel Zak 10a0a9cbc5 last: fix use of non-terminated utmp->ut_line
Addresses: https://github.com/karelzak/util-linux/pull/1097
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-09 10:10:58 +02:00
Karel Zak a102522992 docs: add terminal hyperlinks to TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-09 09:34:30 +02:00
Karel Zak ff89765a8f travis: don't ask for Ubuntu release on XOS
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-08 15:11:17 +02:00
Karel Zak 7680209f8a libmount: (verity) remove unnecessary empty lines
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-08 10:11:57 +02:00
Karel Zak ca4faf2441 Merge branch 'lp1886300' of https://github.com/mfoliveira/util-linux
* 'lp1886300' of https://github.com/mfoliveira/util-linux:
  rename: fix regression for symlink with non-existing target
2020-07-08 10:10:53 +02:00
Karel Zak c9cad81a0c Merge branch 'cryptsetup_dlopen' of https://github.com/bluca/util-linux
* 'cryptsetup_dlopen' of https://github.com/bluca/util-linux:
  cryptsetup: add option to use via dlopen in libmount
2020-07-08 09:55:12 +02:00
Karel Zak c02980d6f2 lsmem: report inaccessible /sys/devices/system/memory
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1794160
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-08 08:51:45 +02:00
Karel Zak 655d736da3 lib/path: add ul_path_is_accessible()
This function allow to check that path_cxt is usable. Note that
ul_new_path() does not open the path.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-08 08:50:07 +02:00
Karel Zak bf1d0a4ea0 lsmem: make it without leaks for non-error output
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-08 08:48:45 +02:00
Mauricio Faria de Oliveira 477239ce0d rename: fix regression for symlink with non-existing target
Since commit 5454df9c31 ("rename: check source file access early")
rename fails early for symlinks with non-existing target (regression),
because access() dereferences the link.

From access(2):

  "access() checks whether the calling process can access the file pathname.
   If pathname is a symbolic link, it is dereferenced."

Thus replace access() with faccessat() and lstat() as fallback,
(as in do_symlink()), that is equivalent for symlink and files.

From fsaccess(2) and stat(2):

  "The faccessat() system call operates in exactly the same way as access(),
   except for the differences described here.
   [...]
   If pathname is relative and dirfd is the special value AT_FDCWD, then pathname
   is interpreted relative to the current working directory of the calling process
   (like access()).
   [...]
   AT_SYMLINK_NOFOLLOW
     If pathname is a symbolic link, do not dereference it:
     instead return information about the link itself."

  "lstat() is identical to stat(), except that if pathname is a symbolic link, then
   it returns information about  the  link  itself, not the file that it refers to."

Testing
-------

  1) symlink with existing target
  2) symlink with non-existing target
  3) non-existing symlink
  4) existing file
  5) non-existing file

Before:

  $ touch file-found
  $ ln -s file-found symlink-1
  $ ./rename sym symbolic- symlink-1	# XPASS.
  $ echo $?
  0

  $ ln -s file-not-found symlink-2
  $ ./rename sym symbolic- symlink-2	# FAIL! REGRESSION.
  rename: symlink-2: not accessible: No such file or directory
  $ echo $?
  1

  $ ./rename sym symbolic- symlink-3	# XFAIL.
  rename: symlink-3: not accessible: No such file or directory
  $ echo $?
  1

  $ touch file-found
  $ ./rename found existing file-found	# XPASS.
  $ echo $?
  0

  $ ./rename found existing file-not-found # XFAIL.
  rename: file-not-found: not accessible: No such file or directory
  $ echo $?
  1

After:

  $ touch file-found
  $ ln -s file-found symlink-1
  $ ./rename sym symbolic- symlink-1	# XPASS.
  $ echo $?
  0

  $ ln -s file-not-found symlink-2
  $ ./rename sym symbolic- symlink-2	# PASS! REGRESSION FIXED.
  $ echo $?
  0

  $ ./rename sym symbolic- symlink-3	# XFAIL.
  rename: symlink-3: not accessible: No such file or directory
  $ echo $?
  1

  $ touch file-found
  $ ./rename found existing file-found	# XPASS.
  $ echo $?
  0

  $ ./rename found existing file-not-found # XFAIL.
  rename: file-not-found: not accessible: No such file or directory
  $ echo $?
  1

And to test/simulate faccessat()'s EINVAL for AT_SYMLINK_NOFOLLOW
for Mac OS X, per commit 826538bf64 ("rename: skip faccessat()
failure if AT_SYMLINK_NOFOLLOW is not a valid flag"), forced 'if'
to evaluate to false so that lstat() is taken.

It still fails early; the error messages are slightly different
('not accessible' vs. 'stat of ... failed') but still tell same
'No such file or directory'; exit code is the same as well.

  $ ./rename sym symbolic- symlink-3	# XFAIL. DIFF MSG/SAME RC.
  rename: stat of symlink-3 failed: No such file or directory
  $ echo $?
  1

  $ ./rename found existing file-not-found # XFAIL. DIFF MSG/SAME RC.
  rename: stat of file-not-found failed: No such file or directory
  $ echo $?
  1

Tested on commit 2b41c409e ("Merge branch 'blkd-err' of ...")

Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
2020-07-07 16:19:15 -03:00
Luca Boccassi 488fd4c3df cryptsetup: add option to use via dlopen in libmount
Enabling libcrypsetup in libmount had several unintended side
effects.
First of all, it increases the Debian minimal image size by
~2.5% (5.6MB worth of new libraries).
Then, due to libcryptsetup linkage to OpenSSL and libjson-c,
it causes incompatibilities with external programs linking
against both libmount and a private, static, old version of
OpenSSL, or external programs linking against libjansson or
json-glib, which have one symbol in common with libjson-c.

If ./configure is ran with --with-crypsetup=dlopen,
instead of linking to libcrypsetup, use dlopen to resolve
the symbols at runtime only when the verity feature is
used, thus avoiding clashes and keeping images size down.

Fixes #1081

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
2020-07-07 16:43:55 +01:00
Karel Zak 2b41c409e7 Merge branch 'blkd-err' of https://github.com/evverx/util-linux
* 'blkd-err' of https://github.com/evverx/util-linux:
  tests: turn off detect_leaks on s390x, use more asan options
  tests: skip "blkid/dm-err" when `mknod` doesn't work
2020-07-07 14:24:41 +02:00
Evgeny Vereshchagin 1b9f2ff333 tests: turn off detect_leaks on s390x, use more asan options
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-07-03 13:26:08 +00:00