From: Jurko Gospodnetiæ (jurko.gospodnetic_at_[hidden])
Date: 2008-01-31 23:45:33
bjam does not handle the '\' root Windows path correctly without its
drive letter being specified. One effect can be seen by MkDir rule on
such a path always attempting to create its base folder even if that
folder already exists. For example if you attempt to create folder
'\Projects\XYZ\BuildDir' it will incorrectly think that '\Projects'
folder does not exist and will attempt to create it - thus causing the
whole build to fail due to the underlying OS mkdir command failing.
This is caused by the file_dirscan() function in the filent.c module
not working correctly when passed '\' as its dir. It then messes up when
formatting its file-selection parameter for the _findfirst()/findfirst()
API and constructs it as '\/*' which causes that API to fail and return
-1 which is in turn interpreted as 'file not found'.
I'm attaching a patch to fix this so please review and grok it for me
to apply or apply it directly.
--- filent.c (revision 43042)
+++ filent.c (working copy)
@@ -92,11 +92,22 @@
f.f_dir.ptr = d->name;
f.f_dir.len = strlen(d->name);
/* Now enter contents of directory */
+ /* Prepare file search specification for the findfirst() API. */
string_copy( filespec, *d->name ? d->name : "." );
- string_append( filespec, "/*" );
+ * We can not simply assume the given folder name will never include
+ * its trailing path separator or otherwise we would not support the
+ * Windows root folder specified without its drive letter, i.e. '\'.
+ char finalChar = d->name[ strlen( d->name ) - 1 ] ;
+ if ( ( finalChar != '\\' ) && ( finalChar != '/' ) )
+ string_append( filespec, "\\" );
+ string_append( filespec, "*" );
if( DEBUG_BINDSCAN )
printf( "scan directory %s\n", dir );
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk