Comments (7)
I haven't tested recently, but I think the default behaviour is to follow symlinks only if they are direct children of the source root directory. Symlinks further down in the directory structure are not followed.
from opengrok.
👍
from opengrok.
is this somehow related to #689 ?
from opengrok.
@kahatlen : yep, this is the case, index/Indexer.java:main()
contains:
524 // automatically allow symlinks that are directly in source root
525 String file = cfg.getSourceRoot();
526 if (file != null) {
527 File sourceRootFile = new File(file);
528 File[] projectDirs = sourceRootFile.listFiles();
529 if (projectDirs != null) {
530 for (File projectDir : projectDirs) {
531 if (!projectDir.getCanonicalPath().equals(projectDir.getAbsolutePath())) {
532 allowedSymlinks.add(projectDir.getAbsolutePath());
533 }
534 }
535 }
536 }
So I guess this is just a matter of adjusting the usage message for -N
.
from opengrok.
One example of how this works currently. Say we have the following under source root:
another/
foo/
bar -> foo
dir/
dir/one/
dir/two -> one
All of the directories (designated by /
suffix) are repositories. The contents of all of the above should be indexed by default except the 'two' entry. For this, one would have to add -N /dir/two
to the options.
However, even though the two
is not recognized as allowedSymlinks
it is indexed.
from opengrok.
This behavior is because of:
746 private boolean acceptSymlink(String absolutePath, String canonicalPath) throws IOException {
747 // Always accept local symlinks
748 if (isLocal(canonicalPath)) {
749 return true;
750 }
...
for the two
symlink above it returns true thanks to line 749. This has been last changed in cset 9239606 ( authored by @kahatlen ) with fix for #159.
from opengrok.
isLocal()
returns true because of line 787 below:
771 private boolean isLocal(String path) {
772 RuntimeEnvironment env = RuntimeEnvironment.getInstance();
773 String srcRoot = env.getSourceRootPath();
774
775 boolean local = false;
776
777 if (path.startsWith(srcRoot)) {
778 if (env.hasProjects()) {
779 String relPath = path.substring(srcRoot.length());
780 if (project.equals(Project.getProject(relPath))) {
781 // File is under the current project, so it's local.
782 local = true;
783 }
784 } else {
785 // File is under source root, and we don't have projects, so
786 // consider it local.
787 local = true;
788 }
789 }
790
791 return local;
792 }
This is because path
is /var/opengrok/src/dir/one
(which is the canonical path for var/opengrok/src/dir/two
starts with srcRoot
(which is /var/opengrok/src-symlinks
).
from opengrok.
Related Issues (20)
- `READONLY_CONFIG_FILE` doesn't work in docker containers HOT 1
- make the "is-annotatable" check more precise
- Opengrok web application isn't accessible during reindex HOT 8
- OpenGrok Indexer. FileNotFoundException while indexing directories HOT 8
- Fix typo in CONTRIBUTING.md file HOT 1
- cannot remove suggester data for extended period of time due to pending rebuilds
- binary data in logs again due to annotation processing HOT 1
- indexer might degrade to serial processing for the trailing project HOT 1
- limit addFile() processing time HOT 2
- Opengrok not showing projects - indexer is working.
- Dockerfile requests a vulnerable version of Apache Tomcat HOT 1
- Support GitHub repos that only allow checkout through web URLs
- History based reindex is on, however history is off. History has to be enabled for history based reindex
- `opengrok-reindex-project` Triggers API-Ratelimit that doesn't reset
- Perforce Error in Project /& Git Repo
- New Bug? Prevents being able to index read-only filesystem
- Opengrok notices newer files but does not rebuild the xref .gz files
- Opengrok notices newer files but does not rebuild the xref .gz files
- OpenGrok webapp fails to start after adding a project
- Opengrok UI shows incorrect results
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opengrok.