patchThe GNU Bourne-Again SHell - Patches: patch #10039, Set last_command_exit_value in...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #10039: Set last_command_exit_value in exec before exiting

Submitted by:  Matthew Bauer <matthewbauer>
Submitted on:  Fri 05 Mar 2021 02:56:13 AM UTC  
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Open

Fri 05 Mar 2021 02:15:06 PM UTC, comment #1: 

Thanks for the report and fix.

Chet Ramey <chet>
Project Administrator
Fri 05 Mar 2021 02:56:13 AM UTC, original submission:  

Previously, this command:

  bash -c 'die(){ :;}; trap die EXIT; exec abc'; echo $?

would result in '0', since no command had completely exec’d yet, the
initial exec code was provided. But exec does have an exit code at
this point (127), which gets overridden by the trap function. Usually,
traps restores the exit code, but this wasn’t happening for exec.

After this change,

     bash -c 'die(){ :;}; trap die EXIT; exec abc'; echo $?
  == bash -c 'exec abc'; echo $?
  == 127

Which is the expected behavior.

Matthew Bauer <matthewbauer>

 

Attached Files

 

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 matthewbauer (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-03-05 chet StatusNone => Done
    2021-03-05 matthewbauer Attached File- => Added 0001-Set-last_command_exit_value-in-exec-before-exiting.patch, #50991

    Back to the top


    Powered by Savane 3.6