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

@hirochachacha hirochachacha commented Jul 29, 2016

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

This comment has been minimized.

Copy link
Member

@minux minux commented Jul 30, 2016

@hirochachacha

This comment has been minimized.

Copy link
Contributor Author

@hirochachacha hirochachacha commented Jul 30, 2016

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

This comment has been minimized.

Copy link
Member

@alexbrainman alexbrainman commented Jul 30, 2016

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

This comment has been minimized.

Copy link
Contributor Author

@hirochachacha hirochachacha commented Jul 30, 2016

Yes, I will.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Aug 24, 2016

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

@gopherbot gopherbot closed this in 2eb46e8 Aug 26, 2016
@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
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants
You can’t perform that action at this time.