Bug 45700 - incorrect sort order of apr_strnatcmp with non-ASCII sequences
Summary: incorrect sort order of apr_strnatcmp with non-ASCII sequences
Status: NEW
Alias: None
Product: APR
Classification: Unclassified
Component: APR (show other bugs)
Version: HEAD
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---
Assignee: Apache Portable Runtime bugs mailinglist
URL:
Keywords: PatchAvailable
Depends on:
Blocks:
 
Reported: 2008-08-27 21:37 UTC by Hiroshi Sumita
Modified: 2008-09-03 06:31 UTC (History)
1 user (show)



Attachments
patch for this issue. (for srclib/apr/strings/apr_strnatcmp.c) (945 bytes, patch)
2008-08-27 21:37 UTC, Hiroshi Sumita
Details | Diff
patch for this issue. [srclib/apr/strings/apr_strnatcmp.c] (1.15 KB, patch)
2008-08-28 01:59 UTC, Hiroshi Sumita
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Hiroshi Sumita 2008-08-27 21:37:54 UTC
Created attachment 22489 [details]
patch for this issue. (for srclib/apr/strings/apr_strnatcmp.c)

if "IndexOptions VersionSort" is enabled, sort order in autoindex is incorrect with non-ASCII filename.

usually non-ASCII characters is bigger than ASCII characters by strcmp().
but if VersionSort option is enabled, ASCII is bigger than non-ASCII.

for example,
"foo.txt" < "ほげ.txt"  if this option is disabled.
"foo.txt" > "ほげ.txt"  if this option is enabled.

the cause of this issue is "apr_strnatcmp0()" in "apr_strnatcmp.c".
this function treat sequences as "char const *".
but we should this as "unsigned char const *" in a normal situation. (e.g. C function strcmp())

I wrote a patch for this issue.
please see and marge this one.
Comment 1 Hiroshi Sumita 2008-08-28 01:59:02 UTC
Created attachment 22491 [details]
patch for this issue. [srclib/apr/strings/apr_strnatcmp.c]