develooper Front page | perl.perl5.porters | Postings from August 2013

[perl #119419] system LIST on Win32 doesn't quote accurately

Thread Previous
From:
Graham Knop
Date:
August 22, 2013 19:46
Subject:
[perl #119419] system LIST on Win32 doesn't quote accurately
Message ID:
rt-3.6.HEAD-1873-1377158269-371.119419-75-0@perl.org
# New Ticket Created by  Graham Knop 
# Please include the string:  [perl #119419]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org:443/rt3/Ticket/Display.html?id=119419 >


This is a bug report for perl from haarg@haarg.org,
generated with the help of perlbug 1.39 running under perl 5.18.0.


-----------------------------------------------------------------

Program arguments on Win32 are passed as a single string, which is
then parsed by the program on startup.  While it's possible for a
program to do arbitrary parsing of the command line string, almost
all programs either use the routine provided by the MS standard C
library, or a routine with compatible rules.

For system LIST to work, perl must assemble the list into a single
string.  But the strings it generates aren't always compatible with
the standard parsing rules.  Attached is a test script that shows
multiple strings that aren't quoted properly.

cmd.exe uses a different set of parsing rules from the C runtime.  It
isn't possible to consistently generate strings that will be handled
the same by cmd.exe and the standard C routine.  This can be
problematic because in some cases, perl will re-try failed system
calls using cmd.exe.

I have a module on CPAN, Win32::ShellQuote, that will quote things
properly for Win32.

-----------------------------------------------------------------
---
Flags:
    category=core
    severity=low
---
Site configuration information for perl 5.18.0:

Configured by gknop at Sat May 18 11:37:06 EDT 2013.

Summary of my perl5 (revision 5 version 18 subversion 0) configuration:
  Commit id: a9acda3b5f74585852a57b51b724804ac586cb0b
  Platform:
    osname=darwin, osvers=12.3.0, archname=darwin-2level
    uname='darwin cuneus 12.3.0 darwin kernel version 12.3.0: sun jan
6 22:37:10 pst 2013; root:xnu-2050.22.13~1release_x86_64 x86_64 '
    config_args='-des -Dusedevel -Uversiononly
-Dprefix=/Users/gknop/perl5/perls/v5.18.0'
    hint=recommended, useposix=true, d_sigaction=define
    useithreads=undef, usemultiplicity=undef
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=define, use64bitall=define, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-fno-common -DPERL_DARWIN -fno-strict-aliasing
-pipe -fstack-protector -I/usr/local/include -I/opt/local/include',
    optimize='-O3',
    cppflags='-fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe
-fstack-protector -I/usr/local/include -I/opt/local/include'
    ccversion='', gccversion='4.2.1 Compatible Apple LLVM 4.2
(clang-425.0.28)', gccosandvers=''
    intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='
-fstack-protector -L/usr/local/lib -L/opt/local/lib'
    libpth=/usr/local/lib /opt/local/lib /usr/lib
    libs=-lgdbm -ldbm -ldb -ldl -lm -lutil -lc
    perllibs=-ldl -lm -lutil -lc
    libc=, so=dylib, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup
-L/usr/local/lib -L/opt/local/lib -fstack-protector'

Locally applied patches:


---
@INC for perl 5.18.0:
    /Users/gknop/perl5/perls/v5.18.0/lib/site_perl/5.18.0/darwin-2level
    /Users/gknop/perl5/perls/v5.18.0/lib/site_perl/5.18.0
    /Users/gknop/perl5/perls/v5.18.0/lib/5.18.0/darwin-2level
    /Users/gknop/perl5/perls/v5.18.0/lib/5.18.0
    .

---
Environment for perl 5.18.0:
    DYLD_LIBRARY_PATH (unset)
    HOME=/Users/gknop
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/Users/gknop/bin:/Users/gknop/perl5/perls/active/bin:/opt/local/bin:/opt/X11/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/bash

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About