behaviour change in getDirectoryContents in GHC 7.2?
David Brown
haskell3 at davidb.org
Fri Nov 4 15:16:22 CET 2011
On Thu, Nov 03, 2011 at 09:41:32AM +0000, Max Bolingbroke wrote:
>On 2 November 2011 21:46, Ganesh Sittampalam <ganesh at earth.li> wrote:
>> The workaround you propose seems a little complex and it might be a bit
>> problematic that 100% roundtripping can't be guaranteed even once your
>> fix is applied.
>
>I can understand this perspective, although the roundtripping as
>implemented will only fail in certain very obscure cases.
Depending on the software one is writing, any failure, no matter how
obscure, would not be acceptable. Think of a file browser, or backup
software. So, yes, a non-destructive way of reading directories is
important.
At least one Linux distribution (I think Gentoo) actually has invalid
pathnames in the filesystem in order to make sure that software that
is part of the system will be able to handle them.
For 'harchive' (which I am still gradually working on), I had to write
my own version of readDirStream out of Posix that returns both the
path and the inode number (FileID). Most filesystems on Linux are
vastly faster if you 'stat' the entires of a directory in inode order
rather than the order they were returned by readdir. In this sense,
I'm not all that concerned if the regular getDirectoryContents isn't
round trippable.
David
More information about the Glasgow-haskell-users
mailing list