Don't try to use PATH_MAX in the Hurd
authorAlberto Garcia <berto@igalia.com>
Mon, 26 Aug 2024 13:24:02 +0000 (15:24 +0200)
committerAlberto Garcia <berto@igalia.com>
Mon, 26 Aug 2024 13:24:02 +0000 (15:24 +0200)
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=978098
Bug: https://bugs.webkit.org/show_bug.cgi?id=219572

===================================================================

Gbp-Pq: Name fix-ftbfs-hurd.patch

Source/WTF/wtf/posix/FileSystemPOSIX.cpp
Source/WebCore/platform/text/hyphen/HyphenationLibHyphen.cpp

index c214c14621f2e51ba572cd022961826837505909..987b3e44c450d39cc93e59c134b3b177d1e7e0bf 100644 (file)
 #include <glib.h>
 #endif
 
+#if OS(HURD)
+#define PATH_MAX 4096
+#endif
+
 namespace WTF {
 
 namespace FileSystemImpl {
index 41cb6722404db96b1ff11a0e31084b33302ad0e7..f934a67e7f6b0e258468f35d643f303d9b60bf34 100644 (file)
@@ -72,11 +72,21 @@ static void scanDirectoryForDictionaries(const char* directoryPath, HashMap<Atom
             continue;
 
         auto filePath = FileSystem::pathByAppendingComponent(directoryPathString, fileName);
+#if OS(HURD)
+        char *normalizedPath;
+        normalizedPath = realpath(FileSystem::fileSystemRepresentation(filePath).data(), NULL);
+        if (!normalizedPath)
+            continue;
+
+        filePath = FileSystem::stringFromFileSystemRepresentation(normalizedPath);
+        free(normalizedPath);
+#else
         char normalizedPath[PATH_MAX];
         if (!realpath(FileSystem::fileSystemRepresentation(filePath).data(), normalizedPath))
             continue;
 
         filePath = FileSystem::stringFromFileSystemRepresentation(normalizedPath);
+#endif
         availableLocales.add(locale, Vector<String>()).iterator->value.append(filePath);
 
         String localeReplacingUnderscores = makeStringByReplacingAll(locale, '_', '-');