From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Wooledge Subject: bug#22354: Hash-bang line length Date: Wed, 13 Jan 2016 09:04:41 -0500 Message-ID: <20160113140441.GZ27325__7010.29465203664$1452693920$gmane$org@eeg.ccf.org> References: <87lh7t7p4w.fsf@gnu.org> <20160113131902.GU27325@eeg.ccf.org> <87y4bt60zb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39712) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJM2p-0003dt-Bm for bug-guix@gnu.org; Wed, 13 Jan 2016 09:05:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aJM2o-0000Yv-EC for bug-guix@gnu.org; Wed, 13 Jan 2016 09:05:03 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:59701) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aJM2o-0000Yr-Aw for bug-guix@gnu.org; Wed, 13 Jan 2016 09:05:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aJM2o-0006B7-4z for bug-guix@gnu.org; Wed, 13 Jan 2016 09:05:02 -0500 Sender: "Debbugs-submit" Resent-Message-ID: Content-Disposition: inline In-Reply-To: <87y4bt60zb.fsf@gnu.org> List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 22354@debbugs.gnu.org, bug-bash@gnu.org On Wed, Jan 13, 2016 at 02:52:08PM +0100, Ludovic Courtès wrote: > Sure, but the fact that it???s smaller than that of the kernel Linux is > problematic: when a hash-bang line > 127 chars is encountered, ???execve??? > fails with ENOENT, so Bash???s fallback code is executed, fails as well, > but it prints a misleading error message with an even more truncated > hash-bang line. Let's suppose bash is changed to read a shebang line of unlimited length. In your scenario, the script with the 150 character shebang fails at the kernel level with ENOENT, so bash's fallback code runs, and the script is executed by a new instance of bash. This just masks the problem. Now, your script ONLY works when you run it from a bash shell. Not from any other shell, not via C's exec(), not via find -exec, etc. That said, it's not bash's place to try to guess how the host system's kernel will handle the shebang. I certainly wouldn't expect bash to tell me "Hey, this is Linux, so your shebang won't work because it's more than 127 bytes." I'm not sure what error message or behavior you think bash should employ in this scenario. I don't see any clear "best" choice here.