Hi,

On +2023-02-06 16:54:20 -0500, Maxim Cournoyer wrote:
> Hi,
> 
> Simon Tournier <zimon.touto...@gmail.com> writes:
> 
> > Hi Maxim,
> >
> > A naive question since it works when using the --no-cwd option.
> >
> > On ven., 27 janv. 2023 at 11:19, Maxim Cournoyer 
> > <maxim.courno...@gmail.com> wrote:
> >
> >> --8<---------------cut here---------------start------------->8---
> >> guix environment -C --expose=/tmp=$PWD/tmp --ad-hoc bash coreutils \
> >>  -- bash -c 'stat $PWD/tmp'
> >> --8<---------------cut here---------------end--------------->8---
> >
> > Is $PWD referring to the same thing?  Because one is outside and the
> > other is inside.
> 
> Yes!  See:
> 
> --8<---------------cut here---------------start------------->8---
> maxim@hurd ~$ echo $PWD/tmp && guix environment \
>  -C --expose=/tmp=$PWD/tmp --ad-hoc bash coreutils -- bash -c 'echo $PWD/tmp'
> /home/maxim/tmp
> /home/maxim/tmp
> --8<---------------cut here---------------end--------------->8---
> 
> -- 
> Thanks,
> Maxim
>

I imagine the created environment is COW[1]
[1] <https://en.wikipedia.org/wiki/Copy-on-write>

Then your output above,
--8<---------------cut here---------------start------------->8---
> /home/maxim/tmp
> /home/maxim/tmp
--8<---------------cut here---------------end--------------->8---
looks the same, but IIUC they have different '/' root dirs, the one
in the container being like an initrd separate file system.

Or is --expose meant to be a shared rw reference to the caller's memory
(directory content or regular file etc) from the start?
That would seem hard to keep safe, so I doubt that's the design.

How do the two tmp's stat? (Before and after writing content
like $PWD/tmp/foo ?

And foo doesn't appear in the caller $PWD/tmp/* right?

What is your use case goal for --expose=/tmp=$PWD/tmp ?

SFTN if this is useless distraction.
--
Regards,
Bengt Richter



Reply via email to