Bug 507054 - fsetpos/fseek broken for wide-oriented streams
fsetpos/fseek broken for wide-oriented streams
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: glibc (Show other bugs)
11
All Linux
low Severity medium
: ---
: ---
Assigned To: Andreas Schwab
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 516995
  Show dependency treegraph
 
Reported: 2009-06-20 05:12 EDT by Watanabe, Yuki
Modified: 2009-09-07 09:36 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-09-07 09:36:49 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
a test case (374 bytes, text/plain)
2009-06-20 05:12 EDT, Watanabe, Yuki
no flags Details

  None (edit)
Description Watanabe, Yuki 2009-06-20 05:12:14 EDT
Created attachment 348738 [details]
a test case

Description of problem:
The fsetpos and fseek functions does not work for wide-oriented streams.
They leave the file position at the wrong place or cause a segfault.

Version-Release number of selected component (if applicable):
glibc-2.10.1-2 (i686)

How reproducible:
Sometimes.

Steps to Reproduce:
Compile and run the attached test case.
  
Actual output of the test case:
1
2
1
1

Expected output of the test case:
1
2
1
3

Additional info:
The fflush function seems to affect the behaviour fsetpos. Doing fflush just before fsetpos sometimes makes fsetpos work correctly, but it does not always help.
Comment 1 Andreas Schwab 2009-08-12 10:15:52 EDT
The bug seems to be connected with this old change, but reverting it breaks other tests.

2002-11-04  Ulrich Drepper  <drepper@redhat.com>

	* libio/wfileops.c (_IO_wfile_seekoff): Don't modify _offset and
	_wide_data->_IO_read_end if adjustment can be made in the current
	buffer.
Comment 2 Andreas Schwab 2009-08-31 08:25:06 EDT
Looks like the equivalent of this change has never been applied to wfileops.c:

2004-12-06  Ulrich Drepper  <drepper@redhat.com>
    
	* libio/fileops.c (_IO_new_file_seekoff): Fix optimization of in-buffer
	seek.  Remove dead code.
Comment 3 Andreas Schwab 2009-09-07 09:36:49 EDT
Fixed in 2.10.90-20.

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