-
Notifications
You must be signed in to change notification settings - Fork 251
Back up on scrub #1660
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
base: main
Are you sure you want to change the base?
Back up on scrub #1660
Conversation
sergiomb2
commented
Nov 26, 2025
- make mock --scrub=all correctly back up build directory
- Use 'mv' instead of 'cp' for backing up builds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the backup logic by moving it from backend.py to buildroot.py and changing the operation from copy (cp) to move (mv). This is a good refactoring as the logic is now closer to where the buildroot is actually deleted. However, I've found a critical security vulnerability related to command injection when moving the RPM files. The way the mv command is constructed is unsafe and could allow for arbitrary code execution if a filename contains special shell characters. I've provided a suggestion to fix this using Python's shutil module, which is the safer and more idiomatic approach. I also found a minor style issue where a multi-line string is used for a comment inside a method, which should be a regular hash-prefixed comment. Please address the critical security issue.
57d76c8 to
2f02a9d
Compare
2f02a9d to
79b7a3f
Compare
xsuchy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Can you add release entry as described in https://rpm-software-management.github.io/mock/Release-Notes-New-Entry please?
79b7a3f to
1149de1
Compare
|
Done. Let me know if I can improve anything else. |
|
I found a bug "shutil.Error: Destination path '/var/lib/mock/backup/fedora-43-x86_64/javapackages-compat-6.4.1-5.fc43.noarch.rpm' already exists" |
1149de1 to
cf5d223
Compare
daf4800 to
3089847
Compare
|
Can you please rebase on top of |
3089847 to
45d15c3
Compare
|
Lint Python issues / python-lint-job (pull_request)Failing after 46s I'm working on another solution |
45d15c3 to
1b583a7
Compare
2f9cdbf to
3879063
Compare
|
/packit test |
3879063 to
01061cb
Compare
praiskup
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay. Otherwise looks good, thank you for the fix.
01061cb to
9503dd4
Compare
…buildroot. Fixes issue rpm-software-management#1639. The backup process now uses `mv` semantics instead of `cp`, avoiding file duplication, preserving timestamps, and improving performance. Gemini Code Assist flagged the use of `util.run` as unsafe, so it was replaced with `os.replace` to safely overwrite existing files. Improve logs and comments in backup_build_results for clarity.
9503dd4 to
cb07a9a
Compare