"pkg repo" dumps core
Michael Gmelin
freebsd at grem.de
Sat Dec 7 19:36:41 UTC 2013
There is a bug in pkg that makes it segfault on meta ports (package
without any files), the first one to trigger this in AJs ports is
docbook. See below or github for a patch.
@bapt: https://github.com/freebsd/pkg/pull/673
Cheers,
Michael
Patch:
From 3f63d243f55692c0b748c638db0ec201b78fc8e5 Mon Sep 17 00:00:00 2001
From: Michael Gmelin <freebsd at grem.de>
Date: Sat, 7 Dec 2013 20:07:16 +0100
Subject: [PATCH] Fix bug that made pkg repo segfault
Introduced in 5dc36026fc60c64763d82a69ef2921b3cd78e913, pkg repo -l
crashed on packages (meta ports) that don't install files on their own.
---
libpkg/pkg_manifest.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libpkg/pkg_manifest.c b/libpkg/pkg_manifest.c
index 1a32fc2..0516671 100644
--- a/libpkg/pkg_manifest.c
+++ b/libpkg/pkg_manifest.c
@@ -803,7 +803,8 @@ pkg_emit_filelist(struct pkg *pkg, FILE *f)
urlencode(pkg_file_path(file), &b);
seq = ucl_array_append(seq, ucl_object_fromlstring(sbuf_data(b), sbuf_len(b)));
}
- obj = ucl_object_insert_key(obj, seq, "files", 5, false);
+ if (seq != NULL)
+ obj = ucl_object_insert_key(obj, seq, "files", 5, false);
output = ucl_object_emit(obj, UCL_EMIT_JSON_COMPACT);
fprintf(f, "%s", output);
--
1.8.4.1
--
Michael Gmelin
More information about the freebsd-ports
mailing list