local: add debugging for link problem

See: https://forum.rclone.org/t/problem-with-symlinks-and-links/23840/13
This commit is contained in:
Nick Craig-Wood 2021-04-29 14:38:39 +01:00
parent 34627c5c7e
commit 1dc58a924c
1 changed files with 2 additions and 0 deletions

View File

@ -1017,6 +1017,7 @@ func (file *localOpenFile) Close() (err error) {
func (o *Object) openTranslatedLink(offset, limit int64) (lrc io.ReadCloser, err error) {
// Read the link and return the destination it as the contents of the object
linkdst, err := os.Readlink(o.path)
fs.Infof(o, "openTranslatedLink link = %q, offset = %d, limit = %d, err = %v", linkdst, offset, limit, err)
if err != nil {
return nil, err
}
@ -1271,6 +1272,7 @@ func (o *Object) setMetadata(info os.FileInfo) {
// Optionally, users can turn this feature on with the zero_size_links flag
if (runtime.GOOS == "windows" || o.fs.opt.ZeroSizeLinks) && o.translatedLink {
linkdst, err := os.Readlink(o.path)
fs.Infof(o, "setMetadata link = %q, err = %v", linkdst, err)
if err != nil {
fs.Errorf(o, "Failed to read link size: %v", err)
} else {