Skip to content

mix release regression under read-only Elixir installations #15286

@chinponya

Description

@chinponya

Elixir and Erlang/OTP versions

Erlang/OTP 28 [erts-16.3.1] [source] [64-bit] [smp:32:32] [ds:32:32:10] [async-threads:1] [jit:ns]
Elixir 1.20.0-rc.4 (compiled with Erlang/OTP 28)

Operating system

NixOS 25.11

Current behavior

Something changed between 1.20.0-rc.2 and 1.20.0-rc.3 that's causing mix release to fail when the Elixir installation has no write permission. Possibly due to this commit: 52c58c7.

This issue directly affects nix, so I'll use nix for the repro steps

# that's the commit hash which introduced elixir 1.20.0-rc.3
# current master which points to rc.4 is broken too
nix shell github:NixOS/nixpkgs/6587ff4208bfff9745bbdd6b4c4e05fada36e800#beam.packages.erlang_28.elixir_1_20
mix new example
cd example
mix release

This gets us:

Compiling 1 file (.ex)
Generated example app
* assembling example-0.1.0 on MIX_ENV=dev
* skipping runtime configuration (config/runtime.exs not found)
* skipping elixir.bat for windows (bin/elixir.bat not found in the Elixir installation)
* skipping iex.bat for windows (bin/iex.bat not found in the Elixir installation)

14:00:26.810 [error] Task #PID<0.263.0> started from #PID<0.95.0> terminating
** (File.CopyError) could not copy recursively from "/nix/store/cg3wmh2h30cn586x3kb87did5qqddrwb-erlang-28.4/lib/erlang/erts-16.3/bin" to "/home/user/dev/example/_build/dev/rel/example/erts-16.3/bin". /nix/store/cg3wmh2h30cn586x3kb87did5qqddrwb-erlang-28.4/lib/erlang/erts-16.3/bin/escript: permission denied
    (elixir 1.20.0-rc.3) lib/file.ex:1236: File.cp_r!/3
    (mix 1.20.0-rc.3) lib/mix/release.ex:797: Mix.Release.copy_erts/1
    (mix 1.20.0-rc.3) lib/mix/tasks/release.ex:1391: Mix.Tasks.Release.copy/2
    (elixir 1.20.0-rc.3) lib/task/supervised.ex:105: Task.Supervised.invoke_mfa/2
    (elixir 1.20.0-rc.3) lib/task/supervised.ex:40: Task.Supervised.reply/4
Function: &:erlang.apply/2
    Args: [#Function<0.18801473/1 in Mix.Tasks.Release.assemble/1>, [:erts]]
** (EXIT from #PID<0.95.0>) an exception was raised:
    ** (File.CopyError) could not copy recursively from "/nix/store/cg3wmh2h30cn586x3kb87did5qqddrwb-erlang-28.4/lib/erlang/erts-16.3/bin" to "/home/user/dev/example/_build/dev/rel/example/erts-16.3/bin". /nix/store/cg3wmh2h30cn586x3kb87did5qqddrwb-erlang-28.4/lib/erlang/erts-16.3/bin/escript: permission denied
        (elixir 1.20.0-rc.3) lib/file.ex:1236: File.cp_r!/3
        (mix 1.20.0-rc.3) lib/mix/release.ex:797: Mix.Release.copy_erts/1
        (mix 1.20.0-rc.3) lib/mix/tasks/release.ex:1391: Mix.Tasks.Release.copy/2
        (elixir 1.20.0-rc.3) lib/task/supervised.ex:105: Task.Supervised.invoke_mfa/2
        (elixir 1.20.0-rc.3) lib/task/supervised.ex:40: Task.Supervised.reply/4

Expected behavior

It should build like it did in 1.20.0-rc.2 and earlier. I don't think this can be corrected on the nixpkgs side.

For example this:

# commit hash which introduced elixir 1.20.0-rc.2
nix shell github:NixOS/nixpkgs/218a9739a409258928ebb0378ccc2a2cbb6bb1fb#beam.packages.erlang_28.elixir_1_20
mix new example
cd example
mix release

Builds just fine:

Compiling 1 file (.ex)
Generated example app
* assembling example-0.1.0 on MIX_ENV=dev
* skipping runtime configuration (config/runtime.exs not found)
* skipping elixir.bat for windows (bin/elixir.bat not found in the Elixir installation)
* skipping iex.bat for windows (bin/iex.bat not found in the Elixir installation)

Release created at _build/dev/rel/example

    # To start your system
    _build/dev/rel/example/bin/example start

Once the release is running:

    # To connect to it remotely
    _build/dev/rel/example/bin/example remote

    # To stop it gracefully (you may also send SIGINT/SIGTERM)
    _build/dev/rel/example/bin/example stop

To list all commands:

    _build/dev/rel/example/bin/example

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions