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

Overlapping cases in manifest don't err nor match #1729

Open
reznikmm opened this issue Aug 5, 2024 · 2 comments
Open

Overlapping cases in manifest don't err nor match #1729

reznikmm opened this issue Aug 5, 2024 · 2 comments
Labels
type: bug Something isn't working

Comments

@reznikmm
Copy link
Contributor

reznikmm commented Aug 5, 2024

Describe the bug
environment.'case(os)'.'...' is ignored (doesn't match?) on Mac OS X.

To Reproduce
I want to build a crate with HEAD of gnatcoll-core. I do

  1. Clone and pin:
    git clone https://github.com/AdaCore/gnatcoll-core.git gnatcoll
    cp -v gnatcoll.toml gnatcoll/alire.toml
    alr pin gnatcoll --use=./gnatcoll
  2. gnatcoll.toml has
    [environment.'case(os)'.'...'.GPR_PROJECT_PATH]
    prepend = "${CRATE_ROOT}/core:${CRATE_ROOT}/projects:${CRATE_ROOT}/minimal"
    
  3. But alire doesn't take it into account on Mac OS (but does it on Linux AFAICS). On Linux I see

detail: Env: gnatcoll (env) prepends '/tmp/test/gnatcoll/core:/tmp/test/gnatcoll/projects:/tmp/test/gnatcoll/minimal' to 'GPR_PROJECT_PATH'

But I don't see this line in Mac OS logs. And GPR_PROJECT_PATH misses core, etc.

See Commit ae36a4e6b22070127db61c9a92df41a9385b16dc in my https://github.com/reznikmm/test repo (mac_env branch).

Expected Behavior
I want ... to match Mac OS.

alr version
2.0.1.

alr logs
See attached zip from GitHub CI (4_Do something.txt)
logs_26807299048.zip

@reznikmm
Copy link
Contributor Author

reznikmm commented Aug 5, 2024

If I an not mistaken:

  • [environment.'case(os)'.'macos'.GPR_PROJECT_PATH] works
  • [environment.'case(os)'.'macos|linux'.GPR_PROJECT_PATH] doesn't work

@mosteo
Copy link
Member

mosteo commented Sep 3, 2024

I think the problem comes from a misunderstanding. I've tested a similar setup here and it works as expected. But, after inspecting that gnatcoll.toml, what I see is that there is both ... and .macos. entries. This means that ... is not going to match .macos. because it appears explicitly.

TOML is not the best format for anything not trivial. If you visualize the tree, ... is a sibling of macos and it means "others", not "all". So in your case the not-very-nice remedy is to list all cases explicitly.

This however has unearthed a different bug, which is that when two overlapping cases are used, no error is given, nor either match:

[environment.'case(os)'.'linux'.MOCKVAR_LINUX]
prepend = "OKLINUX"

[environment.'case(os)'.'linux|macos'.MOCKVAR_MULTI]
prepend = "OKMULTI"

Either by themselves work as expected, but both simultaneously don't.

@mosteo mosteo changed the title environment.'case(os)'.'...' is ignored on Mac OS X Overlapping cases in manifest don't err nor match Sep 3, 2024
@mosteo mosteo added the type: bug Something isn't working label Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants