Perl / perl5

đŸȘ The Perl programming language
https://dev.perl.org/perl5/
Other
1.85k stars 523 forks source link

"Too late for "-CS" option" #9511

Closed p5pRT closed 15 years ago

p5pRT commented 15 years ago

Migrated from rt.perl.org#59652 (status was 'resolved')

Searchable as RT59652$

p5pRT commented 15 years ago

From simon.perreault@viagenie.ca

Created by simon.perreault@viagenie.ca

This is a bug report for perl from simon.perreault@​viagenie.ca\, generated with the help of perlbug 1.36 running under perl 5.10.0.

----------------------------------------------------------------- Do the following to reproduce​:

$ cat >test.pl #!/usr/bin/perl -CS print "hello world\n"; $ chmod +x test.pl $ ./test.pl Too late for "-CS" option at ./test.pl line 1. $

Perl Info ``` Flags: category=core severity=medium This perlbug was built using Perl 5.10.0 in the Fedora build system. It is being executed now by Perl 5.10.0 - Mon Jul 21 06:53:57 EDT 2008. Site configuration information for perl 5.10.0: Configured by Red Hat, Inc. at Mon Jul 21 06:53:57 EDT 2008. Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Platform: osname=linux, osvers=2.6.18-92.1.6.el5, archname=x86_64-linux-thread-multi uname='linux x86-4 2.6.18-92.1.6.el5 #1 smp fri jun 20 02:36:06 edt 2008 x86_64 x86_64 x86_64 gnulinux ' config_args='-des -Doptimize=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DPERL_USE_SAFE_PUTENV -Dversion=5.10.0 -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Dprivlib=/usr/lib/perl5/5.10.0 -Dsitelib=/usr/local/lib/perl5/site_perl/5.10.0 -Dvendorlib=/usr/lib/perl5/vendor_perl/5.10.0 -Darchlib=/usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi -Dsitearch=/usr/local/lib64/perl5/site_perl/5.10.0/x86_64-linux-thread-multi -Dvendorarch=/usr/lib64/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi -Darchname=x86_64-linux-thread-multi -Dlibpth=/usr/local/lib64 /lib64 /usr/lib64 -Dvendorprefix=/usr -Dsiteprefix=/usr/local -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl=n -Ubincompat5005 -Uversiononly -Dpager=/ usr/bin/less -isr -Dd_gethostent_r_proto -Ud_endhostent_r_proto -Ud_sethostent_r_proto -Ud_endprotoent_r_proto -Ud_setprotoent_r_proto -Ud_endservent_r_proto -Ud_setservent_r_proto -Dscriptdir=/usr/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='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DPERL_USE_SAFE_PUTENV', cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBUGGING -fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='4.3.0 20080428 (Red Hat 4.3.0-8)', 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='gcc', ldflags ='' libpth=/usr/local/lib64 /lib64 /usr/lib64 libs=-lresolv -lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lresolv -lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.8' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-rpath,/usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DPERL_USE_SAFE_PUTENV' Locally applied patches: @INC for perl 5.10.0: /usr/lib64/perl5/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/5.10.0 /usr/local/lib64/perl5/site_perl/5.10.0/x86_64-linux-thread-multi /usr/local/lib/perl5/site_perl/5.10.0 /usr/lib64/perl5/vendor_perl/5.10.0/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl . Environment for perl 5.10.0: HOME=/home/simon LANG=en_US.utf8 LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/simon/bin:/home/simon/android_sdk_linux_m3-rc20a/tools:/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin PERL_BADLANG (unset) SHELL=/bin/bash ```
p5pRT commented 15 years ago

From module@renee-baecker.de

quoting from perl5100delta ( http​://perldoc.perl.org/perl5100delta.html#Miscellaneous )​:

The -C option can no longer be used on the #! line. It wasn't working there anyway\, since the standard streams are already set up at this point in the execution of the perl interpreter. You can use binmode() instead to get the desired behaviour.

p5pRT commented 15 years ago

module@renee-baecker.de - Status changed from 'new' to 'resolved'

p5pRT commented 15 years ago

From renee.baecker@smart-websolutions.de

Hi\,

attached is a small documentation patch that adds a hint that -C can no longer be used in the shebang to perlrun.

Cheers\, Renee

p5pRT commented 15 years ago

From renee.baecker@smart-websolutions.de

perlrun.patch ```diff --- perlrun.pod.orig 2008-10-07 08:11:34.000000000 +0200 +++ perlrun.pod 2008-10-07 08:13:36.000000000 +0200 @@ -341,6 +341,11 @@ This feature was practically unused, however, and the command line switch was therefore "recycled".) +B In Perls later than 5.10.0 the -C option can no longer be used +on the #! line. It wasn't working there anyway, since the standard streams +are already set up at this point in the execution of the perl interpreter. +You can use binmode() instead to get the desired behaviour. + =item B<-c> X<-c> ```
p5pRT commented 15 years ago

From @ap

* \simon\.perreault@&#8203;viagenie\.ca [2008-10-07 10​:50]​:

$ cat >test.pl #!/usr/bin/perl -CS print "hello world\n"; $ chmod +x test.pl $ ./test.pl Too late for "-CS" option at ./test.pl line 1. $

This is not a bug in perl\, it’s a bug in your shebang line. The fact that this used to work was a bug in perl that has since been fixed. The correct incantation for what you want to achieve is

  use open qw( :std :encoding(UTF-8) );

Regards\, -- Aristotle Pagaltzis // \<http​://plasmasturm.org/>

p5pRT commented 15 years ago

From @nwc10

On Tue\, Oct 07\, 2008 at 02​:57​:20PM +0200\, Aristotle Pagaltzis wrote​:

* \simon\.perreault@&#8203;viagenie\.ca [2008-10-07 10​:50]​:

$ cat >test.pl #!/usr/bin/perl -CS print "hello world\n"; $ chmod +x test.pl $ ./test.pl Too late for "-CS" option at ./test.pl line 1. $

This is not a bug in perl\, it???s a bug in your shebang line. The fact that this used to work was a bug in perl that has since been fixed. The correct incantation for what you want to achieve is

use open qw\( :std :encoding\(UTF\-8\) \);

It's not a bug in that it's behaving as documented. But\, arguably it is a bug\, because it could be made to work in future. There hasn't been the conjunction of people with desire\, ability and time.

I have some idea how it might be made to work\, if someone else with time wants to learn enough to get it done.

Nicholas Clark

p5pRT commented 15 years ago

From @rgs

2008/10/7 RenĂ©e BĂ€cker \renee\.baecker@&#8203;smart\-websolutions\.de​:

Hi\,

attached is a small documentation patch that adds a hint that -C can no longer be used in the shebang to perlrun.

Thanks\, applied.