BusyBox Bug and Patch Tracking
BusyBox
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000973 [BusyBox] Other minor always 07-27-06 06:12 02-14-08 09:14
Reporter Keith Young View Status public  
Assigned To BusyBox
Priority normal Resolution fixed  
Status closed   Product Version 1.01
Summary 0000973: msh grave substitution does not work if stdin/stdout are not already open
Description I tried using busybox sh as the script processor /sbin/hotplug (Linux 2.6.16)
Substitutions such as:
d=`date`
return empty.
Additional Information Using strace I could see what was happening. The hotplug executable is invoked
from the kernel (somehow) and has no stdin/stdout attached. Consequently when
the pipe is created for communication with the sub-shell it has fd's [0,1].
After the vfork() (see msh.c, grave()) the child process does:

    dup2(pf[1], 1);
    closepipe(pf);

Fd 1 gets successfully duplicated to 1 and then closed. Hence no more output is possible on stdout from the sub-shell.

A fix that works for me is:

    if (pf[1] != 1)
    {
        dup2(pf[1], 1);
        closepipe(pf);
    }
    else
        close(pf[0]);
Attached Files

- Relationships

- Notes
(0004744)
vda
02-14-08 09:14

Fixed sometime ago in svn:

        xmove_fd(pf[1], 1);
        if (pf[0] != 1)
                close(pf[0]);
 

- Issue History
Date Modified Username Field Change
07-27-06 06:12 Keith Young New Issue
07-27-06 06:12 Keith Young Status new => assigned
07-27-06 06:12 Keith Young Assigned To  => BusyBox
02-14-08 09:14 vda Status assigned => closed
02-14-08 09:14 vda Note Added: 0004744
02-14-08 09:14 vda Resolution open => fixed


Copyright © 2000 - 2006 Mantis Group
Powered by Mantis Bugtracker