FS#74895 - [flac] metaflac always detects locale as US-ASCII

Attached to Project: Arch Linux
Opened by Joost Molenaar (j0057_1) - Sunday, 29 May 2022, 10:23 GMT
Last edited by Jan Alexander Steffens (heftig) - Sunday, 10 July 2022, 10:17 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Jan Alexander Steffens (heftig)
Levente Polyak (anthraxx)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:

When running metaflac to set tags in .flac files, and passing in
non-ASCII values for the vorbis comments fields, all non-ASCII
characters are replaced with fallback characters. One option is
to pass in the --no-utf8-convert option or to set the CHARSET
environment variable to UTF-8, but this wouldn't be needed
if the package were compiled with HAVE_LANGINFO_CODESET defined.

The bug happens in the current_charset() function in utf8.c[1];
if compiled without -DHAVE_LANGINFO_CODESET=ON, the function
only looks at the CHARSET environment variable and falls back
to US-ASCII if it's undefined.

I tested that adding -DHAVE_LANGINFO_CODESET=ON to the PKGBUILD
solves the issue.

[1] https://github.com/xiph/flac/blob/1.3.4/src/share/utf8/utf8.c#L133-L144

Additional info:

Package version 1.3.4-2

Steps to reproduce:

1. copy some flac file to /tmp/test.flac
2. metaflac /tmp/test.flac --set-tag ARTIST="DJ Krush" --set-tag ALBUM="漸 -Zen-"
3. metaflac /tmp/test.flac --list --block-type VORBIS_COMMENT

With a metaflac compiled without HAVE_LANGINFO_CHARSET, step 2 puts
in the '#' fallback character for non-ASCII bytes in the metadata,
and step 3 outputs the '?' as fallback for non-ASCII bytes.

In case Flyspray mangles the second step, a Unicode-safe invocation (from Bash) is:

metaflac /tmp/test.flac --set-tag ARTIST="DJ Krush" --set-tag ALBUM=$'\u6F38 -Zen-'
This task depends upon

Closed by  Jan Alexander Steffens (heftig)
Sunday, 10 July 2022, 10:17 GMT
Reason for closing:  Fixed
Additional comments about closing:  flac 1.3.4-3
Comment by Joost Molenaar (j0057_1) - Sunday, 29 May 2022, 10:26 GMT
Correction; I meant HAVE_LANGINFO_CODESET instead of HAVE_LANGINFO_CHARSET.
Comment by - (fx333) - Tuesday, 21 June 2022, 07:45 GMT
Bump. This is a regression from the packaged 1.3.3 caused by the change to cmake.

This also affects encoding with flac(1) and can be confirmed as follows:
* ffmpeg -loglevel quiet -f lavfi -i anullsrc -t 1 test.wav
* flac -f -T "TITLE=無" test.wav
* ffprobe -hide_banner test.flac
Comment by FiveYellowMice (FiveYellowMice) - Saturday, 09 July 2022, 14:38 GMT
I confirmed that upstream has fixed this issue with commit https://github.com/xiph/flac/commit/b171e767e282909d3f4ef4b7d7fcb9b7d7987ff5 .

Loading...