Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.98k stars 560 forks source link

Perl executable pathname may be incorrectly specified in provided utilities #18273

Open mjetzer opened 4 years ago

mjetzer commented 4 years ago

This is a bug report for perl from mjetzer.cdc@gmail.com, generated with the help of perlbug 1.42 running under perl 5.32.0.


[Please describe your issue here]

When I configured perl, I specified a non-standard perl executable name (/usr/bin/catperl-5.32.0) for the "What shall I put after the #! to start up perl ("none" to not use #!)?" question.

When the utilities were installed, that executable name was, indeed, on the "#!" line. However, the "if $running_under_some_shell" test used a different executable name:

    #!/usr/bin/catperl-5.32.0
        eval 'exec /u/local/bin/perl5.32.0 -S $0 ${1+"$@"}'
            if $running_under_some_shell;

I specified "/u/local" for "Installation prefix to use?", "What installation prefix should I use for installing files?", and "Installation prefix to use for add-on modules and utilities?" so that is likely the source of the second executable name.

I would expect the name of the interpreter to be the same on both the "#!" line and in the "if $running_under_some_shell" test.

[Please do not change anything below this line]


Flags: category=utilities severity=low

Site configuration information for perl 5.32.0:

Configured by mikej at Mon Oct 26 13:06:03 CDT 2020.

Summary of my perl5 (revision 5 version 32 subversion 0) configuration:

  Platform:
    osname=linux
    osvers=3.10.0-514.el7.x86_64
    archname=x86_64-linux
    uname='linux catdev7 3.10.0-514.el7.x86_64 #1 smp wed oct 19 11:24:13 edt 2016 x86_64 x86_64 x86_64 gnulinux '
    config_args=''
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=undef
    usemultiplicity=undef
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=undef
    bincompat5005=undef
  Compiler:
    cc='cc'
    ccflags ='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -s -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2'
    optimize='-O2'
    cppflags='-fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -s'
    ccversion=''
    gccversion='4.8.5 20150623 (Red Hat 4.8.5-11)'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='cc'
    ldflags =' -fstack-protector-strong'
    libpth=/usr/lib64
    libs=-lpthread -lnsl -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
    libc=libc-2.17.so
    so=so
    useshrplib=false
    libperl=libperl.a
    gnulibc_version='2.17'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=so
    d_dlsymun=undef
    ccdlflags='-Wl,-E'
    cccdlflags='-fPIC'
    lddlflags='-shared -O2 -fstack-protector-strong'

---
@INC for perl 5.32.0:
    /etc/catalyst/catperl-5.32.0/x86_64-linux
    /etc/catalyst/catperl-5.32.0
    /etc/catalyst/catperl-5.32.0/x86_64-linux
    /etc/catalyst/catperl-5.32.0

---
Environment for perl 5.32.0:
    HOME=/u1/osc2prog
    LANG=en_US.utf8
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/u/local/lib/zlib-1.2.11/lib:/u/local/lib/libxml2-2.6.17/lib:/u/local/lib/openldap-2.3.39/lib:/u/local/lib/krb5-1.6.3/lib:/u/local/lib/openssl-0.9.8h/lib:/u/local/lib/cyrus-sasl-2.1.22/lib:/lib:/usr/lib:/u01/app/oracle/product/19.0.0/client_1/lib
    LOGDIR (unset)
    PATH=/u1/osc2prog/bin:/u1/osc2prog/etc:/u1/osc2prog/local/bin:/u/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/u/local/bin:/bin:/usr/bin:/etc:/u01/app/oracle/product/19.0.0/client_1/bin
    PERL_BADLANG (unset)
    SHELL=/bin/ksh
jkeenan commented 4 years ago

This is a bug report for perl from mjetzer.cdc@gmail.com, generated with the help of perlbug 1.42 running under perl 5.32.0.

[Please describe your issue here]

When I configured perl, I specified a non-standard perl executable name (/usr/bin/catperl-5.32.0) for the "What shall I put after the #! to start up perl ("none" to not use #!)?" question.

When the utilities were installed, that executable name was, indeed, on the "#!" line. However, the "if $running_under_some_shell" test used a different executable name:

    #!/usr/bin/catperl-5.32.0
        eval 'exec /u/local/bin/perl5.32.0 -S $0 ${1+"$@"}'
            if $running_under_some_shell;

I specified "/u/local" for "Installation prefix to use?", "What installation prefix should I use for installing files?", and "Installation prefix to use for add-on modules and utilities?" so that is likely the source of the second executable name.

