emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug in shell.el: explicit-bash-args does not work for bash 1.x


From: Kim F. Storm
Subject: Re: Bug in shell.el: explicit-bash-args does not work for bash 1.x
Date: 27 Oct 2002 02:17:56 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Richard Stallman <address@hidden> writes:

>     However, for bash 1.x (included with e.g. redhat 6.2), the --noediting
>     option isn't recognized and bash refuses to start.
> 
> That is fairly old.  I don't think we should drop the feature
> just for the sake of old systems.  Is there a way to detect the
> error and start bash again in a suitable way for bash 1.x?
> 

The following code returns the proper setting for bash 1.x and 2.x. 

I suppose it could be used as the initial value for explicit-bash-args.


(let* ((prog (or (and (boundp 'explicit-shell-file-name) 
explicit-shell-file-name)
                 (getenv "ESHELL") shell-file-name))
       (name (file-name-nondirectory prog)))
  (if (and (equal name "bash")
           (file-executable-p prog)
           (string-match "bad option"
                         (shell-command-to-string (concat prog " 
--noediting"))))
      '("-i")
    '("--noediting" "-i")))


It is optimized to run (when shell.el is loaded) only if the
configured shell is actually bash, meaning that it isn't set properly
if the user later changes from some other shell to bash after loading
shell.el.

If that behaviour is not acceptable, we can check for bash explicitly
and set the option unconditionally:

  (if (string-match "bad option"
                    (shell-command-to-string "/bin/bash --noediting"))
      '("-i")
    '("--noediting" "-i"))

However, that assumes that bash 1.x is located in /bin/bash for the 
proper [reduced] setting is selected -- probably a reasonable
assumption, and still not much harm done if it makes the wrong
choice.


-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]