Navigation Menu

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: Stat never stops if the path is a circular symbolic link on windows #16538

Closed
hirochachacha opened this issue Jul 29, 2016 · 5 comments
Closed

Comments

@hirochachacha
Copy link
Contributor

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go1.6.3
  2. What operating system and processor architecture are you using (go env)?
    windows/amd64
  3. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    A link on play.golang.org is best.
package main

import (
  "os"
)

func main() {
  os.Symlink("a", "b")
  os.Symlink("b", "a")
  err := os.Stat("a")
  if err != nil {
    panic(err)
  }
}
  1. What did you expect to see?
    stopped with some errors.
  2. What did you see instead?
    No errors. busy loop
@hirochachacha hirochachacha changed the title os: Stat never stop if the path is a circular symbolic link on windows. os: Stat never stops if the path is a circular symbolic link on windows Jul 29, 2016
@quentinmit quentinmit added this to the Go1.8 milestone Jul 29, 2016
@minux
Copy link
Member

minux commented Jul 30, 2016 via email

@hirochachacha
Copy link
Contributor Author

A simple fix ...

I agree with you.

MAXSYMLINKS is defined to be 40.

or _POSIX_SYMLOOP_MAX = 8

http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html

@alexbrainman
Copy link
Member

A simple fix (as used by Unix) is to limit the maximum number
of iterations

Sure. We already do something like that here https://tip.golang.org/src/path/filepath/symlink.go#L36

@hirochachacha do you want to send change (with new test) after go1.7 is released?

Alex

@hirochachacha
Copy link
Contributor Author

Yes, I will.

@gopherbot
Copy link

CL https://golang.org/cl/27580 mentions this issue.

@golang golang locked and limited conversation to collaborators Aug 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants