Hello Ada,

(Cc: Reepca, who followed these developments.)

The build discrepancies you report are serious enough that we need to
find a strategy other than re-mounting the root directory MS_RDONLY so
we get EPERM and not EROFS on /.

I think we can go with the solution Reepca outlined in
<https://issues.guix.gnu.org/75810#14-lineno78>: expose
chrootRootDir/top inside the build environment (with permissions 0555
but still user-owned).  I’ll work on it.


Below are details about the failures you reported, Ada, reproduced with
commit 6af680670bf9055b90e6f8b63c4c2ab7b08e7c56 and a recent guix-daemon
where the build environment root is remounted read-only.

For scons, I get:

--8<---------------cut here---------------start------------->8---
ERROR: test_PathIsDirCreate (__main__.PathVariableTestCase)
Test the PathIsDirCreate validator
----------------------------------------------------------------------
Traceback (most recent call last):
  File 
"/tmp/guix-build-scons-4.4.0.drv-0/source/SCons/Variables/PathVariableTests.py",
 line 129, in test_PathIsDirCreate
    o.validator('X', f, {})
  File 
"/tmp/guix-build-scons-4.4.0.drv-0/source/SCons/Variables/PathVariable.py", 
line 105, in PathIsDirCreate
    os.makedirs(val, exist_ok=True)
  File 
"/gnu/store/nla5820scsv7ibvr3kwpgkm9wr4prf0q-python-3.10.7/lib/python3.10/os.py",
 line 215, in makedirs
    makedirs(head, exist_ok=exist_ok)
  File 
"/gnu/store/nla5820scsv7ibvr3kwpgkm9wr4prf0q-python-3.10.7/lib/python3.10/os.py",
 line 225, in makedirs
    mkdir(name, mode)
OSError: [Errno 30] Read-only file system: '/yyy'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File 
"/tmp/guix-build-scons-4.4.0.drv-0/source/SCons/Variables/PathVariableTests.py",
 line 133, in test_PathIsDirCreate
    raise Exception("did not catch expected UserError") from e
Exception: did not catch expected UserError
[…]
build of /gnu/store/jwsp6vz0hxriiylfl53wg2m98npwv8iy-scons-4.4.0.drv failed
--8<---------------cut here---------------end--------------->8---

And indeed, the code in question expects EEXIST or EPERM, but not EROFS:

--8<---------------cut here---------------start------------->8---
    def PathIsDirCreate(key, val, env) -> None:
        """Validator to check if Path is a directory,
           creating it if it does not exist."""
        try:
            os.makedirs(val, exist_ok=True)
        except FileExistsError:
            m = 'Path for option %s is a file, not a directory: %s'
            raise SCons.Errors.UserError(m % (key, val))
        except PermissionError:
            m = 'Path for option %s could not be created: %s'
            raise SCons.Errors.UserError(m % (key, val))
--8<---------------cut here---------------end--------------->8---

For Ruby, I get:

--8<---------------cut here---------------start------------->8---
make[1]: Leaving directory '/tmp/guix-build-ruby-3.3.3.drv-0/ruby-3.3.3'
Generating RDoc documentation
uh-oh! RDoc had a problem:
Read-only file system @ dir_s_mkdir - /homeless-shelter

run with --debug for full backtrace
make: *** [uncommon.mk:665: rdoc] Error 1
error: in phase 'build': uncaught exception:
%exception #<&invoke-error program: "make" arguments: ("-j" "4") exit-status: 2 
term-signal: #f stop-signal: #f> 
phase `build' failed after 232.1 seconds
command "make" "-j" "4" failed with status 2
build process 6 exited with status 256
note: keeping build directory `/tmp/guix-build-ruby-3.3.3.drv-0'
builder for `/gnu/store/n7zsjg0gm4kz74f2hp6k22iw42zwn5kn-ruby-3.3.3.drv' failed 
with exit code 1
--8<---------------cut here---------------end--------------->8---

Not sure how it would deal with that unwritable $HOME previously.

However, /gnu/store/jyrmg3qkii4mb51ca1f3j9mv6knicr8a-go-1.23.5.drv
builds fine for me (no test failures).

Ludo’.



Reply via email to