Bug 11486 - chmod -c reports all files as having mode changed
Summary: chmod -c reports all files as having mode changed
Status: NEW
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: 1.29.x
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-02 19:21 UTC by John Ata
Modified: 2018-11-02 19:21 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments
When comparing modes for detecting change, filter the file type (572 bytes, application/octet-stream)
2018-11-02 19:21 UTC, John Ata
Details

Note You need to log in before you can comment on or make changes to this bug.
Description John Ata 2018-11-02 19:21:32 UTC
Created attachment 7856 [details]
When comparing modes for detecting change, filter the file type

The "-c" option is only supposed to report changed modes.  However, if a numeric mode is supplied (e.g. 0644), it will always report the result as a mode change even if the mode was not requested to change.  This is because the mode field returned from the stat call is being directly compared with the requested mode.  However, stat (2) will place both the file type and mode in the st_mode field so the values will never compare leading chmod to treat it as a change.  A fix is to compare the st_mode field anded with 0x07777 thus allowing identical modes to be identified.