Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.98k stars 559 forks source link

perl -s does not respect read-onlyness, can cause segfaults #13317

Open p5pRT opened 11 years ago

p5pRT commented 11 years ago

Migrated from rt.perl.org#120039 (status was 'open')

Searchable as RT120039$

p5pRT commented 11 years ago

From @Hugmeir

Created by @Hugmeir

$ perl -E 'say $] = 10' Modification of a read-only value attempted at -e line 1. $ perl -s -E 'say $]' -- '-]=10' 10

Also\, there's a 5.10 regression here​: $ perl -s -le 'print ${"​::"}' -- -​::=10 Assertion failed​: (sv)\, function Perl_sv_setpv\, file sv.c\, line 4589. Abort trap​: 6

Rather than fixing those\, how about we deprecate -s?

Perl Info ``` Flags: category=core severity=low Site configuration information for perl 5.18.1: Configured by hugmeir at Thu Sep 12 14:58:14 ART 2013. Summary of my perl5 (revision 5 version 18 subversion 1) configuration: Platform: osname=darwin, osvers=12.4.0, archname=darwin-thread-multi-2level uname='darwin airtiger 12.4.0 darwin kernel version 12.4.0: wed may 1 17:57:12 pdt 2013; root:xnu-2050.24.15~1release_x86_64 x86_64 ' config_args='-de -Dprefix=/Users/hugmeir/perl5/perlbrew/perls/perl-5.18.1 -Dusethreads -DDEBUGGING -Aeval:scriptdir=/Users/hugmeir/perl5/perlbrew/perls/perl-5.18.1/bin' hint=recommended, useposix=true, d_sigaction=define useithreads=define, usemultiplicity=define 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 -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector', optimize='-O3 -g', cppflags='-fno-common -DPERL_DARWIN -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector' 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' libpth=/usr/lib libs=-ldbm -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 -fstack-protector' Locally applied patches: @INC for perl 5.18.1: /Users/hugmeir/.perlbrew/libs/perl-5.16.2@all /lib/perl5/darwin-thread-multi-2level /Users/hugmeir/.perlbrew/libs/perl-5.16.2@all/lib/perl5 /Users/hugmeir/perl5/perlbrew/perls/perl-5.18.1/lib/site_perl/5.18.1/darwin-thread-multi-2level /Users/hugmeir/perl5/perlbrew/perls/perl-5.18.1/lib/site_perl/5.18.1 /Users/hugmeir/perl5/perlbrew/perls/perl-5.18.1/lib/5.18.1/darwin-thread-multi-2level /Users/hugmeir/perl5/perlbrew/perls/perl-5.18.1/lib/5.18.1 . Environment for perl 5.18.1: DYLD_LIBRARY_PATH=/usr/local/mysql/lib: HOME=/Users/hugmeir LANG=en_US.UTF-8 LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/Users/hugmeir/perl5/perlbrew/bin:/Users/hugmeir/perl5/perlbrew/perls/perl-5.18.1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/local/mysql/bin PERL5LIB=/Users/hugmeir/.perlbrew/libs/perl-5.16.2@all/lib/perl5 PERLBREW_BASHRC_VERSION=0.58 PERLBREW_HOME=/Users/hugmeir/.perlbrew PERLBREW_LIB=all PERLBREW_MANPATH=/Users/hugmeir/perl5/perlbrew/perls/perl-5.18.1/man PERLBREW_PATH=/Users/hugmeir/perl5/perlbrew/bin:/Users/hugmeir/perl5/perlbrew/perls/perl-5.18.1/bin PERLBREW_PERL=perl-5.18.1 PERLBREW_ROOT=/Users/hugmeir/perl5/perlbrew PERLBREW_VERSION=0.58 PERL_BADLANG (unset) PERL_LOCAL_LIB_ROOT=/Users/hugmeir/.perlbrew/libs/perl-5.16.2@all PERL_MB_OPT=--install_base /Users/hugmeir/.perlbrew/libs/perl-5.16.2@all PERL_MM_OPT=INSTALL_BASE=/Users/hugmeir/.perlbrew/libs/perl-5.16.2@all SHELL=/bin/bash ```
p5pRT commented 11 years ago

From @cpansprout

On Sat Sep 28 08​:59​:40 2013\, Hugmeir wrote​:

Rather than fixing those\, how about we deprecate -s?

I use -s a lot.

--

Father Chrysostomos

p5pRT commented 11 years ago

The RT System itself - Status changed from 'new' to 'open'

p5pRT commented 11 years ago

From @rjbs

* Brian Fraser \perlbug\-followup@​perl\.org [2013-09-28T11​:59​:40]

Rather than fixing those\, how about we deprecate -s?

Not happening.

-- rjbs

p5pRT commented 11 years ago

From @Hugmeir

On Sat\, Sep 28\, 2013 at 11​:35 PM\, Ricardo Signes \perl\.p5p@​rjbs\.manxome\.orgwrote​:

* Brian Fraser \perlbug\-followup@​perl\.org [2013-09-28T11​:59​:40]

Rather than fixing those\, how about we deprecate -s?

Not happening.

Boo.

Oh well. I'll look into getting the segfault fixed; I'm ambivalent to the read-only thing being a bug.

p5pRT commented 11 years ago

From @rjbs

* Brian Fraser \fraserbn@​gmail\.com [2013-09-28T23​:05​:18]

On Sat\, Sep 28\, 2013 at 11​:35 PM\, Ricardo Signes \perl\.p5p@​rjbs\.manxome\.orgwrote​:

* Brian Fraser \perlbug\-followup@​perl\.org [2013-09-28T11​:59​:40]

Rather than fixing those\, how about we deprecate -s?

Not happening.

Boo.

There exist programs written in 1994 and running continuously since then without relying on bizarre undocumented behaviors\, or even on weird esoterica that *is* documented. Part of the goal is to avoid breaking those unless we get a big win out of it.

I think the number of such programs we'd break by deprecating/removing -s would be pretty huge.

-- rjbs

p5pRT commented 11 years ago

From @tux

On Sat\, 28 Sep 2013 10​:08​:16 -0700\, "Father Chrysostomos via RT" \perlbug\-followup@​perl\.org wrote​:

On Sat Sep 28 08​:59​:40 2013\, Hugmeir wrote​:

Rather than fixing those\, how about we deprecate -s?

I use -s a lot.

I tend to replace -s procedures with documented Getopt​::Long\, but I agree to NOT deprecate -s

-- H.Merijn Brand http​://tux.nl Perl Monger http​://amsterdam.pm.org/ using perl5.00307 .. 5.19 porting perl5 on HP-UX\, AIX\, and openSUSE http​://mirrors.develooper.com/hpux/ http​://www.test-smoke.org/ http​://qa.perl.org http​://www.goldmark.org/jeff/stupid-disclaimers/

p5pRT commented 11 years ago

From @Leont

On Sat\, Sep 28\, 2013 at 5​:59 PM\, Brian Fraser \perlbug\-followup@​perl\.orgwrote​:

Rather than fixing those\, how about we deprecate -s?

I don't think that's a good idea either\, but it may be reasonable to limit it to \w or some such.

Leon