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

list: traverse nested dir symlinks #96

Merged
merged 2 commits into from
Mar 12, 2015
Merged

Conversation

geniass
Copy link

@geniass geniass commented Mar 12, 2015

Addresses issue #80 and fixes commit 7f7dea5. The proper path of the symlink is now used

Addresses issue odeke-em#80 and fixes commit 7f7dea5. The proper path of the symlink is now used
@odeke-em
Copy link
Owner

Good stuff!

s, err = filepath.EvalSymlinks(gopath.Join(absPath, file.Name()))
var sym_file os.FileInfo
sym_file, err = os.Stat(s)
fileChan <- NewLocalFile(gopath.Join(absPath, file.Name()), sym_file)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sym_file, please use symFile.
s, please use symInfo.
Instead of gopath.Join(absPath,...) twice create a variable say symAbsPath := gopath.Join(absPath, file.Name())
then you can use it in the EvalSymlinks as well as NewLocalFile calls

@odeke-em
Copy link
Owner

LGTM, merging. Thank you!

odeke-em pushed a commit that referenced this pull request Mar 12, 2015
list: traverse nested dir symlinks
@odeke-em odeke-em merged commit 1b3779a into odeke-em:master Mar 12, 2015
@brandoncurtis
Copy link

In the course of trying to troubleshoot my continued problem with file duplication #137, I created some test folders containing every possible combination of nested symlinks.

Everything works fine if I have:
• a symlink to a real folder
• a symlink to a real folder that contains a symlink
• a symlink to a real folder that contains a symlink to a real folder that contains a symlink (&etc)
• a symlink to another symlink
• a symlink to folder nested inside another symlink

It breaks if I have have:
• a symlink that is named something other than the name of the folder it links to

e.g. the symlink is created withcd && ln -s /folder /home/brandon/link-to-folder

drive version 0.1.8
commit hash e071b36
OS linux/amd64

@odeke-em
Copy link
Owner

@brandoncurtis thank you for the detailed debugging and experiments. Sounds plausible but I cannot seem to reproduce this e.g
screen shot 2015-04-25 at 7 21 01 pm
screen shot 2015-04-25 at 7 21 18 pm
screen shot 2015-04-25 at 7 27 29 pm
screen shot 2015-04-25 at 7 27 47 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants