Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unix.write loops forever #2510

Closed
vicuna opened this issue Jun 27, 2000 · 2 comments
Closed

Unix.write loops forever #2510

vicuna opened this issue Jun 27, 2000 · 2 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Jun 27, 2000

Original bug ID: 150
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Georges Brun-Cottan
Version: 2.99 and 3.00
OS: SunOS 5.6
Submission from: los0150.lss.emc.com (168.159.28.150)

Problems:
On Solaris, writing on a raw device beyond its capacity hangs the process.

Recreation:
Choose a unused raw device. Issue write above its capacity.
Process will hang.

Internal Reason:

  1. Writing on a raw device beyond its capacity returns 0 (with no error) on
    Solaris.
  2. Caml wraps the Unix write in a loop that terminate either on error or when
    all
    requested bytes have been written (write.c:unix_write).

The easiest fix would be to suppress the loop, although it might possibly break

some existing code relying on the "atomicity" of the write (Is such a code
exist?
this is not provided by Unix...).

@vicuna
Copy link
Author

vicuna commented Jul 25, 2000

Comment author: administrator

Hi Georges,

Problems:
On Solaris, writing on a raw device beyond its capacity hangs the process.
Internal Reason:

  1. Writing on a raw device beyond its capacity returns 0 (with no error) on
    Solaris.

This is unfortunate, because it doesn't conform with the Single Unix
Specification (Unix98): write() should either return a number > 0
if some bytes were written, or the ENOSPC error otherwise. This said,
raw disk partitions aren't explicitly covered by the spec, so...

The easiest fix would be to suppress the loop, although it might
possibly break some existing code relying on the "atomicity" of the
write (Is such a code exist? this is not provided by Unix...).

The main problem is that Unix.write is declared as returning "unit"
rather than "int", so the application wouldn't be informed of a short
write. The reason for this and for the loop was to simplify the
application, which doesn't have to check for short writes. On the
other hand, it's questionable, since when the application
gets an ENOSPC error, it doesn't know whether some bytes have been
written or not.

Thanks for the bug report. I don't promise to fix it immediately, but
I'll keep it in mind.

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Jul 25, 2000

Comment author: administrator

Solaris bug (at least w.r.t. the Single Unix Specification). Still, the type of
Unix.write is questionable.

@vicuna vicuna closed this as completed Jul 25, 2000
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant