Skip to content

Opening a file with os.O_RDWR | os.O_TRUNC produces an empty file after writing. #2002

@gopherbot

Description

@gopherbot

by gauge2:

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
1. Have a file with data in it.
2. Open the file with os.O_RDWR | os.O_TRUNC flags.
3. Write some new data to the file.
4. Close the file.
5. Notice that the file is empty.

What is the expected output?
The file will be truncated and then the new data will be written to the blank file.

What do you see instead?
A Blank file with no data in it.

Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Ubuntu Unity

Which revision are you using?  (hg identify)
c98449d685d2 weekly/weekly.2011-05-22

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions