Comments (10)
great bug, will accept PR!
from croc.
https://github.com/schollz/croc/blob/v10.0.6/src/croc/croc.go#L1806
c.recipientGetFileReady(finished)
This in turn calls
recipientInitializeFile
which, if i chmod -w
the file first, calls os.Create
on line 1606, sets truncate = true
on line 1616, and truncates the file on line 1619.
Perhaps you could do
fmt.Fprintf(os.Stderr, "skipping '%s'", path.Join(fileInfo.FolderRemote, fileInfo.Name))
c.FilesToTransfer[i] = nil
continue
and then somehow filter the array?
I don't have time to grok the codebase and figure out how to fix it, and this actually destroyed data.
Meanwhile, you should update croc to cancel the entire transfer in this case so that others do not lose data.
from croc.
hm. I think the error might have to do with your receiving file being zeros?
I can't replicate the error with random data on both sides:
Sender:
> dd if=/dev/urandom of=potato bs=1M count=20
20+0 records in
20+0 records out
20971520 bytes (21 MB, 20 MiB) copied, 0.0649862 s, 323 MB/s
> sha256sum potato
9709dbad9dedac47da6c21825a01a75a3fdbead915d6af8ac930135b1e0cf66b potato
> croc --version
croc version v10.0.6
> croc send potato
...
> sha256sum potato
9709dbad9dedac47da6c21825a01a75a3fdbead915d6af8ac930135b1e0cf66b potato
Receiver:
> dd if=/dev/urandom of=potato bs=1M count=20
20+0 records in
20+0 records out
20971520 bytes (21 MB, 20 MiB) copied, 0.0687534 s, 305 MB/s
> sha256sum potato
e498d7172011d7611dc5dcff9e5c55e559bb21a0b925a969ef2619766e0776a2 potato
> croc CODE
Accept 'potato' (20.0 MB)? (Y/n) y
Receiving (<-127.0.0.1:52242)
Overwrite 'potato'? (y/N) n
No files transferred.
> sha256sum potato
e498d7172011d7611dc5dcff9e5c55e559bb21a0b925a969ef2619766e0776a2 potato
In both cases, when the croc exits the Sender and Receiver both have files that have the exact same SHA-256 sum as before they ran the croc program...
this actually destroyed data.
I'm surprised, I can't replicate it using non-zero data. Can you share any more information?
from croc.
The file being sent must be smaller than the file present on the receiver.
from croc.
I did just verify this with random data on both sides.
from croc.
The original incident involved a 3.2GB file called photos.zip on the receiving system and a 650MB photos.zip being sent. This was with croc 9.x, but I thought I should try to replicate it with the current version.
I tried to fix the bug, but my naive attempts either caused the transfer to abort or croc to hang. There seems to be some events and/or sender/receiver communication I don't understand.
from croc.
thanks for clarifying. the fix was a silly mistake or degradation perhaps - that after finishing it needs to return, so one line change seems to fix it: https://github.com/schollz/croc/pull/724/files#diff-79c5691e97f5cb9a1a66c4386dc13c054b83f90debc2a704c72cc91ab0a0945bR1641
from croc.
would you mind building from source and trying it out?
from croc.
Works for me now, thanks!
The "skipping" message to stderr could use a \n
, though.
from croc.
Thanks, fixing in 10.0.7
from croc.
Related Issues (20)
- Version 9.6.16 reports 9.6.15 as version HOT 2
- Claims an Exported Variable is Required to Receive Data HOT 3
- V10 can't secure channel error HOT 15
- fix: improve ux around linux environmental variables
- Extend "--transfers" flag to relay in addition to send HOT 1
- Folders and Chinese name files cannot be transferred
- winget integration now requires Microsoft CLA HOT 5
- curl command no longer works HOT 4
- create flag with warning to enable classic mode for passing shared secret
- show hash progress on large files
- files with filenames containing [] or () can no longer be sent HOT 1
- --yes option does not work as expected HOT 1
- --throttleupload option has no effect HOT 7
- croc --help hangs with broken dns
- Is there support for calling as a Go package or any plans to support it? HOT 1
- Sender still waiting if receiver wrote the correct channel but the incorrect code HOT 3
- Invalid filename detected HOT 7
- Cannot send and receive from Android Termux HOT 10
- Room not ready on any send HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from croc.