Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix brp-strip when using regex-unsafe build root #3492

Merged
merged 1 commit into from
Dec 16, 2024

Conversation

WanzenBug
Copy link
Contributor

@WanzenBug WanzenBug commented Dec 16, 2024

By default, the build root contains NAME-VERSION-RELEASE.ARCH. Some of these may contain characters that are not taken as plain characters when interpreting a regex, such as "." or "+".

This may lead to a situation where files in /usr/lib/debug are stripped, making them useless for debugging. This is because the command to strip debug information interpreted part of the $RPM_BUILD_ROOT as part of a regex.

To fix this, first change to the build root directory, and run the find command relative to that directory, ensuring we don't have to make the build root part of the regex.

@WanzenBug WanzenBug requested a review from a team as a code owner December 16, 2024 09:33
@WanzenBug WanzenBug requested review from ffesti and removed request for a team December 16, 2024 09:33
@ffesti
Copy link
Contributor

ffesti commented Dec 16, 2024

Do you have an actual example where this goes wrong?

Also it is kinda funny you complain about characters not being quoted just to add a unquoted . at the beginning of the regular expression.

@WanzenBug
Copy link
Contributor Author

Do you have an actual example where this goes wrong?

We originally noticed this issue because we sometimes have to build "special versions" of our packages that should only be used for temporary workarounds, distributed only to select users. Compared to a "normal" 9.2.12-1 release, these would be 9.2.12+ptf.34.g<commit-rev>-1.

Eventually we noticed that this would trip up brp-strip, because now directory 9.2.12+ptf... does not match the regex 9.2.12+ptf....

Also it is kinda funny you complain about characters not being quoted just to add a unquoted . at the beginning of the regular expression.

You are absolutely right, though in this case this does not matter, as what is matched will always start with a plain . and "regex ." will happily match that. Still, I pushed an amended version.

@WanzenBug
Copy link
Contributor Author

Looking through our internal history, I actually got the supposed "bug" wrong. It does not cause any issues with some program not being stripped, it causes the "debuginfo" packages to contain stripped debuginfo, because the above command does not correctly filter out the /usr/lib/debug directory when the version contains a +.

By default, the build root contains NAME-VERSION-RELEASE.ARCH. Some of these
may contain characters that are not taken as plain characters when interpreting
a regex, such as "." or "+".

This may lead to a situation where files in /usr/lib/debug are stripped, making
them useless for debugging. This is because the command to strip debug
information interpreted part of the $RPM_BUILD_ROOT as part of a regex.

To fix this, first change to the build root directory, and run the find command
relative to that directory, ensuring we don't have to make the build root part
of the regex.

Co-authored-by: Lars Ellenberg <[email protected]>
@ffesti ffesti merged commit 0a8a0ed into rpm-software-management:master Dec 16, 2024
1 check passed
@ffesti
Copy link
Contributor

ffesti commented Dec 16, 2024

Yeah, that makes a lot more sense. Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants