lkml.org 
[lkml]   [2008]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: directory sort order no longer beginning with "." and ".."?
On Tue, Jul 29, 2008 at 7:53 AM, Jeremy Fitzhardinge <jeremy@goop.org> wrote:
> Oliver Soltys wrote:
>>
>> My question: is this a bug, or a feature? I could not find anything about
>> that
>> anywhere...
>>
>> Does anybody have an idea, how I can fix this? Unfortunately, our
>> application
>> can not be changed.
>
> No Unix-like system makes any guarantee about the order of '.' and '..' with
> respect to other directory entries. They've often appeared first as an
> implementation side-effect, but that's highly system and filesystem
> dependent.
>
> If you can't modify the app, you might consider some LD_PRELOAD library to
> replace readdir with something that sorts the results in the order your app
> expects. There's already examples of that kind of thing to sort the results
> by inode.

That's a good idea, though based on his description it's even easier.
The LD_PRELOAD just needs to artificially introduce . and .., at the
beginning and toss them out once it hits them in the list. No sorting
required.


\
 
 \ /
  Last update: 2008-07-29 18:37    [W:0.045 / U:0.468 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site