From e56df084666dbf9905d90c062b1f462aeb6f5f4a Mon Sep 17 00:00:00 2001 From: "Dr. Tobias Quathamer" Date: Mon, 18 Jul 2016 18:10:51 +0200 Subject: [PATCH] Fix patch for FTBFS on hurd. Thanks to Petter Reinholdtsen for the bug report and patch. (Closes: #761036) --- debian/changelog | 2 ++ debian/patches/hurd_file_name_support | 40 +++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index 914e918606..8013378899 100644 --- a/debian/changelog +++ b/debian/changelog @@ -10,6 +10,8 @@ lilypond (2.19.45-1~exp1) experimental; urgency=medium - Add patch to support guile-2.0 - Add guile-2.0 and font-texgyre to Build-Depends - Enable guile-2.0 in debian/rules + * Fix patch for FTBFS on hurd. Thanks to Petter Reinholdtsen for + the bug report and patch. (Closes: #761036) -- Don Armstrong Mon, 01 Dec 2014 15:01:50 -0800 diff --git a/debian/patches/hurd_file_name_support b/debian/patches/hurd_file_name_support index fd98c38189..1a8493486e 100644 --- a/debian/patches/hurd_file_name_support +++ b/debian/patches/hurd_file_name_support @@ -4,12 +4,15 @@ Origin: vendor Author: Don Armstrong --- a/flower/file-name.cc +++ b/flower/file-name.cc -@@ -77,9 +77,13 @@ +@@ -77,9 +77,16 @@ string get_working_directory () { -+#ifdef _GNU_SOURCE_ -+ return string (get_current_dir_name()); ++#ifdef _GNU_SOURCE ++ char *cwd = get_current_dir_name(); ++ string scwd(cwd); ++ free(cwd); ++ return scwd; +#else char cwd[PATH_MAX]; // getcwd returns NULL upon a failure, contents of cwd would be undefined! @@ -18,3 +21,34 @@ Author: Don Armstrong } /* Join components to full file_name. */ +--- a/flower/test-file-path.cc ++++ b/flower/test-file-path.cc +@@ -6,12 +6,26 @@ + #include "yaffut.hh" + #include "config.hh" + ++string ++get_working_directory () ++{ ++#ifdef _GNU_SOURCE ++ char *cwd = get_current_dir_name(); ++ string scwd(cwd); ++ free(cwd); ++ return scwd; ++#else ++ char cwd[PATH_MAX]; ++ // getcwd returns NULL upon a failure, contents of cwd would be undefined! ++ return string (getcwd (cwd, PATH_MAX)); ++#endif ++} ++ + TEST (File_path, Find) + { + char const *extensions[] = {"ly", "", 0}; + string file = "init"; +- char cwd[PATH_MAX]; +- if (!getcwd (cwd, PATH_MAX)) ++ if (get_working_directory().empty()) + { + cerr << "Could not get current work directory\n"; + exit (1); -- 2.39.2