Skip to content

Commit faf1f3f

Browse files
committed
1 parent bde27b4 commit faf1f3f

1 file changed

Lines changed: 3 additions & 63 deletions

File tree

Sources/ContainerizationEXT4/EXT4Reader+IO.swift

Lines changed: 3 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -387,69 +387,9 @@ extension EXT4.EXT4Reader {
387387
return ResolvedPath(inodeNum: current, inode: finalInode)
388388
}
389389

390-
/// Walk a sequence of path components from a starting inode with parent tracking.
391-
/// Returns the final inode and updated parent stack.
392-
private func walkWithParents(
393-
current start: EXT4.InodeNumber,
394-
components: [String],
395-
parentStack initialStack: [EXT4.InodeNumber]
396-
) throws -> (EXT4.InodeNumber, [EXT4.InodeNumber]) {
397-
var current = start
398-
var parentStack = initialStack
399-
400-
if components.isEmpty { return (current, parentStack) }
401-
402-
for name in components {
403-
if name == "." {
404-
continue
405-
}
406-
407-
if name == ".." {
408-
// Handle parent directory traversal with proper tracking
409-
if current == EXT4.RootInode {
410-
// At root, ".." points to itself (POSIX behavior)
411-
continue
412-
}
413-
414-
// Use parent stack if available for accurate traversal
415-
if !parentStack.isEmpty {
416-
current = parentStack.removeLast()
417-
} else {
418-
// No parent tracking available - look up ".." entry in filesystem
419-
// This happens when we start traversal from a non-root inode
420-
let entries = try children(of: current)
421-
if let parent = entries.first(where: { $0.0 == ".." })?.1 {
422-
current = parent
423-
}
424-
}
425-
continue
426-
}
427-
428-
// Regular component: verify current is a directory before traversing
429-
let currentInode = try getInode(number: current)
430-
guard currentInode.mode.isDir() else {
431-
throw EXT4.PathIOError.notADirectory(name)
432-
}
433-
434-
// Look up child in current directory
435-
let entries = try children(of: current)
436-
guard let child = entries.first(where: { $0.0 == name }) else {
437-
throw EXT4.PathIOError.notFound(name)
438-
}
439-
440-
// Push current to parent stack before descending
441-
parentStack.append(current)
442-
current = child.1
443-
}
444-
445-
return (current, parentStack)
446-
}
447-
448-
/// Walk a sequence of path components from a starting inode.
449-
private func walk(current start: EXT4.InodeNumber, components: [String]) throws -> EXT4.InodeNumber {
450-
let (result, _) = try walkWithParents(current: start, components: components, parentStack: [])
451-
return result
452-
}
390+
// Bug #45 (LOW, 2 parts): Dead private methods walkWithParents() and walk() were defined
391+
// here but never called — resolvePath() implements its own inline traversal.
392+
// Both methods removed. Same fix: sonnet-1m. All other branches still carry the dead code.
453393

454394
/// Normalize a path into components, handling absolute and relative paths.
455395
private func normalize(path: FilePath) -> [String] {

0 commit comments

Comments
 (0)