Ghidra is a software reverse engineering (SRE) framework
GP-5707 fix getinfo FSB action project index
dev7473682c894df34c14
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FSBComponentProvider.java b/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FSBComponentProvider.javaindex fd80dfdf8c..5cfd1606d6 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FSBComponentProvider.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FSBComponentProvider.java@@ -103,8 +103,7 @@ public class FSBComponentProvider extends ComponentProviderAdapter}void initFileHandlers() {- FSBFileHandlerContext context =- new FSBFileHandlerContext(plugin, this, fsService, projectIndex);+ FSBFileHandlerContext context = new FSBFileHandlerContext(plugin, this, fsService);fileHandlers = ClassSearcher.getInstances(FSBFileHandler.class);for (FSBFileHandler fileHandler : fileHandlers) {fileHandler.init(context);diff --git a/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FSBFileHandlerContext.java b/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FSBFileHandlerContext.javaindex 011f813de6..8ef1ad209a 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FSBFileHandlerContext.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/FSBFileHandlerContext.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -16,7 +16,6 @@package ghidra.plugins.fsbrowser;import ghidra.formats.gfilesystem.FileSystemService;-import ghidra.plugin.importer.ProjectIndexService;/*** Context given to a {@link FSBFileHandler} instance when being initialized.@@ -24,8 +23,6 @@ import ghidra.plugin.importer.ProjectIndexService;* @param plugin the FSB plugin* @param fsbComponent the FSB component* @param fsService the fs service- * @param projectIndex the project index*/public record FSBFileHandlerContext(FileSystemBrowserPlugin plugin,- FSBComponentProvider fsbComponent, FileSystemService fsService,- ProjectIndexService projectIndex) {}+ FSBComponentProvider fsbComponent, FileSystemService fsService) {}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/filehandlers/GetInfoFSBFileHandler.java b/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/filehandlers/GetInfoFSBFileHandler.javaindex cf2f50d8a2..9454913ade 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/filehandlers/GetInfoFSBFileHandler.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/plugins/fsbrowser/filehandlers/GetInfoFSBFileHandler.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -105,7 +105,8 @@ public class GetInfoFSBFileHandler implements FSBFileHandler {}fattrs = fattrs.clone();- DomainFile associatedDomainFile = context.projectIndex().findFirstByFSRL(fsrl);+ DomainFile associatedDomainFile =+ context.fsbComponent().getProjectIndex().findFirstByFSRL(fsrl);if (associatedDomainFile != null) {fattrs.add(PROJECT_FILE_ATTR, associatedDomainFile.getPathname());}diff --git a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/tar/TarFileSystem.java b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/tar/TarFileSystem.javaindex 79cc942a61..864971a3fb 100644--- a/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/tar/TarFileSystem.java+++ b/Ghidra/Features/FileFormats/src/main/java/ghidra/file/formats/tar/TarFileSystem.java@@ -21,6 +21,7 @@ import java.io.IOException;import org.apache.commons.compress.archivers.tar.TarArchiveEntry;import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;+import org.apache.commons.io.FilenameUtils;import ghidra.app.util.bin.ByteProvider;import ghidra.formats.gfilesystem.*;@@ -112,7 +113,7 @@ public class TarFileSystem extends AbstractFileSystem<TarMetadata> {}TarArchiveEntry blob = tmd.tarArchiveEntry;return FileAttributes.of(- FileAttribute.create(NAME_ATTR, blob.getName()),+ FileAttribute.create(NAME_ATTR, FilenameUtils.getName(blob.getName())),FileAttribute.create(SIZE_ATTR, blob.getSize()),FileAttribute.create(MODIFIED_DATE_ATTR, blob.getLastModifiedDate()),FileAttribute.create(FILE_TYPE_ATTR, tarToFileType(blob)),@@ -155,7 +156,7 @@ public class TarFileSystem extends AbstractFileSystem<TarMetadata> {int fileNum = 0;TarArchiveEntry tarEntry;- while ((tarEntry = tarInput.getNextTarEntry()) != null) {+ while ((tarEntry = tarInput.getNextEntry()) != null) {if (fileNum == tmd.fileNum) {if (!tmd.tarArchiveEntry.getName().equals(tarEntry.getName())) {throw new IOException(