-
Notifications
You must be signed in to change notification settings - Fork 7
"ipfs add" and "ipfs files write" commands returns different hashes #45
Comments
mhh...perhaps you get two hash's because of the unterlaying deduplication of the file with the same content but other filename? could it be that the second hash i only a link? The underlying concept of ipfs makes it difficult to adopt the previous concepts for storing data easily. |
re. 1 The hashes are different because Underling data is still deduplicated as they use the same chunking, AFAIK. re. 2 I will try to improve that re. 3 |
that would be a nice step.... |
This issue was moved to https://discuss.ipfs.io/t/ipfs-add-and-ipfs-files-write-commands-returns-different-hashes/506 |
Hello! And first of all, I apologize for my bad english. Hope that you can understand it.
I'm trying to add into mfs some files (previously added via
ipfs add
) butipfs files write
command produces different hashes thanipfs add
.For example:
Next, let's try to write this file to mfs:
As we can see, hashes is actually different. Seems like one string now known as two different objects. If is actually true, it turns out that deduplication is not performed for this case.
But object, that returned by
ipfs files stat
command have two child blocks. Maybe one of these blocks is the same object, that was produced by previously executedipfs add
command?No, none of these is not
QmUZtQRZG58yB55k5NFPFeYBQ3FMTKydpuNAb66JnxDgup
, which produced by previously executedipfs add
. But one of those definitely should contains the source string:Indeed, it's the same string. But why the hashes are different? Not exactly what I would like to get.
But OK, we can directly add some previously added hashes to mfs. For example:
(BTW, it's slightly unclear, that we can write to mfs any existing hashes using
ipfs files cp
. I figured it out only after reading this: ipfs/kubo#2610 (comment))But what if I now want to overwrite some files, existing into mfs?
Actually, I cannot do that. In case that I definitely want to overwrite some files, I'll have to execute
ipfs files rm
first, and cannot overwrite it directly, asipfs files write
do. But I don't want to useipfs files write
, because for now it's produces different hashes thatipfs add
, and don't allow to perform deduplication.Tl;dr:
ipfs add
andipfs files write
probably should produce the same hashes, but it's doesn't.It should to be a bit more clearly explained in documentation, that
ipfs files cp
allows to copy existing hashes into mfs, not only files already written to mfs.ipfs files cp
probably should have option to overwrite existing files, but it hasn't.The text was updated successfully, but these errors were encountered: