New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 725685 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Last visit > 30 days ago
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Bug



Sign in to add a comment

FilePath::IsParent has bug on Windows with shortened $TEMP

Project Member Reported by romax@chromium.org, May 23 2017

Issue description

On 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.

 

Comment 1 by chengx@chromium.org, May 24 2017

Cc: brucedaw...@chromium.org
Components: Internals>PlatformIntegration

Comment 2 by romax@chromium.org, Dec 4 2017

Cc: -brucedaw...@chromium.org
Components: -Internals>PlatformIntegration
Owner: romax@chromium.org
Status: Started (was: Assigned)
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

Comment 3 by romax@chromium.org, Apr 3 2018

Status: Assigned (was: Started)
Labels: Hotlist-Fixit
Components: UI>Browser>Offline

Sign in to add a comment