Skip to content

Fix filesystem path handling for root mount point#44

Merged
JohnAmadis merged 4 commits into
developfrom
copilot/fix-root-directory-access
Dec 9, 2025
Merged

Fix filesystem path handling for root mount point#44
JohnAmadis merged 4 commits into
developfrom
copilot/fix-root-directory-access

Conversation

Copilot AI commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

When a filesystem is mounted at /, the VFS layer was passing empty or malformed paths to the underlying filesystem. For example, opening / would pass "" instead of / to the filesystem implementation.

Changes

  • Added get_fs_path() helper to normalize paths before passing to filesystem implementations

    • For root mount (/): returns absolute path as-is
    • For other mounts: strips mount point prefix and ensures leading /
  • Updated all filesystem operations to use the helper: fopen, opendir, mkdir, rmdir, stat, chmod, utime, unlink, remove, rename, chdir, direxists

Example

// Mount point: "/", Absolute path: "/"
// Before: fs receives "" (empty string)
// After:  fs receives "/"

// Mount point: "/", Absolute path: "/test.txt"  
// Before: fs receives "test.txt" (no leading slash)
// After:  fs receives "/test.txt"

// Mount point: "/mnt", Absolute path: "/mnt/test.txt"
// Before: fs receives "/test.txt" 
// After:  fs receives "/test.txt" (unchanged)
Original prompt

This section details on the original issue you should resolve

<issue_title>Nie można dostać się do katalogu root</issue_title>
<issue_description>Jeśli mamy sytuację, w której jakiś FS, np dmramfs jest zamontowany w ścieżce / i próbujemy zrobić opendir na niej, to system plików otrzymuje ścieżkę pustą, więc zwraca błąd. Powinniśmy przekazywać do systemu plików zawsze ścieżki zaczynające się od / - inaczej systemy plików nie będą w stanie obsłużyć jej </issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits December 9, 2025 08:10
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Co-authored-by: JohnAmadis <17320783+JohnAmadis@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix access issue for root directory in mounted filesystem Fix filesystem path handling for root mount point Dec 9, 2025
Copilot AI requested a review from JohnAmadis December 9, 2025 08:18
@JohnAmadis JohnAmadis marked this pull request as ready for review December 9, 2025 08:52
@JohnAmadis JohnAmadis merged commit c095375 into develop Dec 9, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Nie można dostać się do katalogu root

2 participants