Re: bsdutils: /usr/bin/script doesn't wait for command to finish before exiting



On Thu Jul 31 19:56:18 BST 2008, Smoot Carl-Mitchell wrote:

On Mon, 2008-07-28 at 18:58 -0400, Fergus Henderson wrote:
* Package: bsdutils
*>* Version: 1:2.12r-4ubuntu6.1
*>* Severity: normal
*>* Tags: patch
*>*
*>*
*>* The script command fails to wait for the command that it is executing to finish.
*>* For example, the command
*>*
*>* /usr/bin/script -c "sleep 1; echo foo" < /dev/null; echo bar
*>*
*>* produces the output
*>*
*>* Script started, file is typescript
*>* Script done, file is typescript
*>* bar
*>* foo
*
It is the I/O redirection from /dev/null which is the culprit. Without
it the commands run in sequence correctly. With the /dev/null redirect,
it appears the subshell forked by 'script' runs in the background from
the parent shell.

The _culprit_ is the buggy code in script.c, for which I provided a patch
(see my original email at <
https://lists.ubuntu.com/archives/ubuntu-users/2008-July/154664.html>).

You're right that the bug only shows up if stdin is redirected, but that
does not mean that the I/O redirection is the "culprit", just that the I/O
redirection happens to trigger the bug.

Now, if only someone would actually apply my patch! The bsdutils package
that contains /usr/bin/script appears to be effectively ownerless. I have
no idea who to send the patch to.
--
Fergus Henderson <fergus@xxxxxxxxxx>
--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users


Relevant Pages

  • Re: Editable input from the console windows
    ... stdin, stdout, and stderror in relationship to pipe commands. ... I understand the fundamentals behind redirection. ... The exec command adds to the confusion as well. ... I learning the syntax and build upon a previously working script. ...
    (comp.unix.shell)
  • Re: Reg Crontab
    ... Instead of a redirection add an echo command to the script. ... Best thing is to handle the redirection in the script; that way you can put a timestamp into the log file name. ...
    (AIX-L)
  • Re: Scripting
    ... > understandig the redirection of the streams. ... > shell which started the script? ... (or, if you don't care for portability, the command above is the same as: ... -- Thomas Adam ...
    (Debian-User)
  • Re: edit and write multiple files with ed/ed/vi script
    ... IO redirection makes it into the ed clauses then it's time to consider ... A pipe specifies that the next command in line gets its ... is feeding it to the command in the pipe, ... Realistically you'll need to put the ed command in a script and have ...
    (comp.unix.admin)
  • Re: Problems trying to configure Linux laptop to print to Windows XP shared printer
    ... map to guest = Never ... check password script = ... enumports command = ... ldap delete dn = No ...
    (comp.os.linux.setup)