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

surrogateescape error handler to decode UTF-8 strings (RhBug:1893176) #1237

Merged
merged 1 commit into from May 25, 2021

Conversation

m-blaha
Copy link
Member

@m-blaha m-blaha commented May 18, 2021

This ensures that libdnf does not raise UnicodeDecodeError when
accessing package with non UTF-8 file names.

= changelog =
msg: DNF does not fail on non UTF-8 file names in a package
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1893176

…1893176)

This ensures that libdnf does not raise UnicodeDecodeError when
accessing package with non UTF-8 file names.

= changelog =
msg:           DNF does not fail on non UTF-8 file names in a package
type:          bugfix
resolves:      https://bugzilla.redhat.com/show_bug.cgi?id=1893176
@m-blaha
Copy link
Member Author

m-blaha commented May 18, 2021

Unfortunately I'm not able to prepare a test in ci-dnf-stack - the test would require building a package that contains a file with non UTF-8 name. But new enough rpmbuild contains checks to avoid such file names. Also createrepo_c refuses to create repository with such package.

@dmach
Copy link

dmach commented May 19, 2021

@m-blaha I tried your patch with badfilename-1.13-0.0.noarch.rpm from bug#1893176.
$ rpm -Uvh https://www.phcomp.co.uk/tmp/badfilename-1.13-0.0.noarch.rpm
$ dnf repoquery --installed --list badfilenames
here I'd expect output similar to rpm -ql badfilename, but got nothing

@dmach
Copy link

dmach commented May 19, 2021

One more thing, we could try using the following RPM macro to allow generating a broken package on new systems:
%_invalid_encoding_terminates_build 0

@m-blaha
Copy link
Member Author

m-blaha commented May 19, 2021

$ dnf repoquery --installed --list badfilenames
here I'd expect output similar to rpm -ql badfilename, but got nothing

It might be a typo here in comment - but the package name is badfilename (in singular). I got this output:

$ dnf repoquery --installed --list badfilename
/usr/bin/badfilename
/usr/share/doc/badfilename
/usr/share/doc/badfilename/README
/usr/share/doc/badfilename/TestFiles
/usr/share/doc/badfilename/TestFiles/01ControlC--
/usr/share/doc/badfilename/TestFiles/02hex-7f--
/usr/share/doc/badfilename/TestFiles/03hex-80-�-
/usr/share/doc/badfilename/TestFiles/04hex-a0-�-
/usr/share/doc/badfilename/TestFiles/05hex-ff-�-

Looks pretty similar to rpm output.

@m-blaha
Copy link
Member Author

m-blaha commented May 21, 2021

One more thing, we could try using the following RPM macro to allow generating a broken package on new systems:
%_invalid_encoding_terminates_build 0

Great, thanks a lot! The macro works so I should be able to create a test for the issue.

@lukash lukash merged commit 6c2ac67 into dnf-4-master May 25, 2021
@lukash lukash deleted the mblaha/nonutf-filename-decode branch May 25, 2021 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants