Date: Wed, 16 May 2007 10:18:40 +0200 From: des@des.no (Dag-Erling =?utf-8?Q?Sm=C3=B8rgrav?=) To: Alexander Leidinger <Alexander@Leidinger.net> Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src Makefile.inc1 Message-ID: <86mz052nbz.fsf@dwp.des.no> In-Reply-To: <20070516094330.dkp2e41vdc0w8kg8@webmail.leidinger.net> (Alexander Leidinger's message of "Wed\, 16 May 2007 09\:43\:30 %2B0200") References: <200705131815.l4DIFop9026874@repoman.freebsd.org> <20070514154040.0lofzrgm8kskgog4@webmail.leidinger.net> <86wszbqxbz.fsf@dwp.des.no> <20070514172938.5v4yi78kisokk84s@webmail.leidinger.net> <861whiy5ra.fsf@dwp.des.no> <20070516094330.dkp2e41vdc0w8kg8@webmail.leidinger.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Alexander Leidinger <Alexander@Leidinger.net> writes:
> What about another idea: removing the chflags all together and let the
> removal fail (with a message that the file may be protected with schg
> and it should be removed with chglags). This way only a message
> appears when the rm fails (saying no to the removal question of rm is
> not a failure/exit!=3D0).
OK with me.
BTW, testing for the schg flag is not straightforward, but doable:
flags=3D$(stat -f '%f' ./$${file})
if [ $((flags & 131072)) -eq 131072 ] ; then
# schg is set
fi
Another possibility is
if (ls -lo ./$${file} | grep -qw schg) ; then
# schg is set
fi
but it's not 100% foolproof, as the file name itself or the owner /
group might conceivably contain the word "schg".
DES
--=20
Dag-Erling Sm=C3=B8rgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86mz052nbz.fsf>
