Closed Bug 1135255 Opened 9 years ago Closed 9 years ago

devicemanagerADB doesn't close mkstemp() file handles

Categories

(Testing :: Mozbase, defect)

37 Branch
x86_64
Linux
defect
Not set
normal

Tracking

(firefox39 fixed)

RESOLVED FIXED
mozilla39
Tracking Status
firefox39 --- fixed

People

(Reporter: m1, Assigned: wlach)

References

Details

Attachments

(1 file, 1 obsolete file)

tempfile.mkstemp() returns a file descriptor that the caller is expected to close.  Not doing this can cause trouble on platforms such as Windows where it's not permitted to delete an open file
Assignee: nobody → mvines
Status: NEW → ASSIGNED
Attachment #8567329 - Flags: review?(wlachance)
Comment on attachment 8567329 [details] [diff] [review]
0001-Bug-1135255-Close-the-fd-that-mkstemp-returns.patch

Review of attachment 8567329 [details] [diff] [review]:
-----------------------------------------------------------------

This is reasonable but I think I'd prefer to use "with". i.e.

with tempfile.NamedTemporarilyFile() as f:
   do stuff with f.name
   ...

This should auto-close the file and be a lot cleaner than what we have right now to boot.
Attachment #8567329 - Flags: review?(wlachance) → review-
Ah, yep that would be better.  Thanks for the quick feedback.  Turns out it's easier for us to maintain this as a local patch ATM than upstream so unassigning myself.
Assignee: mvines → nobody
No longer blocks: CAF-v2.2-metabug
I figured we may as well fix this properly for next time, while it's fresh in our minds. This uses mozfile's NamedTemporaryFile that should give us the behaviour we want on Windows.
Assignee: nobody → wlachance
Attachment #8567329 - Attachment is obsolete: true
Attachment #8567954 - Flags: review?(gbrown)
try run for b2g to make sure stuff still works: https://treeherder.mozilla.org/#/jobs?repo=try&revision=abc1d2286d56
Attachment #8567954 - Flags: review?(gbrown) → review+
Try run looks good, let's land this.
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/c6e9ecd2bed0
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Thanks guys
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: