You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "epugh (via GitHub)" <gi...@apache.org> on 2023/05/29 23:05:58 UTC
[GitHub] [solr] epugh opened a new pull request, #1670: SOLR-16829: Delegate arg parsing and help usage to java
epugh opened a new pull request, #1670:
URL: https://github.com/apache/solr/pull/1670
https://issues.apache.org/jira/browse/SOLR-16829
# Description
Going thorugh and attempting to remove the help usage (which seems to require also removing the arg parsing!)
# Solution
Please provide a short description of the approach taken to implement your solution.
# Tests
Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.
# Checklist
Please review the following and check all that apply:
- [ ] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/solr/HowToContribute) and my code conforms to the standards described there to the best of my ability.
- [ ] I have created a Jira issue and added the issue ID to my pull request title.
- [ ] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended)
- [ ] I have developed this patch against the `main` branch.
- [ ] I have run `./gradlew check`.
- [ ] I have added tests for my changes.
- [ ] I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1593588424
That would be perfect. This PR is ready for merging as soon as we have the Windows side dealt with. There will be at least a Round 2, and maybe a Round 3 when we tackle `package` and `zk` commands ;-).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] sonatype-lift[bot] commented on a diff in pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java
Posted by "sonatype-lift[bot] (via GitHub)" <gi...@apache.org>.
sonatype-lift[bot] commented on code in PR #1670:
URL: https://github.com/apache/solr/pull/1670#discussion_r1225342278
##########
solr/core/src/java/org/apache/solr/cli/CreateCoreTool.java:
##########
@@ -54,56 +51,50 @@ public String getName() {
public List<Option> getOptions() {
return List.of(
SolrCLI.OPTION_SOLRURL,
- Option.builder(NAME)
+ Option.builder("c")
+ .longOpt("name")
.argName("NAME")
.hasArg()
.required(true)
.desc("Name of the core to create.")
.build(),
- Option.builder("confdir")
- .argName("CONFIG")
+ Option.builder("d")
+ .longOpt("confdir")
+ .argName("NAME")
.hasArg()
.required(false)
.desc(
"Configuration directory to copy when creating the new core; default is "
+ SolrCLI.DEFAULT_CONFIG_SET
+ '.')
.build(),
- Option.builder("configsetsDir")
- .argName("DIR")
- .hasArg()
- .required(true)
- .desc("Path to configsets directory on the local system.")
- .build(),
+ // Option.builder("configsetsDir")
+ // .argName("DIR")
+ // .hasArg()
+ // .required(true)
+ // .desc("Path to configsets directory on the local system.")
+ // .build(),
SolrCLI.OPTION_VERBOSE);
}
@Override
public void runImpl(CommandLine cli) throws Exception {
+ String coreName = cli.getOptionValue("name");
String solrUrl = cli.getOptionValue("solrUrl", SolrCLI.DEFAULT_SOLR_URL);
- if (!solrUrl.endsWith("/")) solrUrl += "/";
-
- File configsetsDir = new File(cli.getOptionValue("configsetsDir"));
- if (!configsetsDir.isDirectory())
- throw new FileNotFoundException(configsetsDir.getAbsolutePath() + " not found!");
-
- String configSet = cli.getOptionValue("confdir", SolrCLI.DEFAULT_CONFIG_SET);
- File configSetDir = new File(configsetsDir, configSet);
- if (!configSetDir.isDirectory()) {
- // we allow them to pass a directory instead of a configset name
- File possibleConfigDir = new File(configSet);
- if (possibleConfigDir.isDirectory()) {
- configSetDir = possibleConfigDir;
- } else {
- throw new FileNotFoundException(
- "Specified config directory "
- + configSet
- + " not found in "
- + configsetsDir.getAbsolutePath());
- }
+ if (!solrUrl.endsWith("/")) {
+ solrUrl += "/";
}
- String coreName = cli.getOptionValue(NAME);
+ final String solrInstallDir = System.getProperty("solr.install.dir");
+ final String confDirName =
+ cli.getOptionValue("confdir", SolrCLI.DEFAULT_CONFIG_SET); // CREATE_CONFDIR
+
+ // we allow them to pass a directory instead of a configset name
+ File configsetDir = new File(confDirName);
Review Comment:
<picture><img alt="9% of developers fix this issue" src="https://lift.sonatype.com/api/commentimage/fixrate/9/display.svg"></picture>
<b>*[PATH_TRAVERSAL_IN](https://find-sec-bugs.github.io/bugs.htm#PATH_TRAVERSAL_IN):</b>* This API (java/io/File.<init>(Ljava/lang/String;)V) reads a file whose location might be specified by user input
ââ <b>2 similar findings have been found in this PR</b>
<details><summary>đ Expand here to view all instances of this finding</summary><br/>
<div align=\"center\">
| **File Path** | **Line Number** |
| ------------- | ------------- |
| solr/core/src/java/org/apache/solr/cli/CreateCoreTool.java | [127](https://github.com/apache/solr/blob/6a915d38e697cefdd5a703c3cf541c11926cc52e/solr/core/src/java/org/apache/solr/cli/CreateCoreTool.java#L127) |
| solr/core/src/java/org/apache/solr/cli/CreateCoreTool.java | [166](https://github.com/apache/solr/blob/6a915d38e697cefdd5a703c3cf541c11926cc52e/solr/core/src/java/org/apache/solr/cli/CreateCoreTool.java#L166) |
<p><a href="https://lift.sonatype.com/results/github.com/apache/solr/01H2JJVT8RQKMKJRZ9WD6H34SG?t=FindSecBugs|PATH_TRAVERSAL_IN" target="_blank">Visit the Lift Web Console</a> to find more details in your report.</p></div></details>
---
<details><summary>âšī¸ Expand to see all <b>@sonatype-lift</b> commands</summary>
You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings.
| **Command** | **Usage** |
| ------------- | ------------- |
| `@sonatype-lift ignore` | Leave out the above finding from this PR |
| `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR |
| `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file |
**Note:** When talking to LiftBot, you need to **refresh** the page to see its response.
<sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] sonatype-lift[bot] commented on a diff in pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java
Posted by "sonatype-lift[bot] (via GitHub)" <gi...@apache.org>.
sonatype-lift[bot] commented on code in PR #1670:
URL: https://github.com/apache/solr/pull/1670#discussion_r1225418993
##########
solr/core/src/java/org/apache/solr/cli/CreateCollectionTool.java:
##########
@@ -174,11 +219,56 @@ protected void runCloudTool(CloudSolrClient cloudSolrClient, CommandLine cli) th
collectionName,
numShards,
replicationFactor);
- if (confname != null && !confname.trim().isEmpty()) {
- endMessage += String.format(Locale.ROOT, " with config-set '%s'", confname);
+ if (confName != null && !confName.trim().isEmpty()) {
+ endMessage += String.format(Locale.ROOT, " with config-set '%s'", confName);
}
echo(endMessage);
}
}
+
+ /**
+ * Ensure the confDirName is a path to a directory by itself or when it is combined with the
+ * solrInstallDir.
+ */
+ private void ensureConfDirExists(String confDirName, String solrInstallDir) {
+ if (!new File(confDirName).isDirectory()) {
Review Comment:
<picture><img alt="9% of developers fix this issue" src="https://lift.sonatype.com/api/commentimage/fixrate/9/display.svg"></picture>
<b>*[PATH_TRAVERSAL_IN](https://find-sec-bugs.github.io/bugs.htm#PATH_TRAVERSAL_IN):</b>* This API (java/io/File.<init>(Ljava/lang/String;)V) reads a file whose location might be specified by user input
---
<details><summary>âšī¸ Expand to see all <b>@sonatype-lift</b> commands</summary>
You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings.
| **Command** | **Usage** |
| ------------- | ------------- |
| `@sonatype-lift ignore` | Leave out the above finding from this PR |
| `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR |
| `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file |
**Note:** When talking to LiftBot, you need to **refresh** the page to see its response.
<sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details>
##########
solr/core/src/java/org/apache/solr/cli/CreateCollectionTool.java:
##########
@@ -174,11 +219,56 @@ protected void runCloudTool(CloudSolrClient cloudSolrClient, CommandLine cli) th
collectionName,
numShards,
replicationFactor);
- if (confname != null && !confname.trim().isEmpty()) {
- endMessage += String.format(Locale.ROOT, " with config-set '%s'", confname);
+ if (confName != null && !confName.trim().isEmpty()) {
+ endMessage += String.format(Locale.ROOT, " with config-set '%s'", confName);
}
echo(endMessage);
}
}
+
+ /**
+ * Ensure the confDirName is a path to a directory by itself or when it is combined with the
+ * solrInstallDir.
+ */
+ private void ensureConfDirExists(String confDirName, String solrInstallDir) {
+ if (!new File(confDirName).isDirectory()) {
+ final String fullConfDir = solrInstallDir + "/server/solr/configsets/" + confDirName;
+ if (!new File(fullConfDir).isDirectory()) {
Review Comment:
<picture><img alt="9% of developers fix this issue" src="https://lift.sonatype.com/api/commentimage/fixrate/9/display.svg"></picture>
<b>*[PATH_TRAVERSAL_IN](https://find-sec-bugs.github.io/bugs.htm#PATH_TRAVERSAL_IN):</b>* This API (java/io/File.<init>(Ljava/lang/String;)V) reads a file whose location might be specified by user input
---
<details><summary>âšī¸ Expand to see all <b>@sonatype-lift</b> commands</summary>
You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings.
| **Command** | **Usage** |
| ------------- | ------------- |
| `@sonatype-lift ignore` | Leave out the above finding from this PR |
| `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR |
| `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file |
**Note:** When talking to LiftBot, you need to **refresh** the page to see its response.
<sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on a diff in pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #1670:
URL: https://github.com/apache/solr/pull/1670#discussion_r1257307670
##########
solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java:
##########
@@ -60,11 +60,11 @@ public List<Option> getOptions() {
SolrCLI.OPTION_SOLRURL,
SolrCLI.OPTION_ZKHOST,
Option.builder("c")
- .argName("COLLECTION")
+ .longOpt("name")
Review Comment:
also... one more thing is that the long name is actually `--name`.. I was struggling with the CreateTool which used `--name` since it can do core or collection. Can't use `--collection` for a Core!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] mkhludnev commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "mkhludnev (via GitHub)" <gi...@apache.org>.
mkhludnev commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1597731079
ok I've got https://github.com/epugh/solr/pull/2/files, I'll check it out. Thanks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1604503377
@Willdotwhite @mkhludnev so what is the best way to bring in the changes that both of you have made? https://github.com/apache/solr/compare/main...mkhludnev:solr:SOLR-16829 shows some great improvments from each of you? Do you each propose a PR to the branch that I have in my github.com/epugh/solr? Just not sure how to get those commits into the PR? @Willdotwhite are the changes you've made ready to go once `status` is done?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1611942622
@Willdotwhite I had a thought which is that maybe I'll back out the `bin/solr status`command changes, since that was giving you some problems, and move that to the Round 2 of work, which then would make this committable?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] mkhludnev commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "mkhludnev (via GitHub)" <gi...@apache.org>.
mkhludnev commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1596124841
Hi, @epugh .
I've caught that you need to test something on windows. Could let me know what you need to check exactly?, I can do it tomorrow.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] Willdotwhite commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "Willdotwhite (via GitHub)" <gi...@apache.org>.
Willdotwhite commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1614280342
> okay @Willdotwhite I had to restore a change to `StatusTool.java` to make it work on Unix.. Is it possible that we have the .cmd and the .sh somewhat working at cross purposes in how we decide to output the help?
Sorry @epugh , I think I was just a bit too tired yesterday and flubbed my testing - I've just put the condition back to `if ((cli.getOptions().length == 0 && cli.getArgs().length == 0) || cli.hasOption("h") || cli.hasOption("help")) {` on my machine and the status checks work as before; not really sure what happened there đ¤
I think both are inline (although I'll fully rebuild from this branch during my coffee break in ~2 hours and confirm).
By the way, a bit of copypasta has slipped through the net on the hashbang of `solr.sh` [just here](https://github.com/apache/solr/pull/1670/files#diff-49c29c8f653341f48008c38f5f2cf970fa430cdca29181c819d7bdcfcc722980R1)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh merged pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh merged PR #1670:
URL: https://github.com/apache/solr/pull/1670
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1602578313
@mkhludnev I've chased down the latest merge conflicts ;-). Let me know how it goes, and if you want to do a pairing session, I can jump on next week.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1592156395
More ambitious is this PR that I haven't tried to change the `solr.cmd` yet, but it should mimic what was done in `solr`. cc @willdotwhite
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1612190694
@Willdotwhite can we delete the method `status_usage` ? Line 282 has:
```
IF "%SCRIPT_CMD%"=="status" goto status_usage
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on a diff in pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #1670:
URL: https://github.com/apache/solr/pull/1670#discussion_r1257305109
##########
solr/bin/solr:
##########
@@ -937,8 +814,8 @@ function stop_solr() {
if [ $# -eq 1 ]; then
case $1 in
- -help|-h)
- print_usage ""
+ -help|-h)
+ run_tool ""
Review Comment:
Not that I know of... Maybe because this is shell? I didn't run shellcheck after making changes...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on a diff in pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #1670:
URL: https://github.com/apache/solr/pull/1670#discussion_r1257305944
##########
solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java:
##########
@@ -60,11 +60,11 @@ public List<Option> getOptions() {
SolrCLI.OPTION_SOLRURL,
SolrCLI.OPTION_ZKHOST,
Option.builder("c")
- .argName("COLLECTION")
+ .longOpt("name")
+ .argName("NAME")
.hasArg()
.required(false)
Review Comment:
https://issues.apache.org/jira/browse/SOLR-16882 for fixing this... I will investigate the .bats test...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1597362729
@mkhludnev right now it's a bit more then "just a test". I have made a lot of changes to `bin/solr` and need the same changes applied to `bin/solr.cmd` ;-). The change was enoguh that I didn't think I could just blindly edit `solr.cmd` and hope it would pass.... @Willdotwhite has done me the favour of testing a couple of places wehre I felt more confident that I could just edit `solr.cmd`!!! I'd love it if you could modify solr.cmd.. My attmeptls to get virtualbox to run windows on my laptop haven't worked out yet, it's been unusualbly slow...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] sonatype-lift[bot] commented on a diff in pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java
Posted by "sonatype-lift[bot] (via GitHub)" <gi...@apache.org>.
sonatype-lift[bot] commented on code in PR #1670:
URL: https://github.com/apache/solr/pull/1670#discussion_r1210962806
##########
solr/core/src/java/org/apache/solr/cli/CreateCollectionTool.java:
##########
@@ -181,4 +235,38 @@ protected void runCloudTool(CloudSolrClient cloudSolrClient, CommandLine cli) th
echo(endMessage);
}
}
+
+ private String ensureConfDirExists(String confDirName, String solrInstallDir) {
+ final String fullConfDir = solrInstallDir + "/server/solr/configsets/" + confDirName;
+ if (!new File(fullConfDir).isDirectory()) {
Review Comment:
<picture><img alt="9% of developers fix this issue" src="https://lift.sonatype.com/api/commentimage/fixrate/9/display.svg"></picture>
<b>*[PATH_TRAVERSAL_IN](https://find-sec-bugs.github.io/bugs.htm#PATH_TRAVERSAL_IN):</b>* This API (java/io/File.<init>(Ljava/lang/String;)V) reads a file whose location might be specified by user input
---
<details><summary>âšī¸ Expand to see all <b>@sonatype-lift</b> commands</summary>
You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings.
| **Command** | **Usage** |
| ------------- | ------------- |
| `@sonatype-lift ignore` | Leave out the above finding from this PR |
| `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR |
| `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file |
**Note:** When talking to LiftBot, you need to **refresh** the page to see its response.
<sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] Willdotwhite commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "Willdotwhite (via GitHub)" <gi...@apache.org>.
Willdotwhite commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1593680985
Awesome đđģ I'll have a read through the changes to `bin/solr` tomorrow and have a crack at it on Sunday if that's ok time-wise? (Busy couple of days coming up, apologies if that's inconvenient)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1590988878
Tests all pass! I'd love to get some review on this so I can wrap it up before I start tackling the rest of the Solr commands which may be tougher to port... (looking at you bin/solr zk)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on a diff in pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #1670:
URL: https://github.com/apache/solr/pull/1670#discussion_r1257306629
##########
solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java:
##########
@@ -60,11 +60,11 @@ public List<Option> getOptions() {
SolrCLI.OPTION_SOLRURL,
SolrCLI.OPTION_ZKHOST,
Option.builder("c")
- .argName("COLLECTION")
+ .longOpt("name")
Review Comment:
Thanks for jumping on this... https://issues.apache.org/jira/browse/SOLR-16824 was opened to specifically track that conversion to the `--collection` approach. I agree on the syntax changes needing tracking in Upgrade Notes. I might start with the Upgrade Notes for 10.x, but if we back port, then bring them back to that version of Upgrade Notes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1613846016
okay @Willdotwhite I had to restore a change to `StatusTool.java` to make it work on Unix.. Is it possible that we have the .cmd and the .sh somewhat working at cross purposes in how we decide to output the help?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] gerlowskija commented on a diff in pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija commented on code in PR #1670:
URL: https://github.com/apache/solr/pull/1670#discussion_r1256262139
##########
solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java:
##########
@@ -60,11 +60,11 @@ public List<Option> getOptions() {
SolrCLI.OPTION_SOLRURL,
SolrCLI.OPTION_ZKHOST,
Option.builder("c")
- .argName("COLLECTION")
+ .longOpt("name")
+ .argName("NAME")
.hasArg()
.required(false)
Review Comment:
[-1] AFAICT from [this bin/solr code](https://github.com/apache/solr/pull/1670/files#diff-49c29c8f653341f48008c38f5f2cf970fa430cdca29181c819d7bdcfcc722980L1003), the collection parameter should be required for the healthcheck tool.
Prior to this commit, we enforced this requirement in the bash/Windows-scripts, but now that we don't parse args or enforce required params there any more - we should update the `.required(...)` call here to be correct.
(Assuming I'm reading the old `bin/solr` code correctly at least; always possible I'm wrong.)
##########
solr/bin/solr:
##########
@@ -937,8 +814,8 @@ function stop_solr() {
if [ $# -eq 1 ]; then
case $1 in
- -help|-h)
- print_usage ""
+ -help|-h)
+ run_tool ""
Review Comment:
[Q] Does nothing in `tidy`/`check` complain about trailing whitespace? I don't care much, but I'm surprised given how we've leaned into code-formatting in recent years.
##########
solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java:
##########
@@ -60,11 +60,11 @@ public List<Option> getOptions() {
SolrCLI.OPTION_SOLRURL,
SolrCLI.OPTION_ZKHOST,
Option.builder("c")
- .argName("COLLECTION")
+ .longOpt("name")
Review Comment:
[Q] I've picked HealthcheckTool's handling of its "collection" parameter as a concrete example, but the concern below applies in a number of places.
----
Historically, `bin/solr healthcheck` has accepted the collection name using either `-c` or `-collection`. But with this PR, AFAICT it now accepts `-c` and `--collection` (note the double-dash in the longopt).
Personally, I like the new syntax better - double-dashes on longopts are pretty ubiquitous in other CLI tools, and Solr's usage of `-longoptName` always struck me as quirky. That said though, it's a backwards incompatible change so we need to roll it out carefully.
If you **do** plan on committing some form of this to branch_9x, do you have plans for addressing backcompat? (i.e. Would the branch_9x version accept both `--collection` and `-collection` as longopt forms?)
If you **don't** plan on committing some form of this to branch_9x, things are better from a backcompat perspective but we'd still need to call out the syntax changes in CHANGES.txt or our Upgrade Notes, presumably?Do you have a general sense or (even better) a list of the syntax changes that'd need documented?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1623990318
I *think* we are finally there... Responding to the last bits of feedback.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on a diff in pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #1670:
URL: https://github.com/apache/solr/pull/1670#discussion_r1257307728
##########
solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java:
##########
@@ -60,11 +60,11 @@ public List<Option> getOptions() {
SolrCLI.OPTION_SOLRURL,
SolrCLI.OPTION_ZKHOST,
Option.builder("c")
- .argName("COLLECTION")
+ .longOpt("name")
Review Comment:
LIkewise the same thinking with the DeleteTool
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] Willdotwhite commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "Willdotwhite (via GitHub)" <gi...@apache.org>.
Willdotwhite commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1593524737
> More ambitious is this PR that I haven't tried to change the `solr.cmd` yet, but it should mimic what was done in `solr`. cc @Willdotwhite
Do you want me to take a crack at the solr.cmd changes (and would that be a PR from my fork into your source branch?) @epugh or do you plan to make the changes on this PR soon (in which case I'll focus on getting my local environment setup ready for testing)? :D
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1593682351
That is perfect !
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] epugh commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1587223833
So... I'm starting to think this is a Solr 10 only change... There are so many small cleanups and other awkwardnesses in the CLI, that making it work in Solr 9 is going to cause a LOT of folks some pain. Not to mention, when we start moving all the commands like `-solrUrl` to `--solrUrl` pattern (in another PR)... Plus, I'm thinking that this is going to need to bake for a while......
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
[GitHub] [solr] janhoy commented on pull request #1670: SOLR-16829: Delegate arg parsing and help usage to java. (Round 1)
Posted by "janhoy (via GitHub)" <gi...@apache.org>.
janhoy commented on PR #1670:
URL: https://github.com/apache/solr/pull/1670#issuecomment-1587234842
> So... I'm starting to think this is a Solr 10 only change... There are so many small cleanups and other awkwardnesses in the CLI, that making it work in Solr 9 is going to cause a LOT of folks some pain. Not to mention, when we start moving all the commands like `-solrUrl` to `--solrUrl` pattern (in another PR)... Plus, I'm thinking that this is going to need to bake for a while......
Sounds fair to make this a main-only change, and documenting the changes in upgrade notes. Solr 10 is coming even if it feels distant right now...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org