summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-15 00:51:11 +0000
committermaruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-15 00:51:11 +0000
commit9d890d7411db7f7d0c993d0e94e9f3daf80c7392 (patch)
treebe3b13de90666e884885bf8573dafa351d1c54bf
parente5877532614b694363b1d96da5b4f909dfad8335 (diff)
downloadchromium_src-9d890d7411db7f7d0c993d0e94e9f3daf80c7392.zip
chromium_src-9d890d7411db7f7d0c993d0e94e9f3daf80c7392.tar.gz
chromium_src-9d890d7411db7f7d0c993d0e94e9f3daf80c7392.tar.bz2
Fix bad native path case on Windows.
The drive letter case wasn't changed by get_native_path_case() on Windows, so get_native_path_case('c:\foo') == 'c:\Foo' and get_native_path_case('C:\foo') == 'C:\Foo', breaking multiple filtering code paths. Make it always upper case for consistency. R=cmp@chromium.org NOTRY=true BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10533155 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142296 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-xtools/isolate/trace_inputs.py6
-rwxr-xr-xtools/isolate/trace_inputs_test.py16
2 files changed, 16 insertions, 6 deletions
diff --git a/tools/isolate/trace_inputs.py b/tools/isolate/trace_inputs.py
index ca36e02..894afd6 100755
--- a/tools/isolate/trace_inputs.py
+++ b/tools/isolate/trace_inputs.py
@@ -208,8 +208,10 @@ if sys.platform == 'win32':
# Go figure why GetShortPathName() is needed.
path = GetLongPathName(GetShortPathName(path))
if path.startswith('\\\\?\\'):
- return path[4:]
- return path
+ path = path[4:]
+ # Always upper case the first letter since GetLongPathName() will return the
+ # drive letter in the case it was given.
+ return path[0].upper() + path[1:]
def CommandLineToArgvW(command_line):
diff --git a/tools/isolate/trace_inputs_test.py b/tools/isolate/trace_inputs_test.py
index 89c33b4..4639aba 100755
--- a/tools/isolate/trace_inputs_test.py
+++ b/tools/isolate/trace_inputs_test.py
@@ -14,6 +14,11 @@ ROOT_DIR = os.path.dirname(FILE_NAME)
import trace_inputs
+def join_norm(*args):
+ """Joins and normalizes path in a single step."""
+ return unicode(os.path.normpath(os.path.join(*args)))
+
+
class TraceInputs(unittest.TestCase):
def test_process_quoted_arguments(self):
test_cases = (
@@ -39,10 +44,13 @@ class TraceInputs(unittest.TestCase):
self.assertEquals(os.path.join('/usr', '$FOO/bar'), actual.full_path)
self.assertEquals(True, actual.tainted)
-
-def join_norm(*args):
- """Joins and normalizes path in a single step."""
- return unicode(os.path.normpath(os.path.join(*args)))
+ def test_native_case_windows(self):
+ if sys.platform != 'win32':
+ return
+ windows_path = os.environ['SystemRoot']
+ self.assertEquals(
+ trace_inputs.get_native_path_case(windows_path.lower()),
+ trace_inputs.get_native_path_case(windows_path.upper()))
if sys.platform != 'win32':