Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5336 Need -include loop detection #5391

Merged
merged 5 commits into from Oct 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions biz.aQute.bndlib.tests/test/test/ProcessorTest.java
Expand Up @@ -26,6 +26,7 @@
import aQute.bnd.osgi.resource.ResourceBuilder;
import aQute.bnd.osgi.resource.ResourceUtils;
import aQute.lib.collections.ExtList;
import aQute.lib.io.IO;
import aQute.lib.strings.Strings;
import aQute.service.reporter.Reporter.SetLocation;

Expand Down Expand Up @@ -529,4 +530,16 @@ public void testMergAndSuffixes() throws IOException {
}

}

@Test
public void testIncludeItself() throws IOException {
File foo = IO.getFile("generated/foo.bnd");
IO.store("-include ./foo.bnd\nfoo=1\n", foo);
try (Processor p = new Processor()) {
p.setBase(foo.getParentFile());
p.setProperties(foo);
assertTrue(p.check("Cyclic or multiple include of"));
}
}

}
1 change: 1 addition & 0 deletions biz.aQute.bndlib/src/aQute/bnd/osgi/Processor.java
Expand Up @@ -868,6 +868,7 @@ public void doIncludeFile(File file, boolean overwrite, Properties target) throw
public void doIncludeFile(File file, boolean overwrite, Properties target, String extensionName) throws Exception {
if (!addIncludedIfAbsent(file)) {
error("Cyclic or multiple include of %s", file);
return;
}
updateModified(file.lastModified(), file.toString());
Properties sub;
Expand Down