[go] os: avoid panic when RemoveAll fails to remove a symlink

0 views
Skip to first unread message

Damien Neil (Gerrit)

unread,
Apr 20, 2026, 12:27:39 PM (10 days ago) Apr 20
to goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Nicholas Husin, Nicholas Husin, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com

Damien Neil submitted the change

Change information

Commit message:
os: avoid panic when RemoveAll fails to remove a symlink

Fix a case where RemoveAll directly returned the error returned
from openDirAt. When the target of openDirAt is a symlink,
it returns an internal-use-only errSymlink error. This error
panics when printed, to catch misuse of openDirAt.

Fix RemoveAll to detect and handle the errSymlink return.

Fixes #78490
Change-Id: Ibd857280bfca1feb50c163a6e4b192716a6a6964
Reviewed-by: Nicholas Husin <hu...@google.com>
Reviewed-by: Nicholas Husin <n...@golang.org>
Files:
  • M src/os/removeall_at.go
  • M src/os/removeall_test.go
  • M src/os/removeall_unix.go
  • M src/os/removeall_windows.go
Change size: M
Delta: 4 files changed, 40 insertions(+), 22 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ibd857280bfca1feb50c163a6e4b192716a6a6964
Gerrit-Change-Number: 763520
Gerrit-PatchSet: 4
Gerrit-Owner: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Nicholas Husin <hu...@google.com>
Gerrit-Reviewer: Nicholas Husin <n...@golang.org>
open
diffy
satisfied_requirement

Michael Pratt (Gerrit)

unread,
Apr 29, 2026, 4:44:16 PM (20 hours ago) Apr 29
to Michael Pratt, Damien Neil, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, golang...@luci-project-accounts.iam.gserviceaccount.com, Robert Griesemer, Robert Griesemer, Ian Lance Taylor, Russ Cox, Gopher Robot, golang-co...@googlegroups.com

Michael Pratt submitted the change

Unreviewed changes

1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.

Change information

Commit message:
[release-branch.go1.26] os: avoid panic when RemoveAll fails to remove a symlink


Fix a case where RemoveAll directly returned the error returned
from openDirAt. When the target of openDirAt is a symlink,
it returns an internal-use-only errSymlink error. This error
panics when printed, to catch misuse of openDirAt.

Fix RemoveAll to detect and handle the errSymlink return.

For #78490
Fixes #78867


Change-Id: Ibd857280bfca1feb50c163a6e4b192716a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/763520
Reviewed-by: Nicholas Husin <hu...@google.com>
LUCI-TryBot-Result: golang...@luci-project-accounts.iam.gserviceaccount.com <golang...@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <n...@golang.org>
(cherry picked from commit 5ddbf4b0e3be9e22b719b8a6a5aeb20029839972)
Reviewed-on: https://go-review.googlesource.com/c/go/+/769021
Reviewed-by: Robert Griesemer <g...@google.com>
Files:
  • M src/os/removeall_at.go
  • M src/os/removeall_test.go
  • M src/os/removeall_unix.go
  • M src/os/removeall_windows.go
Change size: M
Delta: 4 files changed, 40 insertions(+), 22 deletions(-)
Branch: refs/heads/release-branch.go1.26
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Robert Griesemer
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: release-branch.go1.26
Gerrit-Change-Id: Ibd857280bfca1feb50c163a6e4b192716a6a6964
Gerrit-Change-Number: 769021
Gerrit-PatchSet: 3
Gerrit-Owner: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
Gerrit-Reviewer: Robert Griesemer <g...@google.com>
Gerrit-Reviewer: Russ Cox <r...@golang.org>
Gerrit-CC: Gopher Robot <go...@golang.org>
open
diffy
satisfied_requirement

Michael Pratt (Gerrit)

unread,
Apr 29, 2026, 4:44:22 PM (20 hours ago) Apr 29
to Michael Pratt, Damien Neil, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, golang...@luci-project-accounts.iam.gserviceaccount.com, Robert Griesemer, Brad Fitzpatrick, Robert Griesemer, Ian Lance Taylor, Gopher Robot, golang-co...@googlegroups.com

Michael Pratt submitted the change

Change information

Commit message:
[release-branch.go1.25] os: avoid panic when RemoveAll fails to remove a symlink


Fix a case where RemoveAll directly returned the error returned
from openDirAt. When the target of openDirAt is a symlink,
it returns an internal-use-only errSymlink error. This error
panics when printed, to catch misuse of openDirAt.

Fix RemoveAll to detect and handle the errSymlink return.

For #78490
Fixes #78866 


Change-Id: Ibd857280bfca1feb50c163a6e4b192716a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/763520
Reviewed-by: Nicholas Husin <hu...@google.com>
LUCI-TryBot-Result: golang...@luci-project-accounts.iam.gserviceaccount.com <golang...@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Nicholas Husin <n...@golang.org>
(cherry picked from commit 5ddbf4b0e3be9e22b719b8a6a5aeb20029839972)
Reviewed-on: https://go-review.googlesource.com/c/go/+/769020
Reviewed-by: Robert Griesemer <g...@google.com>
Files:
  • M src/os/removeall_at.go
  • M src/os/removeall_test.go
  • M src/os/removeall_unix.go
  • M src/os/removeall_windows.go
Change size: M
Delta: 4 files changed, 40 insertions(+), 22 deletions(-)
Branch: refs/heads/release-branch.go1.25
Submit Requirements:
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: release-branch.go1.25
Gerrit-Change-Id: Ibd857280bfca1feb50c163a6e4b192716a6a6964
Gerrit-Change-Number: 769020
Gerrit-PatchSet: 2
Gerrit-Owner: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Brad Fitzpatrick <brad...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
Gerrit-Reviewer: Robert Griesemer <g...@golang.org>
Gerrit-Reviewer: Robert Griesemer <g...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages