Skip to content

Not found specificed shell: /run/rosetta/rosetta /bin/sh /bin/sh on M3 Macbook Pro #338

Description

@dasza-prog

I am running a container, which uses a redhat image based on linux/amd64.
The docker desktop version is 4.34.2 (167172)
docker engine version: 27.2.0

Use Rosetta for x86_64/amd64 emulation on Apple Silicon is enabled.

When I want to run the test cases through the shellspec, I get the error
Not found specificed shell: /run/rosetta/rosetta /bin/sh /bin/sh
It seems like the shellspec would like to use the host's environment (which is my M3 macbook pro) instead of the container's (--platform linux/amd64).

I did a workaround, but permanent or better solution would be much appreciated:

# shell detection
{
  if [ "${SHELLSPEC_SHELL:-auto}" = "auto" ]; then
    # shellcheck disable=SC2039,SC3047
    if [ "$SHELLSPEC_KCOV" ] && ! (trap '' DEBUG) 2>/dev/null; then
      for shell in sh bash ksh zsh :; do
        "$shell" -c "trap '' DEBUG" 2>/dev/null && break
      done
      [ "$shell" = : ] && abort "Current shell is not compatible with Kcov."
      warn "Current shell is not compatible with Kcov. Using '$shell' instead."
    else
      shell=$(current_shell "$0" "$$")
    fi
    if [ ! "$shell" ] && shell="sh"; then
      warn "Failed to detect the current shell," \
           "because the ps command does not exist or not compatible."
      warn "Using 'sh' instead. You can specify the shell with --shell option."
    fi
    SHELLSPEC_SHELL=$shell
  fi

After # shell detection comment I have just added:
SHELLSPEC_SHELL=usr/bin/sh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions