feat: Rust std target + ruststd tests; SYS_EXIT_GROUP; fix mkdir/create under missing parent

This commit is contained in:
daniel committed 2026-10-17 10:30:24 +02:00
1 parent 9e66c3b249
commit e87bd358a6
20 files changed
+657 -97

No files matched your search

+18
View File
@@ -89,6 +89,20 @@ namespace Fs::Ramdisk {
return -1;
}
// Mkdir/Create must not conjure entries under a missing parent: the
// table is flat, so "a/b/" with no "a/" entry is invisible to ReadDir of
// the parent and makes "a" fail Stat, Delete and recursive removal.
static bool ParentExists(const char* path) {
char normalized[MaxNameLen];
int len = NormalizePath(path, normalized, MaxNameLen);
if (len < 0) return false;
while (len > 0 && normalized[len - 1] != '/') len--;
if (len <= 1) return true; // parent is the root
normalized[len - 1] = '\0';
int idx = FindEntryByPath(normalized);
return idx >= 0 && fileTable[idx].isDirectory;
}
void Initialize(void* moduleData, uint64_t moduleSize) {
Kt::KernelLogStream(Kt::OK, "Ramdisk") << "Parsing USTAR archive (" << moduleSize << " bytes)";
@@ -442,6 +456,8 @@ namespace Fs::Ramdisk {
}
}
if (!ParentExists(path)) return -1;
// Create new file entry
FileEntry& entry = fileTable[fileCount];
@@ -531,6 +547,8 @@ namespace Fs::Ramdisk {
}
}
if (!ParentExists(path)) return -1;
// Create directory entry (stored with trailing slash for tar convention)
FileEntry& entry = fileTable[fileCount];