Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error-checking in chroot_install #23

Open
nkaretnikov opened this issue Nov 18, 2023 · 3 comments
Open

Improve error-checking in chroot_install #23

nkaretnikov opened this issue Nov 18, 2023 · 3 comments

Comments

@nkaretnikov
Copy link

Currently, it has this comment:

    # FIXME: this should reall be check_output(), but chroot or fakechroot is
    # giving some weird segfault after the install command completes ¯\_(ツ)_/¯
    subprocess.call(
        [
            "fakechroot",
            "chroot",
            new_root,
            "/_conda.exe",
            "install",
            "--offline",
            "--file",
            "/opt/conda/pkgs/env.txt",
            "-y",
            "--prefix",
            "/opt/conda",
        ],
        env=env,
        cwd=host_conda_opt,
        stdout=subprocess.DEVNULL,
        stderr=subprocess.DEVNULL,
    )

Suggestions:

  • Fix the typo: "reall" -> "really"
  • Check output as the comment suggests
  • See if fakechroot propagates the exit code if an internal command fails (otherwise, it'll succeed even with check_output)
  • Figure out the cause of the segfault if it repros.
@nkaretnikov
Copy link
Author

Discovered this due to conda-incubator/conda-store#666.

@jaimergp
Copy link
Member

I think we can capture the output without having to check the returncode as done in check_output. IOW:

    process = subprocess.run(
        [
            "fakechroot",
            "chroot",
            new_root,
            "/_conda.exe",
            "install",
            "--offline",
            "--file",
            "/opt/conda/pkgs/env.txt",
            "-y",
            "--prefix",
            "/opt/conda",
        ],
        env=env,
        cwd=host_conda_opt,
        capture_output=True,
        text=True,
        check=False,
    )

And then log the output via process.stdout and process.stderr.

That said, we could also look into less hacky ways to build a docker image without docker. These days buildah, standalone buildkit and/or podman might be good alternatives.

@jaimergp
Copy link
Member

Then, about using conda-standalone exe here... it's going to cause trouble one way or another. We could add an option for micromamba so it actually behaves like a binary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants