Bug 5612

Summary: Ignore \r at the end of interpreter line
Product: Other Reporter: Behdad Esfahbod (kernel)
Component: OtherAssignee: other_other
Status: REJECTED INVALID    
Severity: low CC: protasnb
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.13 Subsystem:
Regression: --- Bisected commit-id:
Attachments: Patch

Description Behdad Esfahbod 2005-11-15 12:13:45 UTC
Distribution: Fedora Core 4
Problem Description:

When a shell script or any other script using the hash-bang to run an
interpreter happens ot have Windows-style line termination (\r\n), trying to run
it returns "bad interpreter", because the kernel is parsing the \r as part of
the interpreter file name.

The kernel already ignores spaces at the end of the interpreter line.  It should
also ignore the \r character at the very end of the line.

Steps to reproduce:

Create a file test.sh containing the following line:

#!/bin/sh

Do unix2dos test.sh
Make it executable: chmod a+x test.sh
Try to run it: ./test.sh
Comment 1 Eric Sesterhenn 2006-07-03 13:49:34 UTC
Created attachment 8485 [details]
Patch

This trivial patch should fix this
Comment 2 Natalie Protasevich 2008-03-10 20:52:14 UTC
Eric, would you mind to submit the patch to lkml, since it won't be picked up from bugzilla.
Thanks.
Comment 3 Behdad Esfahbod 2008-09-22 09:43:25 UTC
Is this resolved or what?