Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Issue 5754002: Moving away from shell api to support long path names on windows for filesystem. (Closed)

Created:
10 years ago by Kavita Kanetkar
Modified:
8 years, 9 months ago
CC:
chromium-reviews, ben+cc_chromium.org, darin-cc_chromium.org, brettw-cc_chromium.org
Visibility:
Public.

Description

Contains 2 parts. Adds back \\?\ prefix to file names for extended path names. And secondly fixes 2 methods in file_util_win.cc required by filesystem to support that pathname prefix. BUG=63574 TEST=file_system_operation_unittest.cc

Patch Set 1 : '' #

Patch Set 2 : '' #

Total comments: 23

Patch Set 3 : '' #

Total comments: 1

Patch Set 4 : '' #

Patch Set 5 : '' #

Total comments: 20

Patch Set 6 : '' #

Total comments: 3

Patch Set 7 : '' #

Total comments: 37

Patch Set 8 : '' #

Total comments: 19

Patch Set 9 : '' #

Total comments: 18

Patch Set 10 : '' #

Total comments: 9

Patch Set 11 : '' #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+333 lines, -153 lines) Patch
M base/file_path.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +22 lines, -0 lines 2 comments Download
M base/file_path.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +69 lines, -0 lines 3 comments Download
M base/file_path_unittest.cc View 1 2 3 4 5 6 7 8 9 10 2 chunks +51 lines, -0 lines 1 comment Download
M base/file_util.h View 1 2 3 4 5 6 7 8 9 7 chunks +10 lines, -1 line 1 comment Download
M base/file_util_unittest.cc View 1 2 3 4 5 6 7 8 2 chunks +9 lines, -51 lines 0 comments Download
M base/file_util_win.cc View 1 2 3 4 5 6 7 8 9 10 5 chunks +113 lines, -95 lines 1 comment Download
M chrome/browser/renderer_host/browser_render_process_host.cc View 1 2 3 4 5 6 7 8 1 chunk +3 lines, -2 lines 0 comments Download
M webkit/fileapi/file_system_operation_unittest.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +38 lines, -0 lines 2 comments Download
M webkit/fileapi/file_system_path_manager.h View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -0 lines 0 comments Download
M webkit/fileapi/file_system_path_manager.cc View 1 2 3 4 5 6 7 8 3 chunks +14 lines, -2 lines 0 comments Download
M webkit/fileapi/file_system_path_manager_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 21 (0 generated)
Kavita Kanetkar
Can you please take an initial look? I have tested layout tests, unittests and all ...
10 years ago (2010-12-10 01:53:50 UTC) #1
michaeln
Not a full review, just some prelim comments questions about the Delete() function. http://codereview.chromium.org/5754002/diff/9/base/file_util_win.cc File ...
10 years ago (2010-12-10 20:08:43 UTC) #2
Kavita Kanetkar
Thanks. Please take a look. Can either of you LGTM this eventually? http://codereview.chromium.org/5754002/diff/9/base/file_util_win.cc File base/file_util_win.cc ...
10 years ago (2010-12-10 22:44:57 UTC) #3
kinuko
http://codereview.chromium.org/5754002/diff/9/base/file_util_unittest.cc File base/file_util_unittest.cc (right): http://codereview.chromium.org/5754002/diff/9/base/file_util_unittest.cc#newcode699 base/file_util_unittest.cc:699: TEST_F(FileUtilTest, DISABLED_DeleteWildCard) { Maybe we should delete this test ...
10 years ago (2010-12-10 23:03:43 UTC) #4
Kavita Kanetkar
Please take a look. http://codereview.chromium.org/5754002/diff/9/base/file_util_unittest.cc File base/file_util_unittest.cc (right): http://codereview.chromium.org/5754002/diff/9/base/file_util_unittest.cc#newcode699 base/file_util_unittest.cc:699: TEST_F(FileUtilTest, DISABLED_DeleteWildCard) { On 2010/12/10 ...
10 years ago (2010-12-14 21:36:36 UTC) #5
Kavita Kanetkar
Please take a look. http://codereview.chromium.org/5754002/diff/9/base/file_util_unittest.cc File base/file_util_unittest.cc (right): http://codereview.chromium.org/5754002/diff/9/base/file_util_unittest.cc#newcode699 base/file_util_unittest.cc:699: TEST_F(FileUtilTest, DISABLED_DeleteWildCard) { On 2010/12/10 ...
10 years ago (2010-12-14 21:36:36 UTC) #6
kinuko
Thanks, I put some more comments. http://codereview.chromium.org/5754002/diff/63002/base/file_util_win.cc File base/file_util_win.cc (right): http://codereview.chromium.org/5754002/diff/63002/base/file_util_win.cc#newcode133 base/file_util_win.cc:133: // greater than ...
10 years ago (2010-12-15 00:09:30 UTC) #7
Kavita Kanetkar
Thanks Kinuko for the review, adding Erik to review too. http://codereview.chromium.org/5754002/diff/63002/base/file_util_win.cc File base/file_util_win.cc (right): http://codereview.chromium.org/5754002/diff/63002/base/file_util_win.cc#newcode133 ...
10 years ago (2010-12-16 00:48:54 UTC) #8
kinuko
Thanks, a few more nits (in addition to the comment issue we talked offline). I ...
10 years ago (2010-12-16 01:48:23 UTC) #9
Paweł Hajdan Jr.
Drive-by with some test comments. http://codereview.chromium.org/5754002/diff/84001/base/file_util_unittest.cc File base/file_util_unittest.cc (right): http://codereview.chromium.org/5754002/diff/84001/base/file_util_unittest.cc#newcode741 base/file_util_unittest.cc:741: file_util::CreateDirectory(sub_subdir_path1); nit: Should you ...
10 years ago (2010-12-16 08:58:39 UTC) #10
Erik does not do reviews
+mark who knows the FilePath issues much better than I I think the key issue ...
10 years ago (2010-12-16 18:34:54 UTC) #11
Mark Mentovai
http://codereview.chromium.org/5754002/diff/84001/base/file_path.h File base/file_path.h (right): http://codereview.chromium.org/5754002/diff/84001/base/file_path.h#newcode155 base/file_path.h:155: // Path length is limited to 260 on windows ...
10 years ago (2010-12-16 19:48:19 UTC) #12
Kavita Kanetkar
Thanks for the review. Please take a look. http://codereview.chromium.org/5754002/diff/84001/base/file_path.h File base/file_path.h (right): http://codereview.chromium.org/5754002/diff/84001/base/file_path.h#newcode155 base/file_path.h:155: // ...
10 years ago (2010-12-17 00:59:32 UTC) #13
michaeln
http://codereview.chromium.org/5754002/diff/84001/webkit/fileapi/file_system_path_manager.cc File webkit/fileapi/file_system_path_manager.cc (right): http://codereview.chromium.org/5754002/diff/84001/webkit/fileapi/file_system_path_manager.cc#newcode179 webkit/fileapi/file_system_path_manager.cc:179: if (!root_path.StartsWithExtendedPathPrefix()) { On 2010/12/16 18:34:54, Erik Kay wrote: ...
10 years ago (2010-12-17 01:22:24 UTC) #14
Mark Mentovai
http://codereview.chromium.org/5754002/diff/105001/base/file_path.cc File base/file_path.cc (right): http://codereview.chromium.org/5754002/diff/105001/base/file_path.cc#newcode39 base/file_path.cc:39: "\\\\?\\"); This is wrapped poorly. Wrap after the =, ...
10 years ago (2010-12-17 01:58:49 UTC) #15
michaeln
http://codereview.chromium.org/5754002/diff/105001/base/file_util_win.cc File base/file_util_win.cc (right): http://codereview.chromium.org/5754002/diff/105001/base/file_util_win.cc#newcode159 base/file_util_win.cc:159: // This is needed because DeleteFile can fail for ...
10 years ago (2010-12-17 02:32:03 UTC) #16
kinuko
On 2010/12/17 02:32:03, michaeln wrote: > http://codereview.chromium.org/5754002/diff/105001/base/file_util_win.cc#newcode253 > base/file_util_win.cc:253: return false; > I think these ...
10 years ago (2010-12-17 07:02:49 UTC) #17
kinuko
Thanks for patiently working on this - I made some more comments. I'd like erik/michael ...
10 years ago (2010-12-22 23:20:49 UTC) #18
Mark Mentovai
MSDN doc describing \\?\ and \\?\UNC\: http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#maxpath
10 years ago (2010-12-22 23:26:22 UTC) #19
Kavita Kanetkar
Thanks for the review. Please take a look. Mark, I have included code to deal ...
10 years ago (2010-12-23 03:14:27 UTC) #20
Erik does not do reviews
10 years ago (2010-12-23 17:57:27 UTC) #21
http://codereview.chromium.org/5754002/diff/129012/base/file_path.cc
File base/file_path.cc (right):

http://codereview.chromium.org/5754002/diff/129012/base/file_path.cc#newcode176
base/file_path.cc:176: DWORD length_to_try = static_cast<DWORD>(path.length() *
2);
I don't understand this *2 logic.  Why not just pass NULL and always retrieve
the length first?

http://codereview.chromium.org/5754002/diff/129012/base/file_path.cc#newcode182
base/file_path.cc:182: return path;
I'm a bit nervous that this won't work in all cases.  Here's the scenario:
(1) get a FilePath object that's a short name near the 260 char limit
(2) call Append to add a path component to it, pushing it past 260 (say you want
to create a subdirectory)
(3) now we call ToLongFileNameHack which returns the path that you passed in
without the parent being converted to a proper long name
(4) we prepend \\? to this filename since
(5) the file operation fails since the path is bogus

I don't have a great suggestion here.  We may need to look at the callsites that
could generate a problem like this and see if there are's anything obvious we
could do.

Maybe we need to figure out how to make sure we're never passing around short
names to begin with.

http://codereview.chromium.org/5754002/diff/129012/base/file_path.cc#newcode1240
base/file_path.cc:1240: if (StartsWith(path_, kExtendedPathPrefix, false) ||
why not call StartsWithExtendedPathOrUNCPrefix?

http://codereview.chromium.org/5754002/diff/129012/base/file_path.h
File base/file_path.h (right):

http://codereview.chromium.org/5754002/diff/129012/base/file_path.h#newcode160
base/file_path.h:160: // '\\' Prefix for network shares.
nit: newline above comments

http://codereview.chromium.org/5754002/diff/129012/base/file_path.h#newcode325
base/file_path.h:325: // Note: The path needs to exist to make this return a
correct long path
This isn't acceptable in FilePath.  One of FilePath's invariants is that it's
supposed to never generate IO.  It should be safe to call FilePath methods from
any thread.  If we need to do this 8.3 shortname lookup, then we need to add it
to file_util instead.  Maybe that's OK since the only time we should be doing
this is inside of file_util already, right?

http://codereview.chromium.org/5754002/diff/129012/base/file_path_unittest.cc
File base/file_path_unittest.cc (right):

http://codereview.chromium.org/5754002/diff/129012/base/file_path_unittest.cc...
base/file_path_unittest.cc:1094: TEST_F(FilePathTest, TestGetLongPathHack) {
we may need to test some really long paths as well (some near 32767)

http://codereview.chromium.org/5754002/diff/129012/base/file_util.h
File base/file_util.h (right):

http://codereview.chromium.org/5754002/diff/129012/base/file_util.h#newcode103
base/file_util.h:103: // Safe to pass extended-path to this method on Windows.
It seems better to mark all of the ones that are unsafe and add a TODO / bug #
to all of those so that they can be fixed.

http://codereview.chromium.org/5754002/diff/129012/base/file_util_win.cc
File base/file_util_win.cc (right):

http://codereview.chromium.org/5754002/diff/129012/base/file_util_win.cc#newc...
base/file_util_win.cc:144: bool Delete(const FilePath& path, bool recursive) {
it seems like this Delete change is worthwhile on its own independent of the
extended length path change.  you may want to just split it out into a separate
CL so that it can be landed / managed independently.

http://codereview.chromium.org/5754002/diff/129012/webkit/fileapi/file_system...
File webkit/fileapi/file_system_operation_unittest.cc (right):

http://codereview.chromium.org/5754002/diff/129012/webkit/fileapi/file_system...
webkit/fileapi/file_system_operation_unittest.cc:431:
TEST_F(FileSystemOperationTest, TestCreateVeryLongName) {
again, we may want to test a much longer path here (closer to the new max)

http://codereview.chromium.org/5754002/diff/129012/webkit/fileapi/file_system...
webkit/fileapi/file_system_operation_unittest.cc:435: FilePath
dir_path(dir.path().GetLongPathHack());
This wasn't really what I had in mind.  We don't want these #ifdefs sprinkled
throughout the code.  Can't we do this directly in each of the various
file_util:: methods?  That way the only place this needs to exist is in
file_util_win.cc.

Powered by Google App Engine
This is Rietveld 408576698