Skip Menu |
Report information
Id: 131651
Status: open
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: cowens <chas.owens [at] gmail.com>
Cc:
AdminCc:

Operating System: All
PatchStatus: HasPatch
Severity: Wishlist
Type: core
Perl Version: 5.27.2
Fixed In: (no value)

Attachments


From: "Chas. Owens" <chas.owens [...] gmail.com>
Date: Sun, 25 Jun 2017 09:47:46 +0000
To: perlbug [...] perl.org
Subject: Add -P and -N switches that use <<>> instead of readline
This is a bug report for perl from chas.owens@gmail.com,
generated with the help of perlbug 1.40 running under perl 5.27.2.


-----------------------------------------------------------------
[Please describe your issue here]


The -n and -p switches use the two argument version of open.  This is a security issue.  The <<>> operator fixes the security issue, but isn't easily available to command line user's of Perl.  This patch adds -N and -P flags that behave just like the -n and -p flags, but uses <<>> instead of readline.

It also adds a test of the interactions amongst -F, -N, -P, -a,
-n, and -p.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=wishlist
    Type=Patch
    PatchStatus=HasPatch
---
Site configuration information for perl 5.27.2:

Configured by cowens at Sat Jun 24 15:22:32 EDT 2017.

Summary of my perl5 (revision 5 version 27 subversion 2) configuration:
  Derived from: 0599cd66b4e9bae6409714e39aa0eebc67712ca7
  Platform:
    osname=darwin
    osvers=15.6.0
    archname=darwin-2level
    uname='darwin caelum.local 15.6.0 darwin kernel version 15.6.0: tue apr 11 16:00:51 pdt 2017; root:xnu-3248.60.11.5.3~1release_x86_64 x86_64 '
    config_args='-des -Dusedevel'
    hint=previous
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='cc'
    ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -DPERL_USE_SAFE_PUTENV'
    optimize='-O3'
    cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11 -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
    ccversion=''
    gccversion='4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -mmacosx-version-min=10.11 -fstack-protector-strong -L/usr/local/lib'
    libpth=/usr/local/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /usr/lib /usr/local/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /usr/lib
    libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc
    perllibs=-lpthread -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=' -mmacosx-version-min=10.11 -bundle -undefined dynamic_lookup -L/usr/local/lib -fstack-protector-strong'

Locally applied patches:
    uncommitted-changes

---
@INC for perl 5.27.2:
    lib
    /Users/cowens/src/perl
    /usr/local/lib/perl5/site_perl/5.27.2/darwin-2level
    /usr/local/lib/perl5/site_perl/5.27.2
    /usr/local/lib/perl5/5.27.2/darwin-2level
    /usr/local/lib/perl5/5.27.2

---
Environment for perl 5.27.2:
    DYLD_LIBRARY_PATH (unset)
    HOME=/Users/cowens
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/Users/cowens/flutter/bin:/Users/cowens/.plenv/shims:/Users/cowens/.plenv/bin:/Users/cowens/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/cowens/flutter/bin:/Users/cowens/.plenv/shims:/Users/cowens/.plenv/bin:/Users/cowens/bin:/usr/local/sbin
    PERL5LIB=/Users/cowens/src/perl
    PERL_BADLANG (unset)
    SHELL=/bin/bash



Message body is not shown because sender requested not to inline it.

RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 909b
On Sun, 25 Jun 2017 09:48:06 GMT, cowens wrote: Show quoted text
> This is a bug report for perl from chas.owens@gmail.com, > generated with the help of perlbug 1.40 running under perl 5.27.2. > > > ----------------------------------------------------------------- > [Please describe your issue here] > > > The -n and -p switches use the two argument version of open. This is > a > security issue. The <<>> operator fixes the security issue, but isn't > easily available to command line user's of Perl. This patch adds -N > and -P > flags that behave just like the -n and -p flags, but uses <<>> instead > of > readline. > > It also adds a test of the interactions amongst -F, -N, -P, -a, > -n, and -p. >
Since this requests a significant change, I have made the patch available for smoke-testing in the smoke-me/jkeenan/cowens/131651-P-N-switches branch. Thank you very much. -- James E Keenan (jkeenan@cpan.org)
From: Sawyer X <xsawyerx [...] gmail.com>
Date: Tue, 27 Jun 2017 14:31:25 -0700
To: perl5-porters [...] perl.org
Subject: Re: [perl #131651] Add -P and -N switches that use <<>> instead of readline
Download (untitled) / with headers
text/plain 4.9k
I think this is a good idea, but it takes two letters, and when we talk about the switches, those are highly-valued commodity. Perhaps we should provide a flag that turns on double diamond on other switches? It would be great if -E could do that, but that will likely break stuff. :/ (If -E meant "turn whatever you want on," we could have done it, but it doesn't.) On 06/25/2017 02:48 AM, Chas Owens (via RT) wrote: Show quoted text
> # New Ticket Created by "Chas Owens" > # Please include the string: [perl #131651] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=131651 > > > > This is a bug report for perl from chas.owens@gmail.com, > generated with the help of perlbug 1.40 running under perl 5.27.2. > > > ----------------------------------------------------------------- > [Please describe your issue here] > > > The -n and -p switches use the two argument version of open. This is a > security issue. The <<>> operator fixes the security issue, but isn't > easily available to command line user's of Perl. This patch adds -N and -P > flags that behave just like the -n and -p flags, but uses <<>> instead of > readline. > > It also adds a test of the interactions amongst -F, -N, -P, -a, > -n, and -p. > > [Please do not change anything below this line] > ----------------------------------------------------------------- > --- > Flags: > category=core > severity=wishlist > Type=Patch > PatchStatus=HasPatch > --- > Site configuration information for perl 5.27.2: > > Configured by cowens at Sat Jun 24 15:22:32 EDT 2017. > > Summary of my perl5 (revision 5 version 27 subversion 2) configuration: > Derived from: 0599cd66b4e9bae6409714e39aa0eebc67712ca7 > Platform: > osname=darwin > osvers=15.6.0 > archname=darwin-2level > uname='darwin caelum.local 15.6.0 darwin kernel version 15.6.0: tue apr > 11 16:00:51 pdt 2017; root:xnu-3248.60.11.5.3~1release_x86_64 x86_64 ' > config_args='-des -Dusedevel' > hint=previous > useposix=true > d_sigaction=define > useithreads=undef > usemultiplicity=undef > use64bitint=define > use64bitall=define > uselongdouble=undef > usemymalloc=n > default_inc_excludes_dot=define > bincompat5005=undef > Compiler: > cc='cc' > ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11 > -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include > -DPERL_USE_SAFE_PUTENV' > optimize='-O3' > cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11 > -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include' > ccversion='' > gccversion='4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)' > gccosandvers='' > intsize=4 > longsize=8 > ptrsize=8 > doublesize=8 > byteorder=12345678 > doublekind=3 > d_longlong=define > longlongsize=8 > d_longdbl=define > longdblsize=16 > longdblkind=3 > ivtype='long' > ivsize=8 > nvtype='double' > nvsize=8 > Off_t='off_t' > lseeksize=8 > alignbytes=8 > prototype=define > Linker and Libraries: > ld='cc' > ldflags =' -mmacosx-version-min=10.11 -fstack-protector-strong > -L/usr/local/lib' > libpth=/usr/local/lib > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib > /usr/lib /usr/local/lib > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib > /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib > /usr/lib > libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc > perllibs=-lpthread -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=' -mmacosx-version-min=10.11 -bundle -undefined > dynamic_lookup -L/usr/local/lib -fstack-protector-strong' > > Locally applied patches: > uncommitted-changes > > --- > @INC for perl 5.27.2: > lib > /Users/cowens/src/perl > /usr/local/lib/perl5/site_perl/5.27.2/darwin-2level > /usr/local/lib/perl5/site_perl/5.27.2 > /usr/local/lib/perl5/5.27.2/darwin-2level > /usr/local/lib/perl5/5.27.2 > > --- > Environment for perl 5.27.2: > DYLD_LIBRARY_PATH (unset) > HOME=/Users/cowens > LANG=en_US.UTF-8 > LANGUAGE (unset) > LD_LIBRARY_PATH (unset) > LOGDIR (unset) > > PATH=/Users/cowens/flutter/bin:/Users/cowens/.plenv/shims:/Users/cowens/.plenv/bin:/Users/cowens/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/cowens/flutter/bin:/Users/cowens/.plenv/shims:/Users/cowens/.plenv/bin:/Users/cowens/bin:/usr/local/sbin > PERL5LIB=/Users/cowens/src/perl > PERL_BADLANG (unset) > SHELL=/bin/bash
From: "Chas. Owens" <chas.owens [...] gmail.com>
Date: Tue, 27 Jun 2017 22:12:28 +0000
Subject: Re: [perl #131651] Add -P and -N switches that use <<>> instead of readline
To: Sawyer X <xsawyerx [...] gmail.com>, perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 5.3k

How about -g for good? Or -z for zafe?


On Tue, Jun 27, 2017, 17:32 Sawyer X <xsawyerx@gmail.com> wrote:
Show quoted text
I think this is a good idea, but it takes two letters, and when we talk
about the switches, those are highly-valued commodity.

Perhaps we should provide a flag that turns on double diamond on other
switches?

It would be great if -E could do that, but that will likely break stuff. :/
(If -E meant "turn whatever you want on," we could have done it, but it
doesn't.)

On 06/25/2017 02:48 AM, Chas Owens (via RT) wrote:
> # New Ticket Created by  "Chas Owens"
> # Please include the string:  [perl #131651]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=131651 >
>
>
> This is a bug report for perl from chas.owens@gmail.com,
> generated with the help of perlbug 1.40 running under perl 5.27.2.
>
>
> -----------------------------------------------------------------
> [Please describe your issue here]
>
>
> The -n and -p switches use the two argument version of open.  This is a
> security issue.  The <<>> operator fixes the security issue, but isn't
> easily available to command line user's of Perl.  This patch adds -N and -P
> flags that behave just like the -n and -p flags, but uses <<>> instead of
> readline.
>
> It also adds a test of the interactions amongst -F, -N, -P, -a,
> -n, and -p.
>
> [Please do not change anything below this line]
> -----------------------------------------------------------------
> ---
> Flags:
>     category=core
>     severity=wishlist
>     Type=Patch
>     PatchStatus=HasPatch
> ---
> Site configuration information for perl 5.27.2:
>
> Configured by cowens at Sat Jun 24 15:22:32 EDT 2017.
>
> Summary of my perl5 (revision 5 version 27 subversion 2) configuration:
>   Derived from: 0599cd66b4e9bae6409714e39aa0eebc67712ca7
>   Platform:
>     osname=darwin
>     osvers=15.6.0
>     archname=darwin-2level
>     uname='darwin caelum.local 15.6.0 darwin kernel version 15.6.0: tue apr
> 11 16:00:51 pdt 2017; root:xnu-3248.60.11.5.3~1release_x86_64 x86_64 '
>     config_args='-des -Dusedevel'
>     hint=previous
>     useposix=true
>     d_sigaction=define
>     useithreads=undef
>     usemultiplicity=undef
>     use64bitint=define
>     use64bitall=define
>     uselongdouble=undef
>     usemymalloc=n
>     default_inc_excludes_dot=define
>     bincompat5005=undef
>   Compiler:
>     cc='cc'
>     ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11
> -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include
> -DPERL_USE_SAFE_PUTENV'
>     optimize='-O3'
>     cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11
> -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
>     ccversion=''
>     gccversion='4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)'
>     gccosandvers=''
>     intsize=4
>     longsize=8
>     ptrsize=8
>     doublesize=8
>     byteorder=12345678
>     doublekind=3
>     d_longlong=define
>     longlongsize=8
>     d_longdbl=define
>     longdblsize=16
>     longdblkind=3
>     ivtype='long'
>     ivsize=8
>     nvtype='double'
>     nvsize=8
>     Off_t='off_t'
>     lseeksize=8
>     alignbytes=8
>     prototype=define
>   Linker and Libraries:
>     ld='cc'
>     ldflags =' -mmacosx-version-min=10.11 -fstack-protector-strong
> -L/usr/local/lib'
>     libpth=/usr/local/lib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib
> /usr/lib /usr/local/lib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib
> /usr/lib
>     libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc
>     perllibs=-lpthread -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=' -mmacosx-version-min=10.11 -bundle -undefined
> dynamic_lookup -L/usr/local/lib -fstack-protector-strong'
>
> Locally applied patches:
>     uncommitted-changes
>
> ---
> @INC for perl 5.27.2:
>     lib
>     /Users/cowens/src/perl
>     /usr/local/lib/perl5/site_perl/5.27.2/darwin-2level
>     /usr/local/lib/perl5/site_perl/5.27.2
>     /usr/local/lib/perl5/5.27.2/darwin-2level
>     /usr/local/lib/perl5/5.27.2
>
> ---
> Environment for perl 5.27.2:
>     DYLD_LIBRARY_PATH (unset)
>     HOME=/Users/cowens
>     LANG=en_US.UTF-8
>     LANGUAGE (unset)
>     LD_LIBRARY_PATH (unset)
>     LOGDIR (unset)
>
> PATH=/Users/cowens/flutter/bin:/Users/cowens/.plenv/shims:/Users/cowens/.plenv/bin:/Users/cowens/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/cowens/flutter/bin:/Users/cowens/.plenv/shims:/Users/cowens/.plenv/bin:/Users/cowens/bin:/usr/local/sbin
>     PERL5LIB=/Users/cowens/src/perl
>     PERL_BADLANG (unset)
>     SHELL=/bin/bash
Subject: Re: [perl #131651] Add -P and -N switches that use <<>> instead of readline
To: Sawyer X <xsawyerx [...] gmail.com>, perl5-porters [...] perl.org
Date: Tue, 27 Jun 2017 22:27:01 +0000
From: "Chas. Owens" <chas.owens [...] gmail.com>
Download (untitled) / with headers
text/plain 5.6k
Also, what about an environment variable to make it the default? If so, should the arg flip the meaning again?

On Tue, Jun 27, 2017, 18:12 Chas. Owens <chas.owens@gmail.com> wrote:
Show quoted text

How about -g for good? Or -z for zafe?


On Tue, Jun 27, 2017, 17:32 Sawyer X <xsawyerx@gmail.com> wrote:
I think this is a good idea, but it takes two letters, and when we talk
about the switches, those are highly-valued commodity.

Perhaps we should provide a flag that turns on double diamond on other
switches?

It would be great if -E could do that, but that will likely break stuff. :/
(If -E meant "turn whatever you want on," we could have done it, but it
doesn't.)

On 06/25/2017 02:48 AM, Chas Owens (via RT) wrote:
> # New Ticket Created by  "Chas Owens"
> # Please include the string:  [perl #131651]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=131651 >
>
>
> This is a bug report for perl from chas.owens@gmail.com,
> generated with the help of perlbug 1.40 running under perl 5.27.2.
>
>
> -----------------------------------------------------------------
> [Please describe your issue here]
>
>
> The -n and -p switches use the two argument version of open.  This is a
> security issue.  The <<>> operator fixes the security issue, but isn't
> easily available to command line user's of Perl.  This patch adds -N and -P
> flags that behave just like the -n and -p flags, but uses <<>> instead of
> readline.
>
> It also adds a test of the interactions amongst -F, -N, -P, -a,
> -n, and -p.
>
> [Please do not change anything below this line]
> -----------------------------------------------------------------
> ---
> Flags:
>     category=core
>     severity=wishlist
>     Type=Patch
>     PatchStatus=HasPatch
> ---
> Site configuration information for perl 5.27.2:
>
> Configured by cowens at Sat Jun 24 15:22:32 EDT 2017.
>
> Summary of my perl5 (revision 5 version 27 subversion 2) configuration:
>   Derived from: 0599cd66b4e9bae6409714e39aa0eebc67712ca7
>   Platform:
>     osname=darwin
>     osvers=15.6.0
>     archname=darwin-2level
>     uname='darwin caelum.local 15.6.0 darwin kernel version 15.6.0: tue apr
> 11 16:00:51 pdt 2017; root:xnu-3248.60.11.5.3~1release_x86_64 x86_64 '
>     config_args='-des -Dusedevel'
>     hint=previous
>     useposix=true
>     d_sigaction=define
>     useithreads=undef
>     usemultiplicity=undef
>     use64bitint=define
>     use64bitall=define
>     uselongdouble=undef
>     usemymalloc=n
>     default_inc_excludes_dot=define
>     bincompat5005=undef
>   Compiler:
>     cc='cc'
>     ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11
> -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include
> -DPERL_USE_SAFE_PUTENV'
>     optimize='-O3'
>     cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11
> -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
>     ccversion=''
>     gccversion='4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)'
>     gccosandvers=''
>     intsize=4
>     longsize=8
>     ptrsize=8
>     doublesize=8
>     byteorder=12345678
>     doublekind=3
>     d_longlong=define
>     longlongsize=8
>     d_longdbl=define
>     longdblsize=16
>     longdblkind=3
>     ivtype='long'
>     ivsize=8
>     nvtype='double'
>     nvsize=8
>     Off_t='off_t'
>     lseeksize=8
>     alignbytes=8
>     prototype=define
>   Linker and Libraries:
>     ld='cc'
>     ldflags =' -mmacosx-version-min=10.11 -fstack-protector-strong
> -L/usr/local/lib'
>     libpth=/usr/local/lib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib
> /usr/lib /usr/local/lib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib
> /usr/lib
>     libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc
>     perllibs=-lpthread -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=' -mmacosx-version-min=10.11 -bundle -undefined
> dynamic_lookup -L/usr/local/lib -fstack-protector-strong'
>
> Locally applied patches:
>     uncommitted-changes
>
> ---
> @INC for perl 5.27.2:
>     lib
>     /Users/cowens/src/perl
>     /usr/local/lib/perl5/site_perl/5.27.2/darwin-2level
>     /usr/local/lib/perl5/site_perl/5.27.2
>     /usr/local/lib/perl5/5.27.2/darwin-2level
>     /usr/local/lib/perl5/5.27.2
>
> ---
> Environment for perl 5.27.2:
>     DYLD_LIBRARY_PATH (unset)
>     HOME=/Users/cowens
>     LANG=en_US.UTF-8
>     LANGUAGE (unset)
>     LD_LIBRARY_PATH (unset)
>     LOGDIR (unset)
>
> PATH=/Users/cowens/flutter/bin:/Users/cowens/.plenv/shims:/Users/cowens/.plenv/bin:/Users/cowens/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/cowens/flutter/bin:/Users/cowens/.plenv/shims:/Users/cowens/.plenv/bin:/Users/cowens/bin:/usr/local/sbin
>     PERL5LIB=/Users/cowens/src/perl
>     PERL_BADLANG (unset)
>     SHELL=/bin/bash
Subject: Re: [perl #131651] Add -P and -N switches that use <<>> instead of readline
To: Sawyer X <xsawyerx [...] gmail.com>, perl5-porters [...] perl.org
From: "Chas. Owens" <chas.owens [...] gmail.com>
Date: Tue, 27 Jun 2017 22:52:47 +0000
Hmm, another option:

-N (implies -n) uses <<>> instead of readline
-p overrides -n or -N

That at least makes sense from a mnemonic point of view.

On Tue, Jun 27, 2017 at 6:16 PM Chas. Owens <chas.owens@gmail.com> wrote:
Show quoted text
Also, what about an environment variable to make it the default? If so, should the arg flip the meaning again?

On Tue, Jun 27, 2017, 18:12 Chas. Owens <chas.owens@gmail.com> wrote:

How about -g for good? Or -z for zafe?


On Tue, Jun 27, 2017, 17:32 Sawyer X <xsawyerx@gmail.com> wrote:
I think this is a good idea, but it takes two letters, and when we talk
about the switches, those are highly-valued commodity.

Perhaps we should provide a flag that turns on double diamond on other
switches?

It would be great if -E could do that, but that will likely break stuff. :/
(If -E meant "turn whatever you want on," we could have done it, but it
doesn't.)

On 06/25/2017 02:48 AM, Chas Owens (via RT) wrote:
> # New Ticket Created by  "Chas Owens"
> # Please include the string:  [perl #131651]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=131651 >
>
>
> This is a bug report for perl from chas.owens@gmail.com,
> generated with the help of perlbug 1.40 running under perl 5.27.2.
>
>
> -----------------------------------------------------------------
> [Please describe your issue here]
>
>
> The -n and -p switches use the two argument version of open.  This is a
> security issue.  The <<>> operator fixes the security issue, but isn't
> easily available to command line user's of Perl.  This patch adds -N and -P
> flags that behave just like the -n and -p flags, but uses <<>> instead of
> readline.
>
> It also adds a test of the interactions amongst -F, -N, -P, -a,
> -n, and -p.
>
> [Please do not change anything below this line]
> -----------------------------------------------------------------
> ---
> Flags:
>     category=core
>     severity=wishlist
>     Type=Patch
>     PatchStatus=HasPatch
> ---
> Site configuration information for perl 5.27.2:
>
> Configured by cowens at Sat Jun 24 15:22:32 EDT 2017.
>
> Summary of my perl5 (revision 5 version 27 subversion 2) configuration:
>   Derived from: 0599cd66b4e9bae6409714e39aa0eebc67712ca7
>   Platform:
>     osname=darwin
>     osvers=15.6.0
>     archname=darwin-2level
>     uname='darwin caelum.local 15.6.0 darwin kernel version 15.6.0: tue apr
> 11 16:00:51 pdt 2017; root:xnu-3248.60.11.5.3~1release_x86_64 x86_64 '
>     config_args='-des -Dusedevel'
>     hint=previous
>     useposix=true
>     d_sigaction=define
>     useithreads=undef
>     usemultiplicity=undef
>     use64bitint=define
>     use64bitall=define
>     uselongdouble=undef
>     usemymalloc=n
>     default_inc_excludes_dot=define
>     bincompat5005=undef
>   Compiler:
>     cc='cc'
>     ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11
> -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include
> -DPERL_USE_SAFE_PUTENV'
>     optimize='-O3'
>     cppflags='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.11
> -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
>     ccversion=''
>     gccversion='4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)'
>     gccosandvers=''
>     intsize=4
>     longsize=8
>     ptrsize=8
>     doublesize=8
>     byteorder=12345678
>     doublekind=3
>     d_longlong=define
>     longlongsize=8
>     d_longdbl=define
>     longdblsize=16
>     longdblkind=3
>     ivtype='long'
>     ivsize=8
>     nvtype='double'
>     nvsize=8
>     Off_t='off_t'
>     lseeksize=8
>     alignbytes=8
>     prototype=define
>   Linker and Libraries:
>     ld='cc'
>     ldflags =' -mmacosx-version-min=10.11 -fstack-protector-strong
> -L/usr/local/lib'
>     libpth=/usr/local/lib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib
> /usr/lib /usr/local/lib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.0.0/lib
> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib
> /usr/lib
>     libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc
>     perllibs=-lpthread -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=' -mmacosx-version-min=10.11 -bundle -undefined
> dynamic_lookup -L/usr/local/lib -fstack-protector-strong'
>
> Locally applied patches:
>     uncommitted-changes
>
> ---
> @INC for perl 5.27.2:
>     lib
>     /Users/cowens/src/perl
>     /usr/local/lib/perl5/site_perl/5.27.2/darwin-2level
>     /usr/local/lib/perl5/site_perl/5.27.2
>     /usr/local/lib/perl5/5.27.2/darwin-2level
>     /usr/local/lib/perl5/5.27.2
>
> ---
> Environment for perl 5.27.2:
>     DYLD_LIBRARY_PATH (unset)
>     HOME=/Users/cowens
>     LANG=en_US.UTF-8
>     LANGUAGE (unset)
>     LD_LIBRARY_PATH (unset)
>     LOGDIR (unset)
>
> PATH=/Users/cowens/flutter/bin:/Users/cowens/.plenv/shims:/Users/cowens/.plenv/bin:/Users/cowens/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/cowens/flutter/bin:/Users/cowens/.plenv/shims:/Users/cowens/.plenv/bin:/Users/cowens/bin:/usr/local/sbin
>     PERL5LIB=/Users/cowens/src/perl
>     PERL_BADLANG (unset)
>     SHELL=/bin/bash
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.6k
On Tue, 27 Jun 2017 14:31:50 -0700, xsawyerx@gmail.com wrote: Show quoted text
> I think this is a good idea, but it takes two letters, and when we > talk > about the switches, those are highly-valued commodity.
Proposals for new command-line switches (as opposed to regexp flags) are generally few and far between. Show quoted text
> > Perhaps we should provide a flag that turns on double diamond on other > switches?
The -N and -P options initially proposed are the clearest, I think. And I do think clarity is important, at least sometimes. (Even though I program in Perl.) Show quoted text
> > It would be great if -E could do that, but that will likely break > stuff. :/ > (If -E meant "turn whatever you want on," we could have done it, but > it > doesn't.)
If -E meant ‘turn on whatever you want on,’ then it would have to read people’s minds. I guess you could implement such an -E with neural networks, and then it would be as good as random. Show quoted text
> > On 06/25/2017 02:48 AM, Chas Owens (via RT) wrote:
> > This is > > a > > security issue. The <<>> operator fixes the security issue,
I just want to clarify that the security issue is mainly when the file name comes from some untrusted source, from someone who does not have the ability to execute arbitrary code. If someone already has access to a command line, then it is more about surprises than security. but Show quoted text
> > isn't > > easily available to command line user's of Perl. This patch adds -N > > and -P > > flags that behave just like the -n and -p flags, but uses <<>> > > instead of > > readline.
I have not had (and do not have) time to read the patch, but I think the idea is good. -- Father Chrysostomos
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.8k
In case it is not clear, parts of my previous message were intended to be risible. On Tue, 27 Jun 2017 16:10:41 -0700, sprout wrote: Show quoted text
> On Tue, 27 Jun 2017 14:31:50 -0700, xsawyerx@gmail.com wrote:
> > I think this is a good idea, but it takes two letters, and when we > > talk > > about the switches, those are highly-valued commodity.
> > Proposals for new command-line switches (as opposed to regexp flags) > are generally few and far between. > >
> > > > Perhaps we should provide a flag that turns on double diamond on > > other > > switches?
> > The -N and -P options initially proposed are the clearest, I think. > And I do think clarity is important, at least sometimes. (Even though > I program in Perl.) >
> > > > It would be great if -E could do that, but that will likely break > > stuff. :/ > > (If -E meant "turn whatever you want on," we could have done it, but > > it > > doesn't.)
> > If -E meant ‘turn on whatever you want on,’ then it would have to read > people’s minds. I guess you could implement such an -E with neural > networks, and then it would be as good as random. > >
> > > > On 06/25/2017 02:48 AM, Chas Owens (via RT) wrote:
> > > This is > > > a > > > security issue. The <<>> operator fixes the security issue,
> > I just want to clarify that the security issue is mainly when the file > name comes from some untrusted source, from someone who does not have > the ability to execute arbitrary code. > > If someone already has access to a command line, then it is more about > surprises than security. > > but
> > > isn't > > > easily available to command line user's of Perl. This patch adds > > > -N > > > and -P > > > flags that behave just like the -n and -p flags, but uses <<>> > > > instead of > > > readline.
> > I have not had (and do not have) time to read the patch, but I think > the idea is good.
-- Father Chrysostomos
Subject: Re: [perl #131651] Add -P and -N switches that use <<>> instead of readline
To: Sawyer X <xsawyerx [...] gmail.com>
CC: Perl5 Porters <perl5-porters [...] perl.org>
From: Leon Timmermans <fawaka [...] gmail.com>
Date: Wed, 28 Jun 2017 01:29:33 +0200
Download (untitled) / with headers
text/plain 690b
On Tue, Jun 27, 2017 at 11:31 PM, Sawyer X <xsawyerx@gmail.com> wrote:
Show quoted text
I think this is a good idea, but it takes two letters, and when we talk
about the switches, those are highly-valued commodity.

Perhaps we should provide a flag that turns on double diamond on other
switches?

It would be great if -E could do that, but that will likely break stuff. :/
(If -E meant "turn whatever you want on," we could have done it, but it
doesn't.)

Capital letters are still quite available. I mean, currently only C, D, E, F, I, M, S, T, U, V, W and X are in use, that's not even half of them. The proposed flags are far more intuitive than any alternative I can think of.

Leon
Subject: Re: [perl #131651] Add -P and -N switches that use <<>> instead of readline
To: Leon Timmermans <fawaka [...] gmail.com>
CC: Perl5 Porters <perl5-porters [...] perl.org>
Date: Tue, 27 Jun 2017 16:35:55 -0700
From: Sawyer X <xsawyerx [...] gmail.com>
Download (untitled) / with headers
text/plain 876b
On 06/27/2017 04:29 PM, Leon Timmermans wrote: Show quoted text
> On Tue, Jun 27, 2017 at 11:31 PM, Sawyer X <xsawyerx@gmail.com > <mailto:xsawyerx@gmail.com>> wrote: > > I think this is a good idea, but it takes two letters, and when we > talk > about the switches, those are highly-valued commodity. > > Perhaps we should provide a flag that turns on double diamond on other > switches? > > It would be great if -E could do that, but that will likely break > stuff. :/ > (If -E meant "turn whatever you want on," we could have done it, > but it > doesn't.) > > > Capital letters are still quite available. I mean, currently only C, > D, E, F, I, M, S, T, U, V, W and X are in use, that's not even half of > them. The proposed flags are far more intuitive than any alternative I > can think of.
I had plans for half of them already, Leon. Kidding.
To: perlbug-followup [...] perl.org
Subject: Re: [perl #131651] Add -P and -N switches that use <<>> instead of readline
From: Sawyer X <xsawyerx [...] gmail.com>
Date: Tue, 27 Jun 2017 16:46:08 -0700
CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.5k
On 06/27/2017 04:10 PM, Father Chrysostomos via RT wrote: Show quoted text
> On Tue, 27 Jun 2017 14:31:50 -0700, xsawyerx@gmail.com wrote:
>> I think this is a good idea, but it takes two letters, and when we >> talk >> about the switches, those are highly-valued commodity.
> Proposals for new command-line switches (as opposed to regexp flags) are generally few and far between.
Fair enough. Show quoted text
> >
>> Perhaps we should provide a flag that turns on double diamond on other >> switches?
> The -N and -P options initially proposed are the clearest, I think. And I do think clarity is important, at least sometimes. (Even though I program in Perl.)
Good point. Let's go with that. Show quoted text
>
>> It would be great if -E could do that, but that will likely break >> stuff. :/ >> (If -E meant "turn whatever you want on," we could have done it, but >> it >> doesn't.)
> If -E meant ‘turn on whatever you want on,’ then it would have to read people’s minds. I guess you could implement such an -E with neural networks, and then it would be as good as random.
I meant the user telling us we can turn on whatever we wanted. It could mean new features, new behaviors, removing what we consider unsafe, etc. Show quoted text
> >
>> On 06/25/2017 02:48 AM, Chas Owens (via RT) wrote:
>>> This is >>> a >>> security issue. The <<>> operator fixes the security issue,
> I just want to clarify that the security issue is mainly when the file name comes from some untrusted source, from someone who does not have the ability to execute arbitrary code. > > If someone already has access to a command line, then it is more about surprises than security.
Thank you for adding that.
To: Sawyer X <xsawyerx [...] gmail.com>, perlbug-followup [...] perl.org
Subject: Re: [perl #131651] Add -P and -N switches that use <<>> instead of readline
From: "Chas. Owens" <chas.owens [...] gmail.com>
Date: Wed, 28 Jun 2017 00:07:20 +0000
CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 390b


On Tue, Jun 27, 2017, 19:46 Sawyer X <xsawyerx@gmail.com> wrote:
Show quoted text

> If someone already has access to a command line, then it is more about surprises than security.

Thank you for adding that.

File names aren't necessarily safe:

$ tar xvfz somecode.tgz
$ cd somecode
$ perl -nE 'say if /someregex/' *

If somecode.tgz had a file named "|rm -rf /home" then you are very unhappy.


Show quoted text
Date: Wed, 28 Jun 2017 09:42:47 +0100
From: Zefram <zefram [...] fysh.org>
To: perl5-porters [...] perl.org
Subject: Re: [perl #131651] Add -P and -N switches that use <<>> instead of readline
Download (untitled) / with headers
text/plain 373b
Chas. Owens wrote: Show quoted text
>Also, what about an environment variable to make it the default?
No, no, no. Also, no. The validity and meaning of a program (in this case, a perl command line) should be determined by the program itself, not dependent on local variations in dialect. (Though there's already PERL5OPT for those who are determined to do this sort of thing.) -zefram
From: Lukas Mai <plokinom [...] gmail.com>
Date: Sun, 2 Jul 2017 10:53:39 +0200
Subject: Re: [perl #131651] Add -P and -N switches that use <<>> instead of readline
To: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 775b
Am 28.06.2017 um 02:07 schrieb Chas. Owens: Show quoted text
> > > On Tue, Jun 27, 2017, 19:46 Sawyer X <xsawyerx@gmail.com > <mailto:xsawyerx@gmail.com>> wrote: > >
> > If someone already has access to a command line, then it is more
> about surprises than security. > > Thank you for adding that. > > > File names aren't necessarily safe: > > $ tar xvfz somecode.tgz > $ cd somecode > $ perl -nE 'say if /someregex/' * > > If somecode.tgz had a file named "|rm -rf /home" then you are very unhappy.
You can't have / in a filename, so it's impossible for * to expand to "|rm -rf /home". Unfortunately that doesn't protect you: touch 'rm -rf `printf \\\\57`home |' still works. See http://www.perlmonks.org/?node_id=258980. :-) -- Lukas Mai <plokinom@gmail.com>
To: perlbug-followup [...] perl.org
Date: Wed, 26 Jul 2017 15:26:20 +0000
Subject: Re: [perl #131651] Add -P and -N switches that use <<>> instead of readline
From: "Chas. Owens" <chas.owens [...] gmail.com>
Download (untitled) / with headers
text/plain 1.1k
Where does this stand?  Is it desirable to have a patch that implements just a -N flag that forces use of <<>>?  So -N is 

LINE: while (defined($_ = <<ARGV>>)) {
    '???';
}

and -Np is

LINE: while (defined($_ = <<ARGV>>)) {
    '???';
}
continue {
    die "-p destination: $!\n" unless print $_;
}

On Sun, Jul 2, 2017 at 4:55 AM Lukas Mai via RT <perlbug-followup@perl.org> wrote:
Show quoted text
Am 28.06.2017 um 02:07 schrieb Chas. Owens:
>
>
> On Tue, Jun 27, 2017, 19:46 Sawyer X <xsawyerx@gmail.com
> <mailto:xsawyerx@gmail.com>> wrote:
>
>
>      > If someone already has access to a command line, then it is more
>     about surprises than security.
>
>     Thank you for adding that.
>
>
> File names aren't necessarily safe:
>
> $ tar xvfz somecode.tgz
> $ cd somecode
> $ perl -nE 'say if /someregex/' *
>
> If somecode.tgz had a file named "|rm -rf /home" then you are very unhappy.

You can't have / in a filename, so it's impossible for * to expand to
"|rm -rf /home". Unfortunately that doesn't protect you: touch 'rm -rf
`printf \\\\57`home |' still works. See
http://www.perlmonks.org/?node_id=258980. :-)


--
Lukas Mai <plokinom@gmail.com>

From: Sawyer X <xsawyerx [...] gmail.com>
Subject: Re: [perl #131651] Add -P and -N switches that use <<>> instead of readline
Date: Thu, 27 Jul 2017 10:03:27 +0200
To: "Chas. Owens" <chas.owens [...] gmail.com>, perlbug-followup [...] perl.org
Download (untitled) / with headers
text/plain 1.5k
Why just -N? I think there are no objections left for -N or -P. On 07/26/2017 05:26 PM, Chas. Owens wrote: Show quoted text
> Where does this stand? Is it desirable to have a patch that > implements just a -N flag that forces use of <<>>? So -N is > > LINE: while (defined($_ = <<ARGV>>)) { > '???'; > } > > and -Np is > > LINE: while (defined($_ = <<ARGV>>)) { > '???'; > } > continue { > die "-p destination: $!\n" unless print $_; > } > > On Sun, Jul 2, 2017 at 4:55 AM Lukas Mai via RT > <perlbug-followup@perl.org <mailto:perlbug-followup@perl.org>> wrote: > > Am 28.06.2017 um 02:07 schrieb Chas. Owens:
> > > > > > On Tue, Jun 27, 2017, 19:46 Sawyer X <xsawyerx@gmail.com
> <mailto:xsawyerx@gmail.com>
> > <mailto:xsawyerx@gmail.com <mailto:xsawyerx@gmail.com>>> wrote: > > > >
> > > If someone already has access to a command line, then it
> is more
> > about surprises than security. > > > > Thank you for adding that. > > > > > > File names aren't necessarily safe: > > > > $ tar xvfz somecode.tgz > > $ cd somecode > > $ perl -nE 'say if /someregex/' * > > > > If somecode.tgz had a file named "|rm -rf /home" then you are
> very unhappy. > > You can't have / in a filename, so it's impossible for * to expand to > "|rm -rf /home". Unfortunately that doesn't protect you: touch 'rm -rf > `printf \\\\57`home |' still works. See > http://www.perlmonks.org/?node_id=258980. :-) > > > -- > Lukas Mai <plokinom@gmail.com <mailto:plokinom@gmail.com>> >


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org