Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
p5pRT opened this issue Oct 6, 2008 · 8 comments
Closed

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

p5pRT opened this issue Oct 6, 2008 · 8 comments

Comments

@p5pRT
Copy link

p5pRT commented Oct 6, 2008

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

Searchable as RT59652$

@p5pRT
Copy link
Author

p5pRT commented Oct 6, 2008

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
Copy link
Author

p5pRT commented Oct 7, 2008

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
Copy link
Author

p5pRT commented Oct 7, 2008

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

@p5pRT p5pRT closed this as completed Oct 7, 2008
@p5pRT
Copy link
Author

p5pRT commented Oct 7, 2008

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
Copy link
Author

p5pRT commented Oct 7, 2008

From renee.baecker@smart-websolutions.de

perlrun.patch
--- 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<Note:> 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
Copy link
Author

p5pRT commented Oct 7, 2008

From @ap

* <simon.perreault@​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
Copy link
Author

p5pRT commented Oct 7, 2008

From @nwc10

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

* <simon.perreault@​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
Copy link
Author

p5pRT commented Nov 2, 2008

From @rgs

2008/10/7 Renée Bäcker <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.

Thanks, applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant