unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* [bug #24009] does not check for short write()s
@ 2008-08-06 11:51 Martin Pitt
  2008-08-06 20:08 ` Neil Jerram
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Pitt @ 2008-08-06 11:51 UTC (permalink / raw)
  To: Martin Pitt, bug-guile


URL:
  <http://savannah.gnu.org/bugs/?24009>

                 Summary: does not check for short write()s
                 Project: Guile
            Submitted by: martinpitt
            Submitted on: Mittwoch 06.08.2008 um 11:51
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

When building guile under current ubuntu (gcc-4.3, with FORTIFY_SOURCE=2), it
detects a lot of cases where write() is called without checking the return
value:

/bin/bash ../libtool --tag=CC   --mode=compile i486-linux-gnu-gcc
-DHAVE_CONFIG_H  -I.. -I.. -I..   -pthread -O2 -g -Wall -Wmissing-prototypes
-Werror -MT libguile_la-async.lo -MD -MP -MF .deps/libguile_la-async.Tpo -c -o
libguile_la-async.lo `test -f 'async.c' || echo './'`async.c
 i486-linux-gnu-gcc -DHAVE_CONFIG_H -I.. -I.. -I.. -pthread -O2 -g -Wall
-Wmissing-prototypes -Werror -MT libguile_la-async.lo -MD -MP -MF
.deps/libguile_la-async.Tpo -c async.c  -fPIC -DPIC -o
.libs/libguile_la-async.o
cc1: warnings being treated as errors
async.c: In function ‘scm_i_queue_async_cell’:
async.c:250: error: ignoring return value of ‘write’, declared with
attribute warn_unused_result

Some of those might actually be harmless and can be cast into (void), but in
most cases a short write is a source of unexpected and hard to debug errors.
Maybe consider using a full_write() wrapper (like in gnulib) which repeatedly
writes until everything is sent?




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?24009>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.gnu.org/





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

* [bug #24009] does not check for short write()s
  2008-08-06 11:51 [bug #24009] does not check for short write()s Martin Pitt
@ 2008-08-06 20:08 ` Neil Jerram
  2008-10-29 16:58   ` Adam Schreiber
  0 siblings, 1 reply; 6+ messages in thread
From: Neil Jerram @ 2008-08-06 20:08 UTC (permalink / raw)
  To: Neil Jerram, Martin Pitt, bug-guile


Follow-up Comment #1, bug #24009 (project guile):

Thanks for noticing and reporting this.  I think you are right - at least for
the one in async.c (I haven't checked any others yet), so we'll hopefully get
to fixing this soon.

     Neil


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?24009>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





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

* [bug #24009] does not check for short write()s
  2008-08-06 20:08 ` Neil Jerram
@ 2008-10-29 16:58   ` Adam Schreiber
  2008-10-30 22:44     ` anonymous
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Schreiber @ 2008-10-29 16:58 UTC (permalink / raw)
  To: Neil Jerram, Martin Pitt, Adam Schreiber, bug-guile


Follow-up Comment #2, bug #24009 (project guile):

This bug breaks building GNOME 2.26 in jhbuild because it treats warnings
like errors.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?24009>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





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

* [bug #24009] does not check for short write()s
  2008-10-29 16:58   ` Adam Schreiber
@ 2008-10-30 22:44     ` anonymous
  2008-10-31  2:45       ` Adam Schreiber
  0 siblings, 1 reply; 6+ messages in thread
From: anonymous @ 2008-10-30 22:44 UTC (permalink / raw)
  To: Neil Jerram, Martin Pitt, Adam Schreiber, bug-guile


Follow-up Comment #3, bug #24009 (project guile):

Thanks Adam for the extra info, I'll try to work on this soon.  In case you
already have a patch that you're using, please could you attach it to this
bug?

- Neil


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?24009>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





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

* [bug #24009] does not check for short write()s
  2008-10-30 22:44     ` anonymous
@ 2008-10-31  2:45       ` Adam Schreiber
  2008-11-30 18:10         ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Adam Schreiber @ 2008-10-31  2:45 UTC (permalink / raw)
  To: Neil Jerram, Martin Pitt, Adam Schreiber, bug-guile


Follow-up Comment #4, bug #24009 (project guile):

I didn't have anything real, I was just checking that the return value didn't
match the correct length and returning.  I suppose asserts could be used
instead.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?24009>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





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

* [bug #24009] does not check for short write()s
  2008-10-31  2:45       ` Adam Schreiber
@ 2008-11-30 18:10         ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2008-11-30 18:10 UTC (permalink / raw)
  To: Ludovic Courtès, Neil Jerram, Martin Pitt, Adam Schreiber,
	joolean, bug-guile


Update of bug #24009 (project guile):

             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #5:

Hello!

This is now fixed:

  master ->
http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commit;h=634aa8de8f8facc285867100c6c0a54c4ea5e6d4
  1.8 ->
http://git.savannah.gnu.org/gitweb/?p=guile.git;a=commit;h=b12a5fd7f645067143523094194db0154a890539

The version in `master' is more robust since it uses `full_write ()' from
Gnulib, which tries hard to actually write the given bytes; the fix in 1.8
does the minimum to make Glibc happy with `_FORTIFY_SOURCE=2'.

Most of the cases reported by `_FORTIFY_SOURCE' are when writing a single
byte to the signal pipe or the sleep FD.  In these situations, it would be
hard to handle a write/read error meaningfully, and it can't be very harmful
if one of these bytes is lost.

One last thing: the Flex-generated file `c-tokenize.c' does not check the
return value of `fwrite(3)', but there's nothing we can do here.  Another good
reason to not make `-Werror' the default?

Thanks,
Ludo'.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?24009>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





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

end of thread, other threads:[~2008-11-30 18:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-06 11:51 [bug #24009] does not check for short write()s Martin Pitt
2008-08-06 20:08 ` Neil Jerram
2008-10-29 16:58   ` Adam Schreiber
2008-10-30 22:44     ` anonymous
2008-10-31  2:45       ` Adam Schreiber
2008-11-30 18:10         ` 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).