rfjakob / gocryptfs

Encrypted overlay filesystem written in Go

Home Page:https://nuetzlich.net/gocryptfs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gocryptfs hangs when mount point is in PATH

redneb opened this issue · comments

When I try to mount a gocryptfs volume and the $PATH environment variable includes the mount point (or a subdirectory of it), then the gocryptfs process hangs and the mount does not complete and other processes that try to access it also hang. This can be reproduced by running the following:

mkdir /tmp/test{.enc,}
gocryptfs -extpass 'echo test' -init /tmp/test.enc
PATH=/tmp/test:"$PATH" gocryptfs -extpass 'echo test' /tmp/test{.enc,}

gocrypfs will remain in the foreground. Then on a different terminal run:

ls /tmp/test

and ls will also hang.

If you pass the -fg flag to gocryptfs, everything works correctly. So I think this has to do with how the foreground gocryptfs process executes the background gocryptfs process; presumably it tries to find gocryptfs in $PATH which includes a yet not accessible directory. If that's the case, the foreground process should find the full path of the gocryptfs executable (i.e. of itself) and then use that instead of relying on $PATH.

Fascinating. Turns out it was the call to logger that locked everything up. logger is started after the mountpoint is attached but before the FUSE server is started - hence it hangs.