Bug 854337 - fseek sets invalid status in the internal buffer in wide mode
Summary: fseek sets invalid status in the internal buffer in wide mode
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: glibc
Version: 18
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Carlos O'Donell
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-09-04 16:46 UTC by Siddhesh Poyarekar
Modified: 2016-11-24 12:11 UTC (History)
7 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-02-05 23:17:01 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Sourceware 14543 0 None None None Never

Description Siddhesh Poyarekar 2012-09-04 16:46:15 UTC
fseek sets the pointers in the external buffer correctly, but initializes the
internal buffer as if there's nothing in it. As a result, the position computed
in a subsequent ftell is incorrect.

How Reproducible:

Always

Reproducer program:

#include <stdio.h>
#include <stdlib.h>
#include <locale.h>

int main(int argc, char** argv)
{
    FILE *fp;

    setlocale(LC_ALL, "en_US.utf8");
    fp = fopen("output.txt", "w+");
    if (fp == NULL) {
        perror("fopen");
        exit(1);
    }
    if (fputws(L"abc\n", fp) == -1) {
        perror("fputws");
        exit(1);
    }
    printf("before=%d\n", ftell(fp));
    rewind (fp);
    if (fseek(fp, 0L, SEEK_END) == -1) {
        perror("fseek");
        exit(1);
    }
    printf("fseek=%d\n", ftell(fp));
    if (fputws(L"xyz\n", fp) == -1) {
        perror("fputws");
        exit(1);
    }
    printf("after=%d\n", ftell(fp));
    fclose(fp);
}

Actual result:

before=4
fseek=0
after=4

Expected Result:

before=4
fseek=4
after=8

Additional Information:

Posted patch upstream:

http://sourceware.org/ml/libc-alpha/2012-09/msg00044.html

Comment 1 Fedora Update System 2012-09-14 19:44:26 UTC
glibc-2.16-14.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/glibc-2.16-14.fc18

Comment 2 Fedora Update System 2012-09-17 15:20:20 UTC
glibc-2.16-15.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/glibc-2.16-15.fc18

Comment 3 Fedora Update System 2012-09-24 03:26:35 UTC
glibc-2.16-15.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 4 Fedora Admin XMLRPC Client 2013-01-28 20:07:56 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 5 Fedora End Of Life 2013-12-21 15:41:22 UTC
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '18'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior to Fedora 18's end of life.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 6 Fedora End Of Life 2014-02-05 23:17:01 UTC
Fedora 18 changed to end-of-life (EOL) status on 2014-01-14. Fedora 18 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.