[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#344269: lintian: false executable-not-elf-or-script warning with perl magic header



Russ Allbery <rra@debian.org> wrote:

> Frank Küster <frank@kuesterei.ch> writes:
>
>> Err, it only runs without it, but I guess that's because the shebang
>> line should be "#!/usr/bin/perl", not "#!/bin/sh".
>
> Hm, the whole point of that sort of magic is that it's supposed to handle
> being run under the shell.  But indeed I can duplicate this, and I'm
> completely mystified why.  If one omits #!/bin/sh, it runs fine, even
> though this still spawns a shell.  If one includes it, Perl is spawned and
> then appears to exec /bin/sh to run the script again but passes the -wS
> option to it, at which point it fails due to an invlaid option.
[...]
> Well, give that this weird construct works and only works without the
> shebang line, maybe fixing lintian to recognize it and not complain about
> it *is* the right thing to do.  Although the problem it's addressing seems
> pretty obscure to me at this point.

Here's some more code to chew on:

#! /bin/sh
eval '(exit $?0)' && eval 'PERL_BADLANG=x;export PERL_BADLANG;: \
;exec perl -x -S -- "$0" ${1+"$@"};#'if 0;
eval 'setenv PERL_BADLANG x;exec perl -x -S -- "$0" $argv:q;#'.q+
#!perl -w
package Htex::a2ping;  $0=~/(.*)/s;unshift@INC,'.';do($1);die$@if$@;__END__+if !1;
# This Perl script was generated by JustLib2 at Wed Apr 23 09:14:13 2003.
# Don't touch/remove any lines above; http://www.inf.bme.hu/~pts/justlib

lintian complains:

E: tetex-bin: shell-script-fails-syntax-check ./usr/bin/a2ping

The script in fact starts fine.

Regards, Frank
-- 
Frank Küster
Inst. f. Biochemie der Univ. Zürich
Debian Developer




Reply to: