Description: Remove some wonky path manipulation
TMPDIR can cause Leptonica to mess with certain paths.
Remove that. Upstream is implementing a similar solution.
.
leptonlib (1.74.4-2) unstable; urgency=medium
.
* Remove some path weirdness involving TMPDIR (closes: #885704)
Author: Jeff Breidenbach <jab@debian.org>
Bug-Debian: http://bugs.debian.org/885704
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: other
Bug-Debian: http://bugs.debian.org/885704
Forwarded: yes, verbal
--- leptonlib-1.74.4.orig/src/utils2.c
+++ leptonlib-1.74.4/src/utils2.c
@@ -2745,35 +2745,7 @@ l_int32 dirlen, namelen, size;
if ((pathout = (char *)LEPT_CALLOC(size, sizeof(char))) == NULL)
return (char *)ERROR_PTR("pathout not made", procName, NULL);
- /* First handle %dir (which may be a full pathname).
- * Note that we're also making sure that a root directory such
- * as "/tmpfiles" does not get re-written as <Temp>files,
- * where <Temp> is the temp directory on the system. */
- if (dirlen < 4 ||
- (dirlen == 4 && strncmp(cdir, "/tmp", 4) != 0) || /* not in "/tmp" */
- (dirlen > 4 && strncmp(cdir, "/tmp/", 5) != 0)) { /* not in "/tmp/" */
- stringCopy(pathout, cdir, dirlen);
- } else { /* in /tmp */
- /* Start with the temp dir */
- l_int32 tmpdirlen;
-#ifdef _WIN32
- char tmpdir[MAX_PATH];
- GetTempPath(sizeof(tmpdir), tmpdir); /* get the windows temp dir */
- tmpdirlen = strlen(tmpdir);
- if (tmpdirlen > 0 && tmpdir[tmpdirlen - 1] == '\\') {
- tmpdir[tmpdirlen - 1] = '\0'; /* trim the trailing '\' */
- }
-#else /* unix */
- const char *tmpdir = getenv("TMPDIR");
- if (tmpdir == NULL) tmpdir = "/tmp";
-#endif /* _WIN32 */
- tmpdirlen = strlen(tmpdir);
- stringCopy(pathout, tmpdir, tmpdirlen);
-
- /* Add the rest of cdir */
- if (dirlen > 4)
- stringCat(pathout, size, cdir + 4);
- }
+ stringCopy(pathout, cdir, dirlen);
/* Now handle %fname */
if (fname && strlen(fname) > 0) {