Skip to content

Commit eeff9f0

Browse files
rminnichorangecms
authored andcommitted
cpud: clear CPU_FSTAB and LC_GLENDA_CPU_FSTAB before starting command
If you cpu to a machine, and the only command you run is cpu, the CPU_FSTAB and LC_GLENDA_CPU_FSTAB variables must be cleared, else the cpu will inherit them and assume it should use them. Before starting the command, os.Unsetenv CPU_FSTAB and LC_GLENDA_CPU_FSTAB. It's changed in both the old code and the new code cpuns uses. I still have to try to figure out a test. But, now, on osx, I can cpu into a docker container for a risc-v board, and from that container cpu into the board. This is very, very nice. It gets around the problem that docker containers on osx can not do volume mapping: cpu alone, on osx, has value in and of itself. Signed-off-by: Ronald G. Minnich <[email protected]>
1 parent 047d054 commit eeff9f0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

session/session.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,12 @@ func (s *Session) Run() error {
204204
// worry about unmounting them once the command is done: the
205205
// unmount happens for free since we unshared.
206206
verbose("runRemote: command is %q", s.args)
207+
208+
// Do not propagate CPU_FSTAB, it causes trouble
209+
// if you cpu to a machine and just run cpu.
210+
os.Unsetenv("CPU_FSTAB")
211+
os.Unsetenv("LC_GLENDA_CPU_FSTAB")
212+
207213
c := exec.Command(s.cmd, s.args...)
208214
c.Stdin, c.Stdout, c.Stderr, c.Dir = s.Stdin, s.Stdout, s.Stderr, os.Getenv("PWD")
209215
dirInfo, err := os.Stat(c.Dir)
@@ -288,6 +294,11 @@ func (s *Session) NameSpace() error {
288294
}
289295
}
290296

297+
// Do not propagate CPU_FSTAB, it causes trouble
298+
// if you cpu to a machine and just run cpu.
299+
os.Unsetenv("CPU_FSTAB")
300+
os.Unsetenv("LC_GLENDA_CPU_FSTAB")
301+
291302
return nil
292303
}
293304

0 commit comments

Comments
 (0)