From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 18 20:53:06 2018 Received: (at submit) by debbugs.gnu.org; 19 Apr 2018 00:53:06 +0000 Received: from localhost ([127.0.0.1]:59871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8xov-0002YC-MI for submit@debbugs.gnu.org; Wed, 18 Apr 2018 20:53:05 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39582) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8xHB-0001hD-2C for submit@debbugs.gnu.org; Wed, 18 Apr 2018 20:18:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f8xH4-0007bh-Mv for submit@debbugs.gnu.org; Wed, 18 Apr 2018 20:18:07 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:41213) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f8xH4-0007bb-Jy for submit@debbugs.gnu.org; Wed, 18 Apr 2018 20:18:06 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58751) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f8xH2-0001KH-Sm for bug-coreutils@gnu.org; Wed, 18 Apr 2018 20:18:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f8xH1-0007aW-OD for bug-coreutils@gnu.org; Wed, 18 Apr 2018 20:18:04 -0400 Received: from mail-yw0-x22e.google.com ([2607:f8b0:4002:c05::22e]:35651) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f8xH1-0007aI-IX for bug-coreutils@gnu.org; Wed, 18 Apr 2018 20:18:03 -0400 Received: by mail-yw0-x22e.google.com with SMTP id i144-v6so1146166ywc.2 for ; Wed, 18 Apr 2018 17:18:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=2SwXqeKOu9V3D+pdgwATPr+vS2b9ddthSRtUn1/o0Eg=; b=dgYymeLXWyxzuYWBvR/fZJP9SgvfyUqw8fSDPj2/QcR8u52pS9vDOnWVOR39N/VA+O /DZQFLUXXXWeBoaRxBWi8PiPau4hevPzHsqy4Prc67uBAkxZanloEUjo6bWWGaUW/xlB uVZh2ekh2FYr7PSdAvLr3ARkaiiiWGmkdcXO4GdfgZXYUiju6hW/7yueBinzIOHzAQa7 Tgry3vQJmXTjYj40FC1pG3UvxJ6xYcOqZrN+BQV+EstKZXS4VQlrR6a6z5UGBVlWIU8G h/pVijfYU7Ex6k03AawsnkWpyjsl64YgcEC8bgJu+YMGTsg3mF6aO9OMX+rrnHrqaIlj Q0tA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=2SwXqeKOu9V3D+pdgwATPr+vS2b9ddthSRtUn1/o0Eg=; b=IVErVi1/dF+lyS2l6ijRBdNTV518jqD1OkUjf2WEw0grQ1F4VzSg0EyGs5sJasWWCu YCuR7+JGJYg4bW1bcaiu1KY9v/PnxS2tGEfnV4LMhmTZ08UkiSSCAhVHwTxmWD1yaO4H bUmyHxDz2PJ4EPupCMNpnB1VIlr/+StQIxsSb1LNIRI+b5Xsl/K0IG6Y0sn9+zx+Mfg5 BnkGSQYfyGhsd975CPNqDjp4DmpWUuE/knKcTilRlwBPYIX3RWGpKugGaBdDa5AeCCZ8 0mMACm37qublHy7GSNALTRSbmlF4B6hUssXaJHdd8VTBooy9t/IIrnV28F1586q6uCMn rmvA== X-Gm-Message-State: ALQs6tCUnfoJbMGWBVckO0JaYjJEBc8J8cQ3vHPB+mGklagS1ct/q88K TJv+6QgePqxyxdzG1LhwAb+NOKgC3INyiBACz6hPig== X-Google-Smtp-Source: AIpwx49HtDDtH0hbMKeYMXGak6Zr/fn1gsBIb28ehYNT5PmAyfWhvd7lL7gLETerUH3GSBtJuC0C6Iuovt/ByV+VYXE= X-Received: by 2002:a0d:eb54:: with SMTP id u81-v6mr2604533ywe.42.1524097082683; Wed, 18 Apr 2018 17:18:02 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:be82:0:0:0:0:0 with HTTP; Wed, 18 Apr 2018 17:18:01 -0700 (PDT) From: William Schmidt Date: Wed, 18 Apr 2018 19:18:01 -0500 Message-ID: Subject: coreutils env fails in a bash shebang To: bug-coreutils@gnu.org Content-Type: multipart/alternative; boundary="00000000000037758f056a2881b4" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Wed, 18 Apr 2018 20:53:04 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --00000000000037758f056a2881b4 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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: =E2=80=98perl -w=E2=80=99: 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 --00000000000037758f056a2881b4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I think I've found a bug in <= b>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

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

/usr/bin/env: =E2=80=98pe= rl -w=E2=80=99: 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 remov= e 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 w= ay 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=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0
Reading state information... Done
coreut= ils is already the newest version (8.26-3).

Both of these sheb= angs work correctly in macOS 10.13.3 with the native perl from Apple and pe= rlbrew 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 <= b>env, something in bash or pilot error?

Regards,
T.W. Schmid= t



--00000000000037758f056a2881b4-- From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 18 23:03:42 2018 Received: (at 31215) by debbugs.gnu.org; 19 Apr 2018 03:03:42 +0000 Received: from localhost ([127.0.0.1]:59934 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8zrK-0001AS-0f for submit@debbugs.gnu.org; Wed, 18 Apr 2018 23:03:42 -0400 Received: from mail.magicbluesmoke.com ([82.195.144.49]:47946) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8zrI-0001AJ-R4 for 31215@debbugs.gnu.org; Wed, 18 Apr 2018 23:03:41 -0400 Received: from localhost.localdomain (unknown [76.21.115.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.magicbluesmoke.com (Postfix) with ESMTPSA id DD80F98B4; Thu, 19 Apr 2018 04:03:38 +0100 (IST) Subject: Re: bug#31215: coreutils env fails in a bash shebang To: William Schmidt , 31215@debbugs.gnu.org References: From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: <37c0b409-5c2d-9146-6871-7d27b350f016@draigBrady.com> Date: Wed, 18 Apr 2018 20:03:36 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 31215 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 18/04/18 17:18, William Schmidt wrote: > 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? The kernel passes "perl -w" to env as a single argument. This was previous discussed at: https://lists.gnu.org/archive/html/coreutils/2017-05/msg00020.html We may add the -S option to support this usage. cheers, Pádraig From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 18 23:11:10 2018 Received: (at control) by debbugs.gnu.org; 19 Apr 2018 03:11:10 +0000 Received: from localhost ([127.0.0.1]:59944 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8zyY-0001L1-A5 for submit@debbugs.gnu.org; Wed, 18 Apr 2018 23:11:10 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:36894 helo=mx1.redhat.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f8zyV-0001Ki-Nd; Wed, 18 Apr 2018 23:11:08 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6B6638DC34; Thu, 19 Apr 2018 03:11:02 +0000 (UTC) Received: from [10.10.123.194] (ovpn-123-194.rdu2.redhat.com [10.10.123.194]) by smtp.corp.redhat.com (Postfix) with ESMTP id 127BE63533; Thu, 19 Apr 2018 03:11:02 +0000 (UTC) Subject: Re: bug#31215: coreutils env fails in a bash shebang To: William Schmidt , 31215-done@debbugs.gnu.org References: From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg Organization: Red Hat, Inc. Message-ID: <8797b717-4ea0-a525-0912-1a522cd4f5fb@redhat.com> Date: Wed, 18 Apr 2018 22:11:01 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UzRZ18bZGcJZuRQNLE0irRyVjcsYeqxEv" X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 19 Apr 2018 03:11:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 19 Apr 2018 03:11:02 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'eblake@redhat.com' RCPT:'' X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --UzRZ18bZGcJZuRQNLE0irRyVjcsYeqxEv Content-Type: multipart/mixed; boundary="S5l8NUWW5eZqRiptVSsG66UobW79HHztW"; protected-headers="v1" From: Eric Blake To: William Schmidt , 31215-done@debbugs.gnu.org Message-ID: <8797b717-4ea0-a525-0912-1a522cd4f5fb@redhat.com> Subject: Re: bug#31215: coreutils env fails in a bash shebang References: In-Reply-To: --S5l8NUWW5eZqRiptVSsG66UobW79HHztW Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable tag 31215 notabug thanks On 04/18/2018 07:18 PM, William Schmidt wrote: > I think I've found a bug in *coreutils*, *env*. >=20 > Linux debian 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3+deb9u1 (2017-12-23) > x86_64 GNU/Linux >=20 > All my Perl scripts contain either of these shebangs: >=20 > #!/usr/bin/env perl -w > or > #!/usr/bin/env perl -wd That is inherently non-portable. On some operating systems (such as GNU/Linux), the #! line is limited to EXACTLY ONE argument beyond the name of the executable. But you are trying to shoehorn two arguments ("perl" and "-w"). Just because it may have worked on some other operating systems does not make it portable. There may be ways to do what you want by telling perl to turn on -w or -wd in subsequent lines of the script, or you can rewrite the #! line to use /path/to/perl instead of trying to make env do the work. Or perldoc even includes some arcane formulas for using #!/bin/sh as the start, and then exec into perl with as many desired arguments as you want (including by using env to locate perl), as the first line when interpreted by sh, while that exec line is skipped by perl. But as this is a limitation of your operating system's handling of #! and not a bug in env, there's nothing we can do about it in coreutils' env. So I'm closing this bug. > 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 b= ut > now I need to move those scripts to debian, without changing the sheban= gs. > Is this a bug in *env*, something in bash or pilot error? Pilot error, as you have used two different OS with different #! handling rules. --=20 Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org --S5l8NUWW5eZqRiptVSsG66UobW79HHztW-- --UzRZ18bZGcJZuRQNLE0irRyVjcsYeqxEv Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEzBAEBCAAdFiEEccLMIrHEYCkn0vOqp6FrSiUnQ2oFAlrYCMUACgkQp6FrSiUn Q2pyqQf/UdVX/Qakt76CUlcuuEi4Cp4b63GKyWKPFR/CmkwAHHVADT5Bft9uBg7c m7aDKVSWlKmjDAajL3p+oLumBATmiIRwS/Sby9QTsewZBgrPpP8IVaLUvu0AshNl WlYtM8lUAGoRmGDYeWWroFGDGeCead0+IU9SIA/bPpwgavl37Cmn2Veld51Ijte0 scQ0rbTuWX7B8p6+XKGzIiJqJSUIa6jAhEJH8I2jnsUzPUuQU8l2d537CNxYQimO z6Xy+nChfNBMDRolTULj6VUJj9qjke6F9I+n8TAqPQrf7OJHJMYLG59oLSOQkGC/ Uc+Zim/OTh9XlxMVYgl4qqnvVDJFrA== =1j+6 -----END PGP SIGNATURE----- --UzRZ18bZGcJZuRQNLE0irRyVjcsYeqxEv-- From unknown Tue Aug 19 21:02:58 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 17 May 2018 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator