helpThe GNU Bourne-Again SHell - Support: sr #110207, Avoid unnecessary chown() on...


sr #110207: Avoid unnecessary chown() on history file

Submitted by:  None
Submitted on:  Wed 11 Mar 2020 06:28:49 PM UTC  
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Done
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Wed 11 Mar 2020 06:28:49 PM UTC, original submission:  

We're running bash on a system monitored through AIDE and whenever a new shell is run for root it will trigger AIDE due to a change in ctime for '.bash_history'. It seems that history_truncate_file() will trigger multiple chown() calls even though the history was neither written nor needs truncating. Unfortunately this modifies the inode's ctime even when the new user and group ids are the same.

The attached patch tries to fix this by checking whether the history file actually needs updates to the ownership before calling chown().



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

Attach Files:

Attached Files
file #48579:  bash_check_before_chown.patch added by None (2KiB - text/x-patch - Patch to check whether history ownership needs updating)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by chet (Updated the item)
  • -email is unavailable- added by None (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
    2020-03-17 chet StatusNone => Done
    2020-03-11 None Attached File- => Added bash_check_before_chown.patch, #48579

    Back to the top

    Powered by Savane 3.5