Skip to content

fix: correct positional arg shift after use-git-cli deprecation - #115

Closed
laurigates wants to merge 1 commit into
EmbarkStudios:mainfrom
laurigates:fix/log-level-arg-shift
Closed

fix: correct positional arg shift after use-git-cli deprecation#115
laurigates wants to merge 1 commit into
EmbarkStudios:mainfrom
laurigates:fix/log-level-arg-shift

Conversation

@laurigates

Copy link
Copy Markdown

Fix positional-argument shift introduced by deprecating use-git-cli

entrypoint.sh consumes a fixed number of leading positional arguments and then runs cargo-deny "$@" on the remainder:

# $1 rust-version, $2 credentials, $3 ssh-key, $4 ssh-known-hosts, $5 use-git-cli
if [ -n "$5" ]; then
    export CARGO_NET_GIT_FETCH_WITH_CLI="$5"
fi
shift 5

Commit 8b229e2 ("Deprecate use-git-cli") removed the use-git-cli entry from action.yml's args: but left entrypoint.sh reading five leading positionals. As a result --log-level is consumed into the (now nonexistent) use-git-cli slot, shift 5 discards it, and the log-level value falls into cargo-deny's subcommand position — so every run fails with:

error: unrecognized subcommand 'warn'

This regressed @v2 at the v2.1.0 release.

Change

Drop the use-git-cli positional handling (consistent with its deprecation to no-effect) and shift one fewer:

-if [ -n "$5" ]; then
-    export CARGO_NET_GIT_FETCH_WITH_CLI="$5"
-fi
-
-shift 5
+shift 4

Verification

Simulating the entrypoint's shift N then cargo-deny $* against the exact arg vector GitHub passes:

args + entrypoint resulting command result
v2.0.20 (use-git-cli present) + shift 5 cargo-deny --log-level warn --manifest-path ./Cargo.toml check licenses bans sources ok (baseline)
v2.1.0 (use-git-cli removed) + shift 5 cargo-deny warn --manifest-path ./Cargo.toml check licenses bans sources unrecognized subcommand 'warn'
v2.1.0 + shift 4 (this PR) cargo-deny --log-level warn --manifest-path ./Cargo.toml check licenses bans sources ok — identical to baseline

The shift 4 result is byte-identical to the working v2.0.20 layout, and the downstream dirname "$4" (manifest directory) reference still resolves to the manifest path as before.

Fixes #114

Removing the use-git-cli entry from action.yml's args (8b229e2) left
entrypoint.sh consuming five leading positionals and running `shift 5`.
As a result --log-level is consumed into the removed use-git-cli slot,
`shift 5` discards it, and the log-level value falls into cargo-deny's
subcommand position — every run fails with
`error: unrecognized subcommand '<log-level>'`.

Drop the (now deprecated, no-effect) use-git-cli handling and shift one
fewer positional. The post-shift arguments are byte-identical to the
working v2.0.20 layout, and the downstream `dirname "$4"` manifest-dir
reference still resolves correctly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Jake-Shadle

Copy link
Copy Markdown
Member

#116

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.

v2.1.0 regression: every run fails with error: unrecognized subcommand '<log-level>'

2 participants