Closed
Bug 818106
Opened 12 years ago
Closed 11 years ago
ScopedClose doesn't deal with EINTR
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla20
People
(Reporter: dhylands, Assigned: badanomaly)
References
Details
(Whiteboard: [good first bug][mentor=dhylands][lang=c++])
Attachments
(1 file, 4 obsolete files)
1.27 KB,
patch
|
dhylands
:
review+
|
Details | Diff | Splinter Review |
close can fail with errno == EINTR, in which case the close call needs to be made again. ScopedClose just calls close and doen't check the return code, assuming that the close succeeded. If the close returns EINTR, then the close may not have actually happened.
Reporter | ||
Updated•12 years ago
|
Whiteboard: [good first bug][mentor=dhylands][lang=c++]
Comment 1•12 years ago
|
||
For whomever takes this one, see http://hg.mozilla.org/mozilla-central/annotate/287a7d7cf7f0/xpcom/glue/FileUtils.h#l54
Comment 2•12 years ago
|
||
Just changing the close(fd); to while(close(fd)==EINTR); is enough ? Or should there be any maximum retries kind of logic ? Or should it wait for some time before retrying again ? Please let me know the details
Reporter | ||
Comment 3•12 years ago
|
||
The actual logic should be: while ((close(fd) == -1) && (errno == EINTR)) { ; } You shouldn't need any maximum retries logic. This is essentially the same logic found in the TEMP_FAILURE_RETRY macro from /usr/include/unistd.h, but that macro is glibc specific, so it may not be portable across all of the platforms that we support.
Assignee | ||
Comment 4•12 years ago
|
||
Attachment #696998 -
Flags: review?(dhylands)
Assignee | ||
Comment 5•12 years ago
|
||
I have attached the patch. Please Review it.
Assignee | ||
Comment 6•12 years ago
|
||
Attachment #696998 -
Attachment is obsolete: true
Attachment #696998 -
Flags: review?(dhylands)
Attachment #697000 -
Flags: review?(dhylands)
Assignee | ||
Comment 7•12 years ago
|
||
Attachment #697000 -
Attachment is obsolete: true
Attachment #697000 -
Flags: review?(dhylands)
Attachment #697219 -
Flags: review?(benjamin)
Reporter | ||
Comment 8•12 years ago
|
||
Comment on attachment 697219 [details] [diff] [review] Patch 3 Review of attachment 697219 [details] [diff] [review]: ----------------------------------------------------------------- ::: xpcom/glue/FileUtils.h @@ +49,5 @@ > static void release(type fd) { > + if (fd != -1){ > + do{ > + close(fd); > + }while (errno == EINTR); This won't work. errno isn't set if close returns successfully. You should only test errno if close returns -1, or if you explicitly set errno to 0 prior to calling close.
Attachment #697219 -
Flags: review?(benjamin) → review-
Reporter | ||
Comment 9•12 years ago
|
||
Also: nit: You should have have a space bewteen } and while and also between ) and {
Assignee | ||
Comment 10•12 years ago
|
||
Attachment #697219 -
Attachment is obsolete: true
Attachment #697276 -
Flags: review?(dhylands)
Reporter | ||
Updated•12 years ago
|
Attachment #697276 -
Flags: review?(dhylands) → review+
Assignee | ||
Comment 11•12 years ago
|
||
How do I get this bug assigned to me. I have attached the patch still its showing assigned to: nobody ?
Reporter | ||
Comment 12•12 years ago
|
||
In bugzilla, click on the "take" link next to the "Assigned To" and then click on Save.
Assignee | ||
Comment 13•12 years ago
|
||
(In reply to Dave Hylands [:dhylands] from comment #12) > In bugzilla, click on the "take" link next to the "Assigned To" and then > click on Save. clicking on the link creates a new email addressed to nobody@mozilla.org . Am i supposed to send an email ?
Reporter | ||
Comment 14•12 years ago
|
||
Are you logged in? There should be 2 links, one says edit, and one says take.
Assignee: nobody → mohit.www
Reporter | ||
Comment 15•12 years ago
|
||
Oops - I wound up assigning it to you. I was playing with logging in and out, and wound up assigning it to you. So I'll assign it back to nobody.
Assignee: mohit.www → nobody
Reporter | ||
Comment 16•12 years ago
|
||
If you click on edit, it will shows who its currently assigned to, and you can change it (if you have permission). You should be able to change it to your email address. Clicking on take should fill in your email address (so this should be easier than clicking on edit)
Reporter | ||
Comment 17•12 years ago
|
||
Are you on IRC? It's probably easier to have a discussion there, rather than in the bug...
Reporter | ||
Updated•12 years ago
|
Assignee: nobody → mohit.www
Reporter | ||
Comment 18•11 years ago
|
||
Try: https://tbpl.mozilla.org/?tree=Try&rev=cfc2657ae40c
Assignee | ||
Comment 19•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Status: NEW → ASSIGNED
Assignee | ||
Updated•11 years ago
|
Attachment #697763 -
Flags: review?(dhylands)
Assignee | ||
Updated•11 years ago
|
Attachment #697276 -
Attachment is obsolete: true
Reporter | ||
Updated•11 years ago
|
Attachment #697763 -
Flags: review?(dhylands) → review+
Reporter | ||
Comment 20•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/b0967de80fb7
Comment 21•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/b0967de80fb7
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
Comment 23•11 years ago
|
||
> If you click on edit
Note that people new to bugzilla don't initially have permission to edit many of a bug's metadata fields. You can go on IRC and ask someone to give X e-mail address "editbugs" permission.
Reporter | ||
Comment 24•11 years ago
|
||
(In reply to Justin Lebar [:jlebar] from comment #23) > > If you click on edit > > Note that people new to bugzilla don't initially have permission to edit > many of a bug's metadata fields. You can go on IRC and ask someone to give > X e-mail address "editbugs" permission. Yeah - we eventually figured that out, and now that I'm aware that's one of the things I look for. Apparently, the proper procedure for getting editbugs is to follow this: https://bugzilla.mozilla.org/page.cgi?id=get_permissions.html and this page is generally a good page to read when first learning about bugzilla: https://developer.mozilla.org/en/docs/What_to_do_and_what_not_to_do_in_Bugzilla
You need to log in
before you can comment on or make changes to this bug.
Description
•