[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 07/15] build: syscalls: Add pivot-root.
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH 07/15] build: syscalls: Add pivot-root. |
Date: |
Wed, 08 Jul 2015 14:47:44 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
"Thompson, David" <address@hidden> skribis:
> On Tue, Jul 7, 2015 at 9:35 AM, Ludovic Courtès <address@hidden> wrote:
>> David Thompson <address@hidden> skribis:
>>
>>> From: David Thompson <address@hidden>
>>>
>>> * guix/build/syscalls.scm (pivot-root): New procedure.
>>> * tests/syscalls.scm: Test it.
>>
>> [...]
>>
>>> +(test-assert "pivot-root"
>>> + (match (pipe)
>>> + ((in . out)
>>> + (match (clone (logior CLONE_NEWUSER CLONE_NEWNS))
>>> + (0
>>> + (close in)
>>> + (call-with-temporary-directory
>>> + (lambda (root)
>>> + (let ((put-old (string-append root "/real-root")))
>>> + (mount "none" root "tmpfs")
>>> + (mkdir put-old)
>>> + (call-with-output-file (string-append root "/test")
>>> + (lambda (port)
>>> + (display "testing\n" port)))
>>> + (pivot-root root put-old)
>>> + ;; The test file should now be located inside the root
>>> directory.
>>> + (write (file-exists "/test") out)
>>> + (close out))))
>>> + (primitive-exit 0))
>>> + (pid
>>> + (close out)
>>> + (read in))))))
>>
>> Shouldn’t it be:
>>
>> (file-exists? (string-append put-old "/test"))
>
> No, because put-old contains the current system root directory. I
> wanted to test that the file I made in the temporary directory is now
> located in the new root file system. I hope this makes sense.
Oh, right. (The other part was the missing question mark, as you
noticed.)
Ludo’.
[PATCH 06/15] build: syscalls: Add setns syscall wrapper., David Thompson, 2015/07/06
[PATCH 10/15] gnu: system: Move file-system->spec to (gnu system file-systems)., David Thompson, 2015/07/06
[PATCH 09/15] gnu: system: Move <file-system-mapping> into (gnu system file-systems)., David Thompson, 2015/07/06
[PATCH 13/15] scripts: system: Add 'container' action., David Thompson, 2015/07/06