matteoserva / MegaFuse

MEGA client for linux, based on FUSE
Other
249 stars 79 forks source link

Exception running megafuse #57

Open junalmeida opened 8 years ago

junalmeida commented 8 years ago
terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct null not valid

My upstartjob:

description "MegaFuse"
author      "Marcos Junior"

start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]

respawn

pre-start script
        test -x /usr/bin/MegaFuse || exit 0
end script

exec /usr/bin/MegaFuse -c /etc/megafuse.conf -f -o allow_other -o uid=1000 >/var/log/mega.log 2>/var/log/mega.err.log
Human commented 7 years ago

FWIW, I'm having a similar issue, also with -f -o allow_other -o uid=1000. When I become root via sudo or su, I don't get the above error (sometimes I get a Segmentation fault, though). However, sometimes it works. It always gets the above error when run as a daemon (monit runs a script that invokes MegaFuse if needed).

@junalmeida Did you ever find a fix for this?

Human commented 7 years ago

Steps to reproduce:

sudo su
env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/sh
MegaFuse -c /path/to/megafuse.conf -f -o allow_other

The env line re-creates the shell environment typically available to daemons.

Human commented 7 years ago

After comparing two shell environments - one where the above error happens 100% of the time and one where it happens 0% of the time - I found a workaround. If you add HOME to your shell's environment, this error goes away.

Put this line before any MegaFuse invocation:

export HOME=/root

Without looking at the source code, I'd guess that something involved in processing the fuse parameters requires knowing what $HOME is, assumes it's non-null, then tries to assign it to a String.