Skip to content

Tests fail when SHELL environment variable is set to /usr/bin/sh that soft links to /usr/bin/bash #4133

@pondichys

Description

@pondichys

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Command attempted

Download release 2.34 tarball and run go test with a user that has his shell set to /usr/bin/sh that links to /usr/bin/bash

I came across this problem while packaging the version 2.34 of the CLI for Void Linux. Package builds for Void happen in a CHROOT where the build user has /usr/bin/sh as SHELL environment variable.

The failing test is TestInit_Prompt/Simple.

Expected Behavior

As bash is a supported shell, the test should follow the link and succeed

Actual Behavior

Test fail with the following error

=== RUN   TestInit_Prompt/Simple
=== PAUSE TestInit_Prompt/Simple
=== CONT  TestInit_Prompt/Simple
    init_test.go:235:
                Error Trace:    /builddir/scaleway-cli-2.34.0/core/testing.go:661
                                                        /builddir/scaleway-cli-2.34.0/core/testing.go:596
                                                        /builddir/scaleway-cli-2.34.0/core/testing.go:462
                Error:          Not equal:
                                expected: "🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲\n🟩🟩🟩 STDOUT️ 🟩🟩🟩️\n✅ Initialization completed with success.\n  Except for SSH key: could not find an SSH key at ~/.ssh/id_rsa.pub\n🟩🟩🟩 JSON STDOUT 🟩🟩🟩\n{\n  \"message\": \"Initialization completed with success\",\n  \"details\": \"Except for SSH key: could not find an SSH key at ~/.ssh/id_rsa.pub\"\n}\n"
                                actual  : "🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲\n🟩🟩🟩 STDOUT️ 🟩🟩🟩️\n✅ Initialization completed with success.\n  Except for autocomplete: unsupported shell 'sh'\n  Except for SSH key: could not find an SSH key at ~/.ssh/id_rsa.pub\n🟩🟩🟩 JSON STDOUT 🟩🟩🟩\n{\n  \"message\": \"Initialization completed with success\",\n  \"details\": \"Except for autocomplete: unsupported shell 'sh'\\nExcept for SSH key: could not find an SSH key at ~/.ssh/id_rsa.pub\"\n}\n"

                                Diff:
                                --- Expected
                                +++ Actual
                                @@ -3,2 +3,3 @@
                                 ✅ Initialization completed with success.
                                +  Except for autocomplete: unsupported shell 'sh'
                                   Except for SSH key: could not find an SSH key at ~/.ssh/id_rsa.pub
                                @@ -7,3 +8,3 @@
                                   "message": "Initialization completed with success",
                                -  "details": "Except for SSH key: could not find an SSH key at ~/.ssh/id_rsa.pub"
                                +  "details": "Except for autocomplete: unsupported shell 'sh'\nExcept for SSH key: could not find an SSH key at ~/.ssh/id_rsa.pub"
                                 }
                Test:           TestInit_Prompt/Simple
--- FAIL: TestInit_Prompt (0.00s)
    --- FAIL: TestInit_Prompt/Simple (0.00s)
FAIL
FAIL    github.com/scaleway/scaleway-cli/v2/internal/namespaces/init    0.018s

More info

Obviously the scw init command also run into this error if I accept the default detected shell

...
To enable autocomplete, scw needs to update your shell configuration.
What type of shell are you using (default: sh):


✅ Initialization completed with success.
  Except for autocomplete: unsupported shell 'sh'

I do get this is an edge case but it would be nice to be able to package with tests enabled and successful.

Best regards.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions