[HEADSUP][CFT] pkgng beta1 is out

Marco Steinbach coco at executive-computing.de
Tue Jan 31 20:25:47 UTC 2012


On Mon, 30 Jan 2012, Baptiste Daroussin wrote:

> Hi,
>
> pkgng has just reached the beta phase, and has now found its way to the
> ports tree (disabled by default).

[...]

> cd /usr/ports/
> touch abc
touch: abc: Permission denied
> pkg create net/ifstat
Creating package for ifstat-1.1_5
Segmentation fault


The attached patch tries to enable pkg(1) to stay on top of things by adding
error handling around archive_write_open_filename.

> pkg create net/ifstat
Creating package for ifstat-1.1_5
pkg: archive_write_open_filename(.//ifstat-1.1_5.txz): Permission denied
pkg: unable to create archive

MfG CoCo
-------------- next part --------------
diff --git a/libpkg/packing.c b/libpkg/packing.c
index e536eb8..9543c32 100644
--- a/libpkg/packing.c
+++ b/libpkg/packing.c
@@ -49,7 +49,15 @@ packing_init(struct packing **pack, const char *path, pkg_formats format)
 		}
 		snprintf(archive_path, sizeof(archive_path), "%s.%s", path, ext);
 
-		archive_write_open_filename((*pack)->awrite, archive_path);
+		if (archive_write_open_filename(
+		    (*pack)->awrite, archive_path) != ARCHIVE_OK ) {
+			pkg_emit_errno("archive_write_open_filename",
+			    archive_path);
+			archive_read_finish((*pack)->aread);
+			archive_write_finish((*pack)->awrite);
+			*pack = NULL;
+			return EPKG_FATAL;
+		}
 	} else { /* pass mode directly write to the disk */
 		(*pack)->awrite = archive_write_disk_new();
 		archive_write_disk_set_options((*pack)->awrite, EXTRACT_ARCHIVE_FLAGS);


More information about the freebsd-ports mailing list