Issue Details (XML | Word | Printable)

Key: STDCXX-949
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Farid Zaripov
Reporter: Farid Zaripov
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
C++ Standard Library

27.filebuf test fails with assertions

Created: 03/Jun/08 09:28 AM   Updated: 03/Jun/08 09:00 PM
Return to search
Component/s: 27. Input/Output, Tests
Affects Version/s: 4.2.1
Fix Version/s: 4.2.2

Time Tracking:
Original Estimate: 1h
Original Estimate - 1h
Remaining Estimate: 0.5h
Time Spent - 0.5h Remaining Estimate - 0.5h
Time Spent: 0.5h
Time Spent - 0.5h Remaining Estimate - 0.5h

File Attachments:
  Size
Text File Licensed for inclusion in ASF works stdcxx-949.patch 2008-06-03 09:50 AM Farid Zaripov 2 kB
Environment: All

Patch Info: Patch Available
Severity: Incorrect Behavior


 Description  « Hide
The 27.filebuf test fails with the following assertions and warnings:
# ASSERTION (S7) (5 lines):
# TEXT: basic_filebuf<char>::is_open() == false, got true after a call to detach()
# CLAUSE: [lib.filebuf]
# FILE: 27.filebuf.cpp
# LINE: 1424

# ASSERTION (S7) (5 lines):
# TEXT: basic_filebuf<char>::fd() < 0, got 3 after a call to detach()()
# CLAUSE: [lib.filebuf]
# FILE: 27.filebuf.cpp
# LINE: 1431

# ASSERTION (S7) (5 lines):
# TEXT: basic_filebuf<char>::~basic_filebuf() attempted to close a detached file descriptor
# CLAUSE: [lib.filebuf]
# FILE: 27.filebuf.cpp
# LINE: 1443

# WARNING (S5) (5 lines):
# TEXT: std::remove("C:\Temp\.rwtest-tmp11") failed: Permission denied
# CLAUSE: [lib.filebuf]
# FILE: 27.filebuf.cpp
# LINE: 1519

# ASSERTION (S7) (5 lines):
# TEXT: basic_filebuf<char>::is_open() unexpectedly true after a successful call to detach()
# CLAUSE: [lib.filebuf]
# FILE: 27.filebuf.cpp
# LINE: 1593

# ASSERTION (S7) (5 lines):
# TEXT: basic_filebuf<wchar_t>::is_open() == false, got true after a call to detach()
# CLAUSE: [lib.filebuf]
# FILE: 27.filebuf.cpp
# LINE: 1424

# ASSERTION (S7) (5 lines):
# TEXT: basic_filebuf<wchar_t>::fd() < 0, got 3 after a call to detach()()
# CLAUSE: [lib.filebuf]
# FILE: 27.filebuf.cpp
# LINE: 1431

# ASSERTION (S7) (5 lines):
# TEXT: basic_filebuf<wchar_t>::~basic_filebuf() attempted to close a detached file descriptor
# CLAUSE: [lib.filebuf]
# FILE: 27.filebuf.cpp
# LINE: 1443

# WARNING (S5) (5 lines):
# TEXT: std::remove("C:\Temp\.rwtest-tmp12") failed: Permission denied
# CLAUSE: [lib.filebuf]
# FILE: 27.filebuf.cpp
# LINE: 1519

# ASSERTION (S7) (5 lines):
# TEXT: basic_filebuf<wchar_t>::is_open() unexpectedly true after a successful call to detach()
# CLAUSE: [lib.filebuf]
# FILE: 27.filebuf.cpp
# LINE: 1593


 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Farid Zaripov added a comment - 03/Jun/08 09:50 AM
The proposed patch is attached.

ChangeLog:

2008-06-03  Farid Zaripov  <farid_zaripov@epam.com>

	* include/fstream.cc (close): Zero out file pointer even when close() is
	called from detach() and all data flushed successfully.
	* tests/iostream/27.filebuf.cpp (test_ctors): Detach pfb from file pointer
	before delete because of the file is already closed in fb dtor.
	(test_attach): Close file descriptor before removing the file.