Skip to content

Conversation

@enirood-p
Copy link

No description provided.

ferd and others added 30 commits May 23, 2023 15:07
This will help testability and to better self-contain the implementation
This now looks like:

    ...
    ===> Compiling apps/rebar/src/fake_mod.erl failed
       ┌─ apps/rebar/src/fake_mod.erl:
       │
     5 │  diagnostic(A) ->
       │             ╰── variable 'A' is unused

       ┌─ apps/rebar/src/fake_mod.erl:
       │
     6 │      X = add(5 / 0),
       │                ╰── evaluation of operator '/'/2 will fail with a 'badarith' exception

        ┌─ apps/rebar/src/fake_mod.erl:
        │
     11 │  add(X, Y) -> X + Y.
        │  ╰── function add/2 is unused

And supports colors with a weak heuristic based on regexes that I expect
we'll need to fix and expand later to cover more compiler-specific
rules.
As reported in a comment in #2090
the current mechanism only breaks on a \n and does not even respect the
\r\n grapheme cluster. So instead of using string functions, we go to
regular expressions where we can specify both endings without a problem.
This avoids an issue with Erlang/OTP 26
where the IO hangs when shelled out on
Windows.

See erlang/otp#7261.
I hadn't seen this because all my projects use warnings_as_errors, but
the warnings were never properly wired up.

This patch fixes that by adding the proper callbacks and invoking them
from the 3 erlang-related compilers we support.
Add simple Erlang LS config
The function `collect_default_refcount/1` of `rebar_git_resource`
did not log the error message when it failed to get the vsn number
with its `git log` command.

A diagnostic error message is now printed with the status code and
output message of the failing command.
While investigating the work required to support
#2803, I found out that the code
was already in place.

However, despite the code being there, we still passed the old
`ssl_verify_hostname:verify_fun/3` function of pre-21.0 on top of it,
which I supposed ignored the check.

So this change reworks the flow such that we fall back to the legacy
check only if it isn't supported by the OTP library at this point.
Getting this going would require someone to build a new release on an
Erlang copy older than OTP-21 (which is no longer supported) which is
unlikely.

This follows guidelines from
https://erlef.github.io/security-wg/secure_coding_and_deployment_hardening/ssl
…-vsn-command

Print diagnostic when failing to get VSN with Git
Defer hostname check to OTP when supported
The current mechanism had a few oddities, as reported in
#2811:

- `rebar3 do a,b` runs `a` then `b`
- `rebar3 as profile task --a=b,c` runs the task with the flag `a` set
  to `b,c`
- `rebar3 as profile task -a b,c` runs the task with the flag `a` set to
  `b`, and then tries to run `c` as a task
- `rebar3 as profile task -a b, c` runs the task with the flag `a` set to
  `b`, and then tries to run `c` as a task

So the issue is that to pass a comma to an argument, we can only do so
when it exists as a long form argument (`--flag`) and that it does not
contain spaces.

This patch attempts to correct things by making the white-space
following the comma significant. If it's missing, it gets grouped as a
single entity. If it's there, the task is considered to be split.

This becomes significant for commands that internally parse the `,` to
allow list of args (such as `rebar3 release --relnames one,two`) which
were only invokable as `relnames=one,two`, and not the spaced version
nor the short version (`m one,two`), which should now be supported.

This should *not* break any backwards compatibility, but there is the
possibility that users who did invoke many commands with both arguments
and sequences without spaces (`rebar3 do release --relname a,tar`) now
get broken commands.

I don't quite know if we'd be okay taking that risk, so this is up for
comments I guess.
…nimum-otp-vsn

Add app name to "OTP release ~ts or later is required" msg
ferd and others added 30 commits September 23, 2025 08:30
Support env variable substitution with defaults in rebar shell
relx: do not discard command line parameters when parameter is not in…
Instead of calling ec_semver directly, all version-related
calls go through this module; This makes it easy
to swap later when hex_core exposes an appropriate
replacement in the future.

It was not possible to use `verl` or other libraries
here, since rebars/erlang_commons parsing was
different in a number of edge cases:

- rebar allows version bounds with 2 components,
  like `< 1.0` or `== 1.2`.
- rebar allows approximate bounds with more than 3
  components, like `~> 1.5.6-rc.0`

To continue to support these, the new module also
uses ec_semver under the hood, but extends the custom
constraint parser to also support `and` and `or`
constraints used by Elixir or Gleam.

Constraints are modelled as a match function without
a pure data representation. This has to be assumed
to be an implementation detail that might change in
the future when a need arises.
Notable changes include:

- find_highest_matching_ now just calls resolve_version_ with a
  pessimistic constraint
- cmp* variants are gone
- is_valid get removed in favour of handling the error case after trying
  to parse
CT: disable cth_readable_failonly hook when verbose option is set
IPv6 support for getting Hex packages
fix the version range parser to support and/or version constraints
fix rebar_app_info:source/1 spec
Filter out dependencies marked as optional in Hex package metadata.
Rebar3 does not support optional dependencies, so they should not be
fetched or compiled. This fixes issues where optional Mix-only
transitive dependencies would cause build failures.

Bump PACKAGE_INDEX_VERSION to invalidate existing caches.

Fixes #2977
Ignore optional Hex package dependencies
Found via `codespell -S vendor -L cant,manuel,nd` and
`typos --hidden --format brief`
…omp_mode

Add middlebox_comp_mode to global options
Update vendored version of hex_core to v0.12.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.