[gopher] Gophernicus & systemd (Was: Motsognir question)

Kim Holviala kim at holviala.com
Tue Dec 29 12:14:07 UTC 2015


I just came back from Porto (Portugal) last night and it was nice and sunny +18C there :D

Currently coding systemd support for Gophernicus, and god damn that sucker refuses to understand my unit files, and apparently there are no working inetd-like unit file examples on the intertubes. Did I mention I hate systemd? So far it was just a bad feeling but now I have first-hand experience...



- kim




> On 29 Dec 2015, at 11:30, Martin Kukac <logout128 at gmail.com> wrote:
> 
> 
> Weather status: +4C here, which is a lot colder than just a week ago, when we had +14C, but it's probably more than we will have next week, as forecast says that new year will start with -4C and less :-)
> 
> I'm glad that Gophernicus will be systemd-compliant, because lack of systemd support would probably not kill systemd but Gophernicus. It's a weird world we live in...
> 
> Martin
> 
> On 12/29/2015 08:43 AM, Kim Holviala wrote:
>> Howdy,
>> 
>> Offtopic: -10C here and car was completely frozen this morning :D
>> 
>> I just checked the Gopherniucs code, and it first parses and fixes the selector and then does a chdir() to that selector directory before continuing. So chdir() is always done, even for requests that don't need it - the original reason was security; if chdir() fails then we don't have proper access rights and we can die() with proper error message.
>> 
>> And I think I'll reverse my stand on systemd - even if I personally loathe it, without support for systemd Gophernicus is as good as dead because no one can use it.
>> 
>> 
>> 
>> - Kim
>> 
>> 
>> 
>>> On 29 Dec 2015, at 09:30, Mateusz Viste <mateusz at viste.fr> wrote:
>>> 
>>> Done:
>>> 
>>> http://sourceforge.net/p/motsognir/code/HEAD/tree/trunk/
>>> 
>>> ("Download snapshot")
>>> 
>>> This latest version should solve both your troubles:
>>> - it makes gophermaps resolve relative paths to dynamic subgophermap (ie. you can use now =./script.php entries in your gophermaps)
>>> - when executing a CGI/PHP script, it makes sure to set the 'working directory' to either where the parent gophermap is (if called from within a gophermap), or where the script itself is.
>>> 
>>> I hope you will find these changes useful.
>>> 
>>> cheers,
>>> Mateusz
>>> 
>>> 
>>> 
>>> On 29/12/2015 06:26, Mateusz Viste wrote:
>>>> Oh, sorry, I missed the fact that your problem was two-fold :)
>>>> Indeed, my latest patch is simply setting the current working directory
>>>> for executed scripts, but the gophermap still needs to find them by
>>>> their absolute path.
>>>> 
>>>> I will add this today, so gophermaps will be able to locate scripts
>>>> using their relative path.
>>>> 
>>>> BTW, in the special case that a script is called by a gophermap (as
>>>> opposed to being called by the user agent directly), I believe it would
>>>> make more sense to set the current working directory to where the
>>>> gophermap is, not where the script is. What do you think?
>>>> 
>>>> say, I have a gophermap in /mystuff, that calls the inline script
>>>> /cgi-bin/output.cgi - in this case, I'd rather expect the current
>>>> working directory of the script to be set to /mystuff, instead of
>>>> /cgi-bin/. Do you agree on this?
>>>> 
>>>> Mateusz
>>>> 
>>>> 
>>>> 
>>>> 
>>>> On 28/12/2015 22:58, Martin Kukac wrote:
>>>>> Hello Mateusz,
>>>>> 
>>>>> thanks a lot, that solved one part of my original question. Indeed PHP
>>>>> scripts now have working directory set to the same directory they are
>>>>> saved in. How about the gophermap itself? When I use = to insert result
>>>>> of executed script, I have to specify the complete path.
>>>>> 
>>>>> It's not a big deal, it just would be more friendly if Motsognir was by
>>>>> default searching in the same directory, where the gophermap is (when I
>>>>> use =./somescript.php).
>>>>> 
>>>>> Thanks.
>>>>> 
>>>>> Martin
>>>>> 
>>>>> On 12/28/2015 08:07 PM, Mateusz Viste wrote:
>>>>>> Hello Martin,
>>>>>> 
>>>>>> It's done. Now Motsognir will run CGI and PHP scripts from within the
>>>>>> directory where the given script resides. You will find the most recent
>>>>>> release on Motsognir's SVN, but you can just as well simply fetch the
>>>>>> tarball from sourceforge's interface:
>>>>>> http://sourceforge.net/p/motsognir/code/HEAD/tree/trunk/
>>>>>> 
>>>>>> ("Download snapshot")
>>>>>> 
>>>>>> I didn't release a new "official" version for that yet, since maybe some
>>>>>> other minor things will go in it.
>>>>>> 
>>>>>> Let me know if you have any troubles deploying this latest version.
>>>>>> 
>>>>>> Mateusz
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> On 28/12/2015 16:33, Martin Kukac wrote:
>>>>>>> Thanks a lot! This will actually be the very first time I will update
>>>>>>> already installed gopher server :-)
>>>>>>> 
>>>>>>> At the moment I can't tell any more suggestions, but that may change as
>>>>>>> I will progress in modyfying gophermaps.
>>>>>>> 
>>>>>>> Martin
>>>>>>> 
>>>>>>> On 12/28/2015 04:06 PM, Mateusz Viste wrote:
>>>>>>>> Hi Martin,
>>>>>>>> 
>>>>>>>> Nice to hear you use Motsognir!
>>>>>>>> 
>>>>>>>> The current path (pwd) is changed to / when Motsognir daemonize
>>>>>>>> itself,
>>>>>>>> and it is never changed. It is not a bug - it's a (lack of) feature ;)
>>>>>>>> 
>>>>>>>> Switching the "current directory" to the script's location just before
>>>>>>>> executing it sounds like a harmless thing to do, and it would
>>>>>>>> definitely
>>>>>>>> make your life easier. I will write a patch for that today, and let
>>>>>>>> you
>>>>>>>> know when it's ready.
>>>>>>>> 
>>>>>>>> By any means, let me know should you see any other other perfectible
>>>>>>>> points in Motsognir, or need help with some particular items, I'll be
>>>>>>>> happy to help.
>>>>>>>> 
>>>>>>>> cheers,
>>>>>>>> Mateusz
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Gopher-Project mailing list
>>> Gopher-Project at lists.alioth.debian.org
>>> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/gopher-project
>>> 
> 
> 
> 
> _______________________________________________
> Gopher-Project mailing list
> Gopher-Project at lists.alioth.debian.org
> http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/gopher-project
> 




More information about the Gopher-Project mailing list