[
https://issues.apache.org/jira/browse/SOLR-18648?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
ASF GitHub Bot updated SOLR-18648:
----------------------------------
Labels: cats pull-request-available windows (was: cats windows)
> bin/solr.cmd always exits 0 from "solr auth", whatever the tool reports
> -----------------------------------------------------------------------
>
> Key: SOLR-18648
> URL: https://issues.apache.org/jira/browse/SOLR-18648
> Project: Solr
> Issue Type: Bug
> Components: cli
> Reporter: Jan Høydahl
> Priority: Major
> Labels: cats, pull-request-available, windows
> Time Spent: 10m
> Remaining Estimate: 0h
>
> *Found by CATS*, the cross-platform CLI test framework proposed in SOLR-18642
> — see [PR #5323|https://github.com/apache/solr/pull/5323]. Two tests there
> expose this, and will be marked {{@AwaitsFix}} against this issue so the
> suite stays green. A fix can land before CATS is merged or after; if it lands
> first, please also drop the {{@AwaitsFix}} annotation from those two tests on
> that PR.
> h3. Symptom
> {code}
> > solr auth enable --type basicAuth --credentials any:any --block-unknown ture
> Argument [block-unknown] must be either true or false, but was [ture]
> > echo %ERRORLEVEL%
> 0
> {code}
> The validation runs, the message is correct, and the command still reports
> success. On bash the same invocation exits non-zero. Same for the
> {{update-include-file-only}} option.
> h3. Cause: the auth path has no exit-code check, and {{:done}} is
> unconditional
> Java is right: {{AuthTool}} validates the argument and calls
> {{runtime.exit(1)}}. The status is lost in the batch script.
> Every other command goes through the generic dispatch, which propagates it —
> {{bin/solr.cmd}} lines 270-274:
> {code}
> org.apache.solr.cli.SolrCLI %*
> if errorlevel 1 (
> exit /b 1
> )
> goto done
> {code}
> {{auth}} is routed to its own label instead, and that path ends with no such
> check — lines 1243-1244:
> {code}
> org.apache.solr.cli.SolrCLI auth %AUTH_PARAMS% --solr-include-file
> "%SOLR_INCLUDE%" --auth-conf-dir "%SOLR_HOME%"
> goto done
> {code}
> and {{:done}} returns zero unconditionally — lines 1326-1328:
> {code}
> :done
> ENDLOCAL
> exit /b 0
> {code}
> h3. Scope is wider than the validation case
> Nothing on that path inspects {{ERRORLEVEL}}, so *any* failure of {{solr
> auth}} on Windows is reported as success — a bad password, an unreachable
> ZooKeeper, an unwritable include file. A {{.bat}} caller testing
> {{%ERRORLEVEL%}}, or any CI step, concludes the command worked.
> h3. Fix
> Give the auth path the same three lines the generic dispatch has at 271-273.
> Worth checking the other dedicated labels in the same file for the same
> omission while there.
> 🤖 AI Assisted
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]