boxo icon indicating copy to clipboard operation
boxo copied to clipboard

examples/unixfs-file-cid: io.Copy is never completed when read a single char-filled contents

Open tmrkw1497 opened this issue 2 years ago • 1 comments

I modified unixfs-file-cid example program so that it could distribute files instead of strings. And, I try to distribute any files with a modified example program. When I try to do it with the same char-filled file (e.g. 0x00, 0x01 filled), the sample receiver program had never completed. In the same program, I can distribute random chars-filled files.

Expected Behavior

I can download and display the same char-filled file.

Current Behabior

io.Copy is never complete. https://github.com/ipfs/boxo/blob/b96767cc0971ca279feb36e7844e527a774309ab/examples/unixfs-file-cid/main.go#L225

steps to reproduce

$ git clone https://github.com/ipfs/boxo.git
$ cd boxo/examples
$ vim unixfs-file-cid/main.go # edit code
$ go run unixfs-file-cid/main.go

other terminal

$ cd boxo/examples
$ go run unixfs-file-cid/main.go -d "peer address"

I modified it. https://github.com/ipfs/boxo/blob/main/examples/unixfs-file-cid/main.go#L145-L149

fileReader,err:= os.Open("file path")
if err!=nil{
return cid.Undef, nil, err
}

cid should be changed. https://github.com/ipfs/boxo/blob/b96767cc0971ca279feb36e7844e527a774309ab/examples/unixfs-file-cid/main.go#L129

I made file this command (the file should be of some size)

$ dd if=/dev/zero of="file path" bs=1G count=1

Environment

  • go version go1.19.12 linux/amd64
  • ubuntu 22.10
  • use boxo which was pulled from master branch (v.0.11.0)

tmrkw1497 avatar Aug 14 '23 09:08 tmrkw1497

Thank you for submitting your first issue to this repository! A maintainer will be here shortly to triage and review. In the meantime, please double-check that you have provided all the necessary information to make this process easy! Any information that can help save additional round trips is useful! We currently aim to give initial feedback within two business days. If this does not happen, feel free to leave a comment. Please keep an eye on how this issue will be labeled, as labels give an overview of priorities, assignments and additional actions requested by the maintainers:

  • "Priority" labels will show how urgent this is for the team.
  • "Status" labels will show if this is ready to be worked on, blocked, or in progress.
  • "Need" labels will indicate if additional input or analysis is required.

Finally, remember to use https://discuss.ipfs.io if you just need general support.

welcome[bot] avatar Aug 14 '23 09:08 welcome[bot]