Skip to content

runtime_env_toolchain requires on exec -a support #3009

@rickeylev

Description

@rickeylev

In #2760, the runtime_env_toolchain interpreter wrapper script was changed to use exec -a. While this works in most shells, it doesn't work in dash shell, which is the usual default for Ubuntu/debian. That script strives to be posix-compatible, and exec -a isn't posix.

It would appear our CI (and my local machine) use bash as a default for whatever reason.

Unfortunately, exec -a will fail with an error in this case, so things break. As noted in the comment in the code, exec -a is used to help trick python into respecting the virtual env when a wrapper script is used. It can probably be removed if need be because of the other "defense in depth" tricks used, but it'd be nice to retain it if possible.

I can't find a posix-compatible way to do exec -a directly. There doesn't seem to be a clean/direct way to test if exec -a is supported, either. Some ideas below

(exec -a true 2>/dev/null) (c/o Alex Martani on Slack)

exec dash -c "$runprog" "newarg0" "$@" might work, if we can detect the shell is dash.

Maybe the above, but using sh? sh -c ...

env -a might work, but I'm not sure how available env is or its -a arg is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-rulesIssues concerning core bin/test/lib rulestype: bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy