bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ls -v oddity with autosave files


From: Jim Meyering
Subject: Re: ls -v oddity with autosave files
Date: Thu, 09 Apr 2009 14:26:42 +0200

Kamil Dudka wrote:

> On Thursday 09 April 2009 11:32:58 Kamil Dudka wrote:
>> On Thursday 09 April 2009 09:23:37 Sven Joachim wrote:
>> > Note that the #.b# file is listed at the top in (1) and at the bottom in
>> > (2), despite all filenames in the directory being the same!
>>
>> Thanks for discovering this! The transitive axiom of the predicate is
>> broken. I am working on a fix. It seems like a regression from this commit:
>> http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=0443c2f3994
>>3017f0aaa0afacbf68fb725858963
>
> The fix for hidden files was based on a really bad idea. I've replaced it
> with a special handle for "", "." and "..".
>
> Each strcmp compares max 2 or 3 chars, so there is no performance impact
> (tested with -02 with zero impact; with -O0 it takes about 2% more time on
> sorting 100000 items).
>
> The behavior on the current test suite is unchanged and the suite has been
> enlarged with "" and "#.b#". Note that the suite has been already checking
> transitivity of the sort predicate, but the "#.b#" was not included.

Thanks, Sven, for the report,
and Kamil, for the speedy fix.

FYI, this demonstrates the problem, too:

    $ printf '%s\n' .b a '#.b' |sort -V
    .b
    a
    #.b

    $ printf '%s\n' '#.b' a .b |sort -V
    #.b
    .b
    a

With your fix, the outputs are the same, as they should be:

    $ printf '%s\n' .b a '#.b' |./sort
    #.b
    .b
    a

I've pushed it to gnulib.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]