Navigation Menu

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

Scoping bug of %^H? #2884

Closed
p5pRT opened this issue Nov 20, 2000 · 3 comments
Closed

Scoping bug of %^H? #2884

p5pRT opened this issue Nov 20, 2000 · 3 comments

Comments

@p5pRT
Copy link

p5pRT commented Nov 20, 2000

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

Searchable as RT4746$

@p5pRT
Copy link
Author

p5pRT commented Nov 20, 2000

From @andk

Created by k@ak-71.mind.de

Today I was interested in finding out how one is supposed to
use charnames.pm at runtime but then I stumbled over this example.

The following program works as expected and prints the same character
tree times in a row. I omit the output because it would be converted
to death anyway. Note that $F[1] contains the string
  OGHAM SPACE MARK
after the split().

% /usr/local/perl-5.7.0@​7787/bin/perl -e '
use charnames qw(​:full);
@​ARGV = grep -e, map "$_/unicode/Unicode.301", @​INC;
LINE​: while (<>){
next unless /OGHAM/;
chomp($_);
@​F = split /;/, $_, 0;
use charnames qw(​:full);
my $evaled = eval(qq{"\\N{$F[1]}"});
my $runtime = charnames​::charnames($F[1]);
printf "%s %s %s %s %s\n", chr(hex($F[0])), $evaled, $runtime, @​F[0,1];
last;
}
'

But if I comment out the first occurrence of 'use charnames', then
the program does not want to live​:

% /usr/local/perl-5.7.0@​7787/bin/perl -e '
# use charnames qw(​:full);
@​ARGV = grep -e, map "$_/unicode/Unicode.301", @​INC;
LINE​: while (<>){
next unless /OGHAM/;
chomp($_);
@​F = split /;/, $_, 0;
use charnames qw(​:full);
my $evaled = eval(qq{"\\N{$F[1]}"});
my $runtime = charnames​::charnames($F[1]);
printf "%s %s %s %s %s\n", chr(hex($F[0])), $evaled, $runtime, @​F[0,1];
last;
}
'
Unknown charname 'OGHAM SPACE MARK' at /usr/local/perl-5.7.0@​7787/lib/5.7.0/charnames.pm line 32, <> line 4249.

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl v5.7.0:

Configured by k at Tue Nov 21 02:41:49 CET 2000.

Summary of my perl5 (revision 5.0 version 7 subversion 0) configuration:
  Platform:
    osname=linux, osvers=2.2.16a, archname=i686-linux
    uname='linux ak-71.mind.de 2.2.16a #1 smp wed jun 14 11:59:53 cest 2000 i686 unknown '
    config_args='-Dprefix=/usr/local/perl-5.7.0@7787 -Doptimize=-g -des -Duseperlio -Dusedevel'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-g',
    cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lc -lposix -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lc -lposix -lcrypt -lutil
    libc=/lib/libc-2.1.3.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    DEVEL7776


@INC for perl v5.7.0:
    /usr/local/perl-5.7.0@7787/lib/5.7.0/i686-linux
    /usr/local/perl-5.7.0@7787/lib/5.7.0
    /usr/local/perl-5.7.0@7787/lib/site_perl/5.7.0/i686-linux
    /usr/local/perl-5.7.0@7787/lib/site_perl/5.7.0
    /usr/local/perl-5.7.0@7787/lib/site_perl
    .


Environment for perl v5.7.0:
    HOME=/home/k
    LANG=en_US
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/k/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/usr/local/perl/bin:/usr/X11/bin:/sbin:/usr/sbin:/usr/local/Office51/bin
    PERL_BADLANG (unset)
    SHELL=/bin/zsh


@p5pRT
Copy link
Author

p5pRT commented Nov 29, 2000

From @andk

On Wed, 22 Nov 2000 21​:56​:58 -0500, Ilya Zakharevich <ilya@​math.ohio-state.edu> said​:

  > +++ ./lib/charnames.pm Wed Nov 22 21​:31​:37 2000

Ilya, while you are at charnames, may I bring the bugreport to your
attention that I filed a few days ago about %^H? Is this a scoping bug
or are my expectations wrong? In other words, shouldn't both programs
behave the same way? Here it is​:

  The following program works as expected and prints the same character
  tree times in a row. I omit the output because it would be converted
  to death anyway. Note that $F[1] contains the string
  OGHAM SPACE MARK
  after the split().

  % /usr/local/perl-5.7.0@​7787/bin/perl -e '
  use charnames qw(​:full);
  @​ARGV = grep -e, map "$_/unicode/Unicode.301", @​INC;
  LINE​: while (<>){
  next unless /OGHAM/;
  chomp($_);
  @​F = split /;/, $_, 0;
  use charnames qw(​:full);
  my $evaled = eval(qq{"\\N{$F[1]}"});
  my $runtime = charnames​::charnames($F[1]);
  printf "%s %s %s %s %s\n", chr(hex($F[0])), $evaled, $runtime, @​F[0,1];
  last;
  }
  '

  But if I comment out the first occurrence of 'use charnames', then
  the program does not want to live​:

  % /usr/local/perl-5.7.0@​7787/bin/perl -e '
  # use charnames qw(​:full);
  @​ARGV = grep -e, map "$_/unicode/Unicode.301", @​INC;
  LINE​: while (<>){
  next unless /OGHAM/;
  chomp($_);
  @​F = split /;/, $_, 0;
  use charnames qw(​:full);
  my $evaled = eval(qq{"\\N{$F[1]}"});
  my $runtime = charnames​::charnames($F[1]);
  printf "%s %s %s %s %s\n", chr(hex($F[0])), $evaled, $runtime, @​F[0,1];
  last;
  }
  '
  Unknown charname 'OGHAM SPACE MARK' at /usr/local/perl-5.7.0@​7787/lib/5.7.0/charnames.pm line 32, <> line 4249.

Thanks!

@p5pRT
Copy link
Author

p5pRT commented Nov 29, 2000

From [Unknown Contact. See original ticket]

On Thu, Nov 23, 2000 at 05​:50​:54AM +0100, Andreas J. Koenig wrote​:

Ilya, while you are at charnames, may I bring the bugreport to your
attention that I filed a few days ago about %^H? Is this a scoping bug
or are my expectations wrong? In other words, shouldn't both programs
behave the same way? Here it is​:

Thanks, it is good that you wrote this; I was thinking whether I want
to beat this issue to death again... Now when the problem report
comes not from me, I may play the other role!

my $evaled = eval(qq{"\\N{$F[1]}"});

%^H (and I'm sure a lot of interesting flags in $^H) do not propagate
inside eval "".

What is needed to be fixed​: upgrade pp_entereval to an SVOP, and save
%^H in the SV slot at compile-time - if %^H is defined when compiling
pp_entereval.

Ilya

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