unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#41204: port-revealed count is initially > 30000
@ 2020-05-12 10:32 Caleb Ristvedt
  2020-05-12 13:04 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Caleb Ristvedt @ 2020-05-12 10:32 UTC (permalink / raw)
  To: 41204


(port-revealed (open-input-file "/dev/null"))
=> 32539

The little investigating I've done so far suggests that this is because
scm_i_fdes_to_port calls scm_gc_malloc_pointerless and initializes only
the 'fdes' and 'options' fields, leaving 'revealed' uninitialized. The
comment above scm_gc_malloc_pointerless does a good job of explaining
why this is an issue:

/* Allocate SIZE bytes of memory whose contents should not be scanned
   for pointers (useful, e.g., for strings).  Note though that this
   memory is *not* cleared; be sure to initialize it to prevent
   information leaks.  */

This issue appears to be present both in the 2.2 and 3.0 releases
packaged in guix.

- reepca





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#41204: port-revealed count is initially > 30000
  2020-05-12 10:32 bug#41204: port-revealed count is initially > 30000 Caleb Ristvedt
@ 2020-05-12 13:04 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2020-05-12 13:04 UTC (permalink / raw)
  To: Caleb Ristvedt; +Cc: 41204-done

Hi,

Caleb Ristvedt <caleb.ristvedt@cune.org> skribis:

> (port-revealed (open-input-file "/dev/null"))
> => 32539

Fixed in b1bdd791cefa1b6d113f9b3972550342d8f4aa9f.

Guile up to 2.2.7/3.0.2 included (but not 2.0) would thus leak the file
descriptors of all the file ports not explicitly closed.  It’s probably
not that common (good practice is too close file ports as soon as you’re
done with them and ‘call-with-output-file’ & co. take care of that), but
still.

Thanks a lot for finding the problem!

Ludo’.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-12 13:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 10:32 bug#41204: port-revealed count is initially > 30000 Caleb Ristvedt
2020-05-12 13:04 ` Ludovic Courtès

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).