I would expect the name of the interpreter to be the same on both the "#!" line and in the "if $running_under_some_shell" test.

Based on my reading of INSTALL (starting at line 31), I attempted the following:

$ sh ./Configure -des -Dusedevel -Dprefix='tmp/gh-18273' 
$ make install PERLNAME=catperl-5.32.0

If you were to do that, how close would that be to what you need?

Thank you very much. Jim Keenan

jkeenan commented 3 years ago

This is a bug report for perl from mjetzer.cdc@gmail.com, generated with the help of perlbug 1.42 running under perl 5.32.0. [Please describe your issue here] When I configured perl, I specified a non-standard perl executable name (/usr/bin/catperl-5.32.0) for the "What shall I put after the #! to start up perl ("none" to not use #!)?" question. When the utilities were installed, that executable name was, indeed, on the "#!" line. However, the "if $running_under_some_shell" test used a different executable name:

    #!/usr/bin/catperl-5.32.0
        eval 'exec /u/local/bin/perl5.32.0 -S $0 ${1+"$@"}'
            if $running_under_some_shell;

I specified "/u/local" for "Installation prefix to use?", "What installation prefix should I use for installing files?", and "Installation prefix to use for add-on modules and utilities?" so that is likely the source of the second executable name. I would expect the name of the interpreter to be the same on both the "#!" line and in the "if $running_under_some_shell" test.

Based on my reading of INSTALL (starting at line 31), I attempted the following:

$ sh ./Configure -des -Dusedevel -Dprefix='tmp/gh-18273' 
$ make install PERLNAME=catperl-5.32.0

If you were to do that, how close would that be to what you need?

Thank you very much. Jim Keenan

@mjetzer, have you had a chance to consider the suggestion above?

Thank you very much. Jim Keenan

mjetzer commented 3 years ago

Since we only run Perl under Unix versions which respect the "#!" interpreter mechanism, the "eval" executable name of no consequence to us. I only reported it as it appeared to be a bug in the configuration/compilation system.

As I've already rolled this out to a number of machines, I have no interest in recompiling Perl. As I said, it appeared to be a bug so I reported it in case it might be important to someone.

On Wed, Dec 23, 2020 at 9:04 PM James E Keenan notifications@github.com wrote:

This is a bug report for perl from mjetzer.cdc@gmail.com, generated with the help of perlbug 1.42 running under perl 5.32.0. [Please describe your issue here] When I configured perl, I specified a non-standard perl executable name (/usr/bin/catperl-5.32.0) for the "What shall I put after the #! to start up perl ("none" to not use #!)?" question. When the utilities were installed, that executable name was, indeed, on the "#!" line. However, the "if $running_under_some_shell" test used a different executable name:

#!/usr/bin/catperl-5.32.0
    eval 'exec /u/local/bin/perl5.32.0 -S $0 ${1+"$@"}'
        if $running_under_some_shell;

I specified "/u/local" for "Installation prefix to use?", "What installation prefix should I use for installing files?", and "Installation prefix to use for add-on modules and utilities?" so that is likely the source of the second executable name. I would expect the name of the interpreter to be the same on both the "#!" line and in the "if $running_under_some_shell" test.

Based on my reading of INSTALL (starting at line 31), I attempted the following:

$ sh ./Configure -des -Dusedevel -Dprefix='tmp/gh-18273' $ make install PERLNAME=catperl-5.32.0

If you were to do that, how close would that be to what you need?

Thank you very much. Jim Keenan

@mjetzer https://github.com/mjetzer, have you had a chance to consider the suggestion above?

Thank you very much. Jim Keenan

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Perl/perl5/issues/18273#issuecomment-750717512, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARR6PCHN7JFUFDHMJO3HBL3SWKVS5ANCNFSM4TD4SW3Q .

tonycoz commented 3 years ago

I don't think this is actually a bug, though the code that's generated is a bit misleading.

The string used to generate the #! and the eval exec code is like:

print OUT <<"!GROK!THIS!";
$Config{startperl}
    eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
    if 0; # ^ Run only under a shell
!GROK!THIS!

From looking at Configure, it prompts for startperl, and if none is provided (setting startperl to : # use perl) for that only then prompts for perlpath, and that is only expected to be used when the #! won't be used to invoke perl.

Assuming this is right the prefix above is misleading but harmless.

Is this the intent @Tux?