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

Issue 639253004: Allow POSIX callers to specify a new file's mode. (Closed)

Created:
6 years, 2 months ago by palmer
Modified:
6 years, 1 month ago
CC:
chromium-reviews, benjhayden+dwatch_chromium.org, darin-cc_chromium.org, erikwright+watch_chromium.org, jam
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Allow POSIX callers to specify a new file's mode. Retain the tight 0640 mode for most existing callers, but honor the user's umask for downloaded files. BUG=409416, 362887 R=asanka@chromium.org, mdempsky@chromium.org, rvargas@chromium.org Committed: https://chromium.googlesource.com/chromium/src/+/3457f738b0dc2dd7d67fa84148d72066db9e0519

Patch Set 1 #

Total comments: 2

Patch Set 2 : Return bool instead of int, to accord with in-progress refactoring. #

Total comments: 8

Patch Set 3 : Use ScopedFD, rename function, adhere to the bool return value. #

Total comments: 4

Patch Set 4 : Fix nits. #

Total comments: 2

Patch Set 5 : Don't mess with the umask. No need, and it causes problems. #

Patch Set 6 : Correct behavior. #

Total comments: 7

Patch Set 7 : Set the right mode in case the new_path already existed. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+67 lines, -21 lines) Patch
M base/files/file_util.h View 1 2 2 chunks +8 lines, -0 lines 0 comments Download
M base/files/file_util_posix.cc View 1 2 3 4 5 6 1 chunk +9 lines, -0 lines 0 comments Download
M base/files/file_util_unittest.cc View 1 2 3 4 5 6 1 chunk +22 lines, -0 lines 0 comments Download
M content/browser/download/base_file_posix.cc View 1 2 3 4 5 6 1 chunk +28 lines, -21 lines 0 comments Download

Messages

Total messages: 36 (9 generated)
palmer
mdempsky: Can you please give this a quick sanity check before I ping rvargas?
6 years, 2 months ago (2014-10-16 22:51:49 UTC) #2
mdempsky
On 2014/10/16 22:51:49, Chromium Palmer wrote: > mdempsky: Can you please give this a quick ...
6 years, 2 months ago (2014-10-16 22:55:11 UTC) #3
palmer
Thanks, mdempsky. rvargas, can you please give this your OWNERS eye? Thanks!
6 years, 2 months ago (2014-10-16 22:56:23 UTC) #4
rvargas (doing something else)
looks good https://codereview.chromium.org/639253004/diff/1/base/files/file_util.h File base/files/file_util.h (right): https://codereview.chromium.org/639253004/diff/1/base/files/file_util.h#newcode338 base/files/file_util.h:338: BASE_EXPORT int WriteFileMode(const FilePath& filename, const char* ...
6 years, 2 months ago (2014-10-17 22:28:59 UTC) #5
palmer
https://codereview.chromium.org/639253004/diff/1/base/files/file_util.h File base/files/file_util.h (right): https://codereview.chromium.org/639253004/diff/1/base/files/file_util.h#newcode338 base/files/file_util.h:338: BASE_EXPORT int WriteFileMode(const FilePath& filename, const char* data, On ...
6 years, 2 months ago (2014-10-17 22:52:37 UTC) #6
rvargas (doing something else)
https://codereview.chromium.org/639253004/diff/20001/base/files/file_util.h File base/files/file_util.h (right): https://codereview.chromium.org/639253004/diff/20001/base/files/file_util.h#newcode338 base/files/file_util.h:338: BASE_EXPORT bool WriteFileMode(const FilePath& filename, const char* data, Shouldn't ...
6 years, 2 months ago (2014-10-21 01:05:53 UTC) #7
palmer
https://codereview.chromium.org/639253004/diff/20001/base/files/file_util.h File base/files/file_util.h (right): https://codereview.chromium.org/639253004/diff/20001/base/files/file_util.h#newcode338 base/files/file_util.h:338: BASE_EXPORT bool WriteFileMode(const FilePath& filename, const char* data, On ...
6 years, 2 months ago (2014-10-21 01:26:42 UTC) #8
rvargas (doing something else)
lgtm https://codereview.chromium.org/639253004/diff/40001/base/files/file_util_posix.cc File base/files/file_util_posix.cc (right): https://codereview.chromium.org/639253004/diff/40001/base/files/file_util_posix.cc#newcode699 base/files/file_util_posix.cc:699: int fd = HANDLE_EINTR(creat(filename.value().c_str(), mode)); tiny nit: declare ...
6 years, 2 months ago (2014-10-22 00:57:38 UTC) #9
palmer
https://codereview.chromium.org/639253004/diff/40001/base/files/file_util_posix.cc File base/files/file_util_posix.cc (right): https://codereview.chromium.org/639253004/diff/40001/base/files/file_util_posix.cc#newcode699 base/files/file_util_posix.cc:699: int fd = HANDLE_EINTR(creat(filename.value().c_str(), mode)); On 2014/10/22 00:57:38, rvargas ...
6 years, 2 months ago (2014-10-22 01:03:03 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/639253004/60001
6 years, 2 months ago (2014-10-22 01:05:49 UTC) #12
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/19138)
6 years, 2 months ago (2014-10-22 01:22:33 UTC) #14
palmer
Oops, forgot to add asanka for content/browser/download/OWNERS approval.
6 years, 2 months ago (2014-10-22 01:32:11 UTC) #16
palmer
+rdsmith for OWNERS in case asanka is too busy
6 years, 2 months ago (2014-10-23 00:51:54 UTC) #18
asanka
https://codereview.chromium.org/639253004/diff/60001/content/browser/download/base_file_posix.cc File content/browser/download/base_file_posix.cc (right): https://codereview.chromium.org/639253004/diff/60001/content/browser/download/base_file_posix.cc#newcode17 content/browser/download/base_file_posix.cc:17: mode_t mask = umask(0); Ruh roh. I think we ...
6 years, 2 months ago (2014-10-23 06:36:16 UTC) #19
asanka
On 2014/10/23 06:36:16, asanka wrote: > https://codereview.chromium.org/639253004/diff/60001/content/browser/download/base_file_posix.cc > File content/browser/download/base_file_posix.cc (right): > > https://codereview.chromium.org/639253004/diff/60001/content/browser/download/base_file_posix.cc#newcode17 > ...
6 years, 2 months ago (2014-10-23 06:42:46 UTC) #20
palmer
https://codereview.chromium.org/639253004/diff/60001/content/browser/download/base_file_posix.cc File content/browser/download/base_file_posix.cc (right): https://codereview.chromium.org/639253004/diff/60001/content/browser/download/base_file_posix.cc#newcode17 content/browser/download/base_file_posix.cc:17: mode_t mask = umask(0); > Ruh roh. I think ...
6 years, 2 months ago (2014-10-23 23:25:25 UTC) #21
asanka
https://codereview.chromium.org/639253004/diff/100001/content/browser/download/base_file_posix.cc File content/browser/download/base_file_posix.cc (right): https://codereview.chromium.org/639253004/diff/100001/content/browser/download/base_file_posix.cc#newcode20 content/browser/download/base_file_posix.cc:20: if (!base::WriteFileWithMode(new_path, "", 0, 0666) || I misspoke in ...
6 years, 2 months ago (2014-10-24 18:15:46 UTC) #22
palmer
https://codereview.chromium.org/639253004/diff/100001/content/browser/download/base_file_posix.cc File content/browser/download/base_file_posix.cc (right): https://codereview.chromium.org/639253004/diff/100001/content/browser/download/base_file_posix.cc#newcode20 content/browser/download/base_file_posix.cc:20: if (!base::WriteFileWithMode(new_path, "", 0, 0666) || > I misspoke ...
6 years, 2 months ago (2014-10-24 18:35:35 UTC) #23
asanka
Whoops. Sorry about the delay. The code lgtm modulo a favorable resolution to the question ...
6 years, 1 month ago (2014-10-28 21:24:21 UTC) #24
palmer
https://codereview.chromium.org/639253004/diff/100001/content/browser/download/base_file_posix.cc File content/browser/download/base_file_posix.cc (right): https://codereview.chromium.org/639253004/diff/100001/content/browser/download/base_file_posix.cc#newcode24 content/browser/download/base_file_posix.cc:24: mode = status.st_mode & 0777; > Would it? Let's ...
6 years, 1 month ago (2014-10-29 01:12:38 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/639253004/120001
6 years, 1 month ago (2014-10-29 01:25:04 UTC) #27
commit-bot: I haz the power
Try jobs failed on following builders: android_dbg_tests_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_dbg_tests_recipe/builds/23085)
6 years, 1 month ago (2014-10-29 03:17:59 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/639253004/120001
6 years, 1 month ago (2014-10-29 18:44:04 UTC) #31
commit-bot: I haz the power
Try jobs failed on following builders: android_dbg_tests_recipe on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_dbg_tests_recipe/builds/23384)
6 years, 1 month ago (2014-10-29 20:42:18 UTC) #33
commit-bot: I haz the power
Patchset 7 (id:??) landed as https://crrev.com/3457f738b0dc2dd7d67fa84148d72066db9e0519 Cr-Commit-Position: refs/heads/master@{#301932}
6 years, 1 month ago (2014-10-29 21:30:06 UTC) #34
palmer
Committed patchset #7 (id:120001) manually as 3457f738b0dc2dd7d67fa84148d72066db9e0519 (presubmit successful).
6 years, 1 month ago (2014-10-29 21:30:10 UTC) #35
Mike Wittman
6 years, 1 month ago (2014-10-29 23:07:45 UTC) #36
Message was sent while issue was closed.
Reverted in e0c8785ea110e0a91523caf09100745924670693. Breaks
FileUtilTest.WriteFileWithMode in Android (dbg).

[ RUN      ] FileUtilTest.WriteFileWithMode
../../base/files/file_util_unittest.cc:2164: Failure
Value of: status.st_mode & 0777
  Actual: 384
Expected: mode
Which is: 420
[  FAILED  ] FileUtilTest.WriteFileWithMode (1 ms)

https://build.chromium.org/p/chromium.linux/builders/Android%20Tests%20%28dbg...

Powered by Google App Engine
This is Rietveld 408576698