#14542: Make wxFileName and wxDir symlink-friendly

38 views
Skip to first unread message

wxTrac

unread,
Jul 31, 2012, 8:07:55 AM7/31/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542>

#14542: Make wxFileName and wxDir symlink-friendly
--------------------------------------+-------------------------------------
Reporter: dghart | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Keywords: wxFileName wxDir symlink | Blockedby:
Patch: 1 | Blocking:
--------------------------------------+-------------------------------------
This patch was prompted by trying to use wxFileSystemWatcher to watch a
directory that contained a symlink to another directory in the same tree.
wxDir::Traverse always follows symlinks, so the destination dir was added
multiple times, the symlink not at all.

The main patch does the following:

wxFileName: As suggested on wx-dev, there are two new functions,
DontFollowLink() and ShouldFollowLink(). I've also added a
dereferenceLink parameter to the static versions of FileExists(),
DirExists() and Exists(), the current behaviour being the default. These
changes are documented.

wxDir: The only alteration needed was to wxDirData::Read in
src/unix/dir.cpp, which now uses wxFileName::DirExists with the new
dereferenceLink parameter false. I've not made deferencing optional as I
doubt if anyone would ever want to; but it could be added if you wish.

This fix also makes wxFileName::Rmdir(wxPATH_RMDIR_RECURSIVE) succeed when
the directory contains a symlink-to-directory; previously the symlink
wasn't removed, so the final wxRmdir() failed.

The other patch adds a section testing this to the 'filename' unit test.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542>

wxTrac

unread,
Jul 31, 2012, 12:45:29 PM7/31/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:3>

#14542: Make wxFileName and wxDir symlink-friendly
--------------------------------------+-------------------------------------
Reporter: dghart | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Keywords: wxFileName wxDir symlink | Blockedby:
Patch: 1 | Blocking: 14544, 14544
--------------------------------------+-------------------------------------

Comment(by vadz):

The patch looks mostly good but,
[http://www.wxwidgets.org/develop/standard.htm#no_bool_params as usual], I
don't like the use of bool parameters in public API, i.e. in
`FileExists()` and `DirExists()` and would prefer to use some kind of
flags.

In fact, we could make `wxFileSystemObject_XXX` public and allow calling
`Exists(wxFileSystemObject_File | wxFileSystemObject_Link)` (perhaps with
shorter names?) to check for the existence of a link to a file?

Boolean argument is, of course, quite all right for `DontFollowSymlinks()`
itself. I could apply this part of the patch even now if you'd like.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:3>

wxTrac

unread,
Jul 31, 2012, 2:47:01 PM7/31/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:6>

#14542: Make wxFileName and wxDir symlink-friendly
--------------------------------------+-------------------------------------
Reporter: dghart | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Keywords: wxFileName wxDir symlink | Blockedby:
Patch: 1 | Blocking: 14544, 14544, 14544, 14544
--------------------------------------+-------------------------------------

Comment(by dghart):

Replying to [comment:3 vadz]:
> The patch looks mostly good but,
[http://www.wxwidgets.org/develop/standard.htm#no_bool_params as usual], I
don't like the use of bool parameters in public API

I know :) but I thought this might be an exception, as it's difficult to
think of any other flag that might be needed in the future.

> In fact, we could make `wxFileSystemObject_XXX` public and allow calling
`Exists(wxFileSystemObject_File | wxFileSystemObject_Link)` (perhaps with
shorter names?) to check for the existence of a link to a file?

I think I'd choose the first way, and I'll change the patch to do that;
but let me know if you'd rather use wxFileSystemObject direct.

> Boolean argument is, of course, quite all right for
`DontFollowSymlinks()` itself. I could apply this part of the patch even
now if you'd like.

Thanks, but it'll be easier for me to redo the whole patch.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:6>

wxTrac

unread,
Jul 31, 2012, 5:37:14 PM7/31/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:7>

#14542: Make wxFileName and wxDir symlink-friendly
--------------------------------------+-------------------------------------
Reporter: dghart | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Keywords: wxFileName wxDir symlink | Blockedby:
Patch: 1 | Blocking: 14544, 14544, 14544, 14544
--------------------------------------+-------------------------------------

Comment(by dghart):

I've updated the patch. I had to make the enum public anyway; it's now
called 'wxFSItem', which is less descriptive but certainly shorter.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:7>

wxTrac

unread,
Oct 14, 2012, 8:21:10 PM10/14/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:13>

#14542: Make wxFileName and wxDir symlink-friendly
--------------------------------------+-------------------------------------
Reporter: dghart | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Keywords: wxFileName wxDir symlink | Blockedby:
Patch: 1 | Blocking: 1993, 14544, 14544, 14544, 14544, 14649, 14649, 14649, 14649
--------------------------------------+-------------------------------------

Comment(by vadz):

I'm going to apply the `DontFollowLink()` part of this patch but I'm still
not totally happy about the changes to `{File,Dir,}Exists()` so I won't
change the static variants of these functions -- just update the member
ones to honour the setting of `m_dontFollowLinks`.

The main reason I'm unhappy about the static ones is pretty stupid but
here it is: naming. I don't think `wxFSItem` is a good name (meaning not
for the enum itself, as nobody cares about it, but as the prefix for its
elements) but I can't for the life of me come with anything better. So
instead of not doing anything, I've decided to apply the important part of
the patch right now and add the other one later, when somebody comes up
with a good idea about how to call these flags.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:13>

wxTrac

unread,
Oct 14, 2012, 9:09:03 PM10/14/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:15>

#14542: Make wxFileName and wxDir symlink-friendly
----------------------------------------------------------------------------------+
Reporter: dghart | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: fixed | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14544, 14544, 14544, 14544, 14544, 14649, 14649, 14649, 14649 |
----------------------------------------------------------------------------------+
Changes (by VZ):

* status: new => closed
* resolution: => fixed


Comment:

(In [72680]) Add support for symlinks to wxFileName.

Allow to work with the symlinks themselves and not the file they reference
by
calling the new wxFileName::DontFollowLink().

Update Unix wxDir implementation to not treat symlinks to directories as
directories, this ensures that we don't recurse into the directories
outside
of the original parent accidentally.

Closes #14542.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:15>

wxTrac

unread,
Oct 16, 2012, 10:27:28 AM10/16/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:22>

#14542: Make wxFileName and wxDir symlink-friendly
--------------------------------------------------------------------------------------------------------------+
Reporter: dghart | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: fixed | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14544, 14544, 14544, 14544, 14544, 14544, 14544, 14544, 14544, 14649, 14649, 14649, 14649 |
--------------------------------------------------------------------------------------------------------------+
Changes (by dghart):

* blocking: 1993, 14544, 14544, 14544, 14544, 14544, 14544, 14544,
14544, 14544, 14544, 14544, 14649, 14649,
14649, 14649 => 1993, 14544, 14544, 14544,
14544, 14544, 14544, 14544, 14544, 14544,
14649, 14649, 14649, 14649


Comment:

Replying to [comment:13 vadz]:
> The main reason I'm unhappy about the static ones is pretty stupid but
here it is: naming. I don't think `wxFSItem` is a good name (meaning not
for the enum itself, as nobody cares about it, but as the prefix for its
elements) but I can't for the life of me come with anything better. So
instead of not doing anything, I've decided to apply the important part of
the patch right now and add the other one later, when somebody comes up
with a good idea about how to call these flags.

How about wxFileSystemFlags (or wxFSFlags if you prefer brevity)? Or
'Mode'?


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:22>

wxTrac

unread,
Oct 16, 2012, 11:24:54 AM10/16/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:23>

#14542: Make wxFileName and wxDir symlink-friendly
--------------------------------------------------------------------------------------------------------------+
Reporter: dghart | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: fixed | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14544, 14544, 14544, 14544, 14544, 14544, 14544, 14544, 14544, 14649, 14649, 14649, 14649 |
--------------------------------------------------------------------------------------------------------------+

Comment(by vadz):

Both are too generic IMHO, and we also already have
`wxFileSystemOpenFlags` which is for (virtual) `wxFileSystem` and not
(physical) `wxFileName` so it could be also a bit confusing. BTW, we also
already have `wxFileKind` too.

So I guess it would need to be some new `wxFileExistsFlags` (or, actually,
unnamed, because what do we need its name for?) enum with elements
`wxFILE_EXISTS_FILE` (or `REGULAR`?), `wxFILE_EXISTS_DIR`, ... and
`wxFILE_EXISTS_NO_FOLLOW`.

Any better suggestions?


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:23>

wxTrac

unread,
Oct 16, 2012, 1:14:37 PM10/16/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:24>

#14542: Make wxFileName and wxDir symlink-friendly
--------------------------------------------------------------------------------------------------------------+
Reporter: dghart | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: fixed | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14544, 14544, 14544, 14544, 14544, 14544, 14544, 14544, 14544, 14649, 14649, 14649, 14649 |
--------------------------------------------------------------------------------------------------------------+

Comment(by dghart):

Replying to [comment:23 vadz]:
> Both are too generic IMHO, and we also already have
`wxFileSystemOpenFlags` which is for (virtual) `wxFileSystem` and not
(physical) `wxFileName` so it could be also a bit confusing. BTW, we also
already have `wxFileKind` too.
OK

> So I guess it would need to be some new `wxFileExistsFlags` (or,
actually, unnamed, because what do we need its name for?) enum with
elements `wxFILE_EXISTS_FILE` (or `REGULAR`?), `wxFILE_EXISTS_DIR`, ...
and `wxFILE_EXISTS_NO_FOLLOW`.
I'm not sure I understand. If we don't bother with the static functions,
do we need an extra flag in the enum at all? Even if so, is there any need
to change the names from the anonymous wxFileSystemObject_Foo?

I'm perfectly happy to skip the statics. I added the flag to them for
completeness, and because it self-documents the need to consider symlinks;
but it's not that much extra work for the user to create a wxFileName
object and call DontFollowLink().

>Any better suggestions?
I don't dare make the alternative suggestion of reverting to a bool
parameter ;)


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:24>

wxTrac

unread,
Oct 16, 2012, 6:27:22 PM10/16/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:25>

#14542: Make wxFileName and wxDir symlink-friendly
--------------------------------------------------------------------------------------------------------------+
Reporter: dghart | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: fixed | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14544, 14544, 14544, 14544, 14544, 14544, 14544, 14544, 14544, 14649, 14649, 14649, 14649 |
--------------------------------------------------------------------------------------------------------------+

Comment(by vadz):

Replying to [comment:24 dghart]:
> I'm not sure I understand. If we don't bother with the static functions,
do we need an extra flag in the enum at all?

No, we don't, but I do agree that being able to use this functionality
with static functions would be useful/convenient/less surprising.

> >Any better suggestions?
> I don't dare make the alternative suggestion of reverting to a bool
parameter ;)

Believe it or not, but I did consider it. However I'd also like to add a
test for symlink existence as this can be useful and I'd really prefer to
do it by adding flags to `Exists()` rather than by adding yet another
`LinkExists()` so flags would be better here.

And for now the best I can see is to allow
{{{
#!cpp
if ( wxFileName::Exists(wxFILE_EXISTS_FILE | wxFILE_EXISTS_NO_FOLLOW) )
...
}}}
as I wrote above. OTOH it's not without its problems neither as this would
mean that the non-static `Exists()` shouldn't take the same flags because
`wxFILE_EXISTS_NO_FOLLOW` could conflict with `m_dontFollowLinks`.

So finally perhaps it's indeed better to do nothing for now and maybe add
`LinkExists()` etc (`FIFOExists()`? `SocketExists()?) later if anybody
asks for it.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:25>

wxTrac

unread,
Oct 17, 2012, 6:13:31 AM10/17/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:26>

#14542: Make wxFileName and wxDir symlink-friendly
-----------------------------------------------+----------------------------
Reporter: dghart | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: fixed | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14649, 14649, 14649, 14649 |
-----------------------------------------------+----------------------------
Changes (by dghart):

* blocking: 1993, 14544, 14544, 14544, 14544, 14544, 14544, 14544,
14544, 14544, 14649, 14649, 14649, 14649 =>
1993, 14649, 14649, 14649, 14649


Comment:

Replying to [comment:25 vadz]:
> Believe it or not, but I did consider it. However I'd also like to add a
test for symlink existence as this can be useful and I'd really prefer to
do it by adding flags to `Exists()` rather than by adding yet another
`LinkExists()` so flags would be better here.
>
> And for now the best I can see is to allow
> {{{
> #!cpp
> if ( wxFileName::Exists(wxFILE_EXISTS_FILE | wxFILE_EXISTS_NO_FOLLOW) )
> ...
> }}}

Ah, I understand now.

>OTOH it's not without its problems neither as this would mean that the
non-static `Exists()` shouldn't take the same flags because
`wxFILE_EXISTS_NO_FOLLOW` could conflict with `m_dontFollowLinks`.

Using wxFILE_EXISTS_NO_FOLLOW in non-static Exists() sounds to me like a
feature, and certainly not a problem. fn(wxFILE_EXISTS_DIR |
wxFILE_EXISTS_NO_FOLLOW) would test if fn holds a real dir, not a symlink,
without changing fn's default behaviour.

> So finally perhaps it's indeed better to do nothing for now and maybe
add `LinkExists()` etc (`FIFOExists()`? `SocketExists()?) later if anybody
asks for it.

I'm happy to implement this, or similar, if you wish. I wonder though if
it's worth adding extra functions (`FIFOExists()` etc) which will seldom
be used, to the already function-heavy wxFileName.
wxFilename::Exists(wxFILE_EXISTS_FLAGS flag = wxFILE_EXISTS_ANY) is less
readable, but allows testing for multiple types.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:26>

wxTrac

unread,
Oct 17, 2012, 11:42:50 AM10/17/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:27>

#14542: Make wxFileName and wxDir symlink-friendly
-----------------------------------------------+----------------------------
Reporter: dghart | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: fixed | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14649, 14649, 14649, 14649 |
-----------------------------------------------+----------------------------

Comment(by vadz):

I do prefer to have a single `Exists(flags = ALL)` rather than
`ThisExists()` and `ThatExists()` and so on. If you think it's not a
problem to have both `NO_FOLLOW` flag and `DontFollow()` method, this is
what should probably be done.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:27>

wxTrac

unread,
Oct 19, 2012, 8:17:54 AM10/19/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:28>

#14542: Make wxFileName and wxDir symlink-friendly
-----------------------------------------------+----------------------------
Reporter: dghart | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: fixed | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14649, 14649, 14649, 14649 |
-----------------------------------------------+----------------------------

Comment(by dghart):

Attached is a new patch, filename.diff, that implements the flags
parameter. I've combined block and char devices in wxFILE_EXISTS_DEVICE,
but they could easily be separated if you prefer.
I've also left a gap before wxFILE_EXISTS_ANY for future entries.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:28>

wxTrac

unread,
Oct 19, 2012, 6:02:18 PM10/19/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:29>

#14542: Make wxFileName and wxDir symlink-friendly
-----------------------------------------------+----------------------------
Reporter: dghart | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: fixed | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14649, 14649, 14649, 14649 |
-----------------------------------------------+----------------------------

Comment(by VZ):

(In [72707]) Allow testing for existence of specific file types in
wxFileName.

Add "flags" parameter to wxFileName::Exists() to allow testing for the
existing of files of specific type: not only regular or directory but also
symlink, device, FIFO or socket.

And also to pass wxFILE_EXISTS_NO_FOLLOW flag inhibiting following the
symlinks without using DontFollowLink().

Closes #14542.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:29>

wxTrac

unread,
Oct 23, 2012, 12:15:55 PM10/23/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:30>

#14542: Make wxFileName and wxDir symlink-friendly
-----------------------------------------------+----------------------------
Reporter: dghart | Owner:
Type: defect | Status: reopened
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14649, 14649, 14649, 14649 |
-----------------------------------------------+----------------------------
Changes (by dghart):

* status: closed => reopened
* resolution: fixed =>


Comment:

As discussed in #14543, the attached wxdir.diff reverts the previous
change, and instead makes following symlinks the default. There is a new
flag in the wxDirFlags enum to control this.

This patch doesn't touch wxFileName::Rmdir (I'll do that separately). As a
result, its use in the FileNameTestCase:929 causes looping; for about 20
seconds on my machine (I don't know what stops it). You may therefore wish
to coordinate applying this and a fix for #14649.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:30>

wxTrac

unread,
Oct 23, 2012, 5:09:19 PM10/23/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:32>

#14542: Make wxFileName and wxDir symlink-friendly
------------------------------------------------------+---------------------
Reporter: dghart | Owner:
Type: defect | Status: reopened
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14649, 14649, 14649, 14649, 14649 |
------------------------------------------------------+---------------------

Comment(by jdagresta):

Note: there are two references in the latest wxdir.diff patch just
attached to "Note that wxDIR_NO_FOLLOW is relevant only on Linux".

Shouldn't that be a reference to "... only on UNIX" or "... only on
UNIX/Linux"?

It applies to other flavors of UNIX than Linux, such as Solaris, AIX,
etc., namely any OS that supports symlinks.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:32>

wxTrac

unread,
Oct 23, 2012, 5:25:45 PM10/23/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:33>

#14542: Make wxFileName and wxDir symlink-friendly
------------------------------------------------------+---------------------
Reporter: dghart | Owner:
Type: defect | Status: reopened
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14649, 14649, 14649, 14649, 14649 |
------------------------------------------------------+---------------------

Comment(by dghart):

Replying to [comment:32 jdagresta]:

> Shouldn't that be a reference to "... only on UNIX" or "... only on
UNIX/Linux"?

Fair enough.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:33>

wxTrac

unread,
Oct 23, 2012, 7:22:54 PM10/23/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:37>

#14542: Make wxFileName and wxDir symlink-friendly
---------------------------------------------------------------------------+
Reporter: dghart | Owner:
Type: defect | Status: reopened
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14649, 14649, 14649, 14649, 14649, 14649, 14649, 14649 |
---------------------------------------------------------------------------+

Comment(by vadz):

Replying to [comment:30 dghart]:
> This patch doesn't touch wxFileName::Rmdir (I'll do that separately). As
a result, its use in the FileNameTestCase:929 causes looping; for about
20 seconds on my machine (I don't know what stops it). You may therefore
wish to coordinate applying this and a fix for #14649.

FWIW I don't see any problems like this here...


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:37>

wxTrac

unread,
Oct 23, 2012, 7:57:09 PM10/23/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:38>

#14542: Make wxFileName and wxDir symlink-friendly
---------------------------------------------------------------------------+
Reporter: dghart | Owner:
Type: defect | Status: reopened
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14649, 14649, 14649, 14649, 14649, 14649, 14649, 14649 |
---------------------------------------------------------------------------+

Comment(by VZ):

(In [72739]) Change the way directory iteration flags are constructed.

Instead of explicitly constructing the flags from the flags that should be
included, construct them by excluding the flags that shouldn't be used.
This
makes the code more stable in the sense that it will continue to work when
new
flags, such as the upcoming wxDIR_NO_FOLLOW, are added.

See #14542.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:38>

wxTrac

unread,
Oct 23, 2012, 7:57:34 PM10/23/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:39>

#14542: Make wxFileName and wxDir symlink-friendly
---------------------------------------------------------------------------+
Reporter: dghart | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: fixed | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14649, 14649, 14649, 14649, 14649, 14649, 14649, 14649 |
---------------------------------------------------------------------------+
Changes (by VZ):

* status: reopened => closed
* resolution: => fixed


Comment:

(In [72740]) Add wxDIR_NO_FOLLOW flag for wxDir iteration.

This flag allows to avoid following the symbolic links during the
directory
traversal. In particular, this means that links to the directories
(potentially outside the directory being traversed) are not considered as
directories at all when it is used, potentially avoiding surprises.

Closes #14542.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:39>

wxTrac

unread,
Oct 23, 2012, 7:57:56 PM10/23/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:40>

#14542: Make wxFileName and wxDir symlink-friendly
---------------------------------------------------------------------------+
Reporter: dghart | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: fixed | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14649, 14649, 14649, 14649, 14649, 14649, 14649, 14649 |
---------------------------------------------------------------------------+

Comment(by VZ):

(In [72741]) Mention wxFILE_EXISTS_NO_FOLLOW in wxFILE_EXISTS_SYMLINK
description.

Using wxFILE_EXISTS_SYMLINK without wxFILE_EXISTS_NO_FOLLOW can only be
fruitless, so mention that they should normally be used together in the
documentation.

An alternative solution would be to always add wxFILE_EXISTS_NO_FOLLOW
automatically if wxFILE_EXISTS_SYMLINK is used, perhaps we should do this
instead.

See #14542.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:40>

wxTrac

unread,
Oct 24, 2012, 7:18:16 AM10/24/12
to wx-...@googlegroups.com
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:43>

#14542: Make wxFileName and wxDir symlink-friendly
-----------------------------------------------------------------------------------------+
Reporter: dghart | Owner:
Type: defect | Status: closed
Priority: normal | Milestone: 2.9.5
Component: base | Version: 2.9-svn
Resolution: fixed | Keywords: wxFileName wxDir symlink
Blockedby: | Patch: 1
Blocking: 1993, 14649, 14649, 14649, 14649, 14649, 14649, 14649, 14649, 14649, 14649 |
-----------------------------------------------------------------------------------------+

Comment(by dghart):

Replying to [comment:40 VZ]:

> Using wxFILE_EXISTS_SYMLINK without wxFILE_EXISTS_NO_FOLLOW can only be
> fruitless, so mention that they should normally be used together in the
> documentation.
>
> An alternative solution would be to always add wxFILE_EXISTS_NO_FOLLOW
> automatically if wxFILE_EXISTS_SYMLINK is used, perhaps we should do
this
> instead.

Yes, I noticed this yesterday and was going to ask about it once the dust
had settled.

I can't think of a reason to want wxFILE_EXISTS_SYMLINK without
wxFILE_EXISTS_NO_FOLLOW. I'll create a patch.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/14542#comment:43>
Reply all
Reply to author
Forward
0 new messages