unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: rms@gnu.org, schwab@suse.de, emacs-devel@gnu.org
Subject: Re: Bug in shell.el: explicit-bash-args does not work for bash 1.x
Date: 29 Oct 2002 00:29:30 +0100	[thread overview]
Message-ID: <5x65vmw3ad.fsf@kfs2.cua.dk> (raw)
In-Reply-To: <200210282148.g9SLm2711909@rum.cs.yale.edu>

"Stefan Monnier" <monnier+gnu/emacs@rum.cs.yale.edu> writes:

> > (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")))
> 
> I must say I don't like the idea of running a program when loadng
> a .el file.  It's already done at various places, tho.
> 
> There is no strong reason, but one of the recent problem I came
> across in this area is that process operations don't work properly during
> dumping (the handling of sigchld is explicitly not turned on because
> it can supposedly prevent unexec from working right).
> 

The following code doesn't execute the program; it does a brute-force
check for the version of the bash program by looking inside the
executeable.  This works for me on GNU/Linux -- again, if it
doesn't work on other platforms, it doesn't do any worse than
the current default...

(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)
           (file-readable-p prog)
	   (with-temp-buffer
	     (insert-file-contents-literally prog)
	     (goto-char (point-min))
	     (search-forward "@(#)Bash version 1" nil t)))
      '("-i")
    '("--noediting" "-i")))

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

  reply	other threads:[~2002-10-28 23:29 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
2002-10-28 19:19     ` Richard Stallman
2002-10-28 21:48     ` Stefan Monnier
2002-10-28 23:29       ` Kim F. Storm [this message]
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=5x65vmw3ad.fsf@kfs2.cua.dk \
    --to=storm@cua.dk \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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).