Skip to content

Ensure global command line arguments end up in args like before#40929

Merged
alalazo merged 1 commit intospack:developfrom
haampie:fix/argparse-globals
Nov 7, 2023
Merged

Ensure global command line arguments end up in args like before#40929
alalazo merged 1 commit intospack:developfrom
haampie:fix/argparse-globals

Conversation

@haampie
Copy link
Copy Markdown
Member

@haampie haampie commented Nov 7, 2023

Fixes a bug introduced in #17229.

Previously if you ran spack --verbose command the args.verbose option was
set accordingly in the sub-command, but with the recent changes all global
options are set to defaults in sub commands ( args.verbose == False).

This was used in spack install to ensure that spack --verbose install
implied spack install --verbose too s.t. you wouldn't have to run spack
--verbose install --verbose -- this is relied on in Gitlab CI, which
currently shows no build logs.

I haven't checked if there are other cases where args.<global option> is used
in a sub command.

Maybe the global argument shouldn't be forwarded to sub commands at all, but
that's how it used to be, so let's continue to do that, cause there's no time
to fix it "properly" and the current state is definitely a regression.

@spackbot-app spackbot-app bot added the core PR affects Spack core functionality label Nov 7, 2023
@haampie haampie added this to the v0.21.0 milestone Nov 7, 2023
@haampie haampie requested a review from michaelkuhn November 7, 2023 14:04
@haampie haampie mentioned this pull request Nov 7, 2023
9 tasks
@alalazo alalazo merged commit 3a2ec72 into spack:develop Nov 7, 2023
@michaelkuhn
Copy link
Copy Markdown
Member

Sorry, I didn't notice that this forwarding was a thing. Sadly, this change breaks multi-word aliases:

$ spack -c 'config:aliases:foo:info hdf5' foo
usage: spack info [-ha] [--detectable] [--maintainers] [--no-dependencies] [--no-variants]
                  [--no-versions] [--phases] [--tags] [--tests] [--virtuals]
                  package
spack info: error: the following arguments are required: package

Do we want to keep the forwarding long-term? I find that quite weird, to be honest. Anyway, I will try to figure out a way to fix multi-word aliases again.

@haampie haampie deleted the fix/argparse-globals branch November 7, 2023 20:40
@haampie
Copy link
Copy Markdown
Member Author

haampie commented Nov 7, 2023

It sure is weird, but it was relied on at least in one place.

Forwarding the wrong thing is worse than forwarding the right thing is worse than not forwarding at all ;p

michaelkuhn added a commit to michaelkuhn/spack that referenced this pull request Nov 17, 2023
PR spack#40929 reverted the argument parsing to make `spack --verbose
install` work again. It looks like `--verbose` is the only instance
where this kind of argument inheritance is used since all other commands
override arguments with the same name instead. For instance, `spack
--bootstrap clean` does not invoke `spack clean --bootstrap`.

Therefore, fix multi-line aliases again by parsing the resolved
arguments and instead explicitly pass down `args.verbose` to commands.
gabrielctn pushed a commit to gabrielctn/spack that referenced this pull request Nov 24, 2023
haampie pushed a commit that referenced this pull request Nov 24, 2023
PR #40929 reverted the argument parsing to make `spack --verbose
install` work again. It looks like `--verbose` is the only instance
where this kind of argument inheritance is used since all other commands
override arguments with the same name instead. For instance, `spack
--bootstrap clean` does not invoke `spack clean --bootstrap`.

Therefore, fix multi-line aliases again by parsing the resolved
arguments and instead explicitly pass down `args.verbose` to commands.
haampie pushed a commit that referenced this pull request Nov 24, 2023
PR #40929 reverted the argument parsing to make `spack --verbose
install` work again. It looks like `--verbose` is the only instance
where this kind of argument inheritance is used since all other commands
override arguments with the same name instead. For instance, `spack
--bootstrap clean` does not invoke `spack clean --bootstrap`.

Therefore, fix multi-line aliases again by parsing the resolved
arguments and instead explicitly pass down `args.verbose` to commands.
mtaillefumier pushed a commit to mtaillefumier/spack that referenced this pull request Dec 14, 2023
mtaillefumier pushed a commit to mtaillefumier/spack that referenced this pull request Dec 14, 2023
PR spack#40929 reverted the argument parsing to make `spack --verbose
install` work again. It looks like `--verbose` is the only instance
where this kind of argument inheritance is used since all other commands
override arguments with the same name instead. For instance, `spack
--bootstrap clean` does not invoke `spack clean --bootstrap`.

Therefore, fix multi-line aliases again by parsing the resolved
arguments and instead explicitly pass down `args.verbose` to commands.
alalazo pushed a commit that referenced this pull request Jan 10, 2024
PR #40929 reverted the argument parsing to make `spack --verbose
install` work again. It looks like `--verbose` is the only instance
where this kind of argument inheritance is used since all other commands
override arguments with the same name instead. For instance, `spack
--bootstrap clean` does not invoke `spack clean --bootstrap`.

Therefore, fix multi-line aliases again by parsing the resolved
arguments and instead explicitly pass down `args.verbose` to commands.
RikkiButler20 pushed a commit to RikkiButler20/spack that referenced this pull request Jan 31, 2024
PR spack#40929 reverted the argument parsing to make `spack --verbose
install` work again. It looks like `--verbose` is the only instance
where this kind of argument inheritance is used since all other commands
override arguments with the same name instead. For instance, `spack
--bootstrap clean` does not invoke `spack clean --bootstrap`.

Therefore, fix multi-line aliases again by parsing the resolved
arguments and instead explicitly pass down `args.verbose` to commands.
vjranagit pushed a commit to vjranagit/spack that referenced this pull request Jan 18, 2026
vjranagit pushed a commit to vjranagit/spack that referenced this pull request Jan 18, 2026
PR spack#40929 reverted the argument parsing to make `spack --verbose
install` work again. It looks like `--verbose` is the only instance
where this kind of argument inheritance is used since all other commands
override arguments with the same name instead. For instance, `spack
--bootstrap clean` does not invoke `spack clean --bootstrap`.

Therefore, fix multi-line aliases again by parsing the resolved
arguments and instead explicitly pass down `args.verbose` to commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core PR affects Spack core functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants