Skip to content

rewrite check_files_md5 in pure Python - #643

Open
bdrung wants to merge 1 commit into
canonical:mainfrom
bdrung:md5sum
Open

rewrite check_files_md5 in pure Python#643
bdrung wants to merge 1 commit into
canonical:mainfrom
bdrung:md5sum

Conversation

@bdrung

@bdrung bdrung commented Jul 28, 2026

Copy link
Copy Markdown
Member

GNU coreutils 9.11 and rust-coreutils 0.9 changed md5sum to quote the filenames in case they contain spaces or other special characters. Example:

$ echo first > "with spaces"
$ echo second > "with'quotes"
$ echo third > 'with"quotes'
$ echo fourth > "with \" and ' quotes"
$ md5sum "with spaces" "with'quotes" 'with"quotes' "with \" and ' quotes" > sums
$ md5sum -c sums
'with spaces': OK
"with'quotes": OK
'with"quotes': OK
'with " and '\'' quotes': OK

This new quoting could be supported by checking for single or double quotes and use shlex.split in these cases.

To make the code more robust do not rely on the md5sum command and just use pure Python for it.

Bug: https://launchpad.net/bugs/2161957

@bdrung bdrung changed the title fileutils: rewrite check_files_md5 in pure Python rewrite check_files_md5 in pure Python Jul 28, 2026
@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.47%. Comparing base (2eacb11) to head (7cc8df5).

Files with missing lines Patch % Lines
apport/packaging_impl/apt_dpkg.py 72.72% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #643      +/-   ##
==========================================
- Coverage   84.48%   84.47%   -0.02%     
==========================================
  Files         106      106              
  Lines       21018    20996      -22     
  Branches     3195     3187       -8     
==========================================
- Hits        17758    17736      -22     
- Misses       2785     2786       +1     
+ Partials      475      474       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

GNU coreutils 9.11 and rust-coreutils 0.9 changed `md5sum` to quote the
filenames in case they contain spaces or other special characters.
Example:

```
$ echo first > "with spaces"
$ echo second > "with'quotes"
$ echo third > 'with"quotes'
$ echo fourth > "with \" and ' quotes"
$ md5sum "with spaces" "with'quotes" 'with"quotes' "with \" and ' quotes" > sums
$ md5sum -c sums
'with spaces': OK
"with'quotes": OK
'with"quotes': OK
'with " and '\'' quotes': OK
```

This new quoting could be supported by checking for single or double
quotes and use `shlex.split` in these cases.

To make the code more robust do not rely on the `md5sum` command and
just use pure Python for it.

Bug: https://launchpad.net/bugs/2161957
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.

1 participant