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

#!perl -C -w #10127

Closed
p5pRT opened this issue Feb 2, 2010 · 6 comments
Closed

#!perl -C -w #10127

p5pRT opened this issue Feb 2, 2010 · 6 comments

Comments

@p5pRT
Copy link

p5pRT commented Feb 2, 2010

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

Searchable as RT72434$

@p5pRT
Copy link
Author

p5pRT commented Feb 2, 2010

From @cpansprout

parse_unicode_opts expects to end on '\0'. So #!perl -C -w causes an
‘Unknown Unicode option letter ' '’ error. The attached patch fixes it.

Use of uninitialized value $category in concatenation (.) or string
at /usr/local/bin/perlbug5.11.4 line 645.
Use of uninitialized value $severity in concatenation (.) or string
at /usr/local/bin/perlbug5.11.4 line 645.


Flags​:
  category=core
  severity=low


Site configuration information for perl 5.11.4​:

Configured by sprout at Wed Jan 20 14​:43​:21 PST 2010.

Summary of my perl5 (revision 5 version 11 subversion 4 patch
v5.11.4-5-g603fcd1) configuration​:
  Snapshot of​: e2c4d20
  Platform​:
  osname=darwin, osvers=10.0.0, archname=darwin-2level
  uname='darwin pint.local 10.0.0 darwin kernel version 10.0.0​: fri
jul 31 22​:47​:34 pdt 2009; root​:xnu-1456.1.25~1release_i386 i386 '
  config_args='-de -Dusedevel'
  hint=recommended, useposix=true, d_sigaction=define
  useithreads=undef, usemultiplicity=undef
  useperlio=define, d_sfio=undef, uselargefiles=define,
usesocks=undef
  use64bitint=undef, use64bitall=undef, uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cc', ccflags ='-fno-common -DPERL_DARWIN -no-cpp-precomp -fno-
strict-aliasing -pipe -fstack-protector -I/usr/local/include',
  optimize='-O3',
  cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-
precomp -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/
include'
  ccversion='', gccversion='4.2.1 (Apple Inc. build 5646)',
gccosandvers=''
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long', ivsize=4, 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'
  libpth=/usr/local/lib /usr/lib
  libs=-ldbm -ldl -lm -lutil -lc
  perllibs=-ldl -lm -lutil -lc
  libc=/usr/lib/libc.dylib, 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 -fstack-protector'

Locally applied patches​:


@​INC for perl 5.11.4​:
  /usr/local/lib/perl5/site_perl/5.11.4/darwin-2level
  /usr/local/lib/perl5/site_perl/5.11.4
  /usr/local/lib/perl5/5.11.4/darwin-2level
  /usr/local/lib/perl5/5.11.4
  /usr/local/lib/perl5/site_perl
  .


Environment for perl 5.11.4​:
  DYLD_LIBRARY_PATH (unset)
  HOME=/Users/sprout
  LANG=en_US.UTF-8
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/usr/bin​:/bin​:/usr/sbin​:/sbin​:/usr/local/bin​:/usr/X11/bin​:/
usr/local/bin
  PERL_BADLANG (unset)
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Feb 3, 2010

From @cpansprout

And here’s the patch.

@p5pRT
Copy link
Author

p5pRT commented Feb 3, 2010

From @cpansprout

Inline Patch
diff -Nurp blead/t/run/switchC.t blead-C-bug2/t/run/switchC.t
--- blead/t/run/switchC.t	2009-11-19 08:51:41.000000000 -0800
+++ blead-C-bug2/t/run/switchC.t	2010-01-30 14:03:19.000000000 -0800
@@ -18,7 +18,7 @@ BEGIN {
 
 BEGIN { require "./test.pl"; }
 
-plan(tests => 9);
+plan(tests => 11);
 
 my $r;
 
@@ -69,6 +69,19 @@ $r = runperl( switches => [ '-CS', '-w' 
               stderr   => 1, );
 like( $r, qr/^$b(?:\r?\n)?$/s, '#!perl -C' );
 
+$r = runperl( switches => [ '-CS' ],
+	      progs    => [ '#!perl -CS -w', 'print chr(256), !!$^W'],
+              stderr   => 1, );
+like( $r, qr/^${b}1(?:\r?\n)?$/s, '#!perl -C followed by another switch' );
+
+$r = runperl( switches => [ '-CS' ],
+	      progs    => [ '#!perl -C7 -w', 'print chr(256), !!$^W'],
+              stderr   => 1, );
+like(
+  $r, qr/^${b}1(?:\r?\n)?$/s,
+ '#!perl -C<num> followed by another switch'
+);
+
 $r = runperl( switches => [ '-CA', '-w' ],
 	      progs    => [ '#!perl -CS', 'print chr(256)' ],
               stderr   => 1, );
diff -Nurp blead/util.c blead-C-bug2/util.c
--- blead/util.c	2010-01-15 09:09:09.000000000 -0800
+++ blead-C-bug2/util.c	2010-01-30 13:32:29.000000000 -0800
@@ -5384,8 +5384,11 @@ Perl_parse_unicode_opts(pTHX_ const char
 	    opt = (U32) atoi(p);
 	    while (isDIGIT(*p))
 		p++;
-	    if (*p && *p != '\n' && *p != '\r')
+	    if (*p && *p != '\n' && *p != '\r') {
+	     if(isSPACE(*p)) goto the_end_of_the_opts_parser;
+	     else
 		 Perl_croak(aTHX_ "Unknown Unicode option letter '%c'", *p);
+	    }
        }
        else {
 	    for (; *p; p++) {
@@ -5411,9 +5414,12 @@ Perl_parse_unicode_opts(pTHX_ const char
 		 case PERL_UNICODE_UTF8CACHEASSERT:
 		      opt |= PERL_UNICODE_UTF8CACHEASSERT_FLAG; break;
 		 default:
-		      if (*p != '\n' && *p != '\r')
+		      if (*p != '\n' && *p != '\r') {
+			if(isSPACE(*p)) goto the_end_of_the_opts_parser;
+			else
 			  Perl_croak(aTHX_
 				     "Unknown Unicode option letter '%c'", *p);
+		      }
 		 }
 	    }
        }
@@ -5421,6 +5427,8 @@ Perl_parse_unicode_opts(pTHX_ const char
   else
        opt = PERL_UNICODE_DEFAULT_FLAGS;
 
+  the_end_of_the_opts_parser:
+
   if (opt & ~PERL_UNICODE_ALL_FLAGS)
        Perl_croak(aTHX_ "Unknown Unicode option value %"UVuf,
 		  (UV) (opt & ~PERL_UNICODE_ALL_FLAGS));

@p5pRT
Copy link
Author

p5pRT commented Sep 27, 2010

From @cpansprout

On Wed Feb 03 07​:15​:36 2010, sprout wrote​:

And here’s the patch.

Applied as d4a59e5.

@p5pRT
Copy link
Author

p5pRT commented Sep 27, 2010

From [Unknown Contact. See original ticket]

On Wed Feb 03 07​:15​:36 2010, sprout wrote​:

And here’s the patch.

Applied as d4a59e5.

@p5pRT
Copy link
Author

p5pRT commented Sep 27, 2010

@cpansprout - Status changed from 'new' to 'resolved'

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

No branches or pull requests

1 participant