public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/6544] New: fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE
@ 2008-05-22  6:27 witekfl at poczta dot onet dot pl
  2008-05-22  6:30 ` [Bug libc/6544] " witekfl at poczta dot onet dot pl
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: witekfl at poczta dot onet dot pl @ 2008-05-22  6:27 UTC (permalink / raw)
  To: glibc-bugs

fmemopen_seek in case of SEEK_END set the seek position on the first '\0' char
what is wrong. This way fmemopen is unusable with binary data.
I tried to use fmemopen with zziplib library to open a ZIP file which was
already loaded into memory, but it failed. With the patch below it works fine. 


--- glibc-2.8/libio/fmemopen.c.old      2008-05-21 23:40:18.000000000 +0200
+++ glibc-2.8/libio/fmemopen.c  2008-05-21 23:42:51.000000000 +0200
@@ -165,7 +165,7 @@ fmemopen_seek (void *cookie, _IO_off64_t
       break;

     case SEEK_END:
-      np = c->maxpos - *p;
+      np = c->size - *p;
       break;

     default:

-- 
           Summary: fseek(..., 0, SEEK_END) doesn't work as it should on
                    fmemopen's FILE
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: witekfl at poczta dot onet dot pl
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=6544

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/6544] fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE
  2008-05-22  6:27 [Bug libc/6544] New: fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE witekfl at poczta dot onet dot pl
@ 2008-05-22  6:30 ` witekfl at poczta dot onet dot pl
  2008-05-22  6:32 ` witekfl at poczta dot onet dot pl
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: witekfl at poczta dot onet dot pl @ 2008-05-22  6:30 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From witekfl at poczta dot onet dot pl  2008-05-22 06:29 -------
Created an attachment (id=2751)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2751&action=view)
Load ZIP file into memory and decompress the first entry

Real code that failed.

-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6544

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/6544] fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE
  2008-05-22  6:27 [Bug libc/6544] New: fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE witekfl at poczta dot onet dot pl
  2008-05-22  6:30 ` [Bug libc/6544] " witekfl at poczta dot onet dot pl
@ 2008-05-22  6:32 ` witekfl at poczta dot onet dot pl
  2008-08-14  6:36 ` drepper at redhat dot com
  2008-08-14 16:55 ` ebb9 at byu dot net
  3 siblings, 0 replies; 10+ messages in thread
From: witekfl at poczta dot onet dot pl @ 2008-05-22  6:32 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From witekfl at poczta dot onet dot pl  2008-05-22 06:31 -------
Created an attachment (id=2752)
 --> (http://sourceware.org/bugzilla/attachment.cgi?id=2752&action=view)
Patch.


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6544

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/6544] fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE
  2008-05-22  6:27 [Bug libc/6544] New: fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE witekfl at poczta dot onet dot pl
  2008-05-22  6:30 ` [Bug libc/6544] " witekfl at poczta dot onet dot pl
  2008-05-22  6:32 ` witekfl at poczta dot onet dot pl
@ 2008-08-14  6:36 ` drepper at redhat dot com
  2008-08-14 16:55 ` ebb9 at byu dot net
  3 siblings, 0 replies; 10+ messages in thread
From: drepper at redhat dot com @ 2008-08-14  6:36 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2008-08-14 06:34 -------
The patch cannot be used as is.  Existing code might expect the current behavior.

Instead I implement a binary mode, selected through 'b' in the mode string.  It
seems this is done in your code so you should not have to make any changes.  In
the binary mode we do the search as you proposed and writes don't add a NUL byte.

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


http://sourceware.org/bugzilla/show_bug.cgi?id=6544

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/6544] fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE
  2008-05-22  6:27 [Bug libc/6544] New: fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE witekfl at poczta dot onet dot pl
                   ` (2 preceding siblings ...)
  2008-08-14  6:36 ` drepper at redhat dot com
@ 2008-08-14 16:55 ` ebb9 at byu dot net
  3 siblings, 0 replies; 10+ messages in thread
From: ebb9 at byu dot net @ 2008-08-14 16:55 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From ebb9 at byu dot net  2008-08-14 16:53 -------
POSIX 200x is standardizing fmemopen with semantics that match neither the
original implementation, nor your new binary mode (in particular, the POSIX
wording states concerning the mode argument "The character 'b' shall have no
effect").  I also raised some questions as to whether glibc's fmemopen is buggy
in relation to other stream behavior:

https://www.opengroup.org/sophocles/show_mail.tpl?CALLER=show_archive.tpl&source=L&listname=austin-group-l&id=10782


-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=6544

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


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

* [Bug libc/6544] fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE
       [not found] <bug-6544-131@http.sourceware.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2014-02-16 18:23 ` jackie.rosen at hushmail dot com
@ 2014-05-28 19:46 ` schwab at sourceware dot org
  4 siblings, 0 replies; 10+ messages in thread
From: schwab at sourceware dot org @ 2014-05-28 19:46 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=6544

Andreas Schwab <schwab at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|jackie.rosen at hushmail dot com   |

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug libc/6544] fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE
       [not found] <bug-6544-131@http.sourceware.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-04-28  3:37 ` mtk.manpages at gmail dot com
@ 2014-02-16 18:23 ` jackie.rosen at hushmail dot com
  2014-05-28 19:46 ` schwab at sourceware dot org
  4 siblings, 0 replies; 10+ messages in thread
From: jackie.rosen at hushmail dot com @ 2014-02-16 18:23 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=6544

Jackie Rosen <jackie.rosen at hushmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jackie.rosen at hushmail dot com

--- Comment #6 from Jackie Rosen <jackie.rosen at hushmail dot com> ---
*** Bug 260998 has been marked as a duplicate of this bug. ***
Seen from the domain http://volichat.com
Page where seen: http://volichat.com/adult-chat-rooms
Marked for reference. Resolved as fixed @bugzilla.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


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

* [Bug libc/6544] fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE
       [not found] <bug-6544-131@http.sourceware.org/bugzilla/>
  2012-04-27 20:22 ` mtk.manpages at gmail dot com
  2012-04-28  2:34 ` mtk.manpages at gmail dot com
@ 2012-04-28  3:37 ` mtk.manpages at gmail dot com
  2014-02-16 18:23 ` jackie.rosen at hushmail dot com
  2014-05-28 19:46 ` schwab at sourceware dot org
  4 siblings, 0 replies; 10+ messages in thread
From: mtk.manpages at gmail dot com @ 2012-04-28  3:37 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=6544

--- Comment #5 from Michael Kerrisk <mtk.manpages at gmail dot com> 2012-04-28 03:36:15 UTC ---
Since the addition of binary mode appears to have been a silent change to the
ABI, I've noted this in the man page, under bugs:

[[
The glibc 2.9 addition of "binary" mode for
.BR fmemopen ()
silently changed the ABI: previously,
.BR fmemopen ()
ignored \(aqb\(aq in
.IR mode .
]]

-- 
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] 10+ messages in thread

* [Bug libc/6544] fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE
       [not found] <bug-6544-131@http.sourceware.org/bugzilla/>
  2012-04-27 20:22 ` mtk.manpages at gmail dot com
@ 2012-04-28  2:34 ` mtk.manpages at gmail dot com
  2012-04-28  3:37 ` mtk.manpages at gmail dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: mtk.manpages at gmail dot com @ 2012-04-28  2:34 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=6544

Michael Kerrisk <mtk.manpages at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eblake at redhat dot com

-- 
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] 10+ messages in thread

* [Bug libc/6544] fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE
       [not found] <bug-6544-131@http.sourceware.org/bugzilla/>
@ 2012-04-27 20:22 ` mtk.manpages at gmail dot com
  2012-04-28  2:34 ` mtk.manpages at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: mtk.manpages at gmail dot com @ 2012-04-27 20:22 UTC (permalink / raw)
  To: glibc-bugs

http://sourceware.org/bugzilla/show_bug.cgi?id=6544

Michael Kerrisk <mtk.manpages at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mtk.manpages at gmail dot
                   |                            |com

-- 
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] 10+ messages in thread

end of thread, other threads:[~2014-05-28 19:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-22  6:27 [Bug libc/6544] New: fseek(..., 0, SEEK_END) doesn't work as it should on fmemopen's FILE witekfl at poczta dot onet dot pl
2008-05-22  6:30 ` [Bug libc/6544] " witekfl at poczta dot onet dot pl
2008-05-22  6:32 ` witekfl at poczta dot onet dot pl
2008-08-14  6:36 ` drepper at redhat dot com
2008-08-14 16:55 ` ebb9 at byu dot net
     [not found] <bug-6544-131@http.sourceware.org/bugzilla/>
2012-04-27 20:22 ` mtk.manpages at gmail dot com
2012-04-28  2:34 ` mtk.manpages at gmail dot com
2012-04-28  3:37 ` mtk.manpages at gmail dot com
2014-02-16 18:23 ` jackie.rosen at hushmail dot com
2014-05-28 19:46 ` schwab at sourceware 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).