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

Submitter:  Matthew Bauer <matthewbauer>
Submitted:  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>
Group 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>

 

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

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)
  •  

    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.

     

    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.13-4448.
    Corresponding source code