Date: Mon, 20 May 2013 15:23:16 -0400 From: Kurt Lidl <lidl@pix.net> To: freebsd-hackers@freebsd.org Subject: find -delete broken, or just used improperly? Message-ID: <20130520192316.GA32531@pix.net>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130520192316.GA32531>