unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: schwab@suse.de, emacs-devel@gnu.org
Subject: Re: Bug in shell.el: explicit-bash-args does not work for bash 1.x
Date: 27 Oct 2002 02:17:56 +0200	[thread overview]
Message-ID: <5x1y6cg2ff.fsf@kfs2.cua.dk> (raw)
In-Reply-To: <E185XJU-0002BQ-00@fencepost.gnu.org>

Richard Stallman <rms@gnu.org> 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 <storm@cua.dk> http://www.cua.dk

  reply	other threads:[~2002-10-27  0:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-25 14:28 Bug in shell.el: explicit-bash-args does not work for bash 1.x Kim F. Storm
2002-10-26 20:13 ` Richard Stallman
2002-10-27  0:17   ` Kim F. Storm [this message]
2002-10-28 19:19     ` Richard Stallman
2002-10-28 21:48     ` Stefan Monnier
2002-10-28 23:29       ` Kim F. Storm
2002-10-29  6:17         ` Eli Zaretskii
2002-10-29  6:15       ` Eli Zaretskii
2002-10-29 14:42         ` Stefan Monnier
2002-10-29  7:40       ` Kai Großjohann
2002-10-30 21:32         ` Kim F. Storm
2002-10-31  6:33           ` Kai Großjohann
2002-10-29 11:29       ` Richard Stallman
2002-11-01  0:38     ` Kim F. Storm

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=5x1y6cg2ff.fsf@kfs2.cua.dk \
    --to=storm@cua.dk \
    --cc=emacs-devel@gnu.org \
    --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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).