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

charnames.pm clobbers default variable #7379

Closed
p5pRT opened this issue Jun 22, 2004 · 4 comments
Closed

charnames.pm clobbers default variable #7379

p5pRT opened this issue Jun 22, 2004 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 22, 2004

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

Searchable as RT30409$

@p5pRT
Copy link
Author

p5pRT commented Jun 22, 2004

From marcel@noug.at

This is a bug report for perl from marcel@​noug.at,
generated with the help of perlbug 1.35 running under perl v5.9.2.

charnames.pm's import() clobbers $_.

$ perl -Mcharnames=​:full -le print
:full

Here's a patch​:

Inline Patch
diff -ruN src.orig/lib/charnames.pm src/lib/charnames.pm
--- src.orig/lib/charnames.pm	Mon Feb  9 22:30:09 2004
+++ src/lib/charnames.pm	Tue Jun 22 18:38:23 2004
@@ -190,8 +190,8 @@
   ## fill %h keys with our @_ args.
   ##
   my ($promote, %h, @args) = (0);
-  while (@_ and $_ = shift) {
-    if ($_ eq ":alias") {
+  while (my $arg = shift) {
+    if ($arg eq ":alias") {
       @_ or
 	croak ":alias needs an argument in charnames";
       my $alias = shift;
@@ -210,11 +210,11 @@
       alias_file ($alias);
       next;
     }
-    if (m/^:/ and ! ($_ eq ":full" || $_ eq ":short")) {
-      warn "unsupported special '$_' in charnames";
+    if (substr($arg, 0, 1) eq ':' and ! ($arg eq ":full" || $arg eq ":short")) {
+      warn "unsupported special '$arg' in charnames";
       next;
     }
-    push @args, $_;
+    push @args, $arg;
   }
   @args == 0 && $promote and @args = (":full");
   @h{@args} = (1) x @args;



Marcel

Flags​:
  category=library
  severity=low


Site configuration information for perl v5.9.2​:

Configured by marcel at Tue Jun 22 18​:01​:17 CEST 2004.

Summary of my perl5 (revision 5 version 9 subversion 2 patch 22969) configuration​:
  Platform​:
  osname=darwin, osvers=7.4.0, archname=darwin-2level
  uname='darwin pcgr.cc.univie.ac.at 7.4.0 darwin kernel version 7.4.0​: wed may 12 16​:58​:24 pdt 2004; root​:xnuxnu-517.7.7.obj~7release_ppc power macintosh powerpc '
  config_args='-Dusedevel -Dprefix=/opt/perl -de'
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=undef 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 -I/usr/local/include -I/opt/local/include',
  optimize='-Os',
  cppflags='-no-cpp-precomp -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-aliasing -pipe -I/usr/local/include -I/opt/local/include'
  ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build 1640)', gccosandvers=''
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
  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 =' -L/usr/local/lib -L/opt/local/lib'
  libpth=/usr/local/lib /opt/local/lib /usr/lib
  libs=-ldbm -ldl -lm -lc
  perllibs=-ldl -lm -lc
  libc=/usr/lib/libc.dylib, so=dylib, useshrplib=false, libperl=libperl.a
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dyld.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags=' -bundle -undefined dynamic_lookup -L/usr/local/lib -L/opt/local/lib'

Locally applied patches​:
  DEVEL22511


@​INC for perl v5.9.2​:
  /opt/perl/lib/5.9.2/darwin-2level
  /opt/perl/lib/5.9.2
  /opt/perl/lib
  /opt/perl/lib/5.9.2/darwin-2level
  /opt/perl/lib/5.9.2
  /opt/perl/lib/site_perl/5.9.2/darwin-2level
  /opt/perl/lib/site_perl/5.9.2
  /opt/perl/lib/site_perl
  .


Environment for perl v5.9.2​:
  DYLD_LIBRARY_PATH (unset)
  HOME=/Users/marcel
  LANG (unset)
  LANGUAGE (unset)
  LC_ALL=C
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/opt/perl/bin​:/opt/local/bin​:/Users/marcel/bin​:/usr/local/bin​:/sw/bin​:/sw/sbin​:/opt/perl/bin​:/opt/local/bin​:/Users/marcel/bin​:/usr/local/bin​:/bin​:/sbin​:/usr/bin​:/usr/sbin​:/usr/local/teTeX/bin/powerpc-apple-darwin-current​:/usr/X11R6/bin
  PERL5LIB=/opt/perl/lib
  PERL_BADLANG (unset)
  SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented Jun 22, 2004

From @mhx

On 2004-06-22, at 16​:43​:50 -0000, Marcel "Grünauer" (via RT) wrote​:

# New Ticket Created by Marcel Grünauer
# Please include the string​: [perl #30409]
# in the subject line of all future correspondence about this issue.
# <URL​: http​://rt.perl.org​:80/rt3/Ticket/Display.html?id=30409 >

This is a bug report for perl from marcel@​noug.at,
generated with the help of perlbug 1.35 running under perl v5.9.2.

charnames.pm's import() clobbers $_.

$ perl -Mcharnames=​:full -le print
:full

Here's a patch​:

diff -ruN src.orig/lib/charnames.pm src/lib/charnames.pm
--- src.orig/lib/charnames.pm Mon Feb 9 22​:30​:09 2004
+++ src/lib/charnames.pm Tue Jun 22 18​:38​:23 2004
@​@​ -190,8 +190,8 @​@​
## fill %h keys with our @​_ args.
##
my ($promote, %h, @​args) = (0);
- while (@​_ and $_ = shift) {
- if ($_ eq "​:alias") {
+ while (my $arg = shift) {
+ if ($arg eq "​:alias") {
@​_ or
croak "​:alias needs an argument in charnames";
my $alias = shift;
@​@​ -210,11 +210,11 @​@​
alias_file ($alias);
next;
}
- if (m/^​:/ and ! ($_ eq "​:full" || $_ eq "​:short")) {
- warn "unsupported special '$_' in charnames";
+ if (substr($arg, 0, 1) eq '​:' and ! ($arg eq "​:full" || $arg eq "​:short")) {
+ warn "unsupported special '$arg' in charnames";
next;
}
- push @​args, $_;
+ push @​args, $arg;
}
@​args == 0 && $promote and @​args = ("​:full");
@​h{@​args} = (1) x @​args;

Thanks for your report.

Your patch has been applied together with a test case as change #22972.

Marcus

--
Overflow on /dev/null, please empty the bit bucket.

@p5pRT
Copy link
Author

p5pRT commented Jun 22, 2004

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

@p5pRT
Copy link
Author

p5pRT commented Jun 22, 2004

@mhx - Status changed from 'open' 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