From: stevenknight Date: Sat, 8 Nov 2008 01:46:33 +0000 (+0000) Subject: Fix an exception and stack trace when Glob() hits an on-disk file or X-Git-Url: http://git.tremily.us/?p=scons.git;a=commitdiff_plain;h=243ecf3843c38dc577530b4a297256081169ac89 Fix an exception and stack trace when Glob() hits an on-disk file or directory that begins with '#'. git-svn-id: http://scons.tigris.org/svn/scons/trunk@3773 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index e15fe031..b481617d 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -69,6 +69,11 @@ RELEASE 1.X - XXX - Make the Action() function handle positional parameters consistently. + From Randall Spangler: + + - Fix Glob() so an on-disk file or directory beginning with '#' + doesn't throw an exception. + RELEASE 1.1.0 - Thu, 09 Oct 2008 08:33:47 -0700 diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index 794a530c..5c5aac1a 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -1911,6 +1911,9 @@ class Dir(Base): dirEntry = dir.Entry selfEntry = self.Entry for name in disk_names: + # Add './' before disk filename so that '#' at + # beginning of filename isn't interpreted. + name = './' + name node = dirEntry(name).disambiguate() n = selfEntry(name) if n.__class__ != node.__class__: diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 3d1afdc3..6566d59e 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -2126,6 +2126,7 @@ class GlobTestCase(_tempdirTestCase): self.test.write('disk-aaa', "disk-aaa\n") self.test.write('disk-bbb', "disk-bbb\n") self.test.write('disk-ccc', "disk-ccc\n") + self.test.write('#disk-hash', "#disk-hash\n") self.test.subdir('disk-sub') self.test.write(['disk-sub', 'disk-ddd'], "disk-sub/disk-ddd\n") self.test.write(['disk-sub', 'disk-eee'], "disk-sub/disk-eee\n") @@ -2136,6 +2137,7 @@ class GlobTestCase(_tempdirTestCase): self.test.write('both-aaa', "both-aaa\n") self.test.write('both-bbb', "both-bbb\n") self.test.write('both-ccc', "both-ccc\n") + self.test.write('#both-hash', "#both-hash\n") self.test.subdir('both-sub1') self.test.write(['both-sub1', 'both-ddd'], "both-sub1/both-ddd\n") self.test.write(['both-sub1', 'both-eee'], "both-sub1/both-eee\n") @@ -2148,6 +2150,7 @@ class GlobTestCase(_tempdirTestCase): self.both_aaa = fs.File('both-aaa') self.both_bbb = fs.File('both-bbb') self.both_ccc = fs.File('both-ccc') + self._both_hash = fs.File('./#both-hash') self.both_sub1 = fs.Dir('both-sub1') self.both_sub1_both_ddd = self.both_sub1.File('both-ddd') self.both_sub1_both_eee = self.both_sub1.File('both-eee') @@ -2162,6 +2165,7 @@ class GlobTestCase(_tempdirTestCase): self.ggg = fs.File('ggg') self.hhh = fs.File('hhh') self.iii = fs.File('iii') + self._hash = fs.File('./#hash') self.subdir1 = fs.Dir('subdir1') self.subdir1_lll = self.subdir1.File('lll') self.subdir1_jjj = self.subdir1.File('jjj') @@ -2253,11 +2257,13 @@ class GlobTestCase(_tempdirTestCase): [self.hhh]), ('*', - ['both-aaa', 'both-bbb', 'both-ccc', + ['#both-hash', '#hash', + 'both-aaa', 'both-bbb', 'both-ccc', 'both-sub1', 'both-sub2', 'ggg', 'hhh', 'iii', 'sub', 'subdir1', 'subdir2'], - [self.both_aaa, self.both_bbb, self.both_ccc, + [self._both_hash, self._hash, + self.both_aaa, self.both_bbb, self.both_ccc, self.both_sub1, self.both_sub2, self.ggg, self.hhh, self.iii, self.sub, self.subdir1, self.subdir2]), @@ -2271,7 +2277,9 @@ class GlobTestCase(_tempdirTestCase): None), ('*', - ['both-aaa', 'both-bbb', 'both-ccc', 'both-sub1', 'both-sub2', + ['#both-hash', '#disk-hash', '#hash', + 'both-aaa', 'both-bbb', 'both-ccc', + 'both-sub1', 'both-sub2', 'disk-aaa', 'disk-bbb', 'disk-ccc', 'disk-sub', 'ggg', 'hhh', 'iii', 'sub', 'subdir1', 'subdir2'], @@ -2331,8 +2339,12 @@ class GlobTestCase(_tempdirTestCase): join('both-sub2', 'both-ddd'), join('both-sub2', 'both-eee'), join('both-sub2', 'both-fff')], - [self.both_sub1_both_ddd, self.both_sub1_both_eee, self.both_sub1_both_fff, - self.both_sub2_both_ddd, self.both_sub2_both_eee, self.both_sub2_both_fff], + [self.both_sub1_both_ddd, + self.both_sub1_both_eee, + self.both_sub1_both_fff, + self.both_sub2_both_ddd, + self.both_sub2_both_eee, + self.both_sub2_both_fff], ), ('subdir?/*',