Don't try to use PATH_MAX in the Hurd
authorAlberto Garcia <berto@igalia.com>
Thu, 19 Sep 2024 17:11:43 +0000 (19:11 +0200)
committerAlberto Garcia <berto@igalia.com>
Thu, 19 Sep 2024 17:11:43 +0000 (19:11 +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 c6920fae4a369b71f9fa6c9c69a56f1bc46d1e1d..01c2de3b3cae37e101f319962c593ffc329e9ce7 100644 (file)
 #include <glib.h>
 #endif
 
+#if OS(HURD)
+#define PATH_MAX 4096
+#endif
+
 namespace WTF {
 
 namespace FileSystemImpl {
index 50da2aa25aa589c453d27628c1cb5047ef55ce18..acf16ee322cc28cb9797b65e04381a493be2301a 100644 (file)
@@ -73,11 +73,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, '_', '-');