Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
emilianobovetti opened this issue Feb 26, 2024 · 1 comment
Closed

Comments

@emilianobovetti
Copy link

emilianobovetti commented Feb 26, 2024

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

@josevalim
Copy link
Member

In this case the docs for --overwrite are unclear, I will push a fix. If you want no overlap, then nuking the previous release is better. :)

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

No branches or pull requests

2 participants