You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
albums of different artists merged in library view #103
So I have some music (mp3) where the (at least the relevant) tags are in Korean (hangul).
E.g.:
Artist: 요조, Album: 나의 쓸모
Artist: 프롬, Album: Arrival
(Both artists have two-character names.)
In library view both albums are shown under one of those artists. When a song is played the correct artist name is shown.
I suspect that the artist displayed (in library view) is the one of the top album of the list when nothing of either artist is being played or when something is the one whose song is currently being played. The artist displayed doesn't change at runtime but does after quitting and resuming play.
The same happens with two other artists whose names are both three characters long.
(One other artist whose name has more than three characters is shown separately.)
A dummy file I created with another two-character name artist was also added to the other such artists.
Just now did I find out that the same happens with songs as well: the songs of two different artists but on an album with the same name (album name in hangul) are shown under the same album. But I guess this would be consistent behavior, at least.
My mostly uneducated guess would have something to do with sorting and/or encoding.
A hint that this problem might only affect korean hangul is that I couldn't reproduce the behavior with Japanese kanji or kana (but then, the structure of hangul and kanji is hardly similar).
This is my first issue ever, so feel free to complain :)
The problem goes away when I remove setlocale(LC_COLLATE, "") in ui_curses. The LC_COLLATE is "C" at startup and that line changes it to "en_US.UTF-8". I've no idea why that breaks cmus.
There is a possibly related bug: cmus is unable to sort many of my artists properly.
I use cmus 2.5.0; it happens with the version in the Arch Linux repo and a version I compiled from git a while ago (v2.5.0-26-g371e060). Did not yet try master HEAD.
My LANG is either en_US.UTF-8 or ja_JP.UTF-8; it makes no difference. setlocale(LC_COLLATE, "") returns the same as the current LANG.
I just generated Korean locales and it behaves correctly when I set the LANG to ko_KR.UTF-8.
Comparing two strings using strcmp() after strxfrm() is equal to comparing two original strings with strcoll().
and
The strcoll() function lexicographically compares the null-terminated strings s1 and s2 according to the current locale collation and returns an integer greater than, equal to, or less than 0, according as s1 is greater than, equal to, or less than s2. If information about the current locale collation is not available, the value of strcmp(s1, s2) is returned.
So this looks to me like a bug in strxfrm internals. But this should be pretty unlikely, so there has to be something I am currently missing.
But it should not! Why the hell are they considered equal — they should be non-equal in any locale (because they are even when there is no locale info and strcoll degenerates to strcmp). Weird.
@mahkoh: the same for me, except when run with the Korean locale, in that case it's non-zero.
So it seems as if strcoll thinks it has all information it needs, uses it somehow and thus transforms at least all Korean characters into the same output character ...
and regenerate the locales with locale-gen. Now it should work.
Edit: This is how I see it: No locale except ko_KR has any information about the ordering of Hangul. There is a note in iso14651_t1_common (which is included by most locales) saying that every character that hasn't been explicitly specified is treated as a special character (whatever that means). It's not clear to me if this is a bug in glibc or the locales.
This does indeed work, but only for en_US not ja_JP. From what I can tell this has the same effect as running cmus with the Korean locale. I shall go with my solution as editing system files makes me feel dirty :)
May I ask how you found this out?
Is there perhaps any other way to do collation? I just tried Rhythmbox and it doesn't seem to have this problem. But I don't know enough about this stuff to discuss this any further ...
Lasltly, can this issue be closed? As it doesn't seem to be cmus's fault.
Is this a bug somewhere else then?
Activity
flyingmutant commentedon Feb 4, 2014
Can you please publish your test files which are merged together?
vicvw commentedon Feb 4, 2014
https://db.tt/ooK3URvL
I tried to create a somewhat minimal scenario (of dummy files) where all cases/combinations occur.
flyingmutant commentedon Feb 4, 2014
This is what I get in tree view and playlist view, respectively. I'd say this is the expected result, right?
What version of cmus are you using? Can you reproduce the issue with 2.5.0 and git
masterbranch?mahkoh commentedon Feb 4, 2014
It doesn't work because
strxfrmreturns garbage.Right side are the collkeys.
flyingmutant commentedon Feb 4, 2014
Maybe the reason is the current locale setting, since
strxfrmdepends on it? What is yourLANG?mahkoh commentedon Feb 4, 2014
en_US.UTF-8
The problem goes away when I remove
setlocale(LC_COLLATE, "")in ui_curses. TheLC_COLLATEis "C" at startup and that line changes it to "en_US.UTF-8". I've no idea why that breaks cmus.There is a possibly related bug: cmus is unable to sort many of my artists properly.flyingmutant commentedon Feb 4, 2014
Hm, weird because mine is
ru_RU.UTF-8.@vicvw, what about you? What is the
LANGand operating system?@mahkoh, you have this bug too, right — so I am the only one who does not have it?
mahkoh commentedon Feb 4, 2014
What's the return value of
setlocale(LC_COLLATE, "")on your system?flyingmutant commentedon Feb 4, 2014
ru_RU.UTF-8, same asLANG.mahkoh commentedon Feb 4, 2014
This program https://gist.github.com/anonymous/d8d56427f1538c68a91d has the following output on my system:
Do you know where
strxfrmgets its data from?flyingmutant commentedon Feb 4, 2014
No idea! FYI, I've got
vicvw commentedon Feb 4, 2014
I use cmus 2.5.0; it happens with the version in the Arch Linux repo and a version I compiled from git a while ago (v2.5.0-26-g371e060). Did not yet try master HEAD.
My
LANGis eitheren_US.UTF-8orja_JP.UTF-8; it makes no difference.setlocale(LC_COLLATE, "")returns the same as the currentLANG.I just generated Korean locales and it behaves correctly when I set the
LANGtoko_KR.UTF-8.outputs of the gist:
en_US:
ja_JP:
ko_KR:
flyingmutant commentedon Feb 4, 2014
According to my man pages,
and
So this looks to me like a bug in
strxfrminternals. But this should be pretty unlikely, so there has to be something I am currently missing.mahkoh commentedon Feb 4, 2014
strcollof the two characters returns 0 aftersetlocaleon my system.flyingmutant commentedon Feb 4, 2014
But it should not! Why the hell are they considered equal — they should be non-equal in any locale (because they are even when there is no locale info and
strcolldegenerates tostrcmp). Weird.vicvw commentedon Feb 4, 2014
@mahkoh: the same for me, except when run with the Korean locale, in that case it's non-zero.
So it seems as if
strcollthinks it has all information it needs, uses it somehow and thus transforms at least all Korean characters into the same output character ...vicvw commentedon Feb 4, 2014
Tried it with
ru_RU.UTF-8thinking maybe there was something special about it, but no ...flyingmutant commentedon Feb 4, 2014
It probably works for me because I am running cmus on OS X, which has different libc implementation.
mahkoh commentedon Feb 4, 2014
You can do the following to fix it: Go to
/usr/share/i18n/localesand open the fileiso14651_t1. AboveEND LC_COLLATEadd the followingand regenerate the locales with
locale-gen. Now it should work.Edit: This is how I see it: No locale except ko_KR has any information about the ordering of Hangul. There is a note in
iso14651_t1_common(which is included by most locales) saying that every character that hasn't been explicitly specified is treated as a special character (whatever that means). It's not clear to me if this is a bug in glibc or the locales.vicvw commentedon Feb 4, 2014
This does indeed work, but only for
en_USnotja_JP. From what I can tell this has the same effect as running cmus with the Korean locale. I shall go with my solution as editing system files makes me feel dirty :)May I ask how you found this out?
Is there perhaps any other way to do collation? I just tried Rhythmbox and it doesn't seem to have this problem. But I don't know enough about this stuff to discuss this any further ...
Lasltly, can this issue be closed? As it doesn't seem to be cmus's fault.
Is this a bug somewhere else then?
mahkoh commentedon Feb 4, 2014
ja_JPprobably doesn't includeiso14651_t1.Downloading the glibc code, reading lots of code, urgh...
There should be no need for another way since this is the right way to do it.
I've filed a bug report here: https://sourceware.org/bugzilla/show_bug.cgi?id=16527
But, looking at the buglist, I'm less than hopeful.