* [9front] Shared env in child scripts
@ 2021-05-31 2:30 kjn
2021-05-31 12:32 ` sirjofri
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: kjn @ 2021-05-31 2:30 UTC (permalink / raw)
To: 9front
I find the lack of default rfork e in rc scripts irritating.
Inevitably, I end up forgetting to add an 'rfork e' to the top of my
scripts. Is there a good reason why rc doesn't do an rfork(RFENVG);
on startup? I understand that it allows a child script to change env
values for its parent, but is that desirable?
Even if that behavior is wanted, I would expect it to be the exception
not the rule.
Does anyone know more about this design decision?
-- KJN
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9front] Shared env in child scripts
2021-05-31 2:30 [9front] Shared env in child scripts kjn
@ 2021-05-31 12:32 ` sirjofri
2021-05-31 14:58 ` kvik
2021-05-31 18:23 ` binary cat
2 siblings, 0 replies; 5+ messages in thread
From: sirjofri @ 2021-05-31 12:32 UTC (permalink / raw)
To: 9front
Hello,
31.05.2021 04:30:56 kjn@9project.net:
> I find the lack of default rfork e in rc scripts irritating.
> Inevitably, I end up forgetting to add an 'rfork e' to the top of my
> scripts. Is there a good reason why rc doesn't do an rfork(RFENVG);
> on startup? I understand that it allows a child script to change env
> values for its parent, but is that desirable?
>
> Even if that behavior is wanted, I would expect it to be the exception
> not the rule.
>
> Does anyone know more about this design decision?
I don't exactly know the details about the decision, but I think it's
easier to tell rc to please fork than to tell it _not_ to do have done it
before starting the script.
I distinguish between smaller scripts (no env, only a chain of commands,
sometimes $1...) and more complex scripts (basically all start with rfork
en).
Hope that helps.
sirjofri
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9front] Shared env in child scripts
2021-05-31 2:30 [9front] Shared env in child scripts kjn
2021-05-31 12:32 ` sirjofri
@ 2021-05-31 14:58 ` kvik
2021-05-31 18:23 ` binary cat
2 siblings, 0 replies; 5+ messages in thread
From: kvik @ 2021-05-31 14:58 UTC (permalink / raw)
To: 9front
Quoth kjn@9project.net:
> I understand that it allows a child script to change env
> values for its parent, but is that desirable?
That's the idea but it's not how it works in practice due to rc
caching the environments variable as its own variables, writing back the
changes but never reloading after initial load.
If you want two-way communication via environment the procs must make
special arrangements, with env(3) being nothing more than a slightly
convenient (and shitty) ramfs(4).
In any case, making `rfork e` a default now is sure to break a lot of
scripts in horrible ways -- which doesn't seem worth it.
In theory the proposed default makes way more sense.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9front] Shared env in child scripts
2021-05-31 2:30 [9front] Shared env in child scripts kjn
2021-05-31 12:32 ` sirjofri
2021-05-31 14:58 ` kvik
@ 2021-05-31 18:23 ` binary cat
2021-05-31 22:10 ` Stanley Lieber
2 siblings, 1 reply; 5+ messages in thread
From: binary cat @ 2021-05-31 18:23 UTC (permalink / raw)
To: 9front
> I understand that it allows a child script to change env
> values for its parent, but is that desirable?
It doesn't even do that well.
Environment variables are cached in rc, and this cache is never updated.
I think a good change would be that, by default,
rc performs `rfork(RFENVG);` at startup, then continues as it does now.
Then, there would be a flag that skips this rfork, and also disables caching
of environment variables.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [9front] Shared env in child scripts
2021-05-31 18:23 ` binary cat
@ 2021-05-31 22:10 ` Stanley Lieber
0 siblings, 0 replies; 5+ messages in thread
From: Stanley Lieber @ 2021-05-31 22:10 UTC (permalink / raw)
To: 9front
On May 31, 2021 2:23:46 PM EDT, binary cat <dogedoge61@gmail.com> wrote:
>> I understand that it allows a child script to change env
>> values for its parent, but is that desirable?
>
>It doesn't even do that well.
>Environment variables are cached in rc, and this cache is never updated.
>
>I think a good change would be that, by default,
>rc performs `rfork(RFENVG);` at startup, then continues as it does now.
>Then, there would be a flag that skips this rfork, and also disables caching
>of environment variables.
>
why
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-06-01 9:27 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-31 2:30 [9front] Shared env in child scripts kjn
2021-05-31 12:32 ` sirjofri
2021-05-31 14:58 ` kvik
2021-05-31 18:23 ` binary cat
2021-05-31 22:10 ` Stanley Lieber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).