Merge ~raharper/curtin:fix/udevadm-info-shlex-quote into curtin:master
Status: | Merged |
---|---|
Approved by: | Ryan Harper |
Approved revision: | 5ceb185c76810d3052190b73451cd3e02479a966 |
Merge reported by: | Server Team CI bot |
Merged at revision: | not available |
Proposed branch: | ~raharper/curtin:fix/udevadm-info-shlex-quote |
Merge into: | curtin:master |
Diff against target: |
198 lines (+122/-8) 3 files modified
curtin/udev.py (+25/-2) tests/data/udevadm_info_sandisk_cruzer.txt (+54/-0) tests/unittests/test_udev.py (+43/-6) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Dan Watkins (community) | Approve | ||
Server Team CI bot | continuous-integration | Approve | |
Shawn Weeks (community) | Needs Information | ||
Review via email: mp+382993@code.launchpad.net |
Commit message
udev: use shlex.quote when shlex.split errors on shell-escape chars
The udev database may include shell escape characters in the output.
We want to avoid using shlex_quote unless needed as curtin does not
use the quoted value in our code and applying it to all of the values
breaks parsing of the udevadm info content.
If we encounter a ValueError while invoking shlex.split() then we
first use shlex_quote() and try parsing again and if that fails we
will try replacing shell-quote values with '_'. We log warning
whenever we have to quote or replace values.
- Python2.7 does not have shlex.quote, use pipes.quote (which was
renamed to shlex.quote in Py3:
https:/
- Add unittest with original info dump from bug submitters system
LP: #1875085
FAILED: Continuous integration, rev:17f47538f12 2e8be3443d7b6cf 1ad70744a96998 /jenkins. ubuntu. com/server/ job/curtin- ci/66/ /jenkins. ubuntu. com/server/ job/curtin- ci/nodes= metal-amd64/ 66/ /jenkins. ubuntu. com/server/ job/curtin- ci/nodes= metal-arm64/ 66/ /jenkins. ubuntu. com/server/ job/curtin- ci/nodes= metal-ppc64el/ 66/ /jenkins. ubuntu. com/server/ job/curtin- ci/nodes= metal-s390x/ 66/
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/server/ job/curtin- ci/66// rebuild
https:/