Bug#766333: appstream-glib: FTBFS on hurd-i386
Source: appstream-glib
Version: 0.3.0-1
Severity: important
Tags: patch
User: debian-hurd@lists.debian.org
Usertags: hurd
Hi,
Currently appstream-glib FTBFS on GNU/Hurd due to usage of PATH_MAX,
which is not defined. The attached patch solves this problem by
dynamically allocating strings of required length, and free them after
usage if needed.
Thanks!
Index: appstream-glib-0.3.0/client/as-util.c
===================================================================
--- appstream-glib-0.3.0.orig/client/as-util.c
+++ appstream-glib-0.3.0/client/as-util.c
@@ -767,9 +767,9 @@ static gboolean
as_util_install_icons (const gchar *filename, const gchar *origin, GError **error)
{
const gchar *destdir;
- const gchar *tmp;
+ const gchar *tmp, *pathname;
gboolean ret = TRUE;
- gchar buf[PATH_MAX];
+ gchar *buf = NULL;
gsize len;
int r;
struct archive *arch = NULL;
@@ -817,26 +817,29 @@ as_util_install_icons (const gchar *file
}
/* no output file */
- if (archive_entry_pathname (entry) == NULL)
+ pathname = archive_entry_pathname (entry);
+ if (pathname == NULL)
continue;
/* update output path */
- g_snprintf (buf, PATH_MAX, "%s/%s",
- dir, archive_entry_pathname (entry));
+ buf = g_strdup_printf ("%s/%s", dir, pathname);
archive_entry_update_pathname_utf8 (entry, buf);
+ g_free (buf);
/* update hardlinks */
tmp = archive_entry_hardlink (entry);
if (tmp != NULL) {
- g_snprintf (buf, PATH_MAX, "%s/%s", dir, tmp);
+ buf = g_strdup_printf ("%s/%s", dir, tmp);
archive_entry_update_hardlink_utf8 (entry, buf);
+ g_free (buf);
}
/* update symlinks */
tmp = archive_entry_symlink (entry);
if (tmp != NULL) {
- g_snprintf (buf, PATH_MAX, "%s/%s", dir, tmp);
+ buf = g_strdup_printf ("%s/%s", dir, tmp);
archive_entry_update_symlink_utf8 (entry, buf);
+ g_free (buf);
}
r = archive_read_extract (arch, entry, 0);
Index: appstream-glib-0.3.0/libappstream-builder/asb-utils.c
===================================================================
--- appstream-glib-0.3.0.orig/libappstream-builder/asb-utils.c
+++ appstream-glib-0.3.0/libappstream-builder/asb-utils.c
@@ -184,7 +184,7 @@ asb_utils_explode_file (struct archive_e
GPtrArray *glob)
{
const gchar *tmp;
- gchar buf[PATH_MAX];
+ gchar *buf = NULL;
_cleanup_free_ gchar *path = NULL;
/* no output file */
@@ -206,21 +206,24 @@ asb_utils_explode_file (struct archive_e
}
/* update output path */
- g_snprintf (buf, PATH_MAX, "%s/%s", dir, tmp);
+ buf = g_strdup_printf ("%s/%s", dir, tmp);
archive_entry_update_pathname_utf8 (entry, buf);
+ g_free (buf);
/* update hardlinks */
tmp = archive_entry_hardlink (entry);
if (tmp != NULL) {
- g_snprintf (buf, PATH_MAX, "%s/%s", dir, tmp);
+ buf = g_strdup_printf ("%s/%s", dir, tmp);
archive_entry_update_hardlink_utf8 (entry, buf);
+ g_free (buf);
}
/* update symlinks */
tmp = archive_entry_symlink (entry);
if (tmp != NULL) {
- g_snprintf (buf, PATH_MAX, "%s/%s", dir, tmp);
+ buf = g_strdup_printf ("%s/%s", dir, tmp);
archive_entry_update_symlink_utf8 (entry, buf);
+ g_free (buf);
}
return TRUE;
}
Index: appstream-glib-0.3.0/libappstream-builder/plugins/asb-plugin-gstreamer.c
===================================================================
--- appstream-glib-0.3.0.orig/libappstream-builder/plugins/asb-plugin-gstreamer.c
+++ appstream-glib-0.3.0/libappstream-builder/plugins/asb-plugin-gstreamer.c
@@ -111,9 +111,10 @@ static const AsbGstreamerDescData data[]
static gboolean
asb_utils_is_file_in_tmpdir (const gchar *tmpdir, const gchar *filename)
{
- gchar tmp[PATH_MAX];
- g_snprintf (tmp, PATH_MAX, "%s/%s", tmpdir, filename);
- return g_file_test (tmp, G_FILE_TEST_EXISTS);
+ char *tmp = g_strdup_printf ("%s/%s", tmpdir, filename);
+ gboolean ret = g_file_test (tmp, G_FILE_TEST_EXISTS);
+ g_free (tmp);
+ return ret;
}
/**
Reply to: