public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jesse Pollard <pollard@tomcat.admin.navo.hpc.mil>
To: schwab@suse.de, Jesse Pollard <pollard@tomcat.admin.navo.hpc.mil>
Cc: Paul Flinders <paul@dawa.demon.co.uk>,
	Paul Flinders <P.Flinders@ftel.co.uk>,
	Jeff Mcadams <jeffm@iglou.com>,
	Rik van Riel <riel@conectiva.com.br>,
	John Kodis <kodis@mail630.gsfc.nasa.gov>,
	"Richard B. Johnson" <root@chaos.analogic.com>,
	linux-kernel@vger.kernel.org, bug-bash@gnu.org
Subject: Re: binfmt_script and ^M
Date: Tue, 6 Mar 2001 09:56:09 -0600 (CST)	[thread overview]
Message-ID: <200103061556.JAA94341@tomcat.admin.navo.hpc.mil> (raw)

---------  Received message begins Here  ---------

> 
> Jesse Pollard <pollard@tomcat.admin.navo.hpc.mil> writes:
> 
> |> Andreas Schwab <schwab@suse.de>:Andreas Schwab <schwab@suse.de>Andreas Schwab <schwab@suse.de>
> |> > Paul Flinders <paul@dawa.demon.co.uk> writes:
> |> > 
> |> > |> Andreas Schwab wrote:
> |> > |> 
[snip]
> |> > |> It's a difficult one - logically white space should terminate the interpreter
> |> > 
> |> > No, IFS-whitespace delimits arguments in the Bourne shell.
> |> 
> |> IFS can be defined in the environment.
> 
> No, the shell won't import it.

I wasn't directly referring to the bourn shell or bash. The "shell" is whatever
program is specified on the "#!<shellprog>". The arbitrary <shellprog> could
import it, depending on the definition. (IFS=....; export IFS). If <shellprog>
imports it then it could be used, but only after the <shellprog> is running.

By default, IFS is a non-exported environment variable. It can be exported
to other programs if desired, those other programs can be used in
"#!<shellprog>" constructs.

And some systems do import IFS. IRIX bourn shell will import it:

