Bug#344269: lintian: false executable-not-elf-or-script warning with perl magic header
I believe that this bug has been resolved incorrectly. Section 10.4 of the Debian Policy says: All command scripts, including the package maintainer scripts inside the package and used by dpkg, should have a #! line naming the shell to be used to interpret them. In the case of Perl scripts this should be #!/usr/bin/perl. Moreover, section 5.g of the Etch RC Policy says: Scripts must include the appropriate #! line, and set executable. It seems that tetex-base has a release-critical bug, and that lintian was right to complain about it.
Bug#344269: lintian: false executable-not-elf-or-script warning with perl magic header
Piotr Engelking [EMAIL PROTECTED] writes: I believe that this bug has been resolved incorrectly. Section 10.4 of the Debian Policy says: All command scripts, including the package maintainer scripts inside the package and used by dpkg, should have a #! line naming the shell to be used to interpret them. In the case of Perl scripts this should be #!/usr/bin/perl. Moreover, section 5.g of the Etch RC Policy says: Scripts must include the appropriate #! line, and set executable. It seems that tetex-base has a release-critical bug, and that lintian was right to complain about it. I'm going to wait and see what the outcome of Frank's query is before changing this, but thank you for pointing this out. I should have checked this myself. A Policy should should translate into at least a lintian warning, and a release policy must should translate into a lintian error, so unless Policy changes, I expect I'll at least partially revert this. -- Russ Allbery ([EMAIL PROTECTED]) http://www.eyrie.org/~eagle/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]
Bug#344269: lintian: false executable-not-elf-or-script warning with perl magic header
Russ Allbery [EMAIL PROTECTED] wrote: Frank Küster [EMAIL PROTECTED] 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;[EMAIL PROTECTED],'.';do($1);[EMAIL PROTECTED]@;__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
Bug#344269: lintian: false executable-not-elf-or-script warning with perl magic header
Russ Allbery [EMAIL PROTECTED] wrote: Frank Küster [EMAIL PROTECTED] writes: Russ Allbery [EMAIL PROTECTED] wrote: Frank Küster [EMAIL PROTECTED] 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, Err, it only runs without it, but I guess that's because the shebang line should be #!/usr/bin/perl, not #!/bin/sh. man perlrun under the -S option explains what's going on here, Good to read an explanation of these magic lines, thank you. This tells me that the purpose of the magic is to be able to start the script with perl even on systems that do not understand the shebang line. I was thinking (and am still unsure) that there is an additional purpose: Being able to run the script without relying on a specific path for perl. Yes, in fact if I move perl to /usr/local/bin, the script (without any shebang line) still works, a normal perl script with #!/usr/bin/perl of course not. So the question is whether it's worth to patch upstream's script just to have a nice shebang line, while it works fine without it, but in any case this isn't a bug in lintian, but a question about overriding or fixing. 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. According to man perlrun, the first line must be #!/usr/bin/perl, and I think I have just confused you with my misconception. If it is in fact supposed to work with #!/bin/sh, then I'm puzzled (because it doesn't), and then I think this bug still applies (because I don't think it's a worthwile goal to break things [on other systems] that work, just to make it look nicer). Regards, Frank -- Frank Küster Inst. f. Biochemie der Univ. Zürich Debian Developer
Bug#344269: lintian: false executable-not-elf-or-script warning with perl magic header
Frank Küster [EMAIL PROTECTED] 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. I have no idea why that would be happening. Some bizarre code in perl -S maybe? Maybe perl -S tries to honor the #! line? This tells me that the purpose of the magic is to be able to start the script with perl even on systems that do not understand the shebang line. I was thinking (and am still unsure) that there is an additional purpose: Being able to run the script without relying on a specific path for perl. Yes, but there's a much easier way to do that if that's all you want. #!/usr/bin/env perl (Or perl -S for some weird platforms, although I've never seen that be necesary.) It's quite common for Python scripts to use this technique. So the question is whether it's worth to patch upstream's script just to have a nice shebang line, while it works fine without it, but in any case this isn't a bug in lintian, but a question about overriding or fixing. 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. -- Russ Allbery ([EMAIL PROTECTED]) http://www.eyrie.org/~eagle/
Bug#344269: lintian: false executable-not-elf-or-script warning with perl magic header
Russ Allbery [EMAIL PROTECTED] wrote: 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. Hm, yes. But then the perlrun manpage should be clearer about this; in case you change lintian, will you file a bug against perl? Regards, Frank -- Frank Küster Inst. f. Biochemie der Univ. Zürich Debian Developer
Bug#344269: lintian: false executable-not-elf-or-script warning with perl magic header
Russ Allbery [EMAIL PROTECTED] wrote: Frank Küster [EMAIL PROTECTED] writes: Package: lintian Version: 1.23.8 Severity: normal Lintian warns about executable-not-elf-or-script on tetex-base's thumbpdf.pl and uniqleaf.pl. Both contain a magic perl header eval '(exit $?0)' eval 'exec perl -S $0 ${1+$@}' eval 'exec perl -S $0 $argv:q' if 0; use strict; It should either accept that header, or tell me why it is wrong. I know that many trying-to-be-portable perl scripts use such a header. 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. Regards, Frank -- Frank Küster Inst. f. Biochemie der Univ. Zürich Debian Developer
Bug#344269: lintian: false executable-not-elf-or-script warning with perl magic header
Frank Küster [EMAIL PROTECTED] writes: Russ Allbery [EMAIL PROTECTED] wrote: Frank Küster [EMAIL PROTECTED] 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 ([EMAIL PROTECTED]) http://www.eyrie.org/~eagle/
Bug#344269: lintian: false executable-not-elf-or-script warning with perl magic header
Package: lintian Version: 1.23.8 Severity: normal Lintian warns about executable-not-elf-or-script on tetex-base's thumbpdf.pl and uniqleaf.pl. Both contain a magic perl header eval '(exit $?0)' eval 'exec perl -S $0 ${1+$@}' eval 'exec perl -S $0 $argv:q' if 0; use strict; It should either accept that header, or tell me why it is wrong. I know that many trying-to-be-portable perl scripts use such a header. Regards, Frank -- System Information: Debian Release: 3.1 Architecture: i386 (i686) Kernel: Linux 2.6.10 Locale: [EMAIL PROTECTED], [EMAIL PROTECTED] (charmap=ISO-8859-15) Versions of packages lintian depends on: ii binutils 2.15-6The GNU assembler, linker and bina ii diffstat 1.39-1produces graph of changes introduc ii file 4.12-1Determines file type using magic ii gettext0.14.4-2 GNU Internationalization utilities ii intltool-debian0.30+20040213 Help i18n of RFC822 compliant conf ii man-db 2.4.2-21 The on-line manual pager ii perl [libdigest-md5-perl] 5.8.4-8 Larry Wall's Practical Extraction -- no debconf information -- Frank Küster Inst. f. Biochemie der Univ. Zürich Debian Developer
Bug#344269: lintian: false executable-not-elf-or-script warning with perl magic header
Frank Küster [EMAIL PROTECTED] writes: Package: lintian Version: 1.23.8 Severity: normal Lintian warns about executable-not-elf-or-script on tetex-base's thumbpdf.pl and uniqleaf.pl. Both contain a magic perl header eval '(exit $?0)' eval 'exec perl -S $0 ${1+$@}' eval 'exec perl -S $0 $argv:q' if 0; use strict; It should either accept that header, or tell me why it is wrong. I know that many trying-to-be-portable perl scripts use such a header. 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. -- Russ Allbery ([EMAIL PROTECTED]) http://www.eyrie.org/~eagle/