[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#294197: upgrading tetex creates ls-R in user homedir if sudo is used



On Fri, Mar 11, 2005 at 06:14:21PM +0100, Frank K?ster wrote:
> > >> Hm. unsetting HOME in postinst's environment could relieve you from this
> > >> inconvenience. But I don't know which other effects it could have. 
> > > In my opinon, a {post,pre}{install,remove} script should never do
> > > anything in $HOME, be it mine or root's and regardless of having called
> > > texhash/mktexlsr or not.

> Unfortunately it does not work.  There is no way to prevent mktexlsr
> from updating HOMETEXMF/ls-R if the directory exists, except if we add a
> Debian-specific option for this.  Unsetting $HOME only has the effect
> that it tries /texmf instead, which is probably even worse.

> But if we make this the default behavior, I'm sure we get other
> complaints, e.g. on systems where people want to use sudo and
> to be able to update /usr/local/share/texmf/ls-R and their
> $HOME/texmf/ls-R with the same command.

Can we not patch mktexlsr to do the following:

 test $# = 0 && {
   OIFS=$IFS; IFS=$SEP; set x `kpsewhich --show-path=ls-R 2>/dev/null`;
+  if test "`id -u`" eq 0; then NOROOTHOME=true; fi;
   shift; IFS=$OIFS
 }
 for TEXMFLS_R in "$@"; do
   # Prepend cwd if the directory was relative.
   case "$TEXMFLS_R" in
   "") continue ;;  # Strictly speaking, it is an error if this case is taken.
+  $HOME/*) if test -n "$NOROOTHOME"; then continue; fi
   /* | [A-z]:/*) ;;
   *)  TEXMFLS_R="`pwd`/$TEXMFLS_R"
   esac

In this way, the situations where $HOME/texmf/ls-R file will be
touched are if:
(i)  mktexlsr is being run by a non-root user
(ii) mktexlsr is being run by root with an explicit list of
     directories

To me, this sounds like a good idea.

   Julian



Reply to: