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

Working with symlinks #80

Closed
asmisha opened this issue Mar 6, 2015 · 11 comments
Closed

Working with symlinks #80

asmisha opened this issue Mar 6, 2015 · 11 comments

Comments

@asmisha
Copy link

asmisha commented Mar 6, 2015

Is it possible to push a symlink? Now it results in pushing an empty file.

@odeke-em
Copy link
Owner

odeke-em commented Mar 6, 2015

It is, symlinks should not matter.

$ cd ~/my_drive
$ ln -s ~/Desktop/test.txt
$ drive push test.txt

In fact one of the push methods push -m uses symlinks in order to push content that isn't present in your drive, but you'd like to push from an arbitrary path on your file system. A sample usage is:

$ cd ~/my_drive/tests
$ drive push -m ~/Desktop/content ~/angstrom .

If this persists would you mind giving drive version, OS, go version, as well as a screenshot of a test?

@geniass
Copy link

geniass commented Mar 9, 2015

It doesn't automatically follow symlinks though:

     $ ln -s ~/somefolder ~/mydrive/somefolder
     $ cd ~/mydrive
     $ drive push somefolder

The result is a file in Drive called somefolder. It's a 0 byte binary file where it should be a folder containing file.

@odeke-em
Copy link
Owner

odeke-em commented Mar 9, 2015

Unfortunately I cannot reproduce this, even going by your steps. Please see the screenshot attached. Maybe I am missing something
screen shot 2015-03-09 at 9 07 33 am

What version of drive are you using? What OS?

@geniass
Copy link

geniass commented Mar 9, 2015

Your example works for me too. The problem is actually when there is a symlink inside a subdirectory. In my case:

$ ls -lrth dim
   lrwxrwxrwx 1 root root 62 Mar  9 22:20 appm -> /home/ari/Dropbox/wits/appm
$ ls -lrth dim/appm
   -rwxrwxrwx 1 root root 302K Feb 25 18:54 LectureNotes_Student_1.pdf
   drwxrwxrwx 1 root root 4,0K Mar  4 21:52 lab2
$ drive push -ignore-conflict dim
   Resolving...
   X /dim/lab2
   + /dim/appm
   Clashing modification count 1 src: 92.00B
   Addition count 1 src: 62.00B

This results in the problem I described. I also tried drive push dim/appm but then I get errors like

/dim/appm/LectureNotes_Student_1.pdf: googleapi: Error 400: Parent is not a folder: 0B2gbvqIBh4KaMDhyczFQUTN5eE0, invalid

@odeke-em
Copy link
Owner

odeke-em commented Mar 9, 2015

It would be great if you could give me information like the version of drive, OS and any other information, as previously requested.

@geniass
Copy link

geniass commented Mar 10, 2015

Sorry forgot to add it's drive 0.1.1 (from Github) on Linux Mint 17.1 x64.

@odeke-em
Copy link
Owner

Alright, I'll look at it when I get home in about 10 hours.

@odeke-em
Copy link
Owner

Okay, so ReadDir when given a directory does not resolve the symlinks if they are directories. You can try to reproduce this even on your system by doing

$ mkdir -p a/b
$ mkdir -p ~/Desktop/z1/z2 && ls ~ > ~/Desktop/z1/z2/listing.txt
$ ln -s ~/Desktop/z1/z2 a/b
$ ls -R a # Should print only z2 and nothing inside it

This to me is on the OS and not a bug on drive's part. Of course I could try to mitigate this but what happens when the next user who expects system dependent behaviour?

@odeke-em
Copy link
Owner

You know what, never mind, I'll just include this in the README with caution to the user.

odeke-em pushed a commit that referenced this issue Mar 12, 2015
@odeke-em
Copy link
Owner

Please pull from master, and try again.

odeke-em pushed a commit that referenced this issue Mar 12, 2015
geniass added a commit to geniass/drive that referenced this issue Mar 12, 2015
Addresses issue odeke-em#80 and fixes commit 7f7dea5. The proper path of the symlink is now used
@odeke-em
Copy link
Owner

Fixed by 9579c28 with a contribution form @geniass. Thank you very much. Reopen if persists.

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

No branches or pull requests

3 participants