Bug#885249: yoshimi: FTBFS on hurd-i386: PATH_MAX undeclared

2017-12-26 Thread Svante Signell
tags 885289 patch
thanks

On Mon, 2017-12-25 at 22:49 -0500, Aaron M. Ucko wrote:
> Source: yoshimi
> Version: 1.5.6-2
> Severity: important
> Tags: upstream
> Justification: fails to build from source
> User: debian-h...@lists.debian.org
> Usertags: hurd-i386

> The Hurd notoriously has no static PATH_MAX.  Best practice is to
> accommodate whatever you actually encounter (with the help of, e.g.,
> the GNU libc extension get_current_dir_name); alternatively, you can
> look up _PC_PATH_MAX via pathconf or supply a fallback constant
> (traditionally 4096).
> 
> Could you please take a look?

Hi,

Attached is a patch fixing the PATH_MAX issues of the package yoshimi
1.5.6-2.

Thanks!

Index: yoshimi-1.5.6/src/Misc/Config.cpp
===
--- yoshimi-1.5.6.orig/src/Misc/Config.cpp
+++ yoshimi-1.5.6/src/Misc/Config.cpp
@@ -231,17 +231,16 @@ bool Config::Setup(int argc, char **argv
 }
 if (restoreState)
 {
-char * fp;
+char *fp = NULL;
 if (! StateFile.size()) goto no_state0;
-else fp = new char [PATH_MAX];
+fp = realpath (StateFile.c_str(), NULL);
+if (fp == NULL) goto no_state0;
 
-if (! realpath (StateFile.c_str(), fp)) goto no_state1;
 StateFile = fp;
-delete (fp);
+free (fp);
 
 if (! isRegFile(StateFile))
 {
-no_state1: delete (fp);
 no_state0: Log("Invalid state file specified for restore " + StateFile, 2);
 return true;
 }
Index: yoshimi-1.5.6/src/Misc/MiscFuncs.cpp
===
--- yoshimi-1.5.6.orig/src/Misc/MiscFuncs.cpp
+++ yoshimi-1.5.6/src/Misc/MiscFuncs.cpp
@@ -339,9 +339,9 @@ string MiscFuncs::setExtension(string fn
 // replace 'src' with a different one in the compilation directory
 string MiscFuncs::localPath(string leaf)
 {
-char *tmpath;
-tmpath = (char*) malloc(PATH_MAX);
-getcwd (tmpath, PATH_MAX);
+char *tmpath = getcwd (NULL, 0);
+if (tmpath == NULL)
+   return "";
 string path = (string) tmpath;
 size_t found = path.rfind("/src");
 if (found != string::npos)
___
pkg-multimedia-maintainers mailing list
pkg-multimedia-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers

Bug#885249: yoshimi: FTBFS on hurd-i386: PATH_MAX undeclared

2017-12-25 Thread Aaron M. Ucko
Source: yoshimi
Version: 1.5.6-2
Severity: important
Tags: upstream
Justification: fails to build from source
User: debian-h...@lists.debian.org
Usertags: hurd-i386

Builds of yoshimi for hurd-i386 (admittedly not a release
architecture) have been failing:

  /<>/src/Misc/MiscFuncs.cpp: In member function 
'std::__cxx11::string MiscFuncs::localPath(std::__cxx11::string)':
  /<>/src/Misc/MiscFuncs.cpp:343:29: error: 'PATH_MAX' was not 
declared in this scope

The Hurd notoriously has no static PATH_MAX.  Best practice is to
accommodate whatever you actually encounter (with the help of, e.g.,
the GNU libc extension get_current_dir_name); alternatively, you can
look up _PC_PATH_MAX via pathconf or supply a fallback constant
(traditionally 4096).

Could you please take a look?

Thanks!

-- 
Aaron M. Ucko, KB1CJC (amu at alum.mit.edu, ucko at debian.org)
http://www.mit.edu/~amu/ | http://stuff.mit.edu/cgi/finger/?a...@monk.mit.edu

___
pkg-multimedia-maintainers mailing list
pkg-multimedia-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers