Re: [Pharo-users] Pharo6 server deployment and no home directory

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Pharo-users] Pharo6 server deployment and no home directory

Holger Freyther

> On 8. Jun 2017, at 23:16, Holger Freyther <[hidden email]> wrote:
>
> Hey Juraj!


Hey!

this will most likely block more people trying to deploy a headless Pharo6 image but I am not so sure how to properly fix it.


> $ unset HOME
> $ pharo ...
> Error: Can't find the requested origin
...

> UnixResolver(PlatformResolver)>>directoryFromEnvVariableNamed:

$HOME is not set so cantFindOriginError will be executed.

> UnixResolver>>home
> [ self home / '.config' ] in UnixResolver>>preferences in Block: [ self home / '.config' ]

XDG_CONFIG_DIR can not be found and then "self home" will be executed...

> FileLocator(AbstractFileReference)>>exists

(FileLocator preferences / '.config' / ...) resolve exists


a.) Behave like unix and resolve $HOME to ''

$ unset HOME
$ echo $HOME/.config
/.config

self home / '.config' => '/.config'

b.) FileLocator>>#exists

If something can not be resolved, one can argue that it doesn't exist? So I wonder if the exception should be catched and false be returned?

c.) ???

I don't see an obvious/good approach. Do you?

holger
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Pharo-users] Pharo6 server deployment and no home directory

Holger Freyther

> On 9. Jun 2017, at 11:09, Holger Freyther <[hidden email]> wrote:
>
>


> a.) Behave like unix and resolve $HOME to ''
>
> $ unset HOME
> $ echo $HOME/.config
> /.config
>
> self home / '.config' => '/.config'


Implementing UnixResolver>>#home as

home
        ^ self directoryFromEnvVariableNamed: 'HOME' or: [self resolveString: '']

will lead to something creating /.config/pharo (if possible). By itself this change is not good enough but when adding --no-default-preferences.


Comments? Opinions?

holger



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Pharo-users] Pharo6 server deployment and no home directory

Holger Freyther

> On 9. Jun 2017, at 13:26, Sven Van Caekenberghe <[hidden email]> wrote:

Hey,


> Why would $HOME not be set ?

In this specific case runit doesn't export HOME when starting my service but looking at systemd and picking a random service like exim4.service I see:

$ strings /proc/946/environ
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
LANG=C
_SYSTEMCTL_SKIP_REDIRECT=true
PWD=/

I think it is safe to assume this applies to other services started by systemd as well.

> And if it is not set / seems like a reasonable default.

In Shell it would be "" but with >>resolveString: '' it seems to be / but that seems to be fair enough. E.g. as {home} / '.config' is used anyway.

holger
Loading...