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/


Reply via email to