GNU bug report logs - #24055
Bug: #!/usr/bin/env gives poor error message for DOS line-endings

Previous Next

Package: coreutils;

Reported by: Simon Richard Clarkstone <src <at> corefiling.com>

Date: Fri, 22 Jul 2016 22:23:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24055 in the body.
You can then email your comments to 24055 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

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


Report forwarded to bug-coreutils <at> gnu.org:
bug#24055; Package coreutils. (Fri, 22 Jul 2016 22:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Simon Richard Clarkstone <src <at> corefiling.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Fri, 22 Jul 2016 22:23:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Simon Richard Clarkstone <src <at> corefiling.com>
To: bug-coreutils <at> gnu.org
Subject: Bug: #!/usr/bin/env gives poor error message for DOS line-endings
Date: Fri, 22 Jul 2016 21:39:58 +0100
I have found a poor error message in env (GNU coreutils) 8.23, on FC22.

---

I created the following executable file, with a DOS line-end:

#!/usr/bin/env sh

When run, it displays the following error message on my terminal:

: No such file or directory

This error message is cryptic.  However, if you process stderr through 
`cat -v` to display nonprintable characters, you find the error message 
has a CR in it:

/usr/bin/env: sh^M: No such file or directory

and the CR caused the second half of the error message to over-write the 
first half when displayed on-screen.

---

To diagnose the problem I had to use strace, so IMO this error message 
could be improved by expanding out control characters.  For example see 
how bash handles an analogous situation, with the script:

#!/usr/bin/sh

Which displays:

bash: ./tmp.sh: /usr/bin/sh^M: bad interpreter: No such file or directory

Here, bash has expanded out the ^M before displaying it, showing that 
something is stuck on the end of the #! line.

-- 
Simon Richard Clarkstone, CoreFiling Limited
Software Engineer, Data Modelling
http://www.corefiling.com/
Phone: +44-1865-203192




Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Fri, 22 Jul 2016 22:59:01 GMT) Full text and rfc822 format available.

Notification sent to Simon Richard Clarkstone <src <at> corefiling.com>:
bug acknowledged by developer. (Fri, 22 Jul 2016 22:59:02 GMT) Full text and rfc822 format available.

Message #10 received at 24055-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Simon Richard Clarkstone <src <at> corefiling.com>, 24055-done <at> debbugs.gnu.org
Subject: Re: bug#24055: Bug: #!/usr/bin/env gives poor error message for DOS
 line-endings
Date: Fri, 22 Jul 2016 23:57:58 +0100
On 22/07/16 21:39, Simon Richard Clarkstone wrote:
> I have found a poor error message in env (GNU coreutils) 8.23, on FC22.
> 
> ---
> 
> I created the following executable file, with a DOS line-end:
> 
> #!/usr/bin/env sh
> 
> When run, it displays the following error message on my terminal:
> 
> : No such file or directory
> 
> This error message is cryptic.  However, if you process stderr through 
> `cat -v` to display nonprintable characters, you find the error message 
> has a CR in it:
> 
> /usr/bin/env: sh^M: No such file or directory

That's fixed by the new file name quoting in coreutils 8.25.
The new output is:

/usr/bin/env: ‘sh\r’: No such file or directory

thanks,
Pádraig.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 20 Aug 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 301 days ago.

Previous Next


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