GNU bug report logs - #31215
coreutils env fails in a bash shebang

Previous Next

Package: coreutils;

Reported by: William Schmidt <t.william.schmidt <at> gmail.com>

Date: Thu, 19 Apr 2018 00:54:02 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: William Schmidt <t.william.schmidt <at> gmail.com>
To: 31215 <at> debbugs.gnu.org
Subject: bug#31215: coreutils env fails in a bash shebang
Date: Wed, 18 Apr 2018 19:18:01 -0500
[Message part 1 (text/plain, inline)]
I think I've found a bug in *coreutils*, *env*.

Linux debian 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23)
x86_64 GNU/Linux

All my Perl scripts contain either of these shebangs:

#!/usr/bin/env perl -w
or
#!/usr/bin/env perl -wd

When I attempt to run a Perl script with either of these shebangs in debian
I get:

/usr/bin/env: ‘perl -w’: No such file or directory

It is not perl that can't be found; it is either *env*'s or *bash*'s
handling of the argument. If I remove the *-w* and/or the *-wd* arguments
the scripts execute, but of course, without the benefit of those switches.

The man page for *env* asserts that any command may take an argument. I
have tried every way I can think of to quote the *-w* and the *-wd* but
*env* is treating these perl command line arguments as filenames, and since
they aren't files, renders that error message. I'm running the latest
*coreutils* as in this apt-get fragment:

Reading package lists... Done
Building dependency tree
Reading state information... Done
coreutils is already the newest version (8.26-3).

Both of these shebangs work correctly in macOS 10.13.3 with the native perl
from Apple and perlbrew perl. That is where I do most of my perl work but
now I need to move those scripts to debian, without changing the shebangs.
Is this a bug in *env*, something in bash or pilot error?

Regards,
T.W. Schmidt
[Message part 2 (text/html, inline)]

This bug report was last modified 7 years and 96 days ago.

Previous Next


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