namespace loaded by wm/logon

29 views
Skip to first unread message

Go Phone

unread,
Jul 7, 2021, 4:15:58 PM7/7/21
to inferno-os

Hello,

I can see the /usr/$user/namespace being loaded by wm/logon.

But, in the tk shell windows (or, acme win), ns does not show the entries from /usr/$user/namespace.

What is the proper way of setting up a default namespace?

Thanks

Valery Ushakov

unread,
Jul 9, 2021, 10:46:16 AM7/9/21
to inferno-os
FWIW, it works for me.

#!/bin/sh
args="$args -g 1280x720"
args="$args -f /fonts/terminus/terminus.16.font"
exec emu $args '{ wm/wm wm/logon -u "{cat /dev/user} }'

and in my namespace something like:

bind -ib -c '#U*/home/uwe/inferno/fonts' /fonts
bind -ia #C /
bind -ib -c '#U*/home/uwe/inferno/locale' /locale
bind /locale/Moscow.ok /locale/timezone
bind -ib /usr/uwe/dis /dis

Go Phone

unread,
Jul 14, 2021, 9:49:16 PM7/14/21
to inferno-os
Hello Valery,

Thanks, I did not know about this  emu $args usage.

FWIW, it works for me.

#!/bin/sh
args="$args -g 1280x720"
args="$args -f /fonts/terminus/terminus.16.font"
exec emu $args '{ wm/wm wm/logon -u "{cat /dev/user} }'

and in my namespace something like:

bind -ib -c '#U*/home/uwe/inferno/fonts' /fonts
bind -ia #C /
bind -ib -c '#U*/home/uwe/inferno/locale' /locale
bind /locale/Moscow.ok /locale/timezone
bind -ib /usr/uwe/dis /dis

 The issue I mentioned is a little different:

Assume the user logging in is joe. I have some bind commands in /usr/joe/namespace.

emu /dis/wm/wm.dis wm/logon -u joe
open a tk shell window:
ns # does not show the binds specified in /usr/joe/namespace

Looking through the code, wm/logon.b is loading the nsfile (in this case, /usr/joe/namespace) as shown by the below code snippet.

    if(nsfile != nil){
        (ok, nil) = sys->stat(nsfile);
        if(ok < 0){
            nsfile = nil;
            (ok, nil) = sys->stat("namespace");
        }
    }else
        (ok, nil) = sys->stat("namespace");
    if(ok >= 0) {
        ns := load Newns Newns->PATH;
        if(ns == nil)
            notice("failed to load namespace builder");
        else if ((nserr := ns->newns(nil, nsfile)) != nil)
            notice("namespace error:\n"+nserr);
    }

I am not able to figure out why the tk shell windows or acme win ns does not show the above loaded /usr/joe/namespace contents.

Hope the above makes sense.

Thanks

bhgv

unread,
Jul 15, 2021, 4:17:59 AM7/15/21
to inferno-os
all namespace changes exist only for the program where you made them and for its children. until they change the namespace again or revert those changes.

if you want them to be visible globally, then you have to do them in the startline of emu or in the primary sh (and already start wm/wm from it)

четверг, 15 июля 2021 г. в 04:49:16 UTC+3, Go Phone:

Ethan Gardener

unread,
Jul 15, 2021, 7:54:38 AM7/15/21
to inferno-os
I had the same problem years ago. I think it comes from the method beginners find to start emu. First, you don't even get a homedir, then you find the following combination sets up your homedir and reads your startup scripts:

emu wm/wm wm/logon [-u inferno]

Then comes confusion because logon is started by wm and thus can't set the namespace for wm's children. Toolbar is a child of wm.

On Thu, Jul 15, 2021, at 9:17 AM, bhgv wrote:
all namespace changes exist only for the program where you made them and for its children. until they change the namespace again or revert those changes.

if you want them to be visible globally, then you have to do them in the startline of emu or in the primary sh (and already start wm/wm from it)

That would fix it. It's just really weird for beginners, especially if they come from Plan 9.

bhgv

unread,
Jul 15, 2021, 9:13:31 AM7/15/21
to inferno-os
> That would fix it. It's just really weird for beginners
but the simple ability to have different namespaces for different programs and their children is very convenient. in other OSes a similar effect is achieved by different ways. but they are not very simple and powerful

hmm. you can for example in this place:


```
eve = strdup("inferno");
```
change to:
```
eve = getenv("INFERNO_USER");
if(eve == nil)
    eve = strdup("inferno");
```
after just set your env INFERNO_USER to your inferno user name and after run compiled from this sources emu.
```
export INFERNO_USER="JohnIvanov"
emu <pars of emu>
```
or
```
INFERNO_USER=SaddamClinton emu <emu pars>
```

четверг, 15 июля 2021 г. в 14:54:38 UTC+3, eek...@fastmail.fm:
Reply all
Reply to author
Forward
0 new messages