Re: [perl #75530] Buggy parsing of script arguments in windows
[email protected] (demerphq)
| Newsgroups | perl.perl5.porters |
|---|---|
| Message-ID | <[email protected]> |
On 3 June 2010 07:50, AlexandrFedorov <[email protected]> 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 [email protected], > 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/"