find -delete broken, or just used improperly?
Kurt Lidl
lidl at pix.net
Mon May 20 19:23:23 UTC 2013
OK, maybe I'm missing something obvious, but...
find(1) says:
-delete
Delete found files and/or directories. Always returns true.
This executes from the current working directory as find recurses
down the tree. It will not attempt to delete a filename with a
``/'' character in its pathname relative to ``.'' for security
reasons. Depth-first traversal processing is implied by this
option. Following symlinks is incompatible with this option.
However, it fails even when the path is absolute:
bhyve9# mkdir /tmp/foo
bhyve9# find /tmp/foo -empty -delete
find: -delete: /tmp/foo: relative path potentially not safe
Shouldn't this work?
I ran into this during a build of stable/9 with WITHOUT_SHAREDOCS
set, which ultimately triggers this bit of /usr/src/Makefile.inc1:
.for dist in ${EXTRA_DISTRIBUTIONS}
find ${DESTDIR}/${DISTDIR}/${dist} -empty -delete
.endfor
The actual observed failure is this:
===> etc/sendmail (distribute)
cd /usr/src/etc/sendmail; make install -DNO_SUBDIR DESTDIR=/usr/obj/usr/src/release/dist/base SHARED=copies
find //usr/obj/usr/src/release/dist/doc -empty -delete
find: -delete: //usr/obj/usr/src/release/dist/doc: relative path potentially not safe
*** [distributeworld] Error code 1
Stop in /usr/src.
*** [distributeworld] Error code 1
Stop in /usr/src.
*** [base.txz] Error code 1
Stop in /usr/src/release.
*** [release] Error code 1
Stop in /usr/src/release.
Thanks for any insight.
-Kurt
More information about the freebsd-hackers
mailing list