-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: add support for long path names on unix RemoveAll #27871
os: add support for long path names on unix RemoveAll #27871
Conversation
This PR (HEAD: 3043fe3) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/137442 to see it. Tip: You can toggle comments from me using the |
Message from Gerrit User 5976: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 12446: Uploaded patch set 2: Commit message was updated. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 24096: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
3043fe3
to
e12cec7
Compare
This PR (HEAD: e12cec7) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/137442 to see it. Tip: You can toggle comments from me using the |
Message from Gerrit User 19560: Patch Set 3: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 28776: Patch Set 3: (2 comments)
Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
e12cec7
to
df255c8
Compare
This PR (HEAD: df255c8) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/137442 to see it. Tip: You can toggle comments from me using the |
Message from Gerrit User 28776: Patch Set 4: (1 comment) Fixed to use existing syscall package constants. AT_REMOVEDIR was actually _AT_REMOVEDIR, so had to keep the 0x200 constant. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 19560: Patch Set 4: Run-TryBot+1
Thanks Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5976: Patch Set 4: TryBots beginning. Status page: https://farmer.golang.org/try?commit=d0a82701 Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5976: Patch Set 4: Build is still in progress... Consult https://build.golang.org/ to see whether it's a new failure. Other builds still in progress; subsequent failure notices suppressed until final report. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5976: Patch Set 4: TryBot-Result-1 2 of 19 TryBots failed: Consult https://build.golang.org/ to see whether they are new failures. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 28776: Patch Set 4: Need some advice on removing "." and "..". The reason for the freebsd/openbsd failures is because we added a TestRemoveAllDot test, testing for the removal of "." and ".." (usually not allowed on unix), which expects an error. Do you agree with this reasoning? If so, we should just skip these tests on !linux,!darwin until it's ported. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
df255c8
to
f616868
Compare
This PR (HEAD: f616868) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/137442 to see it. Tip: You can toggle comments from me using the |
Message from Gerrit User 28776: Patch Set 5: Fixed by implementing for freebsd & openbsd Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5889: Patch Set 5:
Were you going to enable it for them? Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
f616868
to
3cafab3
Compare
This PR (HEAD: 3cafab3) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/137442 to see it. Tip: You can toggle comments from me using the |
Message from Gerrit User 12446: Uploaded patch set 7: Commit message was updated. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 28776: Patch Set 6:
Yep, always forgetting build flags. Have enabled for them now. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 19560: Patch Set 7:
I think you can also cover netbsd and dragonfly in the same way. We don't have TryBots for these but I guess TestRemoveAllDot would still fail later on the builders. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
3cafab3
to
9ab706c
Compare
This PR (HEAD: 9ab706c) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/137442 to see it. Tip: You can toggle comments from me using the |
Message from Gerrit User 12446: Uploaded patch set 9: Commit message was updated. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 28776: Patch Set 8:
Yes you're right. Should be done for most unix systems now - maybe time for another trybot? Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
666fc8b
to
886197c
Compare
On unix systems, long enough path names will fail when performing syscalls like `Lstat`. The current RemoveAll uses several of these syscalls, and so will fail for long paths. This can be risky, as it can let users "hide" files from the system or otherwise make long enough paths for programs to fail. By using `Unlinkat` and `Openat` syscalls instead, RemoveAll is safer on unix systems. Initially implemented for linux, darwin, freebsd and openbsd. Fixes golang#27029 Co-authored-by: Giuseppe Capizzi <gcapizzi@pivotal.io> Co-authored-by: Julia Nedialkova <yulia.nedyalkova@sap.com>
886197c
to
b30a621
Compare
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) |
Message from Gerrit User 29433: Patch Set 19:
Cleaned up the uintptr consts and used syscall.SYS_FSTATAT(64) references on supported architectures. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 29433: Patch Set 20: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 19560: Patch Set 20: (4 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 29433: Patch Set 20: (1 comment) Ah, now I see the (new)fstatat(64) overlap, thanks Tobias. I managed to reduce all of the sysnum_linux_* files down to 3 using the 3 different calls. Again should come through when a googler thumbs up on the github PR. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 19560: Patch Set 20:
Nice, thanks a lot for working on these issues. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
This PR (HEAD: b30a621) has been imported to Gerrit for code review. Please visit https://go-review.googlesource.com/c/go/+/137442 to see it. Tip: You can toggle comments from me using the |
Message from Gerrit User 19560: Patch Set 21: Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5976: Patch Set 21: TryBots beginning. Status page: https://farmer.golang.org/try?commit=907b827e Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5976: Patch Set 21: Build is still in progress... Consult https://build.golang.org/ to see whether it's a new failure. Other builds still in progress; subsequent failure notices suppressed until final report. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5976: Patch Set 21: TryBot-Result-1 1 of 19 TryBots failed: Consult https://build.golang.org/ to see whether they are new failures. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 19560: Patch Set 21:
TryBot failure looks unrelated: --- FAIL: TestReadSubKeyNames (0.00s) Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5206: Patch Set 21: Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5206: Patch Set 21: Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5206: Patch Set 22: Patch Set 21 was rebased Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5206: Patch Set 22: Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5976: Patch Set 22: TryBots beginning. Status page: https://farmer.golang.org/try?commit=8853b41f Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5976: Patch Set 21: TryBot-Result+1 TryBots are happy. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5976: Patch Set 22: Build is still in progress... Consult https://build.golang.org/ to see whether it's a new failure. Other builds still in progress; subsequent failure notices suppressed until final report. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
Message from Gerrit User 5976: Patch Set 22: TryBot-Result-1 1 of 19 TryBots failed: Consult https://build.golang.org/ to see whether they are new failures. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
On unix systems, long enough path names will fail when performing syscalls like `Lstat`. The current RemoveAll uses several of these syscalls, and so will fail for long paths. This can be risky, as it can let users "hide" files from the system or otherwise make long enough paths for programs to fail. By using `Unlinkat` and `Openat` syscalls instead, RemoveAll is safer on unix systems. Initially implemented for linux, darwin, and several bsds. Fixes #27029 Co-authored-by: Giuseppe Capizzi <gcapizzi@pivotal.io> Co-authored-by: Julia Nedialkova <yulia.nedyalkova@sap.com> Change-Id: Id9fcdf4775962b021b7ff438dc51ee6d16bb5f56 GitHub-Last-Rev: b30a621 GitHub-Pull-Request: #27871 Reviewed-on: https://go-review.googlesource.com/c/137442 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Message from Gerrit User 5206: Patch Set 22: Code-Review+2 OK, looks good. Whew. Thanks for your patience on this. Please don’t reply on this GitHub thread. Visit golang.org/cl/137442. |
This PR is being closed because golang.org/cl/137442 has been merged. |
On unix systems, long enough path names will fail when performing syscalls
like
Lstat
. The current RemoveAll uses several of these syscalls, and sowill fail for long paths. This can be risky, as it can let users "hide"
files from the system or otherwise make long enough paths for programs
to fail. By using
Unlinkat
andOpenat
syscalls instead, RemoveAll issafer on unix systems. Initially implemented for linux, darwin, and several bsds.
Fixes #27029
Co-authored-by: Giuseppe Capizzi gcapizzi@pivotal.io
Co-authored-by: Julia Nedialkova yulia.nedyalkova@sap.com