diff --git a/code_sandboxes/__version__.py b/code_sandboxes/__version__.py index f84c53b..c3fa782 100644 --- a/code_sandboxes/__version__.py +++ b/code_sandboxes/__version__.py @@ -1 +1 @@ -__version__ = "1.11.0" +__version__ = "1.11.1" diff --git a/code_sandboxes/environments/adapters/datalayer.py b/code_sandboxes/environments/adapters/datalayer.py index 20498d6..73a14a8 100644 --- a/code_sandboxes/environments/adapters/datalayer.py +++ b/code_sandboxes/environments/adapters/datalayer.py @@ -248,7 +248,7 @@ def _contract_user() -> list[str]: f"&& if getent passwd {uid} >/dev/null; then " f'usermod -l {user} -g {gid} -d {home} "$(getent passwd {uid} | cut -d: -f1)"; ' f"else useradd -u {uid} -g {gid} -d {home} -s /bin/bash {user}; fi " - f"&& mkdir -p {home}/.local/share/jupyter/runtime/external_kernels " + f"&& mkdir -p {home}/content {home}/.local/share/jupyter/runtime/external_kernels " f"&& chown -R {uid}:{gid} {home}", f"ENV HOME={home} LANG={contract.locale} LC_ALL={contract.locale} " f"LANGUAGE={contract.locale} TZ=Etc/UTC PATH=$PATH:/opt/datalayer/bin", diff --git a/tests/test_environment_foreign_contract_layer.py b/tests/test_environment_foreign_contract_layer.py index c063913..ce006a6 100644 --- a/tests/test_environment_foreign_contract_layer.py +++ b/tests/test_environment_foreign_contract_layer.py @@ -489,3 +489,14 @@ def test_an_image_that_is_not_debian_derived_is_said_to_be(self, approved, tmp_p base = self._digest("alpine:3.20") with pytest.raises(AssertionError, match="not Debian-derived"): solve_and_build(approved, tmp_path, image_source("alpine:3.20"), base) + + +def test_the_doctor_of_an_older_base_finds_its_working_directory(): + """The doctor is copied from the approved base, and a channel's may still + check `/home/datalayer/content`: an image of another make has to hold it, + the contract's user owning it, before that doctor runs.""" + from code_sandboxes.environments.adapters.datalayer import _contract_user + + created = next(line for line in _contract_user() if "external_kernels" in line) + assert "/home/datalayer/content" in created + assert created.index("/home/datalayer/content") < created.index("chown -R")