[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



Frank Küster <frank@kuesterei.ch> writes:
> Russ Allbery <rra@debian.org> wrote:
>> Frank Küster <frank@debian.org> writes:

>>> eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q'
>>>   if 0;
>>> use strict;

>> Is that the first line of the file?  Generally one still starts such a
>> script with #!/bin/sh.  Otherwise, you're relying on the assumption
>> that any unrecognized file is started under /bin/sh.

> Yes, obviously upstream is relying on that, but it seems this is also
> needed.  If I add a #!/bin/sh line, I get a shell error instead of perl
> execution.  I don't know whether this means that the magic is not magic
> enough, or what.

Does the script run without #!/bin/sh then?  It would really surprise me
if the script ran without it but didn't run with it, although maybe
there's some way in which it's dependent on having that line be the very
first line?

man perlrun under the -S option explains what's going on here, but
frankly, portability to systems that don't support #! lines or that start
shell scripts in csh even if #!/bin/sh is on the first line of the file is
just an intellectual exercise at this point.  Not even the Autoconf people
care about portability to such systems any more.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>



Reply to: