Closed p5pRT closed 14 years ago
There is a problem with parsing command line arguments in Perl in windows:
for example this command in cmd.exe:
perl -E "say join qq(\n)\,@ARGV" "123 234\" 123
resulting:
123 234" 123
but it must be:
123 234\ 123
Why it's important? Because filepath separator in windows is "\" and i can't use long filepaths or UNC in arguments of scripts (for example " \\server\share\some \<file://server/share/some> folder\")
On 3 June 2010 07:50\, AlexandrFedorov \perlbug\-followup@​perl\.org wrote:
# New Ticket Created by AlexandrFedorov # Please include the string: [perl #75530] # in the subject line of all future correspondence about this issue. # \<URL: http://rt.perl.org/rt3/Ticket/Display.html?id=75530 >
This is a bug report for perl from alexandrfedorov@gmail.com\, generated with the help of perlbug 1.39 running under perl 5.12.0.
----------------------------------------------------------------- [Please describe your issue here]
There is a problem with parsing command line arguments in Perl in windows:
for example this command in cmd.exe:
perl -E "say join qq(\n)\,@ARGV" "123 234\" 123
resulting:
123 234" 123
but it must be:
123 234\ 123
Why it's important? Because filepath separator in windows is "\" and i can't use long filepaths or UNC in arguments of scripts (for example " \\server\share\some \<file://server/share/some> folder\")
This isnt a bug in perl. Perl doesnt parse the command line cmd.exe does. And microsoft has never been forthcoming of the actual rules involved\, and despite much time wasted by many people\, including me\, nobody really knows *exactly* what the rules are. Probably because there arent any rules\, just a nasty mess of exceptions.
Anyway\, there are workarounds. You could for instance do either of these:
perl -E "say join qq(\n)\,@ARGV" 123" "234\ 123 perl -E "say join qq(\n)\,@ARGV" "123 234"\ 123
But a much simpler solution is to not use backslashes for path separators and use forward slashes. Perl\, and IIRC the underlying windows API calls that Perl uses work just fine with forward slashes.
Anyway\, IMO this is not a bug in Perl\, and the ticket should be closed.
Yves
-- perl -Mre=debug -e "/just|another|perl|hacker/"
The RT System itself - Status changed from 'new' to 'open'
Hello\, you were right! It's not a Perl problem\, it's gcc problem i tried such code:
#include \
resulting:
a.exe "a a" you have 2 arguments a.exe "a a" a you have 3 arguments a.exe "a a\" a you have 2 arguments
P.S. changing \ to / is a very bad workaround\, because newbies is hard to understand and hard to use this. I'll try to fix this problem in gcc.
alexandrfedorov@gmail.com - Status changed from 'open' to 'resolved'
@iabyn - Status changed from 'resolved' to 'rejected'
Migrated from rt.perl.org#75530 (status was 'rejected')
Searchable as RT75530$