Skip Menu |

This queue is for tickets about the IPC-Cmd CPAN distribution.

Report information
The Basics
Id: 74470
Status: resolved
Worked: 30 min
Priority: 0/
Queue: IPC-Cmd

People
Owner: BINGOS [...] cpan.org
Requestors: hwatattama [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.72
Fixed in: (no value)



Subject: Empty string cannot be passed to command
For example, here is a command that accepts an option 'A' receiving empty string: $ command --A "" arg1 arg2 And we try to run this command via IPC::Cmd: IPC::Cmd::run( command => ["command", "--A", "", "arg1", "arg2"]); Then, the following command-line are generated because IPC::Cmd strips any empty elements. $ command --A arg1 arg2
Subject: Cmd.pm.patch
--- Cmd.pm.orig 2012-01-28 18:06:59.000000000 +0900 +++ Cmd.pm 2012-01-28 18:07:12.000000000 +0900 @@ -1072,7 +1072,7 @@ $cmd = _quote_args_vms( $cmd ) if IS_VMS; ### strip any empty elements from $cmd if present - $cmd = [ grep { defined && length } @$cmd ] if ref $cmd; + $cmd = [ grep { defined } @$cmd ] if ref $cmd; my $pp_cmd = (ref $cmd ? "@$cmd" : $cmd); print loc("Running [%1]...\n", $pp_cmd ) if $verbose;
I did apply this and released as 0.74, but it caused too many downstream failures so I reverted the behaviour and added an option to disable the argument stripping, which was released as version 0.76 $IPC::Cmd::ALLOW_NULL_ARGS This variable controls whether run will remove any empty/null arguments it finds in command arguments. Defaults to false, so it will remove null arguments. Set to true to allow them. Many thanks.