[sf-perl] [ot?] no pipe for you

Steve Fink sphink at gmail.com
Tue Sep 18 16:34:41 PDT 2012

On Tue, Sep 18, 2012 at 4:20 PM, Joseph Brenner <doom at kzsu.stanford.edu> wrote:
> Hm.  Never heard of this one...
> David Alban <extasia at extasia.org> wrote:
>> a user said that one of my perl library routines that does sudo
>> commands was hanging.  the user was using the routine to restart a
>> system service (i.e., invoke an /etc/init.d script via /sbin/service).
>> i started poking and it was hanging in my routine at the line:
>>   @results = qx{ $command 2>&1 };
>> we've used this routine for a few years without anything like this happening.
>> so i poke some more and found that all of these act "normally":
>>   $ sudo service foo restart
>>   $ sudo service foo stop
>>   $ sudo service foo start
>>   $ sudo bash -xv /etc/init.d/foo stop 2>&1 | tee junk
>> but...  these do their actions successfully (start and restart) and
>> then subsequently fail to return the command prompt (i.e., hang):
>>   $ sudo bash -xv /etc/init.d/foo start 2>&1 | tee junk
>>   $ sudo bash -xv /etc/init.d/foo restart 2>&1 | tee junk
>> these "hang", too:
>>   $ sudo service wso2am start 2>&1 | tee ~/junk
>>   $ sudo service wso2am restart 2>&1 | tee ~/junk
> Could there be a peculiar permissions problem on teeing to ~/junk?
> Typically you'd expect "sudo" to give you higher permissions, but if
> it's just giving you *different* permissions, you might have trouble
> accessing a location in a networked file system.  (Also seems
> unlikely).

tee isn't running under sudo in the above commands.

I would strace the hung process to see what it's blocked on. (You'll
have to sudo strace it, of course.)

More information about the SanFrancisco-pm mailing list