Skip to content

Commit a483cb1

Browse files
committed
Do not use -C. Fix up --canonicalRoot and -N,--symlink verbiage.
1 parent 5054bfa commit a483cb1

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

opengrok-indexer/src/main/java/org/opengrok/indexer/index/Indexer.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -477,28 +477,27 @@ public static String[] parseOptions(String[] argv) throws ParseException {
477477
}
478478
);
479479

480-
parser.on("-C", "--canonicalRoot", "=/path/",
481-
"Allow symlinks to canonical targets starting with the specified",
482-
"root without otherwise needing to specify -N,--symlink for such",
483-
"symlinks. A canonical root must end with a file separator. For",
484-
"security a canonical root cannot be the root directory.",
485-
"Option may be repeated.").Do(v -> {
486-
String root = (String) v;
487-
if (!root.endsWith("/") && !root.endsWith("\\")) {
488-
die("--canonicalRoot must end with a separator");
489-
}
490-
if (root.equals("/") || root.equals("\\")) {
491-
die("--canonicalRoot cannot be the root directory");
492-
}
493-
canonicalRoots.add(root);
494-
});
495-
496480
parser.on("-c", "--ctags", "=/path/to/ctags",
497481
"Path to Universal Ctags",
498482
"By default takes the Universal Ctags in PATH.").
499483
Do(ctagsPath -> cfg.setCtags((String) ctagsPath)
500484
);
501485

486+
parser.on("--canonicalRoot", "=/path/",
487+
"Allow symlinks to canonical targets starting with the specified root",
488+
"without otherwise needing to specify -N,--symlink for such symlinks. A",
489+
"canonical root must end with a file separator. For security, a canonical",
490+
"root cannot be the root directory. Option may be repeated.").Do(v -> {
491+
String root = (String) v;
492+
if (!root.endsWith("/") && !root.endsWith("\\")) {
493+
die("--canonicalRoot must end with a separator");
494+
}
495+
if (root.equals("/") || root.equals("\\")) {
496+
die("--canonicalRoot cannot be the root directory");
497+
}
498+
canonicalRoots.add(root);
499+
});
500+
502501
parser.on("--checkIndexVersion",
503502
"Check if current Lucene version matches index version").Do(v -> {
504503
checkIndexVersion = true;
@@ -598,9 +597,10 @@ public static String[] parseOptions(String[] argv) throws ParseException {
598597
.Do(mandocPath -> cfg.setMandoc((String) mandocPath));
599598

600599
parser.on("-N", "--symlink", "=/path/to/symlink",
601-
"Allow this symlink to be followed. Option may be repeated.",
602-
"By default only symlinks directly under source root directory",
603-
"are allowed. See also -C,--canonicalRoot").Do(v ->
600+
"Allow the symlink to be followed. Other symlinks targeting the same",
601+
"canonical target or canonical children will be allowed too. Option may",
602+
"be repeated. (By default only symlinks directly under source root",
603+
"directory are allowed. See also --canonicalRoot)").Do(v ->
604604
allowedSymlinks.add((String) v));
605605

606606
parser.on("-n", "--noIndex",

opengrok-indexer/src/test/java/org/opengrok/indexer/index/IndexDatabaseSymlinksTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ public void testSymlinksWithFullCanonicalRoot() throws IOException, IndexerExcep
138138

139139
/*
140140
* For this test, don't even bother to include default-accepted links
141-
* immediately under sourceRoot, as -C,--canonicalRoot as specified
142-
* here encompasses all of external/.
141+
* immediately under sourceRoot, as --canonicalRoot as specified here
142+
* encompasses all of external/.
143143
*/
144144
env.setCanonicalRoots(new HashSet<>(Collections.singletonList(
145145
externalRoot.getCanonicalPath())));

0 commit comments

Comments
 (0)