[xen-tools-discuss] Re: [xen-shell] [PATCH] fix open command for xm list
Ward Vandewege
ward at pong.be
Mon May 11 16:27:38 CEST 2009
Looks like this list strips pure text attachments. Tsk tsk, bad list.
Here's the patch, inline.
Thanks,
Ward.
--- bin/xen-shell 2009-05-10 20:56:25.000000000 -0400
+++ /usr/bin/xen-shell 2009-05-10 23:03:42.000000000 -0400
@@ -1310,10 +1310,10 @@
my ($name) = (@_);
my $running = 0;
- my @cmd = ( 'sudo', 'xm', 'list', $name, '|' );
+ my @cmd = ( 'sudo', 'xm', 'list', $name );
# Lovely taint.. making this nice and hard for us.
- my $pid = open( CMD, @cmd );
+ my $pid = open( CMD, '-|', @cmd );
if ( defined($pid) )
{
while (<CMD>)
@@ -2190,9 +2190,9 @@
print "Guest : Running\n";
my $seconds = "";
- my @cmd = ( 'sudo', 'xm', 'list', '--long', $ACTIVE, '|' );
+ my @cmd = ( 'sudo', 'xm', 'list', '--long', $ACTIVE );
- open( RUNNING, @cmd );
+ open( RUNNING, '-|', @cmd );
foreach my $line (<RUNNING>)
{
if ( $line =~ /\(up_time[ \t]*([0-9]+)/ )
On Sun, May 10, 2009 at 11:09:14PM -0400, Ward Vandewege wrote:
> Hi all,
> It seems the open commands used in isRunning and do_status don't work as
> expected on recent versions of perl. This was observed on
>
> This is perl, v5.8.7 built for x86_64-linux-gnu-thread-multi
>
> as well as
>
> This is perl, v5.8.8 built for x86_64-linux-gnu-thread-multi
>
> on Ubuntu Dapper and Hardy, respectively.
>
> Specifically, the problem appears to be with the pipe passed as the last
> argument in the @cmd variable.
>
> Perl doesn't seem to like that pipe there ('Bad command or file name' error),
> which results in the 'status' command always returning 'Shutdown', regardless
> of the real status of the guest.
>
> The perlfunction man page on the 'open' command suggests
>
> For three or more arguments if MODE is '|-', the filename is interpreted as
> a command to which output is to be piped, and if MODE is '-|', the filename
> is interpreted as a command which pipes output to us.
>
> which works when used in the arguments to the open call but not when simply
> added to the front of @cmd (tainting?). The attached patch implements the fix
> to make the status command work.
>
> Thanks,
> Ward.
>
> --
> Pong.be -( "If you think penguins are fat and waddle, you have )-
> Virtual hosting -( never been attacked by one running at you in excess of )-
> http://pong.be -( 100 MPH." -- Linus )-
> GnuPG public key: http://pgp.mit.edu
>
>
>
>
>
> !DSPAM:4a07970d4042119816014!
>
Ward Vandewege.
--
Pong.be -( "HTML needs a rant tag" - Alan Cox )-
Virtual hosting -( )-
http://pong.be -( )-
GnuPG public key: http://pgp.mit.edu
More information about the xen-tools-discuss
mailing list