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>
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>
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>
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>
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>
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>
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>
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>
* 'coverity' of https://github.com/evverx/util-linux:
docs: mention Coverity Scan and the Fossies codespell report
travis: integrate util-linux with Coverity Scan
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>
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>
* '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