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

Issue 9034005: Change the behavior of open on files to not truncate by default (Closed)

Created:
8 years, 12 months ago by Mads Ager (google)
Modified:
8 years, 11 months ago
Reviewers:
ricow1, Bill Hesse
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Change the behavior of open on files to not truncate by default when opening for writing. We have an explicit truncate method in the API and truncating the file is a bit hostile to users who want to modify or append to an existing file. :-) R=whesse@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=2941

Patch Set 1 #

Patch Set 2 : Address review comments. #

Total comments: 4

Patch Set 3 : Address review comment.s #

Unified diffs Side-by-side diffs Delta from patch set Stats (+241 lines, -106 lines) Patch
M runtime/bin/dartutils.cc View 1 chunk +1 line, -1 line 0 comments Download
M runtime/bin/file.h View 2 chunks +14 lines, -1 line 0 comments Download
M runtime/bin/file.cc View 1 1 chunk +16 lines, -2 lines 0 comments Download
M runtime/bin/file.dart View 1 2 chunks +48 lines, -7 lines 0 comments Download
M runtime/bin/file_impl.dart View 1 6 chunks +27 lines, -12 lines 0 comments Download
M runtime/bin/file_linux.cc View 1 chunk +6 lines, -3 lines 0 comments Download
M runtime/bin/file_macos.cc View 1 chunk +6 lines, -3 lines 0 comments Download
M runtime/bin/file_test.cc View 3 chunks +3 lines, -3 lines 0 comments Download
M runtime/bin/file_win.cc View 1 chunk +6 lines, -3 lines 0 comments Download
M runtime/bin/gen_snapshot.cc View 1 chunk +1 line, -2 lines 0 comments Download
M runtime/bin/main.cc View 1 chunk +2 lines, -1 line 0 comments Download
M tests/standalone/src/FileInvalidArgumentsTest.dart View 1 3 chunks +3 lines, -3 lines 0 comments Download
M tests/standalone/src/FileTest.dart View 1 2 20 chunks +104 lines, -61 lines 0 comments Download
M tools/testing/bin/linux/dart View 0 chunks +-1 lines, --1 lines 0 comments Download
M tools/testing/bin/macos/dart View 0 chunks +-1 lines, --1 lines 0 comments Download
M tools/testing/bin/windows/dart.exe View 0 chunks +-1 lines, --1 lines 0 comments Download
M tools/testing/dart/multitest.dart View 1 1 chunk +1 line, -1 line 0 comments Download
M tools/testing/dart/test_suite.dart View 1 2 4 chunks +6 lines, -6 lines 0 comments Download

Messages

Total messages: 6 (0 generated)
Mads Ager (google)
8 years, 12 months ago (2011-12-23 11:26:03 UTC) #1
Bill Hesse
I really prefer files to be truncated be default - that is what every Posix, ...
8 years, 12 months ago (2011-12-23 14:22:23 UTC) #2
Bill Hesse
Also see issue dart:1017
8 years, 11 months ago (2012-01-02 14:29:41 UTC) #3
Mads Ager (google)
I agree with your comments Bill. Thanks. Changed to use FileMode type instead. FileMode:WRITE truncates. ...
8 years, 11 months ago (2012-01-03 15:18:47 UTC) #4
Bill Hesse
LGTM. I guess it is good to distinguish between the internal (C++) mode representation and ...
8 years, 11 months ago (2012-01-03 18:28:47 UTC) #5
Mads Ager (google)
8 years, 11 months ago (2012-01-04 10:27:51 UTC) #6
http://codereview.chromium.org/9034005/diff/5001/tests/standalone/src/FileTes...
File tests/standalone/src/FileTest.dart (right):

http://codereview.chromium.org/9034005/diff/5001/tests/standalone/src/FileTes...
tests/standalone/src/FileTest.dart:660: // Test that opens the same file for
writing twice to test that
On 2012/01/03 18:28:47, Bill Hesse wrote:
> I wouldn't say "writing twice" but "for writing, then for appending"

Done.

http://codereview.chromium.org/9034005/diff/5001/tests/standalone/src/FileTes...
tests/standalone/src/FileTest.dart:661: // the file is not truncated when opened
for writing.
On 2012/01/03 18:28:47, Bill Hesse wrote:
> for appending.

Done.

Powered by Google App Engine
This is Rietveld 408576698