Repository navigation
Conversation
Fixes apache#9300. check_dependencies probed the hard-coded path /usr/sbin/mksquashfs, while the conversion itself runs mksquashfs from PATH. After apache#9293 the check can actually fail, so a binary installed elsewhere (e.g. /usr/bin) would stop the tool. Look it up with shutil.which instead, as suggested in the apache#9293 review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
Fixes #9300.
Follow-up to #9293, from rzo1's review: now that
check_dependenciescan actually fail, it probesmksquashfsat the hard-coded path/usr/sbin/mksquashfs, while the conversion itself runsmksquashfsfromPATH. On hosts where the binary lives elsewhere (e.g./usr/bin) the tool would now stop.Changes:
mksquashfswithshutil.which("mksquashfs")and probe that path. If it is not onPATH, the check fails the same way as a missing tool.check_dependenciesare already consistent with this:skopeo,tar, andsetfattrare invoked by name fromPATH;hadoopis resolved viaHADOOP_BIN_DIR. Onlymksquashfswas hard-coded.shutil.which: a binary found at/usr/bin/mksquashfsis accepted, and a missing binary fails the check.How was the change tested
uv run --python 3.9 --no-project python -m unittest test_docker_to_squashinbin/: 5 tests OK.shutil.whichlookup reverted, both new tests fail (which('mksquashfs')is not called; the missing-binary case returns 0). Restoring the fix, all tests pass.from collections import Iterable); that's covered by Fix Python 3 incompatibilities in bin/docker-to-squash.py #9296, so tests were run on Python 3.9.Happy to adjust anything, lmk.