Source: ros-rospack
Version: 2.3.0-3
Severity: important
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd

HI,

ros-rospack currently FTBFS on GNU/Hurd since 2.3.0-3 when the unit
tests were enabled. This is due to usage of PATH_MAX in
file test/test/utest.cpp. The attached patch fixes this by using
getcwd(NULL, 0) to allocate space, populate path and free it after
usage. As all Debian architectures support this usage of getcwd() no
harm would be done. All tests succeed on GNU/Hurd too.

Thanks!
Index: ros-rospack-2.3.0/test/test/utest.cpp
===================================================================
--- ros-rospack-2.3.0.orig/test/test/utest.cpp
+++ ros-rospack-2.3.0/test/test/utest.cpp
@@ -231,8 +231,8 @@ int main(int argc, char **argv)
   char buf[1024];
   std::string rr = std::string(getcwd(buf, sizeof(buf))) + "/test2";
   setenv("ROS_PACKAGE_PATH", rr.c_str(), 1);
-  char path[PATH_MAX];
-  if(getcwd(path,sizeof(path)))
+  char *path = getcwd(NULL, 0);
+  if(path)
   {
     boost::filesystem::path p(path);
     p = p.parent_path();
@@ -243,6 +243,7 @@ int main(int argc, char **argv)
     setenv("PATH", newpath.c_str(), 1);
   }
 
+  free(path);
   testing::InitGoogleTest(&argc, argv);
   return RUN_ALL_TESTS();
 }

Reply via email to