Control: retitle 516915 dpkg: dpkg-deb --contents should sort file list
Control: tags -1 - patch
Control: merge 516915 -1

On Mon, 2016-03-07 at 23:04:57 +0900, Osamu Aoki wrote:
> Package: dpkg
> Version: 1.18.4
> Severity: wishlist
> Tags: patch

> Making dpkg-deb to be deterministic by fixing #719845 was good for
> reproducible build.  But "dpkg-deb -c" output is not human friendly.

> Basically, we want it to be sorted by name instead of internal data
> order.

Yeah, already filed some time ago. There's two issues with this
request. One is that sorting this would imply needing to process the
entire tarball to be able to sort the output which can take some time,
but probably that's not a big deal, it just stalls and makes it not
possible to process the output incrementally. The other is that we
might need to preserve symlinks at the end, or things might break.

> Please consider adding patch such as one attached to instruct tar to
> change its default behavior.

I don't think the attached patch does what you intended though? --sort
only works when packing (i.e. when reading from the filesystem). Not
to mention that it would break the symlinks-last premise.

> One debatable point is when to sort output.  Instead of always sorting
> by name, should we sort only when LIST?  Should we have option to
> control it?

Yeah, an option would be preferable IMO.

> --- extract.c.orig    2016-03-07 22:44:03.421627595 +0900
> +++ extract.c 2016-03-07 22:47:23.810190427 +0900
> @@ -320,6 +320,7 @@
>        command_init(&cmd, TAR, "tar");
>        command_add_arg(&cmd, "tar");
>  
> +      command_add_arg(&cmd, "--sort=name");
>        if ((taroption & DPKG_TAR_LIST) && (taroption & DPKG_TAR_EXTRACT))
>          command_add_arg(&cmd, "-xv");
>        else if (taroption & DPKG_TAR_EXTRACT)

Also this would break with tar requiring action options first I think.

Thanks,
Guillem

Reply via email to