[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>:
> Hilmar Preusse <hille42@web.de> schrieb:
> 
> > On 04.11.03 Michel Casabona (michel.casabona@free.fr) wrote:
> >> IFS is changed by the postinst script not to include "newline"
> >> before texconfig is called. bash and dash seem to behave
> >> differently on word expansion wrt IFS (dunno which one is posixly
> >> correct ;)
> >
> > Anybody able to reproduce that?
> 
> No.
> 
> I did the following: In an up-to-date sid pbuilder environment I
> installed the ash and dash packages, pointed the /bin/sh symlink to dash
> and then apt-get install'ed tetex-bin, with all the dependencies.
> 
> Then I purged only tetex-bin, pointed /bin/sh to ash (which, of course,
> itself points to dash) and installed tetex-bin again.
> 
> In both cases, there were no errors in postinst, and initex was run.
> 
> Michel, you have indicated a suspect line, but as far as I see this line
> is in texconfig, and you said that texconfig does the same change to IFS
> that you needed in postinst to get around the problem. Therefore I
> don't quite understand. Could you please post code that works and code
> that doesn't, ideally in a script that can be run separately from
> package installation?
> 

Thanks for your answers.
I've attached two test scripts, t1 and t2. Code is basically an extract
of tetex-bin.postinst and texconfig. Run t1 that in turn call t2

In short, it seems that bash resets IFS to the default value in the
called script, when dash propagate the value set in the caller.

BTW, the original ash has no problem (tested on stable). I missed the
fact that ash is now a symlink to dash.

Here is a typescript of running the test scripts (on unstable):

me@agenor:~/tmp/dashtex$ ls -al /bin/sh
lrwxrwxrwx    1 root     root            4 2003-11-17 13:01 /bin/sh -> dash
me@agenor:~/tmp/dashtex$ ./t1
IFS is:
00000000  49 46 53 3d 27 20 09 0a                           |IFS=' ..|
00000008                 -------- IFS is space/tab/newline
Calling t2. IFS is now:
IFS=' ,'                 ------ space/comma as in postinst
in t2 ... IFS is:
00000000  49 46 53 3d 27 20 2c 27  0a                       |IFS=' ,'.|
00000009                 ----   still space/comma in t2
the following environment variables were found:

VAR1 = $
VAR1
 VAR3
VAR4
 =
VAR4

Error - they should have been unset
me@agenor:~/tmp/dashtex$ LANG=C sudo dpkg-reconfigure dash --terse -freadline
|-) Install dash as /bin/sh? n
Removing `diversion of /bin/sh to /bin/sh.distrib by dash'
Removing `diversion of /usr/share/man/man1/sh.1.gz to
/usr/share/man/man1/sh.distrib.1.gz
 by dash'
me@agenor:~/tmp/dashtex$ ls -al /bin/sh
lrwxrwxrwx    1 root     root            4 2003-11-17 13:01 /bin/sh -> bash
me@agenor:~/tmp/dashtex$ ./t1
IFS is:
00000000  49 46 53 3d 27 20 09 0a                           |IFS=' ..|
00000008                 -------- IFS is space/tab/newline
Calling t2. IFS is now:
IFS=' ,'                 ------ space/comma as in postinst
in t2 ... IFS is:
00000000  49 46 53 3d 27 20 09 0a                           |IFS=' ..|
00000008                 -------- reset to default in t2
me@agenor:~/tmp/dashtex$

I've just checked that the problem still exists here on two machines,
running testing or unstable.

Frank, sorry if I was unclear. The patch to postinst was meant to save
and restore IFS when it needs to be changed. I took the idea from the
texconfig script (see functions show_path() or setup_mt())

It seems to me that bash behaviour is the intended one (if I read bash
source code correctly), although not mentionned in the doc.
It doesn't mean that it's more correct than dash though.
Actually, it is implementation dependent according to this doc:

http://www.opengroup.org/onlinepubs/009696699/utilities/xcu_chap02.html#tag_02_05_03

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 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.

Thanks
-- 
Michel Casabona

Attachment: t1
Description: Binary data

Attachment: t2
Description: Binary data


Reply to: