Skip to content

Commit

Permalink
Merge pull request #5391 from bndtools/issue/5336
Browse files Browse the repository at this point in the history
#5336 Need -include loop detection
  • Loading branch information
pkriens authored Oct 7, 2022
2 parents 61bf8a6 + d342778 commit 1a3ae8b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
13 changes: 13 additions & 0 deletions biz.aQute.bndlib.tests/test/test/ProcessorTest.java
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit 1a3ae8b

Please sign in to comment.