Le 14/03/2020 à 16:00, Bruce Dubbs via lfs-dev a écrit :
> On 3/14/20 3:41 AM, Pierre Labastie via lfs-dev wrote:
>> In "6.4 Entering the Chroot Environment", we have:
>> --------
>>  From this point on, there is no need to use the LFS variable anymore, 
>> because
>> all work will be restricted to the LFS file system. This is because the Bash
>> shell is told that $LFS is now the root (/) directory.
>> --------
>> But it is not true that the bash shell is told anything: the _kernel_ is told
>> that $LFS is now the root (/) directory for all the processes launched by the
>> first one (that is, here, "env", which itself launches "bash", which will
>> launch all the others). I am not sure how to phrase this: something like:
>> -----
>> ... system. This is because the kernel is told that $LFS is now the root (/)
>> directory for all the programs run from the current Bash shell.
>> -----
>> But I'm sure native English writers can find something better (without
>> excluding non native of course :)
> 
> I think I disagree with your premise.  bash IS told where the root directory
> is, but there is some interaction with the kernel.
> 
> When I enter chroot, env no longer exists.  It does an 'exec' and replaces
> itself with bash. I took a look at /proc/<pid> for that instance of bash and
> in that directory is the pseudo file 'mounts'. That tells me:
> 
> /dev/sda6 / ext4 rw,noatime 0 0
> 
> which is my /mnt/lfs directory on the host.  My interpretation is that this is
> a configuration for bash.  When doing 'cd /', the kernel looks at this
> configuration for the bash instance and uses that to determine what disk
> partition (it could be a directory) to use for the head of an absolute path.
> 
> In my opinion what we have now is correct.
> 


Thinking a little more about this, what I mean is the following: bash is not
"told" anything, and does not "know" that "/" is $LFS: bash may ask the kernel
to open(2) (or stat(2), or other basic calls) a file by passing the filename
to the kernel, say, /a/file/name, and it is the kernel which resolves that
filename to $LFS/a/file/name, not bash itself.

Pierre
-- 
http://lists.linuxfromscratch.org/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to