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: 29 Oct 2002 00:29:30 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

"Stefan Monnier" <monnier+gnu/address@hidden> 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 <address@hidden> http://www.cua.dk





reply via email to

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