Skip to content

Fix System.cmd/3 unit test that fails on Ubuntu 26.04 - #15646

Merged
josevalim merged 1 commit into
elixir-lang:mainfrom
fhunleth:fix-test-ubuntu-26.04
Jul 21, 2026
Merged

Fix System.cmd/3 unit test that fails on Ubuntu 26.04#15646
josevalim merged 1 commit into
elixir-lang:mainfrom
fhunleth:fix-test-ubuntu-26.04

Conversation

@fhunleth

Copy link
Copy Markdown
Contributor

This test runs System.cmd/3 against a symlink to the echo command. This works when echo is its own binary and when it's in a multicall binary that's dispatched using argv[0]. It doesn't work for the new Rust/uutils coreutils which doesn't dispatch via argv[0]. In this case, intended call to echo produces no output:

  1) test Unix cmd/3 with absolute and relative paths (SystemTest)
     test/elixir/system_test.exs:210
     match (=) failed
     code:  assert {"hello\n", 0} = System.cmd(Path.join(File.cwd!(), @echo), ["hello"], arg0: "echo")
     left:  {"hello\n", 0}
     right: {"", 0}
     stacktrace:
       test/elixir/system_test.exs:223: anonymous fn/0 in SystemTest."test Unix cmd/3 with absolute and relative paths"/1
       (elixir 1.21.0-dev) lib/file.ex:2100: File.cd!/2
       test/elixir/system_test.exs:215: (test)

This fix switches the binary used for the test over to sh which fixes the issue on Ubuntu 26.04. This was also verified on Ubuntu 24.04, Ubuntu 22.04, Alpine Linux 3.24, macOS Tahoe (26.5.1) and MacOS Sequoia (15.3.2).

This test runs `System.cmd/3` against a symlink to the `echo` command.
This works when `echo` is its own binary and when it's in a multicall
binary that's dispatched using `argv[0]`. It doesn't work for the new
Rust/uutils coreutils which doesn't dispatch via `argv[0]`. In this
case, intended call to echo produces no output:

```
  1) test Unix cmd/3 with absolute and relative paths (SystemTest)
     test/elixir/system_test.exs:210
     match (=) failed
     code:  assert {"hello\n", 0} = System.cmd(Path.join(File.cwd!(), @echo), ["hello"], arg0: "echo")
     left:  {"hello\n", 0}
     right: {"", 0}
     stacktrace:
       test/elixir/system_test.exs:223: anonymous fn/0 in SystemTest."test Unix cmd/3 with absolute and relative paths"/1
       (elixir 1.21.0-dev) lib/file.ex:2100: File.cd!/2
       test/elixir/system_test.exs:215: (test)
```

This fix switches the binary used for the test over to `sh` which fixes
the issue on Ubuntu 26.04. This was also verified on Ubuntu 24.04,
Ubuntu 22.04, Alpine Linux 3.24, macOS Tahoe (26.5.1) and MacOS Sequoia
(15.3.2).
@josevalim
josevalim merged commit cff8010 into elixir-lang:main Jul 21, 2026
14 of 15 checks passed
@josevalim

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants