skicka: error creating Google Drive client: rename /tmp/skicka.metadata668194580 /usr/home/me/.skicka.metadata.cache: cross-device link #64
Comments
I think that change should fix it; let me know. Thanks! |
commit af59d86 Before I ran skicka, I took a look at the diff and saw that you copy the file from the sys temp dir to a local temp file, if the rename from the sys temp dir doesn't work. I had thought about something like this, but . . .
So I thought that defaulting to creating the temp file in the home dir, in the first place, might be the simplest/safest. Also you find out sooner, rather than later, whether the cache file will be writable to the location you want to access it from (useful), before going through the trouble of creating it. But, anyway, this works. And I see you've been busy on probably more impactful commits. :-) Thanks! |
@bdklahn I was having the exact same problem. So glad you opened the issue! |
I got a similar problem on Windows,
And I'm using the version after this patch. Does anyone have idea? |
And I find the same issue when using I'll create a new issue here. |
It looks like Windows doesn't like renaming a file on top of an existing one. I added a case to remove the target file in that case; please let me know if this fixes it. |
I got BTW, my |
@david50407 That error sounds very much like issue #75 that I just opened. (I have a local fix for that but haven't pushed it yet.) |
@bgrainger Yes, I think that's the same one. |
Closing this as I believe that it should also be fixed by 93fb2d9. |
That's one thing a recent update broke, for me. My OS (PC-BSD) is on a ZFS mirror, and I think /tmp and /usr/home/ might be on different data sets. FreeBSD might not allow cross-device links, by default.
See: http://golang.org/pkg/os/#Rename
"OS-specific restrictions might apply."
Maybe the temp file could be made in the home dir. I see you create and use a userHomeDir() function in skicka.go. If that were included in gdrive.go, maybe you could do:
f, err := ioutil.TempFile(userHomrDir(), "skicka.metadata")
I don't know if it makes sense to include a skicka.go function in gdrive.go, or if a separate utilities library file is in order, to serve both.
I realize this might not affect many others. But this is a little like download utilities: They often keep the temporary partial download files in the same directory, as the completed download; not in the system temp dir.
The temp file is worthless if something goes wrong (unless, maybe, for debugging), and perhaps ought to be deleted on error, anyway.
"It is the caller's responsibility to remove the file when no longer needed." (http://golang.org/pkg/io/ioutil/#TempFile)
I guess that is moot if the rename works, but . . .
One odd thing is that I can do that same rename (mv) from my bash command line. So I don't know if golang's os.rename is using the same library, or if the OS packaged console apps are afforded more permission, or . . .
The text was updated successfully, but these errors were encountered: