FilePath::IsParent has bug on Windows with shortened $TEMP |
|||||
Issue descriptionOn windows trybots, the $TEMP path has the file path containing 'CHROME~2', which will not be considered as 'chrome-bot' when doing components comparison in base::FilePath::IsParent(). A testing CL (and trybots results) for reference is at https://codereview.chromium.org/2889663004. Seems like when getting temp dir(or when calling IsParent), a GetLongPathName() should also be called.
,
Dec 4 2017
Still there. Use case (on windows platform): 1. Create a unit test that create a base::ScopedTempDir, |temp_dir|. 2. Create a temporary file using base::CreateTemporaryFileInDir(temp_dir), say the file name is |temp_file|. 3. Call temp_dir.IsParent(temp_file). Returns false. Reason (at least on trybots): 1. Windows are setting $TMP using short names, like "TEMP=C:\Users\CHROME~1\AppData\Local\Temp, TMP=C:\Users\CHROME~1\AppData\Local\Temp" 2. base::ScopedTempDir is using base::GetTempDir, and the implementation of base::GetTempDir on Windows doesn't consider about short/long names. https://cs.chromium.org/chromium/src/base/files/file_util_win.cc?rcl=411454440403418aeeb2aaf552149ee18d046c02&l=282 3. In CreateTemporaryFileInDir, it's getting the long name if the file it created had a short name. (https://cs.chromium.org/chromium/src/base/files/file_util_win.cc?rcl=fa1b829833b3905a722a0bd59f1d359fba026119&l=376) 4. In FilePath::IsParent, it's using AppendRelativePath, which doesn't consider about long names/short names on Windows and only does string comparison on components of the file path. https://cs.chromium.org/chromium/src/base/files/file_path.cc?rcl=191c0cae61c4174793c40419a931212547e1aa71&l=289
,
Apr 3 2018
,
Aug 2
,
Aug 2
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by chengx@chromium.org
, May 24 2017Components: Internals>PlatformIntegration