-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
dir symlink recursive loop #55
Comments
it may be that the line in onsymlink():
should be changed (somehow) to refer to the linked-to object could use some feedback on this... |
ok, i think this is better -- though only 1 level deep symlink copy: ` case Deep:
` |
ok! a wrap on stopping a recursive copy of a directory caused by a deep symlink copy: https://github.com/enthor/copy/tree/enthor-patch-1 this does not resolve nested symlinks or the issue with shallow symlinks `
` |
Well...I just reviewed Wikipedia's entry for Symbolic Links: https://en.wikipedia.org/wiki/Symbolic_link The topic is beyond being a rabbit hole. There's an entire rabbit world down there! Which is fine at the OS level, but it is "out of scope" for Applications level code. (Or should be.) I don't use symbolic links, or hidden files, or named pipes or anything except for I think I may clone copy.Copy() in order to make a version that is blissfully unaware of To some extent the complications involved here derive from the nature of Go itself, https://stackoverflow.com/questions/12518876/how-to-check-if-a-file-exists-in-go It requires 12 answers, including admonishments that one should not do that and a dive Life is short. Let's not get bogged down in things...not without being paid to do the work. |
The difficulty of writing an OS-independent directory copy is now more apparent. I found another bit of code at stackoverflow: https://stackoverflow.com/questions/51779243/copy-a-folder-in-go and it looks promising, but it is only for Unix. So, I looked into things a bit more So there's that. And the question of whether a distinction of "Deep" vs. "Shallow" Also, the question of what happens when attempt made to copy and src == dest. My view is that the Go authors should be asked to add a directory copy utility to |
With Deep symlink copying in use, when a directory containing a symlink
is copied and the symlink points directly to the directory or to
another directory -- which is subsequently copied and contains
a symlink to the original directory, a loop ensues which is terminated in
os.Create with a "file name too long error" ...
I understand that there may be other issues copying symlinks,
but
https://github.com/enthor/copy/tree/enthor-patch-1
fixes this issue. (I believe...)
I included a test case -- search "case03b" in all_test.go.
To see the error output remove the "Not()." in
the following lines (temporarily):
// stop the recursive loop: opt = Options{OnSymlink: func(string) SymlinkAction { return Deep }} err = Copy("test/data/case03b", "test/data.copy/case03b.deep", opt) Expect(t, err).Not().ToBe(nil)
The text was updated successfully, but these errors were encountered: