2008/3/11, Xavier <shiningxc@gmail.com>:
Currently, every options in pacman.conf apparently has a fixed case : RootDir = / DBPath = /var/lib/pacman/ CacheDir = /var/cache/pacman/pkg/ LogFile = /var/log/pacman.log HoldPkg = pacman glibc
But in fact, pacman does an insensitive comparisons when parsing the file. } else if(!strcmp(key, "CACHEDIR")) { with key = strtoupper("CacheDir")
So you can put cAcHeDiR if you like..
Then we found out this insensitive comparison didn't work in some locales, like tr_TR one, where for example, upper(i) != I To work around this, we also added a sensitive comparison : } else if(strcmp(origkey, "CacheDir") == 0 || strcmp(key, "CACHEDIR") == 0) { http://projects.archlinux.org/git/?p=pacman.git;a=commitdiff;h=1cd7567ff8af4...
So in fact, in tr_TR locale, only case sensitive options will really work (eg cAcHeDiR won't work). Why do we make a special case for this locale? I think that having to do every single comparisons twice during the config file parsing is really ugly, and more error prone when adding new options.
So I would vote for only allowing case sensitive options in pacman.conf, to treat all locales equally, and cleaning the code :)
If that's not acceptable, what about adding a new function, to do something like : } else if(compare(origkey, "CacheDir", "CACHEDIR") == 0) {
That still isn't ideal but would at least reduce the duplication a bit.
"only case sensitive" is ok for me, I'm not that lazy to use Shift. :-P -- Roman Kyrylych (Роман Кирилич)