mainThe GNU Bourne-Again SHell - Support: sr #110850, Bash dies when given: compgen -c...

 
 

sr #110850: Bash dies when given: compgen -c > >(__notfound)

Submitter:  Stephane Zermatten <szermatt>
Submitted:  Wed 08 Mar 2023 03:41:52 PM UTC
   
 
Category:  None Priority:  5 - Normal
Severity:  2 - Minor Status:  Works For Me
Privacy:  Public Assigned to:  None
Open/Closed:  Open Operating System:  GNU/Linux
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 14 Mar 2023 07:59:32 PM UTC, comment #3: 

The shell does not crash. It receives a fatal signal (SIGPIPE) and exits.

Chet Ramey <chet>
Group administrator
Tue 14 Mar 2023 07:44:27 PM UTC, comment #2: 

This is not a problem. Once you know about it, it's easy to check beforehand that the function exists.

It is, however, surprising behavior. Bash doesn't habitually crash when given commands it doesn't like. It just outputs an error message. It's a bug - though an obscure and hard to trigger one - which is why I reported it.

Stephane Zermatten <szermatt>
Tue 14 Mar 2023 07:24:51 PM UTC, comment #1: 

Well, bash gets a SIGPIPE because it tries to write to a pipe for which there is no reader. That's a fatal signal, for which the default disposition is terminating the process.

Process substitution uses pipes to read from and write to the  process.

If this is a problem, you can set a trap on SIGPIPE, or test that __notfound (in this example) exists before trying to use it in a process substitution.


Chet Ramey <chet>
Group administrator
Wed 08 Mar 2023 03:41:52 PM UTC, original submission:  

The following seems to cause bash to crash or exit after issuing the error message:

$ bash --norc
bash-5.2$ compgen -c > >(__notfound)
bash: __notfound : commande introuvable


This affects all versions of Bash I tried, from 4.4.18 to 5.2.15 on Linux and macos.

Stephane Zermatten <szermatt>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by szermatt (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-03-14 chet StatusNone Works For Me

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code