Fix lookups of same-named files.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 29 May 2005 14:10:24 +0000 (14:10 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 29 May 2005 14:10:24 +0000 (14:10 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@1298 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Node/FS.py
src/engine/SCons/Node/FSTests.py

index f8f09fd3ddbb11b0e84fe454a89ea9412374ef10..f1350af462ea0771d12de399dd5dab35f7e71609 100644 (file)
@@ -397,6 +397,11 @@ RELEASE 0.97 - XXX
 
   - Add $RPATH (-R) support to the Sun linker Tool (sunlink).
 
+  From Chris Prince:
+
+  - Look in the right directory, not always the local directory, for a
+    same-named file or directory conflict on disk.
+
   From Kevin Quick:
 
   - Fix the Builder name returned from ListBuilders and other instances
index 9203e181239a89c62205238d5acc7fb196087669..527d1e32236fea1f01043123db4447332d39f3b2 100644 (file)
@@ -840,7 +840,7 @@ class FS(LocalFS):
 
                 # look at the actual filesystem and make sure there isn't
                 # a file already there
-                path = directory.entry_path(orig)
+                path = directory.entry_abspath(orig)
                 if self.isfile(path):
                     raise TypeError, \
                           "File %s found where directory expected." % path
@@ -866,7 +866,7 @@ class FS(LocalFS):
 
             # make sure we don't create File nodes when there is actually
             # a directory at that path on the disk, and vice versa
-            path = directory.entry_path(last_orig)
+            path = directory.entry_abspath(last_orig)
             if fsclass == File:
                 if self.isdir(path):
                     raise TypeError, \
index 1b31009fc0e0eb51d149f41c8fb22e194c49a0b1..6185de8510dc8b0794c3261db94280fd8cebc4da 100644 (file)
@@ -1262,6 +1262,19 @@ class FSTestCase(_tempdirTestCase):
         t = z.target_from_source('pre-', '-suf', lambda x: x[:-1])
         assert str(t) == 'pre-z-suf', str(t)
 
+    def test_same_name(self):
+        """Test that a local same-named file isn't found for # Dir lookup"""
+        test = self.test
+        fs = self.fs
+
+        test.subdir('subdir')
+        test.write(['subdir', 'build'], "subdir/build\n")
+
+        subdir = fs.Dir('subdir')
+        fs.chdir(subdir, change_os_dir=1)
+        path, dir = fs._transformPath('#build/file', subdir)
+        self.fs._doLookup(SCons.Node.FS.File, path, dir)
+
     def test_above_root(self):
         """Testing looking up a path above the root directory"""
         test = self.test