Debian Bug report logs - #683495
perl scripts: "#!/usr/bin/perl" MUST or SHOULD?

version graph

Package: debian-policy; Maintainer for debian-policy is Debian Policy List <debian-policy@lists.debian.org>; Source for debian-policy is src:debian-policy.

Reported by: Ansgar Burchardt <ansgar@debian.org>

Date: Wed, 1 Aug 2012 09:36:02 UTC

Severity: normal

Found in version debian-policy/3.9.3.1

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian Policy List <debian-policy@lists.debian.org>:
Bug#683495; Package debian-policy. (Wed, 01 Aug 2012 09:36:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ansgar Burchardt <ansgar@debian.org>:
New Bug report received and forwarded. Copy sent to Debian Policy List <debian-policy@lists.debian.org>. (Wed, 01 Aug 2012 09:36:04 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Ansgar Burchardt <ansgar@debian.org>
To: submit@bugs.debian.org
Subject: perl scripts: "#!/usr/bin/perl" MUST or SHOULD?
Date: Wed, 01 Aug 2012 11:33:23 +0200
Package: debian-policy
Version: 3.9.3.1

Policy is not consistent about the requirement that perl scripts need to
use "#!/usr/bin/perl" and not, for example, "#!/usr/bin/env perl".

Policy 10.4 says "In the case of Perl scripts this should(!) be
#!/usr/bin/perl", but it's a hard requirement in the Debian Perl Policy
(5.1): "All packaged perl programs must(!) start with #!/usr/bin/perl
and may append such flags as are required".

(Okay, one can argue that Policy 11.9 only says packages SHOULD follow
the Perl policy.)

I have no strong opinion about this being a hard requirement or not, but
see the recent discussion on debian-perl@ [1].

Ansgar

[1] <https://lists.debian.org/debian-perl/2012/07/msg00138.html>



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Policy List <debian-policy@lists.debian.org>:
Bug#683495; Package debian-policy. (Sun, 05 Aug 2012 23:42:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Charles Plessy <plessy@debian.org>:
Extra info received and forwarded to list. Copy sent to Debian Policy List <debian-policy@lists.debian.org>. (Sun, 05 Aug 2012 23:42:03 GMT) Full text and rfc822 format available.

Message #10 received at 683495@bugs.debian.org (full text, mbox):

From: Charles Plessy <plessy@debian.org>
To: 683495@bugs.debian.org
Cc: debian-perl@lists.debian.org
Subject: Re: Mass-filing bug against use of '/usr/bin/env perl' shebang line
Date: Mon, 6 Aug 2012 08:38:56 +0900
user debian-policy@packages.debian.org
usertags 683495 normative discussion
thanks

Hello everybody,

to summarise:

 - from section 10.4, "command scripts (...) should have a #! line naming the
   shell to be used".  The next paragraph gives the example for Perl:
   "this should be #!/usr/bin/perl" ;

 - from section 11.9, "Perl programs and modules should follow the current Perl
   policy." ;

 - from the Perl policy's section 5.1, "packaged perl programs must start with
   #!/usr/bin/perl" ;

 - This may be misleading as somebody reading quickly may not realise that the
   "must" requirements in the Perl policy are mitigated to "should"
   requirements by the Policy's section 11.9.


This can be clarified, however, the same comment could be made about other "must"
points of the Perl policy.

Here are possible resolutions of this bug report.

 - Close, given that there is no internal contradiction within the Debian Policy
   nor the Perl policy.

 - Reduce the Perl policy's "must" to a "should".  A "should" still disallows
   the use of /usr/bin/env with no justification.  It is also in line with the
   fact that some packaged modules sometimes slip in Debian with scripts started
   with /usr/bin/env, without this being a serious bug requiring immediate action.

 - Change the Debian Policy's section 11.9 to require that the Perl policy "must"
   be followed.  I think that this would require to correct the packages that
   would become buggy according to that change, including those with scripts
   starting with /usr/bin/env.  But if it is a reachable target, why not ?


Side remark: for Python, section 1.4.2 of its policy also restricts the use of
/usr/bin/env under a "should not" directive, in line with Debian Policy's
section 10.4 that requests the scripts to started with a "shell", which
/usr/bin/env is not.


Have a nice day,

-- 
Charles Plessy
Tsurumi, Kanagawa, Japan



Information forwarded to debian-bugs-dist@lists.debian.org, Debian Policy List <debian-policy@lists.debian.org>:
Bug#683495; Package debian-policy. (Tue, 16 Oct 2012 21:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gian Piero Carrubba <gpiero@rm-rf.it>:
Extra info received and forwarded to list. Copy sent to Debian Policy List <debian-policy@lists.debian.org>. (Tue, 16 Oct 2012 21:30:03 GMT) Full text and rfc822 format available.

Message #15 received at 683495@bugs.debian.org (full text, mbox):

From: Gian Piero Carrubba <gpiero@rm-rf.it>
To: Charles Plessy <plessy@debian.org>
Cc: 683495@bugs.debian.org, debian-perl@lists.debian.org
Subject: Re: Mass-filing bug against use of '/usr/bin/env perl' shebang line
Date: Tue, 16 Oct 2012 23:17:50 +0200
Maintaining the cc: to debian-perl@l.d.o as the discussion has started 
there. Feel free to strip it out if you think isn't appropriate.

* [Mon, Aug 06, 2012 at 08:38:56AM +0900] Charles Plessy:
[...]
>Here are possible resolutions of this bug report.
>
> - Close, given that there is no internal contradiction within the 
> Debian Policy nor the Perl policy.

This seems fair enough, but ...

> - Reduce the Perl policy's "must" to a "should".  A "should" still 
> disallows the use of /usr/bin/env with no justification.  It is also 
> in line with the fact that some packaged modules sometimes slip in 
> Debian with scripts started with /usr/bin/env, without this being a 
> serious bug requiring immediate action.
>
> - Change the Debian Policy's section 11.9 to require that the Perl 
> policy "must" be followed.  I think that this would require to correct 
> the packages that would become buggy according to that change, 
> including those with scripts starting with /usr/bin/env.  But if it is 
> a reachable target, why not ?

... imho, merging these two points would be better. I mean:

> - Change the Debian Policy's section 11.9 to require that the Perl 
> policy "must" be followed. 

For the sake of clearness and because this way we can remove a sort of 
indeterminateness caused by a perl policy that should (and not must) be 
followed. As a general rule, I support the idea that also other specific 
(python/ruby/java/...) policies could be a "must", so becoming a sort of 
appendixes to the "general" policy.

AND

[ regarding `/usr/bin/perl' in the shebang line ]
> - Reduce the Perl policy's "must" to a "should". 

Because, apart from the reason above, I think there are some legitimate 
(though unusual) reasons for using /usr/bin/env. I'm thinking for 
example to a script that could copy itself to another (possibly not 
Debian nor Linux) host for remote execution. Something like what the 
sshuttle (python) script does.

@debian-perl people: do you think the perl policy as it stands (minus 
eventually the shebang must) could be a "must" policy?

>Side remark: for Python, section 1.4.2 of its policy also restricts the 
>use of /usr/bin/env under a "should not" directive, in line with Debian 
>Policy's section 10.4 that requests the scripts to started with a 
>"shell", which /usr/bin/env is not.

I was submitting a patch to lintian for including a check against the 
use of /usr/bin/env in perl scripts and just remembered this sentence 
from you. Could you please clarify the last point?

$10.4 reads:

 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.

As for my interpretation, '#!/usr/bin/env perl' still names the "shell", 
even if not giving the full path, so it does not violate that 
requirement. But if it's not the case, should we have a lintian check 
that warns about the use of /usr/bin/env whichever the real interpreter 
is ?

Ciao,
Gian Piero.



Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Wed Apr 23 07:34:59 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.