Skip to content

albums of different artists merged in library view #103

Closed

Description

@vicvw

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 :)

Activity

  1. flyingmutant commented on Feb 4, 2014

    @flyingmutant
    Member

    Can you please publish your test files which are merged together?

  2. vicvw commented on Feb 4, 2014

    @vicvw
    Author

    https://db.tt/ooK3URvL

    I tried to create a somewhat minimal scenario (of dummy files) where all cases/combinations occur.

  3. flyingmutant commented on Feb 4, 2014

    @flyingmutant
    Member

    2014-02-04 20 24 07
    2014-02-04 20 24 34

    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 master branch?

  4. mahkoh commented on Feb 4, 2014

    @mahkoh
    Member

    It doesn't work because strxfrm returns garbage.

    아아   ¶¶¶¶¶¶
    나나   ¶¶¶¶¶¶
    오오   ¶¶¶¶¶¶
    노노노   ¶¶¶¶¶¶¶¶¶
    우우   ¶¶¶¶¶¶
    노노   ¶¶¶¶¶¶
    바바바   ¶¶¶¶¶¶¶¶¶
    사사사   ¶¶¶¶¶¶¶¶¶
    보보보   ¶¶¶¶¶¶¶¶¶
    소소소소   ¶¶¶¶¶¶¶¶¶¶¶¶
    부부부   ¶¶¶¶¶¶¶¶¶
    사사사   ¶¶¶¶¶¶¶¶¶
    자자자   ¶¶¶¶¶¶¶¶¶
    사사사   ¶¶¶¶¶¶¶¶¶
    히히히히   ¶¶¶¶¶¶¶¶¶¶¶¶
    잉잉잉잉   ¶¶¶¶¶¶¶¶¶¶¶¶
    흐흐흐흐흐   ¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶
    응응응응응   ¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶
    퍼퍼퍼퍼퍼   ¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶
    터터터터터   ¶¶¶¶¶¶¶¶¶¶¶¶¶¶¶
    

    Right side are the collkeys.

  5. flyingmutant commented on Feb 4, 2014

    @flyingmutant
    Member

    Maybe the reason is the current locale setting, since strxfrm depends on it? What is your LANG?

  6. mahkoh commented on Feb 4, 2014

    @mahkoh
    Member

    en_US.UTF-8

    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.

  7. flyingmutant commented on Feb 4, 2014

    @flyingmutant
    Member

    Hm, weird because mine is ru_RU.UTF-8.

    @vicvw, what about you? What is the LANG and operating system?

    @mahkoh, you have this bug too, right — so I am the only one who does not have it?

  8. mahkoh commented on Feb 4, 2014

    @mahkoh
    Member

    What's the return value of setlocale(LC_COLLATE, "") on your system?

  9. flyingmutant commented on Feb 4, 2014

    @flyingmutant
    Member

    ru_RU.UTF-8, same as LANG.

  10. mahkoh commented on Feb 4, 2014

    @mahkoh
    Member

    This program https://gist.github.com/anonymous/d8d56427f1538c68a91d has the following output on my system:

    237 141 188 0 
    237 157 144 0 
    1 1 1 1 194 182 1 194 182 1 194 182 0 
    1 1 1 1 194 182 1 194 182 1 194 182 0 
    

    Do you know where strxfrm gets its data from?

  11. flyingmutant commented on Feb 4, 2014

    @flyingmutant
    Member

    No idea! FYI, I've got

    237 141 188 0
    237 157 144 0
    48 48 51 95 48 48 50 63 48 48 50 110 48 48 48 48 48 48 51 95 48 48 50 63 48 48 50 110 0
    48 48 51 95 48 48 50 79 48 48 50 66 48 48 48 48 48 48 51 95 48 48 50 79 48 48 50 66 0
    
  12. vicvw commented on Feb 4, 2014

    @vicvw
    Author

    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.

    outputs of the gist:

    en_US:

    237 141 188 0 
    237 157 144 0 
    1 1 1 1 194 182 1 194 182 1 194 182 0 
    1 1 1 1 194 182 1 194 182 1 194 182 0 
    

    ja_JP:

    237 141 188 0 
    237 157 144 0 
    3 3 3 0 
    3 3 3 0 
    

    ko_KR:

    237 141 188 0 
    237 157 144 0 
    226 175 148 0 
    226 190 168 0 
    
  13. flyingmutant commented on Feb 4, 2014

    @flyingmutant
    Member

    According to my man pages,

    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.

  14. mahkoh commented on Feb 4, 2014

    @mahkoh
    Member

    strcoll of the two characters returns 0 after setlocale on my system.

  15. flyingmutant commented on Feb 4, 2014

    @flyingmutant
    Member

    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.

  16. vicvw commented on Feb 4, 2014

    @vicvw
    Author

    @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 ...

  17. vicvw commented on Feb 4, 2014

    @vicvw
    Author

    Tried it with ru_RU.UTF-8 thinking maybe there was something special about it, but no ...

  18. flyingmutant commented on Feb 4, 2014

    @flyingmutant
    Member

    Tried it with ru_RU.UTF-8 thinking maybe there was something special about it, but no ...

    It probably works for me because I am running cmus on OS X, which has different libc implementation.

  19. mahkoh commented on Feb 4, 2014

    @mahkoh
    Member

    You can do the following to fix it: Go to /usr/share/i18n/locales and open the file iso14651_t1. Above END LC_COLLATE add the following

    script <HANGUL>
    
    order_start <HANGUL>;forward;forward;forward;forward,position
    <UAC00> <UAC00>;IGNORE;IGNORE;IGNORE
    .. ..;IGNORE;IGNORE;IGNORE
    <UD7A3> <UD7A3>;IGNORE;IGNORE;IGNORE
    #
    order_end
    #
    

    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.

  20. vicvw commented on Feb 4, 2014

    @vicvw
    Author

    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?

  21. mahkoh commented on Feb 4, 2014

    @mahkoh
    Member

    ja_JP probably doesn't include iso14651_t1.

    May I ask how you found this out?

    Downloading the glibc code, reading lots of code, urgh...

    Is there perhaps any other way to do collation?

    There should be no need for another way since this is the right way to do it.

    Is this a bug somewhere else then?

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions