From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,660973a335e8cfa0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Newsgroups: comp.lang.ada Subject: Re: File list on Windows and Debian References: <1150790778.224228.282310@y41g2000cwy.googlegroups.com> From: M E Leypold Date: 20 Jun 2006 13:59:01 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii User-Agent: Some cool user agent (SCUG) NNTP-Posting-Host: 88.72.231.248 X-Trace: news.arcor-ip.de 1150804394 88.72.231.248 (20 Jun 2006 13:53:14 +0200) X-Complaints-To: abuse@arcor-ip.de Path: g2news2.google.com!news3.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor-ip.de!news.arcor-ip.de!not-for-mail Xref: g2news2.google.com comp.lang.ada:4864 Date: 2006-06-20T13:59:01+02:00 List-Id: Anders Wirzenius writes: > "Ludovic Brenta" writes: > > > Anders Wirzenius writes : > > > I am trying to process files in a directory. They have to be processed > > > in alphabetical order. With following code I get a nice sorted list on > > > Windows XP but not sorted at all on Linux Debian. Have I missed > > > something that switches the sorting on on Debian (Sarge)? > > > > I tried your program at home, and had to tweak it a little bit for it > > to compile. Then I also ghot unsorted directory entries, like I did > > with another program I wrote. > > > > I think this is by design on GNU/Linux systems. They don't impose the > > overhead of sorting potentially large numbers of directory entries > > unless you really need to sort them. That is correct. I suppose that the Gnat directory functions just interface to readdir(3) and with readdir() the order of entries is dependend on the underlying filesystem. In ext2fs this is AFAIS the order in which they are written (a directory is just a file with dirent records, actually), with xfs (which uses btrees internally) entries get retrieved mostly sorted but AFAIR "." and ".." are not the first two and so on. I'd expect different results for reiser fs also. Regards -- Markus