Bugzilla – Bug 1185118
%attr rule with missing closing paren causes inscrutable error messages
Last modified: 2021-09-07 19:32:56 UTC
When a malformed rule such as: %dir %attr(-,root,root /path/to/file is encountered, rpmbuild fails with an error message like: error: File must begin with "/": nÔLó_;^? This is due to the check for the closing paren as found in other rule handlers is missing. When the rule is overwritten by spaces, parseForAttr assumes that the final character is the closing paren and will overwrite the entire string including the NUL terminator. Later, since the entire string is spaces and also not NUL terminated, the error message will include whatever garbage happens to be after the end of the string. Reported upstream as https://github.com/rpm-software-management/rpm/issues/1648
Created attachment 848632 [details] [PATCH] Handle missing closing paren in %attr rules parseForAttr is missing the check for the closing paren. When a malformed rule is encountered, the bounds for the end of the rule will be the NUL terminator for the string. When it overwrites the rule with spaces, the entire string, including the NUL terminator, will be overwritten. Later, in parseForSimple, the string will no longer contain a pathname and will fail the check for files beginning with /. Since the string is also no longer NUL terminated, the error will contain garbage like the following: error: File must begin with "/": nÔLó_;^? Adding the check for the closing paren fixes the issue. Fixes: #1648
(Opening an issue in the upstream tracker is enough, you do not need to duplicate things into our bugzilla.)
Fix has landed in upstream rpm 4.17 but not Tumbleweed yet.