Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: /usr/bin/script annoyance



In message <19980916110804.A19057@xxxxxxxxxxxx>, Dan Nelson writes:
>In the last episode (Sep 16), Ken Lareau said:
>> Thanks for the response; however, a more insidious problem has reared
>> it's head: both the above and my former method (modified to zsh, of
>> course) does not work, since the forking of a subshell doesn't reread
>> the startup scripts when 'script' is executed.
>> 
>> I have been unsuccessful in figuring out why this seems to happen, as
>> the documentation I've read doesn't give a clue... anyone have any
>> ideas on how to get around this little problem?
>
>I've noticed this too.  zsh-3.0.5 does not source _any_ startup scripts
>inside a 'script' run on the following OS's: FreeBSD 2.2, SCO 5.0.4,
>OSF/1 4.0, SunOS 4.1.  It _does_ source startup scripts under Linux (RH
>4.2).

I happen to be using zsh 3.1.4, actually, but I'm sure the code is
similar enough in this case...

>Oh weird.  I just looked at the source to typescript under FreeBSD, and
>it reads in part:
>
>	char *shell;
>
>	shell = getenv("SHELL");
>	if (shell == NULL)
>		shell = _PATH_BSHELL;
>
>	execl(shell, "sh", "-i", NULL);
>
>So argv[0] is "sh", and it's entering /bin/sh compatibility mode.  This
>is almost _exactly_ the problem Paul Lew reported to the zsh list on
>Aug 11 (mailinglist article archive/latest/4298).  Both Bart Schaefer
>and zefram posted ugly workarounds :)

Hmm... I did a 'truss' on the 'script <file>' command and dumped it to
a file, and here's what I see when it calls the shell:

  execve("/software/bin/zsh", 0xEFFFF918, 0xEFFFFA60)  argc = 2

Of course I have no idea what the 2nd and 3rd arguments are to the
execve command, but it would seem to me that it should start up as
a regular zsh shell, no?  (Please tell me if I'm missing something
blatently obvious here.)


Ken Lareau
elessar@xxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author