public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/13152] New: fmemopen does not honor append mode
@ 2011-09-05 2:28 bugdal at aerifal dot cx
2012-02-21 2:43 ` [Bug stdio/13152] " jsm28 at gcc dot gnu.org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: bugdal at aerifal dot cx @ 2011-09-05 2:28 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=13152
Bug #: 13152
Summary: fmemopen does not honor append mode
Product: glibc
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: libc
AssignedTo: drepper.fsp@gmail.com
ReportedBy: bugdal@aerifal.cx
Classification: Unclassified
fmemopen sets the initial offset correctly for append mode, but otherwise seems
to treat append mode just like "r+" (read/update) mode. Writes are not forced
to start at the "current size" of the stream, as specified by POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fmemopen.html
In other words, opening a stream for append, then seeking to the beginning and
attempting a write overwrites the beginning of the buffer rather than
appending.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug stdio/13152] fmemopen does not honor append mode
2011-09-05 2:28 [Bug libc/13152] New: fmemopen does not honor append mode bugdal at aerifal dot cx
@ 2012-02-21 2:43 ` jsm28 at gcc dot gnu.org
2012-04-27 20:18 ` mtk.manpages at gmail dot com
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: jsm28 at gcc dot gnu.org @ 2012-02-21 2:43 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=13152
Joseph Myers <jsm28 at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|libc |stdio
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug stdio/13152] fmemopen does not honor append mode
2011-09-05 2:28 [Bug libc/13152] New: fmemopen does not honor append mode bugdal at aerifal dot cx
2012-02-21 2:43 ` [Bug stdio/13152] " jsm28 at gcc dot gnu.org
@ 2012-04-27 20:18 ` mtk.manpages at gmail dot com
2012-04-27 20:49 ` mtk.manpages at gmail dot com
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mtk.manpages at gmail dot com @ 2012-04-27 20:18 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=13152
Michael Kerrisk <mtk.manpages at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mtk.manpages at gmail dot
| |com
--- Comment #1 from Michael Kerrisk <mtk.manpages at gmail dot com> 2012-04-27 20:18:01 UTC ---
Do you have some example code that demonstrates this?
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug stdio/13152] fmemopen does not honor append mode
2011-09-05 2:28 [Bug libc/13152] New: fmemopen does not honor append mode bugdal at aerifal dot cx
2012-02-21 2:43 ` [Bug stdio/13152] " jsm28 at gcc dot gnu.org
2012-04-27 20:18 ` mtk.manpages at gmail dot com
@ 2012-04-27 20:49 ` mtk.manpages at gmail dot com
2012-04-28 3:11 ` mtk.manpages at gmail dot com
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mtk.manpages at gmail dot com @ 2012-04-27 20:49 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=13152
--- Comment #2 from Michael Kerrisk <mtk.manpages at gmail dot com> 2012-04-27 20:48:37 UTC ---
Okay -- I created an example. See below.
In the below, the "X", should appear at the end of "hello, world", rather than
overwriting the first byte.
$ ./a.out x
Initial ftell(): 12
Resetting file position
New ftell(): 0
Xello, world
=====
#define _XOPEN_SOURCE 700
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \
} while (0)
int
main(int argc, char **argv)
{
char buf[20] = {"hello, world"};
FILE *fp = fmemopen(buf, 20, "a+");
char c;
int j;
printf("Initial ftell(): %ld\n", ftell(fp));
if (argc > 1) {
printf("Resetting file position\n");
fseek(fp, 0, SEEK_SET);
printf("New ftell(): %ld\n", ftell(fp));
}
fflush(fp);
fprintf(fp, "X");
fflush(fp);
printf("%s\n", buf);
}
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug stdio/13152] fmemopen does not honor append mode
2011-09-05 2:28 [Bug libc/13152] New: fmemopen does not honor append mode bugdal at aerifal dot cx
` (2 preceding siblings ...)
2012-04-27 20:49 ` mtk.manpages at gmail dot com
@ 2012-04-28 3:11 ` mtk.manpages at gmail dot com
2012-12-19 10:41 ` schwab@linux-m68k.org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: mtk.manpages at gmail dot com @ 2012-04-28 3:11 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=13152
--- Comment #3 from Michael Kerrisk <mtk.manpages at gmail dot com> 2012-04-28 03:10:35 UTC ---
I've added the following text to the fmemopen(3) man page, under bugs:
[[
Specifying append mode ("a" or "a+") for
.BR fmemopen ()
sets the initial file position to the first null byte,
but (if the file offset is reset to a location other than
the end of the stream)
does not force subsequent to append at the end of the stream.
]]
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug stdio/13152] fmemopen does not honor append mode
2011-09-05 2:28 [Bug libc/13152] New: fmemopen does not honor append mode bugdal at aerifal dot cx
` (3 preceding siblings ...)
2012-04-28 3:11 ` mtk.manpages at gmail dot com
@ 2012-12-19 10:41 ` schwab@linux-m68k.org
2014-06-27 12:10 ` fweimer at redhat dot com
2015-07-08 15:16 ` adhemerval.zanella at linaro dot org
6 siblings, 0 replies; 8+ messages in thread
From: schwab@linux-m68k.org @ 2012-12-19 10:41 UTC (permalink / raw)
To: glibc-bugs
http://sourceware.org/bugzilla/show_bug.cgi?id=13152
Andreas Schwab <schwab@linux-m68k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|drepper.fsp at gmail dot |unassigned at sourceware
|com |dot org
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug stdio/13152] fmemopen does not honor append mode
2011-09-05 2:28 [Bug libc/13152] New: fmemopen does not honor append mode bugdal at aerifal dot cx
` (4 preceding siblings ...)
2012-12-19 10:41 ` schwab@linux-m68k.org
@ 2014-06-27 12:10 ` fweimer at redhat dot com
2015-07-08 15:16 ` adhemerval.zanella at linaro dot org
6 siblings, 0 replies; 8+ messages in thread
From: fweimer at redhat dot com @ 2014-06-27 12:10 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=13152
Florian Weimer <fweimer at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Flags| |security-
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug stdio/13152] fmemopen does not honor append mode
2011-09-05 2:28 [Bug libc/13152] New: fmemopen does not honor append mode bugdal at aerifal dot cx
` (5 preceding siblings ...)
2014-06-27 12:10 ` fweimer at redhat dot com
@ 2015-07-08 15:16 ` adhemerval.zanella at linaro dot org
6 siblings, 0 replies; 8+ messages in thread
From: adhemerval.zanella at linaro dot org @ 2015-07-08 15:16 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=13152
Adhemerval Zanella <adhemerval.zanella at linaro dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |adhemerval.zanella at linaro dot o
| |rg
Resolution|--- |FIXED
--- Comment #4 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
This is fixed by fdb7d390dd0d96e4a8239c46f3aa64598b90842b. Closing bug.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-07-08 15:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-05 2:28 [Bug libc/13152] New: fmemopen does not honor append mode bugdal at aerifal dot cx
2012-02-21 2:43 ` [Bug stdio/13152] " jsm28 at gcc dot gnu.org
2012-04-27 20:18 ` mtk.manpages at gmail dot com
2012-04-27 20:49 ` mtk.manpages at gmail dot com
2012-04-28 3:11 ` mtk.manpages at gmail dot com
2012-12-19 10:41 ` schwab@linux-m68k.org
2014-06-27 12:10 ` fweimer at redhat dot com
2015-07-08 15:16 ` adhemerval.zanella at linaro dot org
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).