Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Topic names in topics.conf with uppercase are ignored #91

Closed
wouldsmina opened this issue Oct 12, 2017 · 14 comments
Closed

Topic names in topics.conf with uppercase are ignored #91

wouldsmina opened this issue Oct 12, 2017 · 14 comments
Labels
Milestone

Comments

@wouldsmina
Copy link

Hello,

No list is shown when selecting a topic with uppercase.

part of topics.conf :

...
ADM
title administration
title.fr administration

RECH
title research
title.fr recherche
...

Debug :
Oct 12 09:39:35 sympa wwsympa[9087]: debug3 Sympa::List::get_lists() filter (scalar(grep { $_ eq "adm" or index($_, "adm/") == 0 } @{$list->{"admin"}{"topics"} || []})); (topics_list LIKE '%,adm,%' OR topics_list LIKE '%,adm/%')

OS : DEBIAN 9
Sympa : 6.2.16

@MargoM
Copy link

MargoM commented Oct 12, 2017

I tried to reproduce, same debug:

Oct 12 16:33:35 sympa wwsympa[32645]: debug3 Sympa::List::get_lists() filter (scalar(grep { $_ eq "testtopic" or index($_, "testtopic/") == 0 } @{$list->{"admin"}{"topics"} || []})); (topics_list LIKE '%,testtopic,%' OR topics_list LIKE '%,testtopic/%')

OS: CentOS 7.4
Sympa: 6.2.20

I think there should be grep -i (ignore case).

@racke
Copy link
Contributor

racke commented Oct 12, 2017

Which database do you use @wouldsmina, @MargoM

@wouldsmina
Copy link
Author

hi @racke
I use MySQL, but topics are stored in config file...

@MargoM I would rather grep { lc($_),... but I don't find where get_lists() execute this command. If any body help me to find where can i change this line, I can test and make a PR...

@racke
Copy link
Contributor

racke commented Oct 12, 2017

This should be the grep you are searching for:

https://github.com/sympa-community/sympa/blob/master/src/lib/Sympa/List.pm#L8066

@wouldsmina
Copy link
Author

thank you @racke. grep { lc($_), don't work :/

@racke
Copy link
Contributor

racke commented Oct 12, 2017

I think you also need to lc($_) in index(...).

@wouldsmina
Copy link
Author

not working too

@racke
Copy link
Contributor

racke commented Oct 12, 2017

I'm wondering why you don't just lowercase "ADM" in topics.conf. I suppose it doesn't show in the UI anyway.

@MargoM
Copy link

MargoM commented Oct 12, 2017

I'm using MySQL. Like racke said, i think you should use uppercases in title/title.fr. This "ADM" is only stored in configuration file and in list_table table.

@wouldsmina
Copy link
Author

Like racke said, i think you should use uppercases in title/title.fr.

that's what I did. I just wanted to inform about this unexpected behavior

@ikedas
Copy link
Member

ikedas commented Oct 13, 2017

Like racke said, i think you should use uppercases in title/title.fr.

that's what I did. I just wanted to inform about this unexpected behavior

I suppose only lowercase topic names are expected. The behavior accepting uppercase topic names seems bug.

@wouldsmina
Copy link
Author

ok. So I close this ticket.
thanks

@ikedas ikedas added the bug label Oct 13, 2017
@ikedas ikedas added this to the 6.2.24 milestone Oct 13, 2017
@ikedas ikedas reopened this Oct 13, 2017
@ikedas
Copy link
Member

ikedas commented Oct 13, 2017

Reopened.

If db_list_chache is on and database is MySQL, topics_list field will be matched using case-insensitive collation (utf8_general_ci etc.): Uppercase topic identifiers will be treated the same as lowercase. This is not the case with the other database and no database (db_list_chache is off).

One solution is to normalize topic identifiers to lowercase.

@ikedas ikedas changed the title topics with uppercase Topic names in topics.conf with uppercase are ignored Oct 15, 2017
ikedas added a commit to ikedas/sympa that referenced this issue Nov 1, 2017
…munity#91

Now topic identfiers (names) in topics.conf will be normalized to lowercase.
ikedas added a commit that referenced this issue Nov 8, 2017
Topic names in topics.conf with uppercase are ignored #91 by ikedas
@ikedas
Copy link
Member

ikedas commented Nov 8, 2017

Merged. This issue is closed.

@ikedas ikedas closed this as completed Nov 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants