[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Junction Point bug report and possible solution

From: Phillip Susi <psusi_at_cfl.rr.com>
Date: 2005-04-25 23:55:18 CEST

I found a bug with subversion and NTFS Junction points, which are NT
versions of symbolic links for directories. The problem may also apply
to symbolic links on unix. I also think I have found the cause of the
problem in the source, and a way to fix it, so I am posting my findings
here in hopes that a developer can verify and apply them.

Background:

If you check out a working copy to c:\wc then create a junction called
c:\junction that points to c:\wc, then you cd \junction and run svn
status, it reports "." with a "~" status, indicating that it thinks the
current directory is a file, not a directory. TortoisSVN also will not
treat c:\junction as a working copy.

Cause:

subversion/libsvn_subr/io.c line 137 reads:

   else if (finfo.filetype == APR_LNK)
     {
       is_special = TRUE;
       *kind = svn_node_file;
     }

I believe the bug is here. The code calls apr_stat with the
APR_FINFO_LINK flag, and apr_stat returns a file type of APR_LNK because
the file in question is a symbolic link. The above code assumes that a
symbolic link points to a file, not a directory. This assumption is
incorrect, as symbolic links can also point to directories.

Solution:

When apr_stat indicates APR_LNK on the file, is_special should be set to
true, and then apr_stat should be called again WITHOUT the
APR_FINFO_LINK flag, which will cause it to indicate APR_REG or APR_DIR
depending on weather the link points to a file or a directory. That
value should then be used to set *kind to svn_node_file or svn_node_dir.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Apr 25 23:55:48 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.