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

Bug#219156: tetex-bin: postinst script fails to run texconfig under dash



Selon Frank Küster <frank@kuesterei.ch>:

> Hm, reading the link you provided it seems to me that IFS should be
> marked for export in any case, together with LANG, LC_*, HOME and
> friends. As far as I understood it is only up to the implementation to
> decide wether it should ignore it even if it _is_ set. However, in my
> bash on woody
> 
> $ export | grep IFS
> $ export | egrep 'HOME|LANG|LC_' | wc -l
>       5

I seemed to understand that the shell marks for export the variables that 
were initialized from the environment. ie, IFS exists when the shell starts,
then it's marked for export (and reset to default value in case of bash as
we found). IFS doesn't exist ? Then the shell uses the default value, put
it or not the environment, but does not mark it exportable.
That's consistent with what we have noticed.

> dash in my pbuilder sid does the same, how is it with your dash?

Same as my bash: IFS is set and marked for export

> > So in the end, I believe that the problem is with texconfig that should
> > not rely on the current value of IFS when it starts.
> 
> I agree. Both behaviors are allowed, so a script should not rely on
> that. A patch is really simple, it seems, I attach it below.

Thanks for the patch to postinst. It will solve the bug. But as I said,
texconfig is not cautious enough with what is found in his environment
(it checks "envvars", but do not set "IFS" !)
 
> > I don't understand why you couldn't reproduce the problem, so it may be
> > caused by something special to my configs but I fail to see what.

Ok, I think I've caught the suspect. Looking in /proc/$PPID/environ and
going back through the parents, I noticed that IFS is marked exportable
by Eterm.

~$ ps $PPID
  PID TTY      STAT   TIME COMMAND
25546 ?        S      0:00 /usr/bin/Eterm
~$ set|grep IFS
IFS=$' \t\n'
~$export|grep IFS
declare -x IFS="        \
~$ 

While if I use rxvt:

~$ ps $PPID
  PID TTY      STAT   TIME COMMAND
25609 ?        S      0:00 rxvt
~$ set|grep IFS
IFS=$' \t\n'
~$ export|grep IFS
~$ 

Actually Eterm sets IFS in startup.c line 84:
    /* Security enhancements -- mej */
    putenv("IFS= \t\n");
then the shell spawn find the variable in the environment thus marks 
it for export as dictated by the specification.
This was patched done for security reasons fours years ago, so I don't 
expect it will be changed ... IMHO dash should rather behave like bash 
and ignore IFS (for security reasons too).

Thanks for your time and support.
-- 
Michel Casabona



Reply to: