From deada5d3831784a38f13b3811d86d629e8f73aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Barbieri?= Date: Fri, 10 Mar 2017 11:41:13 +0100 Subject: [PATCH 1/2] Fix checkconfig args in indextool due to if ( i!=argc ) error handling, all the parameter read must increment i, it was not done for checkconfig https://github.com/sphinxsearch/sphinx/blob/c116ce96f38d17a5aa425ac838e2035e3417fafa/src/indextool.cpp#L941 --- src/indextool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/indextool.cpp b/src/indextool.cpp index fdea0c080..4d13fd5b9 100644 --- a/src/indextool.cpp +++ b/src/indextool.cpp @@ -855,7 +855,7 @@ int main ( int argc, char ** argv ) OPT1 ( "--build-infixes" ) { eCommand = CMD_BUILDINFIXES; sIndex = argv[++i]; } OPT1 ( "--build-skips" ) { eCommand = CMD_BUILDSKIPS; sIndex = argv[++i]; } OPT1 ( "--morph" ) { eCommand = CMD_MORPH; sIndex = argv[++i]; } - OPT1 ( "--checkconfig" ) { eCommand = CMD_CHECKCONFIG; } + OPT1 ( "--checkconfig" ) { eCommand = CMD_CHECKCONFIG; ++i; } // prevent argc != i OPT1 ( "--optimize-rt-klists" ) { eCommand = CMD_OPTIMIZEKLISTS; From e930b747e14e4d7432a801a905663c8ba35954c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Barbieri?= Date: Wed, 22 Mar 2017 00:40:07 +0100 Subject: [PATCH 2/2] move --checkconfig in argless options --- src/indextool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/indextool.cpp b/src/indextool.cpp index 4d13fd5b9..3ea83fbfc 100644 --- a/src/indextool.cpp +++ b/src/indextool.cpp @@ -842,6 +842,7 @@ int main ( int argc, char ** argv ) if ( argv[i][0]!='-' ) break; OPT ( "-q", "--quiet" ) { bQuiet = true; continue; } OPT1 ( "--strip-path" ) { bStripPath = true; continue; } + OPT1 ( "--checkconfig" ) { eCommand = CMD_CHECKCONFIG; ++i; } // prevent argc != i // handle options/commands with 1+ args if ( (i+1)>=argc ) break; @@ -855,7 +856,6 @@ int main ( int argc, char ** argv ) OPT1 ( "--build-infixes" ) { eCommand = CMD_BUILDINFIXES; sIndex = argv[++i]; } OPT1 ( "--build-skips" ) { eCommand = CMD_BUILDSKIPS; sIndex = argv[++i]; } OPT1 ( "--morph" ) { eCommand = CMD_MORPH; sIndex = argv[++i]; } - OPT1 ( "--checkconfig" ) { eCommand = CMD_CHECKCONFIG; ++i; } // prevent argc != i OPT1 ( "--optimize-rt-klists" ) { eCommand = CMD_OPTIMIZEKLISTS;