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

macOS: croc always creates a folder "~" when receiving files #880

Open
jonasjelonek opened this issue Jan 24, 2025 · 10 comments
Open

macOS: croc always creates a folder "~" when receiving files #880

jonasjelonek opened this issue Jan 24, 2025 · 10 comments

Comments

@jonasjelonek
Copy link

jonasjelonek commented Jan 24, 2025

As the title says, croc behaves somewhat strange on macOS. I usually transfer files/folders between Linux and Windows machine, and my Mac using croc. When I send something from my Mac to Windows/Linux everything works as expected. However, when sending files from Windows/Linux to my Mac, croc always creates a folder called "~" in the same folder where the received files/folders are stored and the "~" folder doesn't have any content.

I'm using latest macOS 15.1.1 and croc 10.2.1 on macOS.

What I've observed so far:

  • only occurs when sending files from another system to macOS
  • doesn't depend on what is sent (single/multiple files or folders, file type/extension, size, etc.)
  • debug output of croc has no hint on creation of that "~" folder
[debug] 11:59:43 cli.go:215: debug mode on
[debug] 11:59:43 cli.go:219: public IP address: 46.142.11.245
Enter receive code: 1777-import-volcano-claudia
connecting...[debug]    11:59:50 croc.go:884: attempt to discover peers
[debug] 11:59:51 croc.go:950: discoveries: []
[debug] 11:59:51 croc.go:951: establishing connection
[debug] 11:59:51 croc.go:967: got host '2a01:4f8:1c1c:7804::1' and port '9009'
[debug] 11:59:51 croc.go:969: trying connection to [2a01:4f8:1c1c:7804::1]:9009
[debug] 11:59:51 comm.go:78: dialing to [2a01:4f8:1c1c:7804::1]:9009 with timelimit 200ms
[debug] 11:59:51 comm.go:87: connected to '[2a01:4f8:1c1c:7804::1]:9009'
[debug] 11:59:51 tcp.go:523: strong key: 685893b3260e6c69767d363c7e8cd260569abe81d045ab8a79808d8c86efe5ff
[debug] 11:59:51 tcp.go:537: sending password
[debug] 11:59:51 tcp.go:548: waiting for first ok
[debug] 11:59:51 tcp.go:566: sending room; 448a7ec0de8631886809d5f502d85e287691fb1bbf1284f75bd811fe3c349652
[debug] 11:59:51 tcp.go:577: waiting for room confirmation
[debug] 11:59:51 tcp.go:593: all set
[debug] 11:59:51 croc.go:982: receiver connection established: &{connection:0x140000b6080}
[debug] 11:59:51 croc.go:983: banner: 9010,9011,9012,9013,9014,9015,9016,9017
[debug] 11:59:51 croc.go:1027: dataMessage kA: 6fe521a6b24fbb40a520a18ccc14222dd3373e18a8ce10a8c709fb85f39c33b4
[debug] 11:59:51 croc.go:1034: sending ips?
[debug] 11:59:51 croc.go:1046: ips data: ["9009","169.254.156.222","10.9.4.15","169.254.7.206","192.168.42.127"]
[debug] 11:59:51 croc.go:1058: ipv4Add4: 169.254.156.222, ipv4Net: 169.254.156.0/24, err: <nil>
[debug] 11:59:51 croc.go:1063: localIP: 192.168.1.100, localIPparsed: 192.168.1.100
[debug] 11:59:51 croc.go:1063: localIP: 192.168.42.42, localIPparsed: 192.168.42.42
[debug] 11:59:51 croc.go:1071: 169.254.156.222 is not a local IP, skipping
[debug] 11:59:51 croc.go:1058: ipv4Add4: 10.9.4.15, ipv4Net: 10.9.4.0/24, err: <nil>
[debug] 11:59:51 croc.go:1063: localIP: 192.168.1.100, localIPparsed: 192.168.1.100
[debug] 11:59:51 croc.go:1063: localIP: 192.168.42.42, localIPparsed: 192.168.42.42
[debug] 11:59:51 croc.go:1071: 10.9.4.15 is not a local IP, skipping
[debug] 11:59:51 croc.go:1058: ipv4Add4: 169.254.7.206, ipv4Net: 169.254.7.0/24, err: <nil>
[debug] 11:59:51 croc.go:1063: localIP: 192.168.1.100, localIPparsed: 192.168.1.100
[debug] 11:59:51 croc.go:1063: localIP: 192.168.42.42, localIPparsed: 192.168.42.42
[debug] 11:59:51 croc.go:1071: 169.254.7.206 is not a local IP, skipping
[debug] 11:59:51 croc.go:1058: ipv4Add4: 192.168.42.127, ipv4Net: 192.168.42.0/24, err: <nil>
[debug] 11:59:51 croc.go:1063: localIP: 192.168.1.100, localIPparsed: 192.168.1.100
[debug] 11:59:51 croc.go:1063: localIP: 192.168.42.42, localIPparsed: 192.168.42.42
[debug] 11:59:51 croc.go:1066: ip: 192.168.42.127 is a local IP
[debug] 11:59:51 comm.go:78: dialing to 192.168.42.127:9009 with timelimit 500ms
[debug] 11:59:51 comm.go:87: connected to '192.168.42.127:9009'
[debug] 11:59:51 tcp.go:523: strong key: 21da886dfde8682f48f8b0128feb4aa7ee3549eba984d05a7c86260f481333a6
[debug] 11:59:51 tcp.go:537: sending password
[debug] 11:59:51 tcp.go:548: waiting for first ok
[debug] 11:59:51 tcp.go:566: sending room; 448a7ec0de8631886809d5f502d85e287691fb1bbf1284f75bd811fe3c349652
[debug] 11:59:51 tcp.go:577: waiting for room confirmation
[debug] 11:59:51 tcp.go:593: all set
[debug] 11:59:51 croc.go:1082: local connection established to 192.168.42.127:9009
[debug] 11:59:51 croc.go:1083: banner: 9010,9011,9012,9013
[debug] 11:59:51 croc.go:1104: exchanged header message
securing channel...[debug]      11:59:51 croc.go:1122: ready
[debug] 11:59:51 message.go:61: writing pake message (unencrypted)
[debug] 11:59:51 message.go:80: read pake message (unencrypted)
[debug] 11:59:51 croc.go:1387: received pake payload
[debug] 11:59:51 croc.go:1434: generated key = a0aa9aa7da5a7a839c2006db1d4fa4bfe70f76f18a3419979b1bfda47fc88912 with salt da06610663db7f8f
[debug] 11:59:51 croc.go:1440: port: [9010]
[debug] 11:59:51 croc.go:1440: port: [9011]
[debug] 11:59:51 croc.go:1440: port: [9012]
[debug] 11:59:51 croc.go:1440: port: [9013]
[debug] 11:59:51 croc.go:1454: connecting to 192.168.42.127:9013
[debug] 11:59:51 comm.go:78: dialing to 192.168.42.127:9013 with timelimit 30s
[debug] 11:59:51 croc.go:1454: connecting to 192.168.42.127:9011
[debug] 11:59:51 comm.go:78: dialing to 192.168.42.127:9011 with timelimit 30s
[debug] 11:59:51 croc.go:1454: connecting to 192.168.42.127:9010
[debug] 11:59:51 comm.go:78: dialing to 192.168.42.127:9010 with timelimit 30s
[debug] 11:59:51 croc.go:1454: connecting to 192.168.42.127:9012
[debug] 11:59:51 comm.go:78: dialing to 192.168.42.127:9012 with timelimit 30s
[debug] 11:59:51 comm.go:87: connected to '192.168.42.127:9011'
[debug] 11:59:51 comm.go:87: connected to '192.168.42.127:9010'
[debug] 11:59:51 comm.go:87: connected to '192.168.42.127:9013'
[debug] 11:59:51 comm.go:87: connected to '192.168.42.127:9012'
[debug] 11:59:51 tcp.go:523: strong key: 27efc7af509674aa85302cb590a132652db90e8412ea5841672e717baeaef63f
[debug] 11:59:51 tcp.go:537: sending password
[debug] 11:59:51 tcp.go:548: waiting for first ok
[debug] 11:59:51 tcp.go:523: strong key: 97e18d7b8f31d474b05e8d57fc6a1692e5872a6dc2f6cc21426ea02fd6c92bd5
[debug] 11:59:51 tcp.go:566: sending room; 448a7ec0de8631886809d5f502d85e287691fb1bbf1284f75bd811fe3c349652-2
[debug] 11:59:51 tcp.go:577: waiting for room confirmation
[debug] 11:59:51 tcp.go:537: sending password
[debug] 11:59:51 tcp.go:548: waiting for first ok
[debug] 11:59:51 tcp.go:523: strong key: 6c3cdaca0449dfdfec5d37f9fe9aa66223ed10ae0462ef0586aa17a499c9e8ef
[debug] 11:59:51 tcp.go:537: sending password
[debug] 11:59:51 tcp.go:548: waiting for first ok
[debug] 11:59:51 tcp.go:593: all set
[debug] 11:59:51 croc.go:1463: connected to 192.168.42.127:9012
[debug] 11:59:51 tcp.go:566: sending room; 448a7ec0de8631886809d5f502d85e287691fb1bbf1284f75bd811fe3c349652-1
[debug] 11:59:51 tcp.go:577: waiting for room confirmation
[debug] 11:59:51 tcp.go:566: sending room; 448a7ec0de8631886809d5f502d85e287691fb1bbf1284f75bd811fe3c349652-0
[debug] 11:59:51 tcp.go:593: all set
[debug] 11:59:51 tcp.go:577: waiting for room confirmation
[debug] 11:59:51 croc.go:1463: connected to 192.168.42.127:9011
[debug] 11:59:51 tcp.go:593: all set
[debug] 11:59:51 croc.go:1463: connected to 192.168.42.127:9010
[debug] 11:59:51 tcp.go:523: strong key: 67c6cf622d4922f59dc1a9fab19a1987bb7f6c285b2d75e65675acb5bf47da87
[debug] 11:59:51 tcp.go:537: sending password
[debug] 11:59:51 tcp.go:548: waiting for first ok
[debug] 11:59:51 tcp.go:566: sending room; 448a7ec0de8631886809d5f502d85e287691fb1bbf1284f75bd811fe3c349652-3
[debug] 11:59:51 tcp.go:577: waiting for room confirmation
[debug] 11:59:51 tcp.go:593: all set
[debug] 11:59:51 croc.go:1463: connected to 192.168.42.127:9013
[debug] 11:59:51 croc.go:1472: sending external IP
[debug] 11:59:51 message.go:58: writing externalip message (encrypted)
[debug] 11:59:51 message.go:78: read externalip message (encrypted)
[debug] 11:59:51 croc.go:1483: received external IP: {"t":"externalip","m":"127.0.0.1:34011"}
[debug] 11:59:51 croc.go:1497: connected as 192.168.42.42:52595 -> 127.0.0.1:34011
[debug] 11:59:51 message.go:78: read fileinfo message (encrypted)
[debug] 11:59:51 croc.go:1280: using hash algorithm: xxhash
Accept 'DACT.rar' (34.8 MB)? (Y/n)

Receiving (<-127.0.0.1:34011)
[debug] 11:59:52 croc.go:1381: [{DACT.rar . C:\Users\jonas\Desktop [78 8 24 65 212 199 22 193] 36502593 2023-05-21 14:37:26.85 +0200 CEST false false  -rw-rw-rw- false false}]
[debug] 11:59:52 croc.go:1821: checking {Name:DACT.rar FolderRemote:. FolderSource:C:\Users\jonas\Desktop Hash:[78 8 24 65 212 199 22 193] Size:36502593 ModTime:2023-05-21 14:37:26.85 +0200 CEST IsCompressed:false IsEncrypted:false Symlink: Mode:-rw-rw-rw- TempFile:false IsIgnored:false}
[debug] 11:59:52 croc.go:1838: DACT.rar  4e081841d4c716c1 <nil>
[debug] 11:59:52 croc.go:1840: hashed DACT.rar to  using xxhash
[debug] 11:59:52 croc.go:1841: hashes are not equal  != 4e081841d4c716c1
[debug] 11:59:52 croc.go:1630: working on file 0
[debug] 11:59:52 croc.go:1715: converting to chunk range
 DACT.rar   0% |                    | ( 0 B/36 MB) [0s:0s][debug]       11:59:52 croc.go:1723: sending recipient ready with 0 chunks
[debug] 11:59:52 message.go:58: writing recipientready message (encrypted)
 DACT.rar 100% |████████████████████| (36/36 MB, 233 MB/s)
[debug] 11:59:52 croc.go:2035: finished receiving!
[debug] 11:59:52 croc.go:2039: Successful closing DACT.rar
[debug] 11:59:52 croc.go:2049: sending close-sender
[debug] 11:59:52 message.go:58: writing close-sender message (encrypted)
[debug] 11:59:52 message.go:78: read close-recipient message (encrypted)
[debug] 11:59:52 croc.go:1821: checking {Name:DACT.rar FolderRemote:. FolderSource:C:\Users\jonas\Desktop Hash:[78 8 24 65 212 199 22 193] Size:36502593 ModTime:2023-05-21 14:37:26.85 +0200 CEST IsCompressed:false IsEncrypted:false Symlink: Mode:-rw-rw-rw- TempFile:false IsIgnored:false}
[debug] 11:59:52 croc.go:1838: DACT.rar 4e081841d4c716c1 4e081841d4c716c1 <nil>
[debug] 11:59:52 croc.go:1863: hashes are equal 4e081841d4c716c1 == 4e081841d4c716c1
[debug] 11:59:52 croc.go:1690: finished
[debug] 11:59:52 message.go:58: writing finished message (encrypted)
[debug] 11:59:52 message.go:78: read finished message (encrypted)
[debug] 11:59:52 message.go:58: writing finished message (encrypted)

This seems to be a problem since several versions. I couldn't find out so far at which version this issue started to occur. However, there is no change in that behaviour if the peers use the same or different versions.

Any ideas or hints what I should have a look at to find out what's the issue?

@schollz
Copy link
Owner

schollz commented Feb 13, 2025

I can't replicate this. do you have a way to reproduce the error?

@jonasjelonek
Copy link
Author

Not really a specific way, this occurs everytime I transfer any kind of file/folder to my Mac. Any way I could debug this?

What I just tested to narrow this down is working with different shells/terminal emulator. But it seems to be independent of this.
However, what I just found out is that the ~ folder doesn't actually seem to be created during the file transfer but already before when I just call plain croc on the command line and it then asks for the code.

@schollz
Copy link
Owner

schollz commented Feb 13, 2025

let me know if you can reproduce it, I cannot:

On ubuntu:

>croc send tempdir

On Mac

> croc              
Enter receive code: xxx
Accept 'tempfile' and 1 folders (11 B)? (Y/n) y

Receiving (<-192.168.0.51:9009)
 tempfile 100% |████████████████████| (11/11 B, 3.0 kB/s)
➜  a find .
.
./tempdir
./tempdir/tempfile

no ~...

@jonasjelonek
Copy link
Author

jonasjelonek commented Feb 13, 2025

Tried what you suggested, as soon as I call croc a ~ folder is created.
What I haven't looked into detail before is the contents of the ~ folder. I thought it is empty, since no content is shown in Finder and regular ls, but there's actually some stuff created in that ~ folder when shown with ls -la or find . :

./~
./~/.config
./~/.config/croc

the last entry then is an empty directory called croc

@schollz
Copy link
Owner

schollz commented Feb 13, 2025

what is the folder structure of the sent folder

@jonasjelonek
Copy link
Author

what is the folder structure of the sent folder

./tempdir/
./tempdir/tempfile

Just created that quickly with:

mkdir tempdir
echo "This is a temporary file." > tempdir/tempfile

@schollz
Copy link
Owner

schollz commented Feb 13, 2025

yeah did exactly that, can't reproduce. is this happening on linux and windows?

@jonasjelonek
Copy link
Author

jonasjelonek commented Feb 13, 2025

no, happening on macOS only

EDIT: I guess I need to debug that on my own here on my device. At least I can narrow it a bit down, to be independent of the actual file transfer since it is created right after croc is called, and it actually creates the abovementioned folder structure.

@jonasjelonek
Copy link
Author

the issue was caused by a bad XDG_CONFIG_HOME variable set in my shell configuration. While it is usually set to $HOME/.config, something set it to ~/.config. While this seems to work fine with most of my other tools running on my device, croc doesn't seem to handle this case properly.
@schollz Does this need to be addressed in any way or is this more a user error?

@schollz
Copy link
Owner

schollz commented Feb 18, 2025

thanks! good find. I guess croc could validate the home? not sure...if you want to make a PR please feel free!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants