close 282762 3.0-15
thanks

Chet Ramey writes:
> > Package: bash
> > Version: 3.0-10
> > Severity: normal
> > 
> > 
> > Trying to run a DOS-formatted script with a shebang notation results in
> > the error message ": bad interpreter: No such file or directory"
> > 
> > This occurs specifically when the CR+LF immediately follows the
> > interpreter command: 
> > 
> > #!/bin/sh[cr+lf]
> > 
> > Bash should either read this line correctly or print out a more useful
> > error message.
> 
> Bash is simply printing the name of the interpreter (/bin/sh^M).  The
> trailing carriage return causes the rest of the message to overwrite the
> `/bin/sh'.

The Debian version has a patch since 3.0-15 to make it more user
friendly, closing the report.

--- bash/execute_cmd.c~ 2005-01-22 23:14:33.000000000 +0100
+++ bash/execute_cmd.c  2005-01-23 20:16:58.000000000 +0100
@@ -3858,11 +3858,21 @@
          if (sample_len > 2 && sample[0] == '#' && sample[1] == '!')
            {
              char *interp;
+             int interp_length;
+             char *interp_printable = NULL;
 
              interp = getinterp (sample, sample_len, (int *)NULL);
+             interp_length = strlen(interp);
+             if (interp[interp_length-1] == '\r') {
+               interp_printable = (char *)xmalloc (interp_length + 2);
+               strncpy (interp_printable, interp, interp_length - 1);
+               strcpy (interp_printable + interp_length - 1, "^M");
+             }
              errno = i;
-             sys_error (_("%s: %s: bad interpreter"), command, interp ? interp 
: "");
+             sys_error (_("%s: %s: bad interpreter"), command,
+                        interp_printable ? interp_printable : interp ? interp 
: "");
              FREE (interp);
+             FREE (interp_printable);
              return (EX_NOEXEC);
            }
 #endif


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to