That’s true, but even single variables , if they’re set by rc, will have a
null termination

On Wed, Jun 4, 2025 at 15:04 Romano <[email protected]> wrote:

> IIRC correctly, if you store a list to an environment variable, then the
> elements are NUL separated. I think I saw that a year ago when poking
> around the rc source. For example:
> cpu% a=(ab c d)
> cpu% xd /env/a
> ...
>
> On Wed, Jun 4, 2025, at 9:26 AM, ron minnich wrote:
>
> anyway, I found it, when you do this in rc:
> x=y
> rc writes a trailing null.
>
> Not sure that's needed, but it's what it does. I'm going to strip trailing
> nulls in the cpu command.
>
> On Wed, Jun 4, 2025 at 7:55 AM ron minnich <[email protected]> wrote:
>
> I'll be submitting a PR to fix it, we'll see how that goes, because the
> code, as written, doesn't even give you some idea how many variables had
> the problem.
>
> I don't see that exposing those names is that big a deal, but we'll see.
>
>
> On Tue, Jun 3, 2025 at 5:15 PM Daniel Maslowski via 9fans <[email protected]>
> wrote:
>
> The author of that error message might have chosen to not expose/disclose
> the information.
>
> Anyway, interesting - would be really nice to see both systems integrate
> seamlessly!
> I have a good collection of hardware by now that would really like to see
> this.
>
> On Wed, Jun 4, 2025 at 1:57 AM ron minnich <[email protected]> wrote:
>
> well, here's a fun one.
>
> I've got my golang cpu command working on plan 9. So I'm working to have
> my plan 9 cpu connect to a linux vmx guest running my golang cpud.
>
> The linux kernel has the initramfs builtin, so ... one file for vmx to
> worry about, and 0 disk images.
>
> side note: qemu was choking on this kernel somehow, but vmx ran it just
> fine. I like vmx much more than qemu at this point. I prefer to test these
> linux kernels on vmx now.
>
> The goal is to have a linux appliance process, where it is easy to (e.g.)
> run python3. So the only thing embedded in the linux kernel is u-root
> programs and a cpud. You should be able to cd to the root of a linux file
> system, and say
> linux usr/bin/python3
> where linux is a wrapper for vmx, and have it work. We had this on akaros.
> It's handy.
>
> The only big problem will be the plethora of symlinks in linux images, but
> I have a workaround for that, so we'll see.
>
> Anyway, plan 9 cpu was connecting to linux cpud, mounts were happening,
> and so on, then I got this on the cpud side:
> "exec: environment variable contains NUL"
> and the cpud exec failed.
> WTH? Well, it turns out, it's this in src/os/exec/exec.go.
>
>                 // Reject NUL in environment variables to prevent security
> issues (#56284);
>                 // except on Plan 9, which uses NUL as
> os.PathListSeparator (#56544).
>
> The problem is, this doesn't work if you are communicating plan 9
> environment variables to Linux, and that's what we're doing. You kind of
> have to for cpu. I will guess I'm the first person to see this ... kind of
> funny. Working on it.
>
> I'm a bit annoyed that whoever wrote the test and error did this:
> err = errors.New("exec: environment variable contains NUL"
> instead of this:
> err = fmt.Errorf"%q:exec: environment variable contains NUL", kv)
> since it's always kind of nice to produce useful error messages :-)
> but at least I got something!
>
> btw, my talk, the paper, and the code for vmthreads is mirrored to
> github.com/rminnich/vmproc.
>
>
>
>
> *9fans <https://9fans.topicbox.com/latest>* / 9fans / see discussions
> <https://9fans.topicbox.com/groups/9fans> + participants
> <https://9fans.topicbox.com/groups/9fans/members> + delivery options
> <https://9fans.topicbox.com/groups/9fans/subscription> Permalink
> <https://9fans.topicbox.com/groups/9fans/T9b0ff93502ee4130-M9f93c78b692bce940fbd2461>
>

------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T9b0ff93502ee4130-M0a64be9fd0ed2b7248ae9bca
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to