All of lore.kernel.org
 help / color / mirror / Atom feed
* [Bug 91931] New: fflush(3) is misleading about input streams
@ 2015-01-23 16:15 bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
       [not found] ` <bug-91931-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/>
  0 siblings, 1 reply; 5+ messages in thread
From: bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r @ 2015-01-23 16:15 UTC (permalink / raw)
  To: linux-man-u79uwXL29TY76Z2rM5mHXA

https://bugzilla.kernel.org/show_bug.cgi?id=91931

            Bug ID: 91931
           Summary: fflush(3) is misleading about input streams
           Product: Documentation
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: man-pages
          Assignee: documentation_man-pages-ztI5WcYan/vQLgFONoPN62D2FQJk+8+b@public.gmane.org
          Reporter: cubbi-+Aw+eGX9mmUAvxtiuMwx3w@public.gmane.org
        Regression: No

Current fflush(3) claims that

"For input streams, fflush() discards any buffered data that has been fetched
from the underlying file, but has not been consumed by the application."

While technically true (assuming 'file' implies seekable device), this is
incomplete: flushing an input stream associated with a non-seekable device,
such as the terminal input, does nothing (the update to fp->_IO_read_end at
libio/fileops.c:872 does not happen due to ESPIPE from lseek)

There have been enough confused beginner posts to various internet forums
asking why flushing stdin doesn't work on Linux. I believe it is worth making
the man page more explicit. At the very least, it should begin that sentence
with "For input streams associated with seekable devices", or perhaps it should
mention the unfortunately popular use case fflush(stdin) explicitly.

On a very minor note, fflush(3) also claims that
"The standards do not specify the behavior for input streams"

This is no longer precisely correct; POSIX specifies behavior for seekable
input streams to move fileno's offset to match FILE's offset and undo all
ungetc's: http://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html
and glibc conforms to that (or tries to,
https://sourceware.org/bugzilla/show_bug.cgi?id=5994 is still open)

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [Bug 91931] fflush(3) is misleading about input streams
       [not found] ` <bug-91931-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/>
@ 2015-01-25 19:53   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
  2015-01-27  4:35   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r @ 2015-01-25 19:53 UTC (permalink / raw)
  To: linux-man-u79uwXL29TY76Z2rM5mHXA

https://bugzilla.kernel.org/show_bug.cgi?id=91931

Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

--- Comment #1 from Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ---
Thanks for the report. I think you are more or less right. One question though:
should the text not be in terms of "block buffered stream" rather than
"seekable device"?

Thanks,

Michael

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [Bug 91931] fflush(3) is misleading about input streams
       [not found] ` <bug-91931-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/>
  2015-01-25 19:53   ` [Bug 91931] " bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
@ 2015-01-27  4:35   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
  2015-01-28  8:31   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
  2015-01-28  8:33   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
  3 siblings, 0 replies; 5+ messages in thread
From: bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r @ 2015-01-27  4:35 UTC (permalink / raw)
  To: linux-man-u79uwXL29TY76Z2rM5mHXA

https://bugzilla.kernel.org/show_bug.cgi?id=91931

--- Comment #2 from cubbi-+Aw+eGX9mmUAvxtiuMwx3w@public.gmane.org ---
I don't see how buffering strategy would be relevant: it calls lseek(2) the
same way whether the streams are setvbuf'd line-buffered or block-buffered.

POSIX wording is simply "the file is one capable of seeking"

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [Bug 91931] fflush(3) is misleading about input streams
       [not found] ` <bug-91931-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/>
  2015-01-25 19:53   ` [Bug 91931] " bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
  2015-01-27  4:35   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
@ 2015-01-28  8:31   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
  2015-01-28  8:33   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
  3 siblings, 0 replies; 5+ messages in thread
From: bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r @ 2015-01-28  8:31 UTC (permalink / raw)
  To: linux-man-u79uwXL29TY76Z2rM5mHXA

https://bugzilla.kernel.org/show_bug.cgi?id=91931

--- Comment #3 from Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> ---
(In reply to cubbi from comment #0)

> On a very minor note, fflush(3) also claims that
> "The standards do not specify the behavior for input streams"
> 
> This is no longer precisely correct; POSIX specifies behavior for seekable
> input streams to move fileno's offset to match FILE's offset and undo all
> ungetc's:
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/fflush.html and
> glibc conforms to that (or tries to,
> https://sourceware.org/bugzilla/show_bug.cgi?id=5994 is still open)

Thanks. I modified the text to note that POSIX.1-2008 does add specification
for input streams.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [Bug 91931] fflush(3) is misleading about input streams
       [not found] ` <bug-91931-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/>
                     ` (2 preceding siblings ...)
  2015-01-28  8:31   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
@ 2015-01-28  8:33   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
  3 siblings, 0 replies; 5+ messages in thread
From: bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r @ 2015-01-28  8:33 UTC (permalink / raw)
  To: linux-man-u79uwXL29TY76Z2rM5mHXA

https://bugzilla.kernel.org/show_bug.cgi?id=91931

Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |CODE_FIX

-- 
You are receiving this mail because:
You are watching the assignee of the bug.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2015-01-28  8:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-23 16:15 [Bug 91931] New: fflush(3) is misleading about input streams bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
     [not found] ` <bug-91931-11311-3bo0kxnWaOQUvHkbgXJLS5sdmw4N0Rt+2LY78lusg7I@public.gmane.org/>
2015-01-25 19:53   ` [Bug 91931] " bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-01-27  4:35   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-01-28  8:31   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r
2015-01-28  8:33   ` bugzilla-daemon-590EEB7GvNiWaY/ihj7yzEB+6BGkLq7r

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.