emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/bash-completion b38f9bca0c: Avoid executing anything in ca


From: ELPA Syncer
Subject: [nongnu] elpa/bash-completion b38f9bca0c: Avoid executing anything in case __ebcpre is not defined.
Date: Wed, 8 Mar 2023 10:01:01 -0500 (EST)

branch: elpa/bash-completion
commit b38f9bca0c194ee3a79c19a14db3b38d1262ca8c
Author: Stephane Zermatten <szermatt@gmx.net>
Commit: Stephane Zermatten <szermatt@gmx.net>

    Avoid executing anything in case __ebcpre is not defined.
    
    In single-process mode, to detect communication with an un-configured
    Bash process, bash-completion.el always starts with a check for its
    internal function __ebcpre (type __ebcpre) and configures the Bash
    process if that doesn't succeed.
    
    Before this change, the case where type __ebcpre failed was correctly
    detected and reported by Bash but the command was executed anyways - and
    the result usually thrown away.
    
    This was wasteful, but should have been harmless. However, in some
    cases, at least when expanding a command name first thing in a buffer,
    that command happened to cause Bash to exit or crash.
    
    With this change, the intended command isn't executed anymore when type
    __ebcpre fails, which avoids crashing Bash.
    
    fixes #63
---
 bash-completion.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bash-completion.el b/bash-completion.el
index cad465ad90..b566c9cfdb 100644
--- a/bash-completion.el
+++ b/bash-completion.el
@@ -1492,7 +1492,7 @@ Return the status code of the command, as a number."
             (bash-completion-use-separate-processes "%s\n")
             ;; single process, assume __ebcpre is already defined
             ((not define-functions)
-             "type __ebcpre &>/dev/null || echo 
==emacs==nopre=${BASH_VERSION}==. && { __ebcpre; %s; }\n")
+             "if type __ebcpre &>/dev/null; then __ebcpre; %s; else echo 
==emacs==nopre=${BASH_VERSION}==.; fi;\n")
             ;; single process, define __ebcpre
             (t
               (concat



reply via email to

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