Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 783096 - app-dicts/aspell-nb-0.50.1.0-r1 Invalid UTF-8 encoding used for filename
Summary: app-dicts/aspell-nb-0.50.1.0-r1 Invalid UTF-8 encoding used for filename
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Conrad Kostecki
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-16 07:26 UTC by John Einar Reitan
Modified: 2021-04-21 21:41 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Einar Reitan 2021-04-16 07:26:56 UTC
The archive contains a file 'bokm\0345l.alias' which uses an invalid utf-8 encoding of the letter 'å'.

UTF-8 doesn't allow single byte encoding above 0x7F, but this file has 0xE5, which needs to be escaped.
Creating a file with 'å' manually results in bash encoding the name correctly with escaping 0xc3 0xa5:


"bokm\303\245l.alias"

vs

"bokm\345l.alias"

This issue has only been observed on systems with rootfs on ZFS, but any random tool that would use the file could fail on other systems. ZFS validates the encoding when files are created and it fails file creation.
My pool has utf8only=yes normalization=formD, it it matters.





Reproducible: Always

Steps to Reproduce:
1. Rootfs on ZFS
2. emerge -1v =app-dicts/aspell-nb-0.50.1.0-r1

Results in a tar extraction error.
Actual Results:  
>>> Emerging (1 of 1) app-dicts/aspell-nb-0.50.1.0-r1::gentoo
 * aspell-nb-0.50.1-0.tar.bz2 BLAKE2B SHA512 size ;-) ...                                                                                                                                                                                                                [ ok ]
>>> Unpacking source...
>>> Unpacking aspell-nb-0.50.1-0.tar.bz2 to /var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/work
tar: aspell-nb-0.50.1-0/bokm\345l.alias: Cannot open: Invalid or incomplete multibyte or wide character
tar: Exiting with failure status due to previous errors
 * ERROR: app-dicts/aspell-nb-0.50.1.0-r1::gentoo failed (unpack phase):
 *   unpack: failure unpacking aspell-nb-0.50.1-0.tar.bz2
 * 
 * Call stack:
 *               ebuild.sh, line 125:  Called src_unpack
 *             environment, line 478:  Called default
 *      phase-functions.sh, line 855:  Called default_src_unpack
 *      phase-functions.sh, line 882:  Called __eapi0_src_unpack
 *        phase-helpers.sh, line 754:  Called unpack 'aspell-nb-0.50.1-0.tar.bz2'
 *        phase-helpers.sh, line 427:  Called __unpack_tar 'bzip2 -d'
 *        phase-helpers.sh, line 360:  Called __assert_sigpipe_ok 'unpack: failure unpacking aspell-nb-0.50.1-0.tar.bz2'
 *   isolated-functions.sh, line  41:  Called die
 * The specific snippet of code:
 *   		[[ $x -ne 0 && $x -ne ${PORTAGE_SIGPIPE_STATUS:-141} ]] && die "$@"
 * 
 * If you need support, post the output of `emerge --info '=app-dicts/aspell-nb-0.50.1.0-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=app-dicts/aspell-nb-0.50.1.0-r1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/temp/environment'.
 * Working directory: '/var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/work'
 * S: '/var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/work/aspell-nb-0.50.1-0'

>>> Failed to emerge app-dicts/aspell-nb-0.50.1.0-r1, Log file:

>>>  '/var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/temp/build.log'

 * Messages for package app-dicts/aspell-nb-0.50.1.0-r1:

 * ERROR: app-dicts/aspell-nb-0.50.1.0-r1::gentoo failed (unpack phase):
 *   unpack: failure unpacking aspell-nb-0.50.1-0.tar.bz2
 * 
 * Call stack:
 *               ebuild.sh, line 125:  Called src_unpack
 *             environment, line 478:  Called default
 *      phase-functions.sh, line 855:  Called default_src_unpack
 *      phase-functions.sh, line 882:  Called __eapi0_src_unpack
 *        phase-helpers.sh, line 754:  Called unpack 'aspell-nb-0.50.1-0.tar.bz2'
 *        phase-helpers.sh, line 427:  Called __unpack_tar 'bzip2 -d'
 *        phase-helpers.sh, line 360:  Called __assert_sigpipe_ok 'unpack: failure unpacking aspell-nb-0.50.1-0.tar.bz2'
 *   isolated-functions.sh, line  41:  Called die
 * The specific snippet of code:
 *   		[[ $x -ne 0 && $x -ne ${PORTAGE_SIGPIPE_STATUS:-141} ]] && die "$@"
 * 
 * If you need support, post the output of `emerge --info '=app-dicts/aspell-nb-0.50.1.0-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=app-dicts/aspell-nb-0.50.1.0-r1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/temp/environment'.
 * Working directory: '/var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/work'
 * S: '/var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/work/aspell-nb-0.50.1-0'


Expected Results:  
>>> Emerging (1 of 1) app-dicts/aspell-nb-0.50.1.0-r1::gentoo
 * aspell-nb-0.50.1-0.tar.bz2 BLAKE2B SHA512 size ;-) ...                                                                                                                                                                                                                [ ok ]
>>> Unpacking source...
>>> Unpacking aspell-nb-0.50.1-0.tar.bz2 to /var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/work
>>> Source unpacked in /var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/work
>>> Preparing source in /var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/work/aspell-nb-0.50.1-0 ...
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/work/aspell-nb-0.50.1-0 ...
Finding Dictionary file location ... /usr/lib64/aspell-0.60
Finding Data file location ... /usr/lib64/aspell-0.60
>>> Source configured.
>>> Compiling source in /var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/work/aspell-nb-0.50.1-0 ...
make -j20 
/usr/bin/word-list-compress d < nb.cwl | /usr/bin/aspell  --lang=nb create master ./nb.rws
>>> Source compiled.
>>> Test phase [not enabled]: app-dicts/aspell-nb-0.50.1.0-r1

>>> Install app-dicts/aspell-nb-0.50.1.0-r1 into /var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/image
make -j20 DESTDIR=/var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/image install 
mkdir -p /var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/image/usr/lib64/aspell-0.60/
cp nb.rws bokmal.alias  nb.multi no.alias norsk.alias /var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/image/usr/lib64/aspell-0.60/
cd /var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/image/usr/lib64/aspell-0.60/ && chmod 644 nb.rws bokmal.alias  nb.multi no.alias norsk.alias
mkdir -p /var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/image/usr/lib64/aspell-0.60/
cp nb.dat /var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/image/usr/lib64/aspell-0.60/
cd /var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/image/usr/lib64/aspell-0.60/ && chmod 644 nb.dat
>>> Completed installing app-dicts/aspell-nb-0.50.1.0-r1 into /var/tmp/portage/app-dicts/aspell-nb-0.50.1.0-r1/image

 * Final size of build directory: 12388 KiB (12.0 MiB)
 * Final size of installed tree:  10840 KiB (10.5 MiB)


>>> Installing (1 of 1) app-dicts/aspell-nb-0.50.1.0-r1::gentoo
 * checking 8 files for package collisions
>>> Merging app-dicts/aspell-nb-0.50.1.0-r1 to /
--- /usr/
--- /usr/share/
--- /usr/share/doc/
--- /usr/share/doc/aspell-nb-0.50.1.0-r1/
>>> /usr/share/doc/aspell-nb-0.50.1.0-r1/info.bz2
>>> /usr/share/doc/aspell-nb-0.50.1.0-r1/README.bz2
--- /usr/lib64/
--- /usr/lib64/aspell-0.60/
>>> /usr/lib64/aspell-0.60/bokmal.alias
>>> /usr/lib64/aspell-0.60/norsk.alias
>>> /usr/lib64/aspell-0.60/nb.multi
>>> /usr/lib64/aspell-0.60/no.alias
>>> /usr/lib64/aspell-0.60/nb.dat
>>> /usr/lib64/aspell-0.60/nb.rws
>>> Safely unmerging already-installed instance...
No package files given... Grabbing a set.
--- replaced obj /usr/share/doc/aspell-nb-0.50.1.0-r1/info.bz2
--- replaced obj /usr/share/doc/aspell-nb-0.50.1.0-r1/README.bz2
--- replaced dir /usr/share/doc/aspell-nb-0.50.1.0-r1
--- replaced dir /usr/share/doc
--- replaced dir /usr/share
--- replaced obj /usr/lib64/aspell-0.60/norsk.alias
--- replaced obj /usr/lib64/aspell-0.60/no.alias
--- replaced obj /usr/lib64/aspell-0.60/nb.rws
--- replaced obj /usr/lib64/aspell-0.60/nb.multi
--- replaced obj /usr/lib64/aspell-0.60/nb.dat
--- replaced obj /usr/lib64/aspell-0.60/bokmal.alias
--- replaced dir /usr/lib64/aspell-0.60
--- replaced dir /usr/lib64
--- replaced dir /usr
>>> Regenerating /etc/ld.so.cache...
>>> Original instance of package unmerged safely.
>>> app-dicts/aspell-nb-0.50.1.0-r1 merged.
>>> Auto-cleaning packages...

>>> No outdated packages were found on your system.

 * GNU info directory index is up-to-date.
Comment 1 Conrad Kostecki gentoo-dev 2021-04-17 12:51:27 UTC
Well, I am not sure, what I can do here, as even the unpacking process fails for you. If that would work, we could do some prepare and rename the stuff. Seems to be ZFS specific, as it works fine for me.
Comment 2 Conrad Kostecki gentoo-dev 2021-04-17 20:23:20 UTC
I asked upstream, if they could update the package.

This is likly a ZFS specific problem with 'utf8only=yes', I don't see really a bug fix, since IMHO it still should be able to unpack.
Comment 3 John Einar Reitan 2021-04-17 20:27:16 UTC
If I unpack to /tmp (tmpfs) it works, but a ls in bash shows the file as having bad encoding by printing escapes and not the 'å'.
So bash isn't happy either.
Comment 4 John Einar Reitan 2021-04-17 21:20:29 UTC
You can see this illegal use has been reported elsewhere https://issues.guix.gnu.org/36087
Comment 5 John Einar Reitan 2021-04-19 06:01:02 UTC
Testing on vfat with utf8 option it gives the same result as ZFS when unpacking.
I guess the only way to fix this is upstream?
Comment 6 Larry the Git Cow gentoo-dev 2021-04-21 21:41:47 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ae2839d248d5c6c036f039f3b31ebcdcca74b55

commit 5ae2839d248d5c6c036f039f3b31ebcdcca74b55
Author:     Conrad Kostecki <conikost@gentoo.org>
AuthorDate: 2021-04-21 21:31:00 +0000
Commit:     Conrad Kostecki <conikost@gentoo.org>
CommitDate: 2021-04-21 21:41:12 +0000

    app-dicts/aspell-nb: repack archive
    
    The original archive uses invalid utf-8 file names,
    so unpacking will fail on file systems like ZFS.
    
    Repacking original archive with fixed utf-8 file name.
    
    Closes: https://bugs.gentoo.org/783096
    Package-Manager: Portage-3.0.18, Repoman-3.0.3
    Signed-off-by: Conrad Kostecki <conikost@gentoo.org>

 app-dicts/aspell-nb/aspell-nb-0.50.1.0-r2.ebuild | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)