[Scummvm-git-logs] scummvm master -> 858847e1bab5a519ffe9714c2eb89652d99094b0

sev- noreply at scummvm.org
Wed Mar 26 03:50:57 UTC 2025


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
fb2500e16b BACKENDS: MACOS: Print a warning when no files are found in CDDAFS volumes
858847e1ba BACKENDS: FS: Use stat() fallback for all unexpected dirent d_type values


Commit: fb2500e16b7319d7fe9de7ccb296464b42269e22
    https://github.com/scummvm/scummvm/commit/fb2500e16b7319d7fe9de7ccb296464b42269e22
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2025-03-26T11:50:53+08:00

Commit Message:
BACKENDS: MACOS: Print a warning when no files are found in CDDAFS volumes

getChildren() may have succeeded but found no children at all, for some
reason. Properly print a warning in this case as well.

Changed paths:
    backends/audiocd/macosx/macosx-audiocd.cpp


diff --git a/backends/audiocd/macosx/macosx-audiocd.cpp b/backends/audiocd/macosx/macosx-audiocd.cpp
index c23d9a7856a..53a8c2824f6 100644
--- a/backends/audiocd/macosx/macosx-audiocd.cpp
+++ b/backends/audiocd/macosx/macosx-audiocd.cpp
@@ -267,7 +267,7 @@ bool MacOSXAudioCDManager::findTrackNames(const Common::Path &drivePath) {
 	}
 
 	Common::FSList children;
-	if (!directory.getChildren(children, Common::FSNode::kListFilesOnly)) {
+	if (!directory.getChildren(children, Common::FSNode::kListFilesOnly) || children.empty()) {
 		warning("Failed to find children for '%s'", drivePath.toString(Common::Path::kNativeSeparator).c_str());
 		return false;
 	}


Commit: 858847e1bab5a519ffe9714c2eb89652d99094b0
    https://github.com/scummvm/scummvm/commit/858847e1bab5a519ffe9714c2eb89652d99094b0
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2025-03-26T11:50:53+08:00

Commit Message:
BACKENDS: FS: Use stat() fallback for all unexpected dirent d_type values

On systems where dirent provides a `d_type` field, we currently fall
back to stat() only for DT_UNKNOWN values.

Do so for all unexpected `d_type` values instead (that is, anything
different from DT_DIR, DT_REG and DT_LNK).

This is because there's no guarantee that `d_type` will be meaningful
for all OSes and filesystems. One such example is macOS Tiger, where
`d_type` will hold bogus values for the .aiff files of cddafs mount
points (as triggered by MacOSXAudioCDManager). (This bug appears to
have been fixed in cddafs-242.0.1, around the Snow Leopard area.)

When using stat() over the same files, the proper file type is
returned, though. Hence the need for the stat() fallback to be
triggered in more cases than DT_UNKNOWN.

This fixes Indy3 FM-TOWNS music being silent on macOS Tiger, when
playing from the original CD.

Changed paths:
    backends/fs/posix/posix-fs.cpp


diff --git a/backends/fs/posix/posix-fs.cpp b/backends/fs/posix/posix-fs.cpp
index 368c7c87ebf..995425aeec4 100644
--- a/backends/fs/posix/posix-fs.cpp
+++ b/backends/fs/posix/posix-fs.cpp
@@ -202,20 +202,30 @@ bool POSIXFilesystemNode::getChildren(AbstractFSList &myList, ListMode mode, boo
 		 */
 		entry.setFlags();
 #else
-		if (dp->d_type == DT_UNKNOWN) {
+		switch (dp->d_type) {
+		case DT_DIR:
+		case DT_REG:
+			entry._isValid = true;
+			entry._isDirectory = (dp->d_type == DT_DIR);
+			break;
+		case DT_LNK:
+			entry._isValid = true;
+			struct stat st;
+			if (stat(entry._path.c_str(), &st) == 0)
+				entry._isDirectory = S_ISDIR(st.st_mode);
+			else
+				entry._isDirectory = false;
+			break;
+		case DT_UNKNOWN:
+		default:
 			// Fall back to stat()
+			//
+			// It's important NOT to limit this to DT_UNKNOWN, because d_type can
+			// be unreliable on some OSes and filesystems; a confirmed example is
+			// macOS 10.4, where d_type can hold bogus values when iterating over
+			// the files of a cddafs mount point (as used by MacOSXAudioCDManager).
 			entry.setFlags();
-		} else {
-			entry._isValid = (dp->d_type == DT_DIR) || (dp->d_type == DT_REG) || (dp->d_type == DT_LNK);
-			if (dp->d_type == DT_LNK) {
-				struct stat st;
-				if (stat(entry._path.c_str(), &st) == 0)
-					entry._isDirectory = S_ISDIR(st.st_mode);
-				else
-					entry._isDirectory = false;
-			} else {
-				entry._isDirectory = (dp->d_type == DT_DIR);
-			}
+			break;
 		}
 #endif
 




More information about the Scummvm-git-logs mailing list