Skip Menu |

This queue is for tickets about the Shell-Source CPAN distribution.

Report information
The Basics
Id: 11823
Status: new
Priority: 0/
Queue: Shell-Source

People
Owner: Nobody in particular
Requestors: cpan [...] kevin.lebleu.info
Cc:
AdminCc:

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



Subject: Patch to make Shell::Source work on Cygwin
When I tried to install Shell-Source-0.01 using CPAN under Cygwin (uname -a output: CYGWIN_NT-5.1 WI1WS000861 1.5.12(0.116/4/2) 2004-11-10 08:34 i686 unknown unknown Cygwin), the test for output failed. This happens because Cygwin creates two environment variables named !:: and !C:. Per email at http://www.cygwin.com/ml/cygwin/2004-04/msg00060.html these variables are valid per POSIX, even though Bash does not let you set or use variables like that. The regex used to find environment variables in the the output only allows for word characters in environment variable names. The attached patch corrects the regex to match any non-space, non-equals character as a legal character in an environment variable name. This still doesn't handle spaces in environment variables, but at least it comes closer. I believe the optimal fix would be to add an echo statement between running the script and running env that outputs a long special string to separate output of the script from the environment. The reason I did not implement it this way is because it would change the interface to the script, as what someone needs to pass for the run parameter on unknown scripts would have to be changed.
--- Source.pm.01 2005-03-09 11:32:24.835413300 -0600 +++ Source.pm 2005-03-09 11:32:40.458657300 -0600 @@ -62,7 +62,7 @@ my $env = 0; # for control of multi-line variables while (defined(my $line = <$fh>)) { - if ($line =~ /^(\w+)=(.*)$/) + if ($line =~ /^([^\s=]+)=(.*)$/) { $env = 1; if ((!defined $ENV{$1} || $ENV{$1} ne $2) &&