Skip to content

configure.sh's workflowModel Registry Read Is a Plain jq -r, Aborting on Windows With No Model Passed #1881

Description

@ptr727

Summary

Next in the #1123/#1234/#1246/#1247/#1253/#1254 chain. repo-config/configure.sh resolves $model from the registry with a plain jq -r, one function above a sibling read that already strips the trailing CR a native Windows jq appends.

The defect

if ! model="$(jq -r --arg n "$name" '(.repos[] | select(.name==$n) | .workflowModel) // .defaults.workflowModel // "release"' "$registry")"; then

(repo-config/configure.sh, top-level "Resolve the workflow model" block, around line 82.) The archived_status read a few lines above it, at line 66, already pipes through | sed $'s/\r$//' for exactly this reason. This read does not, so on a native Windows jq $model becomes release\r (or operational\r). The case "$model" in release) ... operational) ... *) echo "Unknown workflow model '$model'..." dispatch a few lines below has no branch that matches a CR-suffixed value, so it falls to *) and exits 1 with "Unknown workflow model" - on every invocation of configure.sh check or configure.sh apply that does not pass --model explicitly, which is the common case, on such a host.

This is the same CRLF-exposure class #1123/#1234/#1246/#1247/#1253/#1254 already fixed at other sites in the same file, on the workflow-model resolution both apply and check depend on before anything ruleset- or environment-specific runs.

Suggested fix

jqr() is defined later in the file (used by apply_ruleset() and others), so it is not yet in scope this early. Strip the CR inline instead, matching line 66's own | sed $'s/\r$//' treatment right above this read, rather than reordering the file to move jqr()'s definition earlier.

Context

Found via an adversarial local-review pass dispatched while fixing #1253. Filed separately to keep that PR scoped to its assigned line.

Unverified on a real Windows host, same as #1123/#1234/#1246/#1247/#1253/#1254.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scriptA defect in hub tooling

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions