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

io.c revision 1.53 #3357

Closed
vicuna opened this issue May 21, 2002 · 1 comment
Closed

io.c revision 1.53 #3357

vicuna opened this issue May 21, 2002 · 1 comment
Labels

Comments

@vicuna
Copy link

vicuna commented May 21, 2002

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

Bug description

Je suis tombé sur ça:
revision 1.53
date: 2002/03/26 14:28:25; author: doligez; state: Exp; lines: +9 -2
ne pas lever d'exception si on flushe un channel ferme
La raison donnée est:

  • If the channel is closed, DO NOT raise a "bad file descriptor"

  • exception, but do nothing (the buffer is already empty). See

  • the "at_exit" line of stdlib/format.ml for a good reason to avoid

  • the exception.

  • */

  • CAMLexport int flush_partial(struct channel *channel)
    {
    int towrite, written;

  • if (channel->fd == -1) return 1;
    towrite = channel->curr - channel->buff;
    J'ai eu exactement le même problème; en discutant avec Pierre, son
    avis est que le programme est hors spec (il ne devrait pas fermer le
    formateur standard).

Même si on estime que Format doit le flusher, je crois qu'il faut le
faire comme on flushe stdout/... par at_exit, i.e. en prenant garde de
ne pas flusher un canal déjà fermé. Le patch ci-dessus cache des bugs
utilisateur potentiels, alors que le problème est uniquement dans
Format.

Je propose donc de décommiter ce patch, et de faire une modification
dans Format, e.g. rattraper Sys_error autour de print_flush à l'appel
de at_exit (si c'est le plus simple).

Bruno.

@vicuna
Copy link
Author

vicuna commented Jul 22, 2002

Comment author: administrator

Keep the current behavior (flush on a closed channel doesn't raise an error if
there is nothing to flush).

@vicuna vicuna closed this as completed Jul 22, 2002
@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