[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #56410] find -L doesn't follow symlinks outside the specified searc
From: |
James Youngman |
Subject: |
[bug #56410] find -L doesn't follow symlinks outside the specified search scope |
Date: |
Wed, 29 May 2019 06:36:43 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36 |
Follow-up Comment #2, bug #56410 (project findutils):
The -L option affects the way that "find" treats symbolic links. But it has
no effect on the "file" program run by -exec. {} expands to the file that
"find" is currently considering, which is in this case is a symbolic link.
Tests made by find on properties will reflect the properties of the file
pointed to by find, but {} will expand to the name of the symbolic link (and
not its target).
Here is a shell script which I think demonstrates the point you were trying to
make, but without requiring root privileges.
#!/bin/bash
set -u
if ! top="$(mktemp -d)"; then
echo "Failed to create a temporary directory" >&2
exit 1
fi
(
set -eCux
cd "${top}"
mkdir temp temp2
echo "test" >| temp/file0.txt
( cd temp2 && ln -s ../temp/file0.txt file )
if wc -c < temp2/file >/dev/null ; then
exit 1
fi
find -L temp2/ -type f -exec file '{}' \;
)
rv=$?
ls -ltR "${top}"
rm -rf "${top}"
exit $rv
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?56410>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #56410] find -L doesn't follow symlinks outside the specified search scope, анонимный, 2019/05/29
- [bug #56410] find -L doesn't follow symlinks outside the specified search scope, James Youngman, 2019/05/29
- [bug #56410] find -L doesn't follow symlinks outside the specified search scope,
James Youngman <=
- [bug #56410] find -L doesn't follow symlinks outside the specified search scope, James Youngman, 2019/05/29
- [bug #56410] find -L doesn't follow symlinks outside the specified search scope, James Youngman, 2019/05/29
- [bug #56410] find -L doesn't follow symlinks outside the specified search scope, James Youngman, 2019/05/29
- [bug #56410] find -L doesn't follow symlinks outside the specified search scope, Arthur Pogosyan, 2019/05/29
- [bug #56410] find -L doesn't follow symlinks outside the specified search scope, James Youngman, 2019/05/29
- [bug #56410] find -L doesn't follow symlinks outside the specified search scope, Arthur Pogosyan, 2019/05/30
- [bug #56410] find -L doesn't follow symlinks outside the specified search scope, James Youngman, 2019/05/30
- [bug #56410] find -L doesn't follow symlinks outside the specified search scope, Arthur Pogosyan, 2019/05/30