You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the case of copying a file in MFS I would like to know which of the two files doesn't exist, as the Unix cp command would report it (this also applies to moving files and similar commands).
cp /this-path-doesnt-exist /this-one-either
# cp: cannot stat '/this-path-doesnt-exist': No such file or directory
ipfs files cp /this-path-doesnt-exist /this-one-either
# Error: file does not exist
# (Which one?)
From the code I would think the most direct way is just to wrap the errors that return from getNodeFromPath and PutNode (that will fail in the Directory.Find() call) with the name of either the src or dst path, but maybe the error should be handled deeper inside the code.
So, cp actually does this at the top level. If we were mimicking it, we'd do it right before calling SetError in the command.
The most general solution would be to have DirLookup and PutNode wrap the error in an os.PathError. However, that won't cover the /ipfs/ special case... (I wish we handled this within MFS instead of within the command)
In the case of copying a file in MFS I would like to know which of the two files doesn't exist, as the Unix
cp
command would report it (this also applies to moving files and similar commands).From the code I would think the most direct way is just to wrap the errors that return from
getNodeFromPath
andPutNode
(that will fail in theDirectory.Find()
call) with the name of either thesrc
ordst
path, but maybe the error should be handled deeper inside the code.https://github.com/ipfs/go-ipfs/blob/7853e53860805e08a212d78c4baa5d59bff99ba8/core/commands/files.go#L330-L340
(Ideally I would even like to specify which part of the path doesn't exist, but this is probably going to far.)
@Stebalien WDYT
The text was updated successfully, but these errors were encountered: