Skip to content

mix release includes overlays even after source files are removed #13371

Closed
@emilianobovetti

Description

@emilianobovetti

Elixir and Erlang/OTP versions

Erlang/OTP 25 [erts-13.2.2.6] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Elixir 1.15.7 (compiled with Erlang/OTP 25)
Erlang/OTP 26 [erts-14.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Elixir 1.17.0-dev (73ef1c5) (compiled with Erlang/OTP 26)

Operating system

Linux 6.1.78 #1-NixOS SMP PREEMPT_DYNAMIC x86_64 GNU/Linux

Current behavior

Here are the steps to reproduce the problem:

  1. Write a file into the rel/overlays directory.
  2. Run mix release.
  3. Delete the file from the rel/overlays directory.
  4. Run mix release --overwrite.
  5. The file is still included into the release.

Expected behavior

Here's a test case that describes the behavior I would expect:

  test "stale files in overlays" do
    in_fixture("release_test", fn ->
      Mix.Project.in_project(:release_test, ".", fn _ ->
        File.mkdir_p!("rel/overlays")
        File.write!("rel/overlays/file1", "hello")
        File.write!("rel/overlays/file2", "world")

        root = Path.absname("_build/dev/rel/release_test")

        Mix.Task.run("release")
        assert root |> Path.join("file1") |> File.read!() == "hello"
        assert root |> Path.join("file2") |> File.read!() == "world"

        File.rm!("rel/overlays/file2")

        Mix.Task.rerun("release", ["--overwrite"])
        refute root |> Path.join("file2") |> File.exists?()
      end)
    end)
  end

Fix attempt

By removing the whole release directory before running a new release the issue is fixed, but I'm afraid my approach is too naive.

ref: emilianobovetti@905327e

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