NetBSD-Bugs archive

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

misc/46546: powerd script fails due to spurious environment variable



>Number:         46546
>Category:       misc
>Synopsis:       powerd script fails due to environment variable passed from rc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 05 16:25:00 +0000 2012
>Originator:     fukumoto%imasy.or.jp@localhost
>Release:        NetBSD 6.0_BETA2
>Organization:
        
>Environment:
        
        
System: NetBSD kestrel 6.0_BETA2 NetBSD 6.0_BETA2 (GENERIC) #7: Wed May 23 
23:37:40 JST 2012 fukumoto@kestrel:/u/src/sys/arch/amd64/compile/obj/GENERIC 
amd64
Architecture: x86_64
Machine: amd64
>Description:
        As I reported in 
http://mail-index.netbsd.org/netbsd-users/2012/06/03/msg010808.html
        powerd(8) script fails due to the environment variable passed from 
rc(8).

        When booting the system, rc_real_work() in /etc/rc defines the
        environment variable $_rc_postprocessor_fd, and spawns daemons
        including powerd(8).  Later, when sleep button is pressed,
        powerd(8) calls /etc/powerd/scripts/sleep_button, which then
        calls /etc/rc.d/network.  It includes /etc/rc.subr, which
        overrides the normal "echo" with its own echo() shell
        function.  Thus "echo -n" inside network script calls
        _flush_rc_output(), which calls print_rc_metadata(), which,
        since $_rc_postprocessor_fd is defined, tries to transmit a
        metadata to postprocessor through $_rc_postprocessor_fd, but
        the postprocessor doesn't exist anymore when powerd script is
        executed, and the network script fails for SIGPIPE.

>How-To-Repeat:
        Set powerd=YES in /etc/rc.conf and restart the system.  Press
        the sleep button to sleep, then resume the system and observe
        /etc/rc.d/network exits midway.

>Fix:
        Either run_rc_command or powerd should clean-up the
        environment variables before spawning subprocesses.

>Unformatted:
        
        


Home | Main Index | Thread Index | Old Index