[PR #1809] [MERGED] fs: Fix wrong mounts being matched by partial guest path. #2318

Closed
opened 2026-02-27 21:16:02 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/1809
Author: @squidbus
Created: 12/17/2024
Status: Merged
Merged: 12/17/2024
Merged by: @georgemoralis

Base: mainHead: fix-fs


📝 Commits (1)

  • 16461c3 fs: Fix wrong mounts being matched by partial guest path.

📊 Changes

2 files changed (+23 additions, -7 deletions)

View changed files

📝 src/core/file_sys/fs.cpp (+17 -4)
📝 src/core/file_sys/fs.h (+6 -3)

📄 Description

Currently when finding the mount for a guest path, if one of the mounts is a prefix of another mount, the wrong mount may be matched. For example, if both /addcont3 and /addcont30 are mounted, the path /addcont30/file may match with /addcont3 despite being the wrong mount.

To fix this:

  • Added sanitization to make sure the mount guest path has no trailing slash, to help with the following change.
  • Changed the mount find condition to check if either the paths are equal (path is exactly the mount path) or path starts with the mount path plus a trailing slash (either exactly the mount path with trailing slash or a sub-path of the mount).

Fixes loading DLC songs in CUSA12636 and CUSA12380.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/1809 **Author:** [@squidbus](https://github.com/squidbus) **Created:** 12/17/2024 **Status:** ✅ Merged **Merged:** 12/17/2024 **Merged by:** [@georgemoralis](https://github.com/georgemoralis) **Base:** `main` ← **Head:** `fix-fs` --- ### 📝 Commits (1) - [`16461c3`](https://github.com/shadps4-emu/shadPS4/commit/16461c379a87b73ef3a7bdee5181fc53d41642d6) fs: Fix wrong mounts being matched by partial guest path. ### 📊 Changes **2 files changed** (+23 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `src/core/file_sys/fs.cpp` (+17 -4) 📝 `src/core/file_sys/fs.h` (+6 -3) </details> ### 📄 Description Currently when finding the mount for a guest path, if one of the mounts is a prefix of another mount, the wrong mount may be matched. For example, if both `/addcont3` and `/addcont30` are mounted, the path `/addcont30/file` may match with `/addcont3` despite being the wrong mount. To fix this: * Added sanitization to make sure the `mount` guest path has no trailing slash, to help with the following change. * Changed the mount find condition to check if either the paths are equal (path is exactly the mount path) or path starts with the mount path plus a trailing slash (either exactly the mount path with trailing slash or a sub-path of the mount). Fixes loading DLC songs in CUSA12636 and CUSA12380. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:16:02 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#2318
No description provided.