-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix mfs cp/mv bug #2690
fix mfs cp/mv bug #2690
Conversation
ndir := NewDirectory(d.ctx, name, nd, d, d.dserv) | ||
d.childDirs[name] = ndir | ||
default: | ||
panic("unrecognized! (NYI)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets definitely not panic here. there are other types (symlinks, raw blocks) that might pop up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
This broke many sharness tests: http://ci.ipfs.team:8111/viewLog.html?buildId=1732&buildTypeId=GoIpfs_CiTests&tab=buildLog#_focus=11331 |
Green! |
@whyrusleeping anything else needed here? |
case ft.TDirectory: | ||
ndir := NewDirectory(d.ctx, name, nd, d, d.dserv) | ||
d.childDirs[name] = ndir | ||
case ft.TFile, ft.TMetadata, ft.TRaw, ft.TSymlink: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm pretty sure we don't want to treat these all the same
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is consistent with what the old code did -- what should happen instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no its not, take a look at the code in childNode
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome -- cacheNode
is exactly what I wanted here.
1166e3f
to
c39545f
Compare
@@ -131,7 +131,7 @@ func (d *Directory) cacheNode(name string, nd *dag.Node) (FSNode, error) { | |||
ndir := NewDirectory(d.ctx, name, nd, d, d.dserv) | |||
d.childDirs[name] = ndir | |||
return ndir, nil | |||
case ufspb.Data_File, ufspb.Data_Raw: | |||
case ufspb.Data_File, ufspb.Data_Raw, ufspb.Data_Symlink: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
symlink is not correct here. We don't currently handle them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What the old code in AddChild did was check if len(links) == 0
, and if so, cached it as a file. it didn't check type (symlink, file, etc) at all like cacheNode
does.
This is because ipfs add
uses the mfs
package to add files, which means in order to handle symlinks in directories (like we do today on ipfs add
), AddChild
needs to also support symlinks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
symlink is still not correct here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we pass a dag node that represents a symlink to 'new file' here, its not going to work properly if we try to use it (NewDagModifier
will produce undefined behaviour when trying to modify a symlink).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason this currently works (since we use mfs for add) is that we never instantiate a NewFile as a symlink (or when we do, in the current incorrect code, it never gets used).
the caching here is likely the cause of #2615 |
@noffle could I get an update here? This is causing issues for people. |
Hey @whyrusleeping. The fix is simple enough: remove the caching piece introduced in #2531. However, this will also cause folders to appear out of order / not at all when using |
@noffle lets go ahead and temporarily disable the only hash flag when combined with the recursive flag, we can print a notice to the user referencing a tracking bug. |
License: MIT Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
License: MIT Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
a438cca
to
74517ea
Compare
License: MIT Signed-off-by: Stephen Whitmore <noffle@ipfs.io>
@whyrusleeping good idea -- added |
License: MIT Signed-off-by: Jeromy <why@ipfs.io>
Looks like this approach won't work either. Another approach -- here are why's notes:
I'll try and get to this next week. |
this has been fixed in #2795 |
Thank you for crushing this bug into a fine paste. On 06/08 22:09, Jeromy Johnson wrote:
|
Addresses #2654