encfs
encfs copied to clipboard
enhance exit code
Hi,
I'm trying to code a small bash script which should detect different scenarios. However, I found that encfs returns two exit codes: 0 or 1 only:
EncFS Password:
fuse: mountpoint is not empty
fuse: if you are sure this is safe, use the 'nonempty' mount option
fuse failed. Common problems:
- fuse kernel module not installed (modprobe fuse)
- invalid options -- see usage message
code: 1
I suggest to create a list of various codes for each case: an invalid password, module is not installed, mountpoint is not empty and so on. In particular, I need a different exit code when the directory was successfully mounted (decrypted) already.
Thank you.
That sounds like a very useful suggestion! I myself integrate encfs through bash scripts.
ping?
Can I contribute ?
Sure @Furinkazan33, I think you can sending a PR.
@benrubson I don't have the permission yet.
Fork the repository, and push modifications to a new branch into your own repository. GitHub will then propose you to submit your modifications into a PR here, the upstream repository 👍
ping?
Sorry, looks like nobody is working on this.
I'm not sure this would be easy to achieve.
EncFS calls fuse_main()
.
And fuse_main()
returns 0 on success, nonzero on failure :
https://libfuse.github.io/doxygen/fuse_8h.html
Unfortunately nonzero is not detailed.
We would then have to implement system stuffs to find out what could have made fuse_main()
to fail.
I think this would be more reliable and easy to implement at a (Bash) script level, verifying all prerequisites are here before mounting.
hm.. that sounds like an fuse issue. Perhaps, we should ask them to implement it as well.
Reading the config file and checking the password happens before jumping to fuse, so these could easily get their own exit codes i believe.
For wrong password yes for sure. But what about the following ?
I need a different exit code when the directory was successfully mounted (decrypted) already.
Hmm, this is actually quite easy using shell script:
if mountpoint /path/to/dir ; then exit 2 fi
Using shell script yes of course ! But inside EncFS itself, we would be "platform-dependant" (remember the unmount stuff).
it may be "easy" but it is a wrong approach. A user should not check for border conditions of a software. That must be done by the software itself. Specifically, sys-fs/encfs-1.9.4
version crashes (!!!) with the following encfs[17049]: segfault at 2d0 ip 00007f1e533c5d8d sp 00007ffe06bcc650 error 4 in libpthread-2.26.so[7f1e533bd000+1c000]
on the attempt to mount a mounted directory.
This is not acceptable. All relevant checks similar with the PoC bash script above must be done by encfs and fuse