Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 923233

Summary: media-gfx/zbar: utf8 decoding problem on musl? (was: dev-python/segno-1.6.0 fails tests)
Product: Gentoo Linux Reporter: Agostino Sarubbo <ago>
Component: Current packagesAssignee: Python Gentoo Team <python>
Status: RESOLVED FIXED    
Severity: normal CC: mgorny, musl
Priority: Normal Keywords: TESTFAILURE
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/heuer/segno/issues/134
https://github.com/mchehab/zbar/issues/281
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 430702    
Attachments: build.log

Description Agostino Sarubbo gentoo-dev 2024-01-29 08:15:23 UTC
https://blogs.gentoo.org/ago/2020/07/04/gentoo-tinderbox/

Issue: dev-python/segno-1.6.0 fails tests.
Discovered on: amd64 (internal ref: tinderbox_musl)
System: MUSL-SYSTEM
Info about the system: https://wiki.gentoo.org/wiki/Project:Tinderbox/Common_Issues_Helper#MUSL

Info about the issue:
https://wiki.gentoo.org/wiki/Project:Tinderbox/Common_Issues_Helper#CF0015
Comment 1 Agostino Sarubbo gentoo-dev 2024-01-29 08:15:26 UTC
Created attachment 883529 [details]
build.log

build log and emerge --info
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2024-02-03 15:55:22 UTC
Curious enough, I can't reproduce this on Alpine.
Comment 3 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2024-02-03 16:03:59 UTC
(In reply to Michał Górny from comment #2)
> Curious enough, I can't reproduce this on Alpine.

Scratch that, I needed to install zbar library.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2024-02-03 16:28:02 UTC
Confirmed that segno produces identical QRCode on glibc and musl.  However, `zbarimg` decodes it differently:

# zbarimg --raw /tmp/dist/test.png 
M酺chenb𡡷her
scanned 1 barcode symbols from 1 images in 0 seconds

while on glibc:

$ zbarimg --raw test.png 
Märchenbücher
scanned 1 barcode symbols from 1 images in 0 seconds
Comment 5 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2024-02-03 16:40:32 UTC
So apparently segno is encoding the string as iso-8859-1 but zbar is decoding it as utf-8.
Comment 6 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2024-02-03 17:07:01 UTC
Incorrect.  It's actually trying to decode it as big5.  For some reason, iconv() for this fails on glibc:

$ iconv -f utf8 -t iso-8859-1 <<<'Märchenbücher' | iconv -f big5 -t utf8
M酺chenbiconv: illegal input sequence at position 8

but passes on musl:

$ iconv -f utf8 -t iso-8859-1 <<<'Märchenbücher' | iconv -f big5 -t utf8
M酺chenb𡡷her

Am I the only person thinking musl upstream will tell me that POSIX technically permits that?
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2024-02-03 17:34:49 UTC
Ok, it doesn't really matter.  zbar is making horribly wrong assumptions here, and it's just a miraculous coincidence that "Märchenbücher" doesn't work on glibc.  "Märchen" alone would get miscoded either way.
Comment 8 Larry the Git Cow gentoo-dev 2024-02-09 03:33:45 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3ad9a11483ce0f348173f6b40d5eeffb30caffe4

commit 3ad9a11483ce0f348173f6b40d5eeffb30caffe4
Author:     Michał Górny <mgorny@gentoo.org>
AuthorDate: 2024-02-09 03:26:20 +0000
Commit:     Michał Górny <mgorny@gentoo.org>
CommitDate: 2024-02-09 03:33:39 +0000

    dev-python/segno: Bump to 1.6.1
    
    Closes: https://bugs.gentoo.org/923233
    Signed-off-by: Michał Górny <mgorny@gentoo.org>

 dev-python/segno/Manifest           |  1 +
 dev-python/segno/segno-1.6.1.ebuild | 38 +++++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+)