Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Dec 2013 20:29:58 +0100
From:      Michael Gmelin <freebsd@grem.de>
To:        Sergio de Almeida Lenzi <lenzi.sergio@gmail.com>, "A.J. 'Fonz' van Werven" <freebsd@skysmurf.nl>
Cc:        Baptiste Daroussin <bapt@freebsd.org>, freebsd-ports@freebsd.org
Subject:   Re: "pkg repo" dumps core
Message-ID:  <20131207202958.58ab3f61@bsd64.grem.de>
In-Reply-To: <1386429686.2287.9.camel@lenovo.toontown>
References:  <20131206183759.GA66308@spectrum.skysmurf.nl> <20131206200452.6ff3fba7@bsd64.grem.de> <1386429686.2287.9.camel@lenovo.toontown>

next in thread | previous in thread | raw e-mail | index | archive | help
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:

=46rom 3f63d243f55692c0b748c638db0ec201b78fc8e5 Mon Sep 17 00:00:00 2001
From: Michael Gmelin <freebsd@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 =3D ucl_array_append(seq, ucl_object_fromlstring(sbuf_data(b), sbuf_=
len(b)));
 	}
-	obj =3D ucl_object_insert_key(obj, seq, "files", 5, false);
+	if (seq !=3D NULL)
+		obj =3D ucl_object_insert_key(obj, seq, "files", 5, false);
=20
 	output =3D ucl_object_emit(obj, UCL_EMIT_JSON_COMPACT);
 	fprintf(f, "%s", output);
--=20
1.8.4.1



--=20
Michael Gmelin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131207202958.58ab3f61>