|
Boost : |
Subject: Re: [boost] [filesystem] Should recursive_directory_iterator follow directory symlinks by default?
From: Beman Dawes (bdawes_at_[hidden])
Date: 2011-02-12 07:56:43
On Wed, Feb 9, 2011 at 12:54 PM, John Maddock <boost.regex_at_[hidden]> wrote:
>>>> Thus I'd like to add an option to either following directory symlinks
>>>> or not. Which should the default be?
>>>
>>> *nix follows symlinks by default. One must use special APIs to recognize
>>> and inspect symlinks. I should think consistency across platforms would be
>>> good.
>>
>> That isn't really true. There isn't any POSIX function for recursive
>> directory walking. It is simply a matter of whether lstat or stat is used
>> to check whether directory entries are themselves directories. As one
>> example, GNU find does not follow symlinks by default.
>
> And also following symlinks requires special handling to prevent going round
> and round in circles in the pathological cases.... which is not to say the
> option of a symlink following API wouldn't be useful.
I'm convinced. In the long run, it is [slightly] safer for the default
to not follow directory symlinks. So that will become the default.
Thanks to everyone who commented,
--Beman
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk