You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Marc Haesen <ma...@oneaccess-net.com> on 2009/03/05 11:33:58 UTC
Bug in function previous_segment of subversion/libsvn_subr/path.c
on trunk 36335
When running the attached batch file in windows at the root dir of a
drive, I discovered a problem in the previous_segment routine of
subversion/libsvn_subr/path.c.
static apr_size_t
previous_segment(const char *path,
apr_size_t len)
{
if (len == 0)
return 0;
while (len > 0 && path[--len] != '/')
;
if (len == 0 && path[0] == '/')
return 1;
else
return len;
}
The case of an absolute path with no previous segments is handled
correctly on unix but not on windows.
For windows it should be changed to:
static apr_size_t
previous_segment(const char *path,
apr_size_t len)
{
if (len == 0)
return 0;
while (len > 0 && path[--len] != '/')
;
if (len == 0 && path[0] == '/')
return 1;
else
{
#ifdef WIN32
if (len==2 && path[1]==':')
return 3;
#endif
return len;
}
}
With this fix, the attached batch file is running fine.
Regards,
Marc
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1271821