Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os: CopyFS overwrites existing file in destination. [1.23 backport] #68907

Closed
gopherbot opened this issue Aug 16, 2024 · 2 comments
Closed

os: CopyFS overwrites existing file in destination. [1.23 backport] #68907

gopherbot opened this issue Aug 16, 2024 · 2 comments
Labels
CherryPickApproved Used during the release process for point releases
Milestone

Comments

@gopherbot
Copy link
Contributor

@panjf2000 requested issue #68895 to be considered for backport to the next 1.23 minor release.

@gopherbot please create a backport to 1.23, it's a mismatch of doc and actual behavior.

@gopherbot gopherbot added the CherryPickCandidate Used during the release process for point releases label Aug 16, 2024
@gopherbot gopherbot added this to the Go1.23.1 milestone Aug 16, 2024
@gopherbot
Copy link
Contributor Author

Change https://go.dev/cl/606415 mentions this issue: [release-branch.go1.23] os: use O_EXCL instead of O_TRUNC in CopyFS to disallow rewriting existing files does not exist

@cherrymui cherrymui added the CherryPickApproved Used during the release process for point releases label Aug 21, 2024
@gopherbot gopherbot removed the CherryPickCandidate Used during the release process for point releases label Aug 21, 2024
gopherbot pushed a commit that referenced this issue Aug 21, 2024
…o disallow rewriting existing files does not exist

On Linux, a call to creat() is equivalent to calling open() with flags
equal to O_CREAT|O_WRONLY|O_TRUNC, which applies to other platforms
as well in a similar manner. Thus, to force CopyFS's behavior to
comply with the function comment, we need to replace O_TRUNC with O_EXCL.

Fixes #68907

Change-Id: I3e2ab153609d3c8cf20ce5969d6f3ef593833cd1
Reviewed-on: https://go-review.googlesource.com/c/go/+/606095
Auto-Submit: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
(cherry picked from commit aa5d672)
Reviewed-on: https://go-review.googlesource.com/c/go/+/606415
@gopherbot
Copy link
Contributor Author

Closed by merging CL 606415 (commit 3c93405) to release-branch.go1.23.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CherryPickApproved Used during the release process for point releases
Projects
None yet
Development

No branches or pull requests

2 participants