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

Issue 276813002: Make it harder to leak temp files on devices (Closed)

Created:
6 years, 7 months ago by cjhopman
Modified:
6 years, 7 months ago
Reviewers:
craigdh, jbudorick
CC:
chromium-reviews, klundberg+watch_chromium.org, bulach+watch_chromium.org, yfriedman+watch_chromium.org, ilevy-cc_chromium.org, Yaron, craigdh
Visibility:
Public.

Description

Make it harder to leak temp files on devices This extracts the device temp file creation deletion into a context manager. This context manager will delete the temporary file when leaving the with: scope. Also changes logic for finding a temp file from a linear search from 0 to just using a random number (still checking that the file doesn't exist). Both of these approaches could return the same file in consecutive calls if the earlier files aren't written to (though it is nearly impossible with the random number approach instead of essentially guaranteed). Removed the temp file name patterns and just added a prefix+suffix argument to DeviceTempFile (like tempfile.NamedTemporaryFile). BUG=371054 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=270917

Patch Set 1 #

Total comments: 7

Patch Set 2 : #

Total comments: 2

Patch Set 3 : #

Patch Set 4 : Rebase #

Patch Set 5 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+105 lines, -47 lines) Patch
M build/android/pylib/android_commands.py View 1 2 3 4 5 chunks +55 lines, -46 lines 0 comments Download
M build/android/pylib/android_commands_unittest.py View 1 chunk +50 lines, -1 line 0 comments Download

Messages

Total messages: 20 (0 generated)
cjhopman
jbudorick: wdyt? It seemed easy for us to accidentally leak temp files on the device, ...
6 years, 7 months ago (2014-05-09 01:07:07 UTC) #1
jbudorick
I think this is a great idea. It's like tempfile for devices. A couple of ...
6 years, 7 months ago (2014-05-09 15:57:03 UTC) #2
craigdh
btw, cyclical dependencies are fine in Python as long as the objects aren't being referenced ...
6 years, 7 months ago (2014-05-09 16:02:40 UTC) #3
cjhopman
> I'd like to see this in it's own module, because this is > something ...
6 years, 7 months ago (2014-05-09 18:55:14 UTC) #4
jbudorick
(non-binding) lgtm I'm fine with you leaving this in AndroidCommands in this CL. I'll probably ...
6 years, 7 months ago (2014-05-09 20:12:02 UTC) #5
craigdh
lgtm w/ optional nit https://codereview.chromium.org/276813002/diff/20001/build/android/pylib/android_commands.py File build/android/pylib/android_commands.py (right): https://codereview.chromium.org/276813002/diff/20001/build/android/pylib/android_commands.py#newcode97 build/android/pylib/android_commands.py:97: self.name = '%s/%s-%010d%s' % ( ...
6 years, 7 months ago (2014-05-09 20:18:24 UTC) #6
cjhopman
https://codereview.chromium.org/276813002/diff/20001/build/android/pylib/android_commands.py File build/android/pylib/android_commands.py (right): https://codereview.chromium.org/276813002/diff/20001/build/android/pylib/android_commands.py#newcode97 build/android/pylib/android_commands.py:97: self.name = '%s/%s-%010d%s' % ( On 2014/05/09 20:18:25, craigdh ...
6 years, 7 months ago (2014-05-09 20:51:03 UTC) #7
cjhopman
The CQ bit was checked by cjhopman@chromium.org
6 years, 7 months ago (2014-05-09 20:51:14 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/cjhopman@chromium.org/276813002/40001
6 years, 7 months ago (2014-05-09 20:54:35 UTC) #9
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). Please consider checking whether the failures are ...
6 years, 7 months ago (2014-05-09 21:39:12 UTC) #10
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 7 months ago (2014-05-09 21:46:36 UTC) #11
commit-bot: I haz the power
Try jobs failed on following builders: android_chromium_gn_compile_rel on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/android_chromium_gn_compile_rel/builds/3018) android_dbg on tryserver.chromium (http://build.chromium.org/p/tryserver.chromium/builders/android_dbg/builds/182382) chromium_presubmit ...
6 years, 7 months ago (2014-05-09 21:46:36 UTC) #12
cjhopman
The CQ bit was checked by cjhopman@chromium.org
6 years, 7 months ago (2014-05-15 21:55:06 UTC) #13
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/cjhopman@chromium.org/276813002/60001
6 years, 7 months ago (2014-05-15 21:56:08 UTC) #14
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). Please consider checking whether the failures are ...
6 years, 7 months ago (2014-05-16 01:07:10 UTC) #15
cjhopman
https://codereview.chromium.org/276813002/diff/1/build/android/pylib/android_commands.py File build/android/pylib/android_commands.py (right): https://codereview.chromium.org/276813002/diff/1/build/android/pylib/android_commands.py#newcode1183 build/android/pylib/android_commands.py:1183: with DeviceTempFile(self) as temp_file: On 2014/05/09 18:55:14, cjhopman wrote: ...
6 years, 7 months ago (2014-05-16 01:15:18 UTC) #16
cjhopman
The CQ bit was checked by cjhopman@chromium.org
6 years, 7 months ago (2014-05-16 01:15:21 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/cjhopman@chromium.org/276813002/70003
6 years, 7 months ago (2014-05-16 01:16:39 UTC) #18
jbudorick
On 2014/05/16 01:15:18, cjhopman wrote: > https://codereview.chromium.org/276813002/diff/1/build/android/pylib/android_commands.py > File build/android/pylib/android_commands.py (right): > > https://codereview.chromium.org/276813002/diff/1/build/android/pylib/android_commands.py#newcode1183 > ...
6 years, 7 months ago (2014-05-16 01:17:55 UTC) #19
commit-bot: I haz the power
6 years, 7 months ago (2014-05-16 03:21:32 UTC) #20
Message was sent while issue was closed.
Change committed as 270917

Powered by Google App Engine
This is Rietveld 408576698