[bug-bash] Invalid command arguments return general-failure exit 1 instead of documented usage exit 2
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 68/100
Rechercherichtung
Start by reading docs/ci.md and docs/navigation.md to confirm the exit-code contract, then trace how command argument validation errors are mapped to exit codes; the issue points to ArgumentException, JsonException, CommandNotFoundException, and plain CommandException paths. Reproduce the three commands in PowerShell without a database connection. Done when missing or invalid arguments return 2 while runtime failures retain their documented classification.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Environment
Windows x64, CosmosDBShell 1.1.291-preview (db49321323).
No database connection is required.
Repro (PowerShell)
$package = "$env:USERPROFILE\.dotnet\tools\.store\cosmosdbshell\1.1.291-preview"
$shell = Join-Path $package 'cosmosdbshell.win-x64\1.1.291-preview\tools\net10.0\win-x64\CosmosDBShell.exe'
& $shell --version
$work = Join-Path ([IO.Path]::GetTempPath()) ("cosmos-usage-" + [guid]::NewGuid().ToString("N"))
New-Item -ItemType Directory -Path $work | Out-Null
Set-Location $work
& $shell --output json -c 'echo [1] | filter'
"Exit code: $LASTEXITCODE"
Actual stderr:
{"status":"error","error":"Missing required parameter: ExpressionText"}
Actual exit code: 1.
Another example:
'[{"id":"a","pk":"a"}]' | Set-Content .\sample.json
& $shell --output json -c 'import sample.json --dry-run --concurrency 0'
"Exit code: $LASTEXITCODE"
Actual stderr:
{"status":"error","error":"Concurrency must be a positive integer."}
Actual exit code: 1.
Third exact command:
& $shell --output json -c 'echo [{"id":"a"}] | ftab --format invalid'
"Exit code: $LASTEXITCODE"
Actual stderr:
{"status":"error","error":"The -format option must be one of: default, markdown, html."}
Actual exit code: 1.
Expected
The documented exit-code contract in docs/ci.md
and docs/navigation.md assigns
code 2 to usage errors, invalid/bad arguments, and unknown options. Code 1 is
for failures that do not fit a more specific category. A missing required
parameter and an invalid concurrency argument should therefore classify as 2.
Working control
An unknown command or unknown app-level option correctly returns exit code 2.
Impact
CI wrappers cannot consistently distinguish incorrect invocation from a runtime
failure using the published exit-code contract.
Investigation lead
The current source maps ArgumentException, JsonException, and
CommandNotFoundException to usage errors. Several argument-validation paths
instead create a plain CommandException without a classified inner exception,
which falls through to general failure. This is a candidate root cause,
not a verified fix.
Reproduced against the installed release.
- Vorherrschende Sprache
- C#
- Sterne
- 4
- Forks
- 7
- Ø Merge
- 1 T. 23 Std.
- Gemergte PRs (30 T.)
- 23
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus Azure/CosmosDBShell
-
[bug-bash] print maps a missing item's HTTP 404 to exit 1 instead of documented not-found exit 5Evtl. vergeben @mkrueger hat das vor 1 Tag übernommen. Offenbug bug-bash
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
Azure/CosmosDBShell#279 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[bug-bash] Sequential script commands leak their result into rm as implicit pipe inputEvtl. vergeben @mkrueger hat das vor 1 Tag übernommen. Offenbug bug-bash
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 75/100
Azure/CosmosDBShell#281 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[bug-bash] edit and theme failures silently return exit 1 without a machine-readable stderr errorEvtl. vergeben @mkrueger hat das vor 1 Tag übernommen. Offenbug bug-bash
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 62/100
Azure/CosmosDBShell#278 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[bug-bash] Multi-statement -c and piped stdin silently drop intermediate output and file redirectionsEvtl. vergeben @mkrueger hat das vor 1 Tag übernommen. Offenbug bug-bash
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 75/100
Azure/CosmosDBShell#277 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
Azure/CosmosDBShell#274 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in Azure/CosmosDBShell
Ähnliche Issues
-
t/bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
dotnet/maui#39950 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
CommunityToolkit/Datasync#600 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
NimblePros/deviq-hugo#121 ·
Maintainer antworten meist innerhalb von 1 Tag
-
RANDOM_REPLACE does not keep the date format when the month abbreviation has a trailing periodOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
philterd/phileas-dotnet#188 ·
-
Add All ContributorsOffenenhancement ready-for-human
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
fboucher/2d6-dungeon-app#288 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag