1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-02-15 03:41:57 +02:00

link,ln: use gnulib's link module to work around Solaris 10 deficiency

Before this change, :>f; ln -T f no-such/ would succeed on Solaris 10.
After it, ln fails, as it should: ln: accessing `z/': Not a directory
The command, link f no-such/, had the same problem on that system.
* bootstrap.conf (gnulib_modules): Add "link".
* tests/ln/slash-decorated-nonexistent-dest: New test.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Portability): Mention the improvement.
This commit is contained in:
Jim Meyering
2009-09-10 17:51:44 +02:00
parent 15223b0c3b
commit ebc7aacf7b
4 changed files with 44 additions and 0 deletions

8
NEWS
View File

@@ -45,6 +45,14 @@ GNU coreutils NEWS -*- outline -*-
(i.e., not inotify-based) implementation.
[bug introduced in coreutils-7.5]
** Portability
ln, link: link f z/ would mistakenly succeed on Solaris 10, given an
existing file, f, and nothing named "z". ln -T f z/ has the same problem.
Each would mistakenly create "z" as a link to "f". Now, even on such a
system, each command reports the error, e.g.,
link: cannot create link `z/' to `f': Not a directory
** New features
cp --reflink accepts a new "auto" parameter which falls back to

View File

@@ -130,6 +130,7 @@ gnulib_modules="
lchown
lib-ignore
linebuffer
link
link-follow
long-options
lstat

View File

@@ -345,6 +345,7 @@ TESTS = \
ln/hard-backup \
ln/misc \
ln/sf-1 \
ln/slash-decorated-nonexistent-dest \
ln/target-1 \
ls/abmon-align \
ls/color-clear-to-eol \

View File

@@ -0,0 +1,34 @@
#!/bin/sh
# ensure that touch f; ln -T f no-such-file/ does not mistakenly succeed
# Copyright (C) 2009 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
if test "$VERBOSE" = yes; then
set -x
ln --version
fi
. $srcdir/test-lib.sh
touch f || framework_failure
fail=0
# Before coreutils-7.6, this would succeed on Solaris 10
ln -T f no-such-file/ && fail=1
test -e no-such-file && fail=1
Exit $fail