diff options
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | bootstrap.conf | 3 | ||||
-rw-r--r-- | doc/coreutils.texi | 6 | ||||
-rwxr-xr-x | tests/readlink/can-f | 36 |
4 files changed, 36 insertions, 13 deletions
@@ -18,6 +18,10 @@ GNU coreutils NEWS -*- outline -*- ** Changes in behavior + canonicalize -f now ignores a trailing slash when deciding if the + last component (possibly via a dangling symlink) can be created, + since mkdir will succeed in that case. + id no longer prints SELinux " context=..." when the POSIXLY_CORRECT environment variable is set. diff --git a/bootstrap.conf b/bootstrap.conf index fb5ed1584..d1dc128e8 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -31,7 +31,6 @@ obsolete_gnulib_modules=' memcpy memmove memset - rename strcspn strtod strtol @@ -177,6 +176,7 @@ gnulib_modules=" readutmp realloc regex + rename rename-dest-slash rmdir root-dev-ino @@ -203,6 +203,7 @@ gnulib_modules=" strtoimax strtoumax strverscmp + symlink sys_stat timespec tzset diff --git a/doc/coreutils.texi b/doc/coreutils.texi index fa0562626..0bfbd5689 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -9204,7 +9204,8 @@ The program accepts the following options. Also see @ref{Common options}. @opindex --canonicalize Activate canonicalize mode. If any component of the file name except the last one is missing or unavailable, -@command{readlink} produces no output and exits with a nonzero exit code. +@command{readlink} produces no output and exits with a nonzero exit +code. A trailing slash is ignored. @item -e @itemx --canonicalize-existing @@ -9212,7 +9213,8 @@ If any component of the file name except the last one is missing or unavailable, @opindex --canonicalize-existing Activate canonicalize mode. If any component is missing or unavailable, @command{readlink} produces -no output and exits with a nonzero exit code. +no output and exits with a nonzero exit code. A trailing slash +requires that the name resolve to a directory. @item -m @itemx --canonicalize-missing diff --git a/tests/readlink/can-f b/tests/readlink/can-f index 8a000f8e9..a702ba990 100755 --- a/tests/readlink/can-f +++ b/tests/readlink/can-f @@ -38,6 +38,7 @@ ln -s regfile link1 || framework_failure ln -s subdir link2 || framework_failure ln -s missing link3 || framework_failure ln -s subdir/missing link4 || framework_failure +ln -s link5 link5 || framework_failure cd "$pwd/$tmp/removed" || framework_failure @@ -73,14 +74,14 @@ for p in "" "$pwd/$tmp/"; do v=`readlink -f "${p}subdir/more"` || fail=1 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1 - v=`readlink -f "${p}./subdir/more/"` && fail=1 - test -z "$v" || fail=1 + v=`readlink -f "${p}./subdir/more/"` || fail=1 + test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1 v=`readlink -f "${p}missing"` || fail=1 test "$v" = "$my_pwd/$tmp/missing" || fail=1 - v=`readlink -f "${p}./missing/"` && fail=1 - test -z "$v" || fail=1 + v=`readlink -f "${p}./missing/"` || fail=1 + test "$v" = "$my_pwd/$tmp/missing" || fail=1 v=`readlink -f "${p}missing/more"` && fail=1 test -z "$v" || fail=1 @@ -109,8 +110,8 @@ for p in "" "$pwd/$tmp/"; do v=`readlink -f "${p}link2/more"` || fail=1 test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1 - v=`readlink -f "${p}./link2/more/"` && fail=1 - test -z "$v" || fail=1 + v=`readlink -f "${p}./link2/more/"` || fail=1 + test "$v" = "$my_pwd/$tmp/subdir/more" || fail=1 v=`readlink -f "${p}link2/more/more2"` && fail=1 test -z "$v" || fail=1 @@ -121,8 +122,8 @@ for p in "" "$pwd/$tmp/"; do v=`readlink -f "${p}link3"` || fail=1 test "$v" = "$my_pwd/$tmp/missing" || fail=1 - v=`readlink -f "${p}./link3/"` && fail=1 - test -z "$v" || fail=1 + v=`readlink -f "${p}./link3/"` || fail=1 + test "$v" = "$my_pwd/$tmp/missing" || fail=1 v=`readlink -f "${p}link3/more"` && fail=1 test -z "$v" || fail=1 @@ -133,11 +134,26 @@ for p in "" "$pwd/$tmp/"; do v=`readlink -f "${p}link4"` || fail=1 test "$v" = "$my_pwd/$tmp/subdir/missing" || fail=1 - v=`readlink -f "${p}./link4/"` && fail=1 - test -z "$v" || fail=1 + v=`readlink -f "${p}./link4/"` || fail=1 + test "$v" = "$my_pwd/$tmp/subdir/missing" || fail=1 v=`readlink -f "${p}link4/more"` && fail=1 test -z "$v" || fail=1 + + v=`readlink -f "${p}./link4/more"` && fail=1 + test -z "$v" || fail=1 + + v=`readlink -f "${p}link5"` && fail=1 + test -z "$v" || fail=1 + + v=`readlink -f "${p}./link5/"` && fail=1 + test -z "$v" || fail=1 + + v=`readlink -f "${p}link5/more"` && fail=1 + test -z "$v" || fail=1 + + v=`readlink -f "${p}./link5/more"` && fail=1 + test -z "$v" || fail=1 done Exit $fail |