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

h2ph - use of local() in generated code #7694

Closed
p5pRT opened this issue Dec 8, 2004 · 4 comments
Closed

h2ph - use of local() in generated code #7694

p5pRT opened this issue Dec 8, 2004 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 8, 2004

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

Searchable as RT32962$

@p5pRT
Copy link
Author

p5pRT commented Dec 8, 2004

From Peter.Dintelmann@dresdner-bank.com

This is a bug report for perl from Peter.Dintelmann@​dresdner-bank.com,
generated with the help of perlbug 1.35 running under perl v5.8.6.

The h2ph tool uses local() in generated subs. These days it should use
my() instead. This is not really a bug and is therefore classified
as "wishlist".

E.g.

  eval 'sub S_ISDIR {
  local($mode) = @​_;
  eval q(((($mode)&0xf000) == 0x4000));
  }' unless defined(&S_ISDIR);

from sys/stat.ph should be

  eval 'sub S_ISDIR {
  my($mode) = @​_;
  eval q(((($mode)&0xf000) == 0x4000));
  }' unless defined(&S_ISDIR);

The patch below fixes this. Existing code should not be affected.

$ diff -ur h2ph h2ph.new

Inline Patch
--- h2ph        Tue Dec  7 11:17:23 2004
+++ h2ph.new    Tue Dec  7 17:08:08 2004
@@ -108,7 +108,7 @@
                            $curargs{$arg} = 1;
                        }
                        $args =~ s/\b(\w)/\$$1/g;
-                       $args = "local($args) = \@_;\n$t    ";
+                       $args = "my($args) = \@_;\n$t    ";
                    }
                    s/^\s+//;
                    expr();
@@ -304,7 +304,7 @@
            }
            $args = (
                @args
-               ? "local(" . (join ',', map "\$$_", @args) . ") = \@_;\n$t
" \+ ? "my\(" \. \(join '\,'\, map "\\$$\_"\, @​args\) \. "\) = \\@​\_;\\n$t "   : ""   \);   my $proto = @​args ? '' : '\(\) ';

Flags​:
  category=utilities
  severity=wishlist


Site configuration information for perl v5.8.6​:

Configured by p013176 at Tue Dec 7 10​:11​:46 CET 2004.

Summary of my perl5 (revision 5 version 8 subversion 6) configuration​:
  Platform​:
  osname=solaris, osvers=2.9, archname=sun4-solaris-thread-multi-64int
  uname='sunos oikbm03 5.9 generic_112233-01 sun4u sparc sunw,ultra-5_10 '
  config_args='-Dprefix=/opt/perl -Uinstallusrbinperl -Dcc=gcc
-Doptimize=-O2 -Aldflags=-R/usr/local/lib -Duseshrplib -Duseperlio
-Dusethreads -Duselargefiles -Duse64bitint -des'
  hint=recommended, useposix=true, d_sigaction=define
  usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
  useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
  use64bitint=define use64bitall=undef uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='gcc', ccflags ='-D_REENTRANT -fno-strict-aliasing -pipe
-I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
  optimize='-O2',
  cppflags='-D_REENTRANT -fno-strict-aliasing -pipe -I/usr/local/include'
  ccversion='', gccversion='3.3.2', gccosandvers='solaris2.9'
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=87654321
  d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
  ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='gcc', ldflags =' -R/usr/local/lib -L/usr/local/lib '
  libpth=/usr/local/lib /usr/lib /usr/ccs/lib
  libs=-lsocket -lnsl -lgdbm -ldl -lm -lpthread -lc
  perllibs=-lsocket -lnsl -ldl -lm -lpthread -lc
  libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
  gnulibc_version=''
  Dynamic Linking​:
  dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -R
/opt/perl/lib/5.8.6/sun4-solaris-thread-multi-64int/CORE'
  cccdlflags='-fPIC', lddlflags='-G -R/usr/local/lib -L/usr/local/lib'

Locally applied patches​:
 


@​INC for perl v5.8.6​:
  /opt/perl/lib/5.8.6/sun4-solaris-thread-multi-64int
  /opt/perl/lib/5.8.6
  /opt/perl/lib/site_perl/5.8.6/sun4-solaris-thread-multi-64int
  /opt/perl/lib/site_perl/5.8.6
  /opt/perl/lib/site_perl
  .


Environment for perl v5.8.6​:
  HOME=/export/home/p013176
  LANG (unset)
  LANGUAGE (unset)
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=/usr/sbin/​:/opt/perl/bin/​:/usr/bin​:/usr/local/bin
  PERL_BADLANG (unset)
  SHELL=/bin/sh

@p5pRT
Copy link
Author

p5pRT commented Dec 8, 2004

From @rgs

Peter.Dintelmann@​dresdner-bank.com (via RT) wrote​:

The h2ph tool uses local() in generated subs. These days it should use
my() instead. This is not really a bug and is therefore classified
as "wishlist".

The patch below fixes this. Existing code should not be affected.

Good point. Thanks, applied to bleadperl as change #23628. (although to
h2ph.PL instead of h2ph which is a generated file)

@p5pRT
Copy link
Author

p5pRT commented Dec 8, 2004

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

@p5pRT
Copy link
Author

p5pRT commented Dec 8, 2004

@rgs - 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