Re: Bug#20241: Timezones should depend on debian-utils
Hi,
if [ -x /usr/bin/tempfile ] ; then
TIMEZONES=$(tempfile)
else
TIMEZONES=/etc/timezone.$$
if [ -e $TIMEZONES ]; then
## either abort
# echo >&2 "Temp File $TIMEZONES already exists"
# exit 1
## or delete the file and go ahead
if [ -d $TIMEZONES ]; then
echo >&2 "$TIMEZONES is a directory!!"
# abort, or remove the directory.
exit 1
# rm -rf $TIMEZONES
else
rm -f $TIMEZONES
fi
fi
# hopefully, our umask is set so that only the owner can write to
# this file, and that this may not be replaced by a symlink (sticky
# flag n /tmp required)
touch $TIMEZONES
fi
There. That may well be paranoid enough. season to either
abort or remove the offending dir/file as you will. The non-tempfile
solution is not quite as safe (since a link maybe created ater we
test for existence and before we create an empty file, or after we
remove and before we create the empty file, but those windows are
relatively small.
manoj
--
The author should gaze at Noah, and ... learn, as they did in the
Ark, to crowd a great deal of matter into a very small
compass. Sydney, Smith, Edinburgh Review
Manoj Srivastava <srivasta@acm.org> <http://www.datasync.com/%7Esrivasta/>
Key C7261095 fingerprint = CB D9 F4 12 68 07 E4 05 CC 2D 27 12 1D F5 E8 6E
--
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: