Description of problem: if you try to restore an rpm to its original permissions using --setperms, rpm exists with a chmod failure. Version-Release number of selected component (if applicable): rpm-4.4.2-47.el5.x86_64 How reproducible: Always Steps to Reproduce: 1. install package 2. run rpm --setperms packagename 3. watch errors Actual results: On each file, rpm throws a chmod error similar to the one below (for httpd) chmod: invalid mode: `0100644' Try `chmod --help' for more information. chmod: invalid mode: `0100644' Try `chmod --help' for more information. chmod: invalid mode: `0100644' Try `chmod --help' for more information. Expected results: rpm properly resets permissions to default state. Additional info: This is a very useful feature when attempting to repair a system, and should be fixed.
Appears I spoke too soon. This appears to be more because of the use of --setugids, not --setperms. --setperms works as advertised. It's --setuigids which fails with the errors listed above.
UGH... STILL speaking too soon. Individually each command succeeds. rpm --setperms httpd ; this succeeds rpm --setugids httpd ; this succeeds rpm --setperms --setugids httpd ; this fails with the error chmod: invalid mode: `0100644' rpm --setuigids --setperms httpd ; apparently command order matters. This fails with an incremented (one for each file) list of: sh: line 356: ch: command not found sh: line 357: ch: command not found sh: line 358: ch: command not found sh: line 359: ch: command not found It would seem that this is something minor and not escaped properly, though I'm not sure where exactly.
Turns out this has gotten fixed a long time ago in the rebase to rpm 4.4.2.3: https://rhn.redhat.com/errata/RHBA-2009-0079.html