Bug#167185: tetex-bin: postrm script fails when homedirectory of user calling the script is non-existant
Atsuhito Kohda <kohda@pm.tokushima-u.ac.jp> writes:
> Date: Wed, 30 Oct 2002 23:39:49 -0500
>
> > This is where the script fails:
> > if [ -d /var/cache/fonts ]; then
> > cd /var/cache/fonts
> > rm -rf source tfm pk
> > cd
> > ^^ fails because the user has no homedir
> > rmdir /var/cache/fonts 2>/dev/null || true
> > fi
> > ;;
> >
> > I suggest you change that to cd / or something else that definetely exists.
> > I aggree its pretty uncommon for the home directory of the user who calls
> > the postrm script not to exist, but maybe for buildd's its more common.
>
> Well, is "cd /var/cache" okay ?
why not use:
if [ -d /var/cache/fonts ]; then
pushd /var/cache/fonts
rm -rf source tfm pk
popd
rmdir /var/cache/fonts 2>/dev/null || true
fi
pushd:
Adds a directory to the top of the directory stack, or rotates the
stack, making the new top of the stack the current working directory.
popd:
Removes entries from the directory stack. With no arguments,
removes the top directory from the stack, and cd's to the new top
directory.
pushd/popd are builtins of bash.
Bye
Christian
--
Dipl.-Ing. Christian Leutloff, Aachen, Germany christian@leutloff.de
http://www.oche.de/~leutloff/ leutloff@debian.org
Debian GNU/Linux - http://www.de.debian.org/
taz muss sein. abomail@taz.de
Reply to: