Skip to content

Commit

Permalink
Merge pull request #24312 from BethGriggs/lost+found
Browse files Browse the repository at this point in the history
fix: handle lost+found directory in plugin scanner
  • Loading branch information
freben committed Apr 19, 2024
2 parents c3f0372 + b611fd0 commit c2fbefc
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/smart-avocados-invent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage/backend-dynamic-feature-service': patch
---

Updates the `scanRoot` method in the `PluginScanner` class to specifically ignore the `lost+found` directory, which is a system-generated directory used for file recovery on Unix-like systems. Skipping this directory avoids unnecessary errors.
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,24 @@ Please add '${mockDir.resolve(
],
},
},
{
name: 'lost+found directory should be ignored',
fileSystem: {
backstageRoot: {
'dist-dynamic': {
'lost+found': {},
},
},
},
expectedPluginPackages: [],
expectedLogs: {
debugs: [
{
message: `skipping 'lost+found' system directory`,
},
],
},
},
])('$name', async (tc: TestCase): Promise<void> => {
const logger = new MockedLogger();
const backstageRoot = mockDir.resolve('backstageRoot');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,11 @@ export class PluginScanner {
withFileTypes: true,
})) {
const pluginDir = dirEnt;

if (pluginDir.name === 'lost+found') {
this.logger.debug(`skipping '${pluginDir.name}' system directory`);
continue;
}
const pluginHome = path.normalize(
path.resolve(dynamicPluginsLocation, pluginDir.name),
);
Expand Down

0 comments on commit c2fbefc

Please sign in to comment.