tomcat 54% sh
$ echo "..${IFS}.."
.. 
..
tomcat 54% sh
$ echo "..${IFS}.."	--(default: space, tab and \n")
.. 
..
$ IFS="         ^M" 	--(space, tab and \r)
$ export IFS
$ echo "..${IFS}.."
.. 
$ sh			-- new subshell
$ echo "..${IFS}.."
.. 			-- space, tab and \r.
$ 

The same test on bash shows that it will not import it:

bash-2.04$ bash
bash-2.04$ echo "..${IFS}.."
.. 
..
bash-2.04$ IFS=" ^M"
bash-2.04$ export IFS
bash-2.04$ echo "..${IFS}.."
.. 
bash-2.04$ bash
bash-2.04$ echo "..${IFS}.."
.. 
..
bash-2.04$

The same test done on ash shows that it will import it:

bash-2.04$ ash
$ echo "..${IFS}.."
.. 
..
$ IFS="         ^M"
$ export IFS
$ echo "..${IFS}.."
.. 
$ ash
$ echo "..${IFS}.."
.. 
$ 

The csh shell, on the other hand, doesn't use IFS. It always uses blank or tab
unless they are escaped with \ or are enclosed in quotes.

Personally, I wouldn't want to change the kernel. There is no good way to
determine which error should be given: the script doesn't exist, or the
shell doesn't exist. Either may be nonexistant, and there is only two
possibilities. First do a "ls -l" on the script (must be readable as well
as executable, second do a "ls -l 'line' where line is the first line
of the shell script, minus the "#!". Sometimes it takes a vi/emacs/...
session to look for any funny characters.

The first case is that the shell script doesn't exist. This is reported
by the users command interpreter. The second case is reported by the
kernel. If all that is wanted is to change the format of the message, then
that should be doable - it has to report a different error than "No such
file..." which is the standard error status for this error. Just because the
file that isn't found is the shell program is no reason to change the status -
it really IS "No such file...". There will be some programs that depend
on this status return (menu/window managers come to mind) to issue an
appropriate status.

If the error is "Permission denied", then the equivalent situation exists.
The difference is that the "ls" alone is enough to determine why. (permission
may be denied for the shell program as well as the script).

A case can be made that the shell programs (bash/ash/csh...) do not do a
complete analysis of the exit status. All they appear to do is a "perror".

If the command does exist, then assume it is the shell program that is
missing?? I would implement this by doing a "stat" on the command path (if
it doesn't exist/permission denied/whatever - issue message about the command
path), then do the exec, followed by the return status analysis. Of course
this isn't easy when using execl, which is why it isn't done - perhaps a
change to the exec.. library funtions?

This is a user mode issue and not a kernel issue.

-------------------------------------------------------------------------
Jesse I Pollard, II
Email: pollard@navo.hpc.mil

Any opinions expressed are solely my own.

             reply	other threads:[~2001-03-06 15:56 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-06 15:56 Jesse Pollard [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-03-06 13:55 binfmt_script and ^M Jesse Pollard
2001-03-06 14:54 ` Andreas Schwab
2001-03-05 21:15 Andries.Brouwer
2001-03-05 19:14 Jesse Pollard
2001-03-06 20:54 ` Thorsten Glaser Geuer
2001-02-27 13:53 Heusden, Folkert van
2001-02-27 14:26 ` Alistair Riddell
2001-02-27 23:22   ` David
2001-02-28 14:07     ` Jamie Lokier
2001-02-28 22:23       ` H. Peter Anvin
2001-02-27 13:42 Heusden, Folkert van
2001-02-27 13:38 ` Ivo Timmermans
2001-02-27 14:01   ` Bruce Harada
2001-02-27 19:20   ` Jamie Lokier
2001-02-27 19:59     ` Don Dugger
2001-02-27 21:35   ` Rogier Wolff
2001-02-27 13:03 Ivo Timmermans
2001-02-27 13:44 ` Alan Cox
2001-02-27 13:47   ` Ivo Timmermans
2001-02-27 13:54     ` Alan Cox
2001-02-27 14:36       ` Rogier Wolff
2001-02-28 20:10   ` Erik Hensema
2001-03-01 12:04     ` Pavel Machek
2001-03-05 13:20       ` Jan Nieuwenhuizen
2001-03-05 13:37         ` Andreas Schwab
2001-03-05 13:40         ` Richard B. Johnson
2001-03-05 14:55           ` John Kodis
2001-03-05 15:25             ` Rik van Riel
2001-03-05 15:59               ` Jeff Mcadams
2001-03-05 16:18                 ` Paul Flinders
2001-03-05 17:12                   ` Andreas Schwab
2001-03-05 19:54                     ` Paul Flinders
2001-03-05 20:09                       ` Paul Flinders
2001-03-06 10:41                       ` Andreas Schwab
2001-03-06 12:33                         ` Paul Flinders
2001-03-06 14:45                           ` Laramie Leavitt
2001-03-06 15:12                             ` Sean Hunter
2001-03-06 15:37                               ` David Weinehall
2001-03-06 21:10                                 ` Thorsten Glaser Geuer
     [not found]                                   ` <20010308130145.O20737@dev.sportingbet.com>
2001-03-09 16:52                                     ` Thorsten Glaser Geuer
2001-03-06 15:53                               ` James A. Sutherland
2001-03-06 16:59                               ` Xavier Bestel
2001-03-07  8:29                               ` Ondrej Sury
2001-03-05 18:58                   ` Pozsar Balazs
2001-03-05 20:39                     ` Robert Read
2001-03-05 21:05                       ` Pozsar Balazs
2001-03-05 22:34                         ` Robert Read
2001-03-06 15:14                           ` Jeff Coy
2001-03-06 18:15                             ` Peter Samuelson
2001-03-06 18:36                               ` Jeff Coy
2001-03-06 20:26                                 ` John Kodis
2001-03-06 20:43                                   ` Andreas Schwab
2001-03-06  2:18                       ` Richard B. Johnson
2001-03-05 15:50             ` Richard B. Johnson
2001-03-05 16:53               ` H. Peter Anvin
2001-03-05 21:48             ` Dr. Kelsey Hudson
2001-03-06 18:19               ` Peter Samuelson
2001-03-06 21:04                 ` Dr. Kelsey Hudson
2001-03-05 16:37           ` Erik Hensema
2001-03-05 22:13             ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200103061556.JAA94341@tomcat.admin.navo.hpc.mil \
    --to=pollard@tomcat.admin.navo.hpc.mil \
    --cc=P.Flinders@ftel.co.uk \
    --cc=bug-bash@gnu.org \
    --cc=jeffm@iglou.com \
    --cc=kodis@mail630.gsfc.nasa.gov \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul@dawa.demon.co.uk \
    --cc=riel@conectiva.com.br \
    --cc=root@chaos.analogic.com \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox