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

Resolving links in sharded directories does not seem to work #5270

Closed
victorb opened this issue Jul 21, 2018 · 11 comments · Fixed by #5484
Closed

Resolving links in sharded directories does not seem to work #5270

victorb opened this issue Jul 21, 2018 · 11 comments · Fixed by #5484
Assignees
Labels
kind/bug A bug in existing code (including security flaws) regression topic/core-api Topic core-api

Comments

@victorb
Copy link
Member

victorb commented Jul 21, 2018

Version information:

Gateways running commit 1dede1b

Type:

Bug

Description:

I've tried three projects that are using sharded directories and one without. The one without resolves links correctly but none of the projects using sharded directories works for resolving links. However, it does work when using 0.4.15

@victorb victorb added the kind/bug A bug in existing code (including security flaws) label Jul 21, 2018
@magik6k
Copy link
Member

magik6k commented Jul 21, 2018

Likely introduced in #4672 which switched from using path.pesolver.ResolvePath to path.pesolver.ResolveToLastNode which doesn't appear to respect Resolver.ResolveOnce. As the gateway uses coreapi it got affected by this

@victorb
Copy link
Member Author

victorb commented Aug 2, 2018

@magik6k something is still weird here...

https://ipfs.io/ipfs/QmXeh5S5Dk528ueFX3iFRB5TuKUNrWM9dEiLfC4crVwuHD is a sharded directory.

https://ipfs.io/ipfs/QmXeh5S5Dk528ueFX3iFRB5TuKUNrWM9dEiLfC4crVwuHD/PAL_Express.html gives me no link by that name

If I look on the IPLD explorer and take that path: https://explore.ipld.io/#/explore/QmXeh5S5Dk528ueFX3iFRB5TuKUNrWM9dEiLfC4crVwuHD it would be 27PAL_Express.html

https://ipfs.io/ipfs/QmXeh5S5Dk528ueFX3iFRB5TuKUNrWM9dEiLfC4crVwuHD/27PAL_Express.html gives me inconsistent ResolveOnce / nd.Resolve

@victorb victorb reopened this Aug 2, 2018
@victorb
Copy link
Member Author

victorb commented Aug 2, 2018

Also:

$ ipfs resolve /ipfs/QmXeh5S5Dk528ueFX3iFRB5TuKUNrWM9dEiLfC4crVwuHD/PAL_Express.html
Error: no link named "PAL_Express.html" under QmXeh5S5Dk528ueFX3iFRB5TuKUNrWM9dEiLfC4crVwuHD

@magik6k
Copy link
Member

magik6k commented Aug 2, 2018

Looking at it

@magik6k
Copy link
Member

magik6k commented Aug 2, 2018

So that's probably a separate issue as the right resolver is used, and on the right nodes. The error seems to come from https://github.com/ipfs/go-unixfs/blob/master/hamt/hamt.go#L388. Digging deeper

@magik6k
Copy link
Member

magik6k commented Aug 2, 2018

I tried this on v0.4.[10,16,17] and master, none of them worked so it's either broken hamt or an older regression. How did you get that hash?

@magik6k magik6k closed this as completed Aug 2, 2018
@whyrusleeping
Copy link
Member

It would be interesting to figure out what exactly is malformed here, and how @victorbjelkholm managed to get an incorrectly formed sharded directory.

Also better error messages would be 🔥

@victorb
Copy link
Member Author

victorb commented Sep 17, 2018

I'm not sure where those hashes come from, don't remember. But here is another example from Cloudflares Stack Exchange archive:

https://ipfs.io/ipfs/QmVsEiBRsdiHMvmDVJTNtrXNqSKYdtoepcoZxUrQ8rU7qR/ham/A/index.html

There is supposed to be a directory called /ham under QmVsEiBRsdiHMvmDVJTNtrXNqSKYdtoepcoZxUrQ8rU7qR but the following happens instead:

$ ipfs resolve /ipfs/QmVsEiBRsdiHMvmDVJTNtrXNqSKYdtoepcoZxUrQ8rU7qR/ham
Error: no link named "ham" under QmVsEiBRsdiHMvmDVJTNtrXNqSKYdtoepcoZxUrQ8rU7qR

@victorb victorb reopened this Sep 17, 2018
@magik6k
Copy link
Member

magik6k commented Sep 17, 2018

I'll look into this later today

@victorb
Copy link
Member Author

victorb commented Sep 17, 2018

Thanks @magik6k

IPLD explorer to the rescue! Loaded it up (https://explore.ipld.io/#/explore/QmVsEiBRsdiHMvmDVJTNtrXNqSKYdtoepcoZxUrQ8rU7qR) and found the "true" directory name 05ham which actually resolves this time:

$ ipfs resolve /ipfs/QmVsEiBRsdiHMvmDVJTNtrXNqSKYdtoepcoZxUrQ8rU7qR/05ham
/ipfs/zdj7WZpLoZYr4AoDUdpCNBVHLi1S8y6muFoCgwUa9kmxUpYCr

So it's not fully "not-working" :)

@ghost ghost added the status/in-progress In progress label Sep 17, 2018
@ghost ghost removed the status/in-progress In progress label Sep 19, 2018
@victorb
Copy link
Member Author

victorb commented Sep 20, 2018

Thanks @Stebalien and @magik6k, I can confirm that the resolve now works for sharded directories!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug A bug in existing code (including security flaws) regression topic/core-api Topic core-api
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants