Minor bugfix

Posted by SuriRaven 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
Minor bugfix
May 25, 2014 09:19AM
I noticed that the piratebox software is rather sensitive to file ownership and permissions. It all worked at first, but as soon as I started making even the slighest alterations things started getting awkward. There's no checking, so it ends up doing things like all uploads turning into zero-byte files, or Droopy writing files that lighttpd can't than read unless both are running as the same user.

The latter problem is easily fixed, at least. Find this line:
self.log_message("Received: %s", os.path.basename(localpath))
And add this after it:
os.chmod(localpath, 0666);

The default permission is 0600, thus the access issue. Now it's much less prone to permission-related problems. Even if lighttpd and droopy are running as different users it'll still work fine.
Re: Minor bugfix
May 25, 2014 10:19PM
Mh, that may throw an exception on FAT filesystems which are used on OpenWRT PirateBox, due to the fact that you can't change the permission on that filesystem.

On PirateBox 1.0 the droopy is running with the same use like lighttpd per default.

what do you think?

Matthias
Re: Minor bugfix
May 25, 2014 11:40PM
I didn't think of that. But exceptions can be caught, if it throws one at all. Someone test?

The problem is that there's no checking for the shared ownership. Same user is default, yes - but a lot of pirateboxes are a little modified, and the software isn't very robust. A package update, copying some files into the share... it's easily broken in some manner.