Page MenuHomeFreeBSD

release: escape spaces in filenames with METALOG
Needs RevisionPublic

Authored by khorben on Mon, Sep 14, 5:37 PM.
Tags
None
Referenced Files
F172018325: D59670.diff
Tue, Sep 15, 10:41 AM
F171963682: D59670.id186701.diff
Mon, Sep 14, 11:32 PM
F171962655: D59670.diff
Mon, Sep 14, 11:18 PM
F171956310: D59670.id186701.diff
Mon, Sep 14, 10:05 PM
F171955883: D59670.diff
Mon, Sep 14, 10:00 PM
F171955800: D59670.diff
Mon, Sep 14, 10:00 PM

Details

Reviewers
andrew
jrtc27
Group Reviewers
pkg
releng
Summary

When generating release images, the METALOG option of pkg(8) is used to list the contents of binary packages installed in the image created. The resulting output is provided to makefs(8) as part of the mtree specfile describing the files. However, spaces in filenames are not escaped and confuse the parser.

These changes introduce an awk(1) script, escaping the part of the METALOG file before the first tag (type=) is encountered, when used by
makefs(8).

Affects and fixes amd64, arm64, and i386; tested on FreeBSD/amd64.

Sponsored by: The FreeBSD Foundation

Test Plan

Add packages such as lcms2 to the list of packages to install in release/Makefile, and run:

$ make buildworld buildkernel packages
[...]
$ (cd release && make dvdrom memstick)
[...]

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Adding pkg for review, since this might really be a bug with the -o METALOG option in pkg(8).

i'm curious why we have files with spaces in on the release to begin with. where do those come from?

In D59670#1369462, @ivy wrote:

i'm curious why we have files with spaces in on the release to begin with. where do those come from?

We do not :)

But if someone creates a custom image with extra packages (like I do e.g., for the graphical installer) and these packages contain files with spaces in the filename (like lcms2, a dependency for Gtk+ 3) then we have the issue.

So this is by no means a release blocker, but it's a nice to have for more advanced uses and downstreams extending the build system.

jrtc27 requested changes to this revision.Tue, Sep 15, 10:42 AM

Um, yeah, if pkg produces a METALOG that is not readable by makefs, due to not escaping the whitespace, that's a bug in pkg to fix in pkg? And it's impossible to reliably escape at this point, because it is inherently ambiguous whether what comes after the space is a continuation of the path or a new key=value pair. So we really should not be trying to guesstimate what the correct METALOG entry is.

This revision now requires changes to proceed.Tue, Sep 15, 10:42 AM

that's a bug in pkg to fix in pkg

Yeah, it seems there's just a bug in pkg to be fixed here