mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2025-09-10 07:59:52 +02:00
ln: --relative: fix updating of existing symlinks
Don't dereference an existing symlink being replaced. I.E. generate the symlink relative to the symlink's containing dir, rather than to some arbitrary place it points to. * src/ln.c (convert_abs_rel): Don't consider the final component of the symlink name when canonicalizing, as we want to avoid dereferencing the final component. * tests/ln/relative.sh: Add a test case. * NEWS: Mention the fix. Resolves http://bugs.gnu.org/14116
This commit is contained in:
committed by
Pádraig Brady
parent
20d7bce0f7
commit
e52293aa7f
@@ -29,4 +29,9 @@ test $(readlink usr/bin/foo) = '../lib/foo/foo' || fail=1
|
||||
ln -sr usr/bin/foo usr/lib/foo/link-to-foo
|
||||
test $(readlink usr/lib/foo/link-to-foo) = 'foo' || fail=1
|
||||
|
||||
# Correctly update an existing link, which was broken in <= 8.21
|
||||
ln -s dir1/dir2/f existing_link
|
||||
ln -srf here existing_link
|
||||
test $(readlink existing_link) = 'here' || fail=1
|
||||
|
||||
Exit $fail
|
||||
|
||||
Reference in New Issue
Block a user