Closed Bug 785138 Opened 12 years ago Closed 7 years ago

B2G Updates: Updater fopen calls don't handle EINTR

Categories

(Toolkit :: Application Update, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: marshall, Unassigned)

References

Details

(Whiteboard: [LOE:S])

This is a follow up to Bug 764683. Currently, none of the calls to fopen in the standalone updater gracefully handle EINTR signals errors. The general pattern suggested for this is:

do {
  file = fopen("path", "flags");
} while (file == NULL && errno == EINTR);
If we want to support EINTR signals, don't we have to also check them on read/write calls? Do you expect these to happen during an update?
Yes.

This *should not* happen during normal operation.  However, this code needs to be bullet proof.  bionic is the worst PoS libc you could ever imagine, so I mostly want to guard against bugs in there.
Hi

> This *should not* happen during normal operation.  However, this code needs
> to be bullet proof.  bionic is the worst PoS libc you could ever imagine, so
> I mostly want to guard against bugs in there.

Is there an official statement whether bionic automatically restarts interrupted syscall (e.g., like glibc does), or not?

I ask, because I thought about going through _all_ sources and adding EINTR handling to _all_ affected calls. I wrote a small test program for triggering an EINTR, but it never did; so I though that bionic might handle this automatically.

And there is still the case where you read/write only half of the data you requested...
Even if bionic attempted to implement auto-restart, I wouldn't trust it to get that right :(.
(In reply to Chris Jones [:cjones] [:warhammer] from comment #4)
> Even if bionic attempted to implement auto-restart, I wouldn't trust it to
> get that right :(.

Ok. I opened https://bugzilla.mozilla.org/show_bug.cgi?id=804959 to track this problem, and will work on it with low priority.
Assignee: marshall → nobody
B2G no longer supported
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.