[Fwd: xerces-c: Fix FTBFS on hurd-i386]
Until X-Debbugs-CC is working for me: Bug #636568
-------- Forwarded Message --------
From: Svante Signell <svante.signell@telia.com>
Reply-to: svante.signell@telia.com
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: xerces-c: Fix FTBFS on hurd-i386
Date: Thu, 04 Aug 2011 10:07:23 +0200
Package: xerces-c
Version: 3.1.1-1
Severity: important
Tags: patch
User: debian-hurd@lists.debian.org
Usertags: hurd
Hi,
currently xerces-c does not compile on hurd-i386. The problem is a
PATH_MAX definition which is not supported on GNU/Hurd.
One of blahtexml build dependencies is xerces-c. blahtexml is on the
list of GNU/Hurd packages lagging behind other architectures:
http://ftp-master.debian.org/users/twerner/pre-squeeze.txt
The attached patch fixes the build.
Thanks,
Svante
--- xerces-c-3.1.1/src/xercesc/util/FileManagers/PosixFileMgr.cpp.orig 2008-07-04 09:23:56.000000000 +0000
+++ xerces-c-3.1.1/src/xercesc/util/FileManagers/PosixFileMgr.cpp 2011-08-04 07:30:19.000000000 +0000
@@ -187,6 +187,17 @@
ArrayJanitor<char> janText(newSrc, manager);
// Use a local buffer that is big enough for the largest legal path
+#ifdef __GNU__
+ char *absPath;
+ XMLCh *ret;
+ // get the absolute path
+ absPath = realpath(newSrc, NULL);
+ if (absPath == NULL)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName, manager);
+ ret = XMLString::transcode(absPath, manager);
+ free(absPath);
+ return ret;
+#else
char absPath[PATH_MAX + 1];
// get the absolute path
@@ -194,12 +205,27 @@
ThrowXMLwithMemMgr(XMLPlatformUtilsException, XMLExcepts::File_CouldNotGetBasePathName, manager);
return XMLString::transcode(absPath, manager);
+#endif
}
XMLCh*
PosixFileMgr::getCurrentDirectory(MemoryManager* const manager)
{
+#ifdef __GNU__
+ char *dirBuf=NULL;
+ XMLCh *ret;
+ size_t dummy = 0;
+ char *curDir = getcwd(dirBuf, dummy);
+
+ if (curDir == NULL)
+ ThrowXMLwithMemMgr(XMLPlatformUtilsException,
+ XMLExcepts::File_CouldNotGetBasePathName, manager);
+
+ ret = XMLString::transcode(curDir, manager);
+ free(curDir);
+ return ret;
+#else
char dirBuf[PATH_MAX + 2];
char *curDir = getcwd(&dirBuf[0], PATH_MAX + 1);
@@ -208,6 +234,7 @@
XMLExcepts::File_CouldNotGetBasePathName, manager);
return XMLString::transcode(curDir, manager);
+#endif
}
Reply to: