Elixir v1.17.2 released

1. Bug fixes

Logger

  • [Logger.Translator] Fix logger crash when :gen_statem’s format_status/2 returns non-tuple

Mix

  • [mix deps.get] Fix regression when fetching a git repository with a :ref
  • [mix release] Validate RELEASE_MODE and set ERRORLEVEL on .bat scripts
  • [mix release] Fix invalid example in code comment inside the generated vm.args.eex
24 Likes

I found Fix regression when fetching repo with a ref · elixir-lang/elixir@786f959 · GitHub.

Does anyone have more details on what the problem was with setting both ref and depth?

Fetch a :ref was not working at all and, once I addressed the :ref bug, I could not make it work together with :ref. If you can figure it out, a PR is welcome. :slight_smile:

1 Like

I could not reproduce it. I’m probably not trying to do the thing that is broken?!

Here’s what I’ve done:

  1. Fresh Elixir 1.17.1 env:
$ cat Dockerfile
FROM docker.io/hexpm/elixir:1.17.1-erlang-27.0-debian-bookworm-20240701-slim

RUN apt-get update && apt-get install -y git vim && rm -rf /var/lib/apt/lists/*

RUN mix new app

WORKDIR /app
$ podman build -t elixir-1.17.1 .
$ podman run --rm -it elixir-1.17.1
  1. Configure deps using ref and depth:
$ vim mix.exs
$ sed -n '/defp deps/,/end/p' mix.exs
  defp deps do
    [
      {:heroicons,
       github: "tailwindlabs/heroicons",
       ref: "c1b192b8cd0f1b3c569d25ba995d170f3db86039",
       sparse: "optimized",
       app: false,
       compile: false,
       depth: 1},
    ]
  end
  1. Fetch first time:
$ mix deps.get
* Getting heroicons (https://github.com/tailwindlabs/heroicons.git - c1b192b8cd0f1b3c569d25ba995d170f3db86039)
remote: Enumerating objects: 2405, done.        
remote: Counting objects: 100% (2405/2405), done.        
remote: Compressing objects: 100% (2178/2178), done.        
remote: Total 2405 (delta 277), reused 1905 (delta 217), pack-reused 0 
  1. Sanity checks:
$ cat mix.lock 
%{
  "heroicons": {:git, "https://github.com/tailwindlabs/heroicons.git", "c1b192b8cd0f1b3c569d25ba995d170f3db86039", [ref: "c1b192b8cd0f1b3c569d25ba995d170f3db86039", sparse: "optimized", depth: 1]},
}
$ git -C /app/deps/heroicons log --oneline
c1b192b (grafted, HEAD) 2.1.4
  1. Downgrade to a previous commit:
$ vim mix.exs
$ sed -n '/defp deps/,/end/p' mix.exs
  defp deps do
    [
      {:heroicons,
       github: "tailwindlabs/heroicons",
       ref: "01c786b0353c7e51b86bc903a329e81d7578333d",
       sparse: "optimized",
       app: false,
       compile: false,
       depth: 1},
    ]
  end
  1. Fetch second time, updating repo:
$ mix deps.get
* Updating heroicons (https://github.com/tailwindlabs/heroicons.git - 01c786b0353c7e51b86bc903a329e81d7578333d)
remote: Enumerating objects: 2405, done.        
remote: Counting objects: 100% (2405/2405), done.        
remote: Compressing objects: 100% (2179/2179), done.        
remote: Total 2405 (delta 277), reused 1901 (delta 216), pack-reused 0 
  1. Sanity checks:
$ cat mix.lock
%{
  "heroicons": {:git, "https://github.com/tailwindlabs/heroicons.git", "01c786b0353c7e51b86bc903a329e81d7578333d", [ref: "01c786b0353c7e51b86bc903a329e81d7578333d", sparse: "optimized", depth: 1]},
}
$ git -C /app/deps/heroicons log --oneline
01c786b (grafted, HEAD) 2.1.3
  1. Upgrade to an intermediate commit:
$ vim mix.exs
$ sed -n '/defp deps/,/end/p' mix.exs
  defp deps do
    [
      {:heroicons,
       github: "tailwindlabs/heroicons",
       ref: "cafc7d6cb6c2233b07667ae1fb77a43866a333e3",
       sparse: "optimized",
       app: false,
       compile: false,
       depth: 1},
    ]
  end
$ mix deps.get
* Updating heroicons (https://github.com/tailwindlabs/heroicons.git - cafc7d6cb6c2233b07667ae1fb77a43866a333e3)
remote: Enumerating objects: 2405, done.        
remote: Counting objects: 100% (2405/2405), done.        
remote: Compressing objects: 100% (2179/2179), done.        
remote: Total 2405 (delta 277), reused 1902 (delta 216), pack-reused 0
  1. Sanity checks:
$ cat mix.lock
%{
  "heroicons": {:git, "https://github.com/tailwindlabs/heroicons.git", "cafc7d6cb6c2233b07667ae1fb77a43866a333e3", [ref: "cafc7d6cb6c2233b07667ae1fb77a43866a333e3", sparse: "optimized", depth: 1]},
}
$ git -C /app/deps/heroicons log --oneline
cafc7d6 (grafted, HEAD) use `size-*` instead of `w-* h-*` (#1182)

All of the above seems to be working as expected for me. The deps.get works and the repository has the correct commit with depth 1.

I wonder what did I miss in the steps above?

What is your git --version?

The issue was that Mix.install [{:flame, github: "phoenixframework/flame", ref: "4600277"}] was not working on v1.17.

In the Debian bookworm container from above:

$ git --version
git version 2.39.2

What is the version where cloning flame fails?

git version 2.39.3 (Apple Git-145), so theoretically it is not the git version, unless the Apple Git has modifications.

Do you have an error report somewhere? What was the error message from mix deps.get / Git?

iex(1)> Mix.install [{:flame, github: "phoenixframework/flame", ref: "4600277"}]
* Getting flame (https://github.com/phoenixframework/flame.git - 4600277)
fatal: couldn't find remote ref 4600277
** (Mix.Error) Command "git --git-dir=.git fetch --force --quiet --progress origin 4600277" failed
    (mix 1.17.2) lib/mix.ex:588: Mix.raise/2

Did you try the full ref? 46002774775fa5be947a970d7ff5aeefc0dd6707

This is not even using :depth :slight_smile:

Maybe the problem is just the ref itself!

Short ref (error) and full ref (ok):

root@214431fdf2a5:/app# iex
Erlang/OTP 27 [erts-15.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.17.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Mix.install [{:flame, github: "phoenixframework/flame", ref: "4600277"}]
* Getting flame (https://github.com/phoenixframework/flame.git - 4600277)
fatal: couldn't find remote ref 4600277
** (Mix.Error) Command "git --git-dir=.git fetch --force --quiet --progress origin 4600277" failed
    (mix 1.17.1) lib/mix.ex:588: Mix.raise/2
    (mix 1.17.1) lib/mix/scm/git.ex:136: Mix.SCM.Git.checkout/2
    (elixir 1.17.1) lib/file.ex:1665: File.cd!/2
    (mix 1.17.1) lib/mix/dep/fetcher.ex:64: Mix.Dep.Fetcher.do_fetch/3
    (mix 1.17.1) lib/mix/dep/converger.ex:238: Mix.Dep.Converger.all/9
    (mix 1.17.1) lib/mix/dep/converger.ex:170: Mix.Dep.Converger.init_all/8
    (mix 1.17.1) lib/mix/dep/converger.ex:110: Mix.Dep.Converger.all/4
    iex:1: (file)
iex(1)> Mix.install [{:flame, github: "phoenixframework/flame", ref: "46002774775fa5be947a970d7ff5aeefc0dd6707"}]
* Getting flame (https://github.com/phoenixframework/flame.git - 46002774775fa5be947a970d7ff5aeefc0dd6707)
remote: Enumerating objects: 767, done.        
remote: Counting objects: 100% (257/257), done.        
remote: Compressing objects: 100% (90/90), done.        
remote: Total 767 (delta 206), reused 181 (delta 164), pack-reused 510        
...
==> flame
Compiling 13 files (.ex)
Generated flame app
:ok

With full ref and depth:

root@214431fdf2a5:/app# iex
Erlang/OTP 27 [erts-15.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Interactive Elixir (1.17.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Mix.install [{:flame, github: "phoenixframework/flame", ref: "46002774775fa5be947a970d7ff5aeefc0dd6707", depth: 1}]
* Getting flame (https://github.com/phoenixframework/flame.git - 46002774775fa5be947a970d7ff5aeefc0dd6707)
remote: Enumerating objects: 38, done.        
remote: Counting objects: 100% (38/38), done.        
remote: Compressing objects: 100% (32/32), done.        
remote: Total 38 (delta 0), reused 17 (delta 0), pack-reused 0        
Resolving Hex dependencies...
Resolution completed in 0.053s
...
==> flame
Compiling 13 files (.ex)
Generated flame app
:ok
1 Like

Exactly. We cannot fetch the short ref, with or without the depth option. Perhaps we can change the message and say that it requires the full ref with depth (instead of disallowing it). Do you want to submit a PR?

I’m sorry it took me some time to understand what the regression was.

Here’s a PR: Fetch all refs unless using Git :depth option by rhcarvalho · Pull Request #13713 · elixir-lang/elixir · GitHub, I think we can move the conversation there.

Thanks, @josevalim :purple_heart:

2 Likes