On Mon, Jun 16, 2008 at 10:21:56AM -0400, Jeff Johnson wrote:
> Hmm, at some point, I start to question whether permitting duplicates
> like
> /foo/1
> /foo/1
> in %files, or worrying about %ghost (and %attr and %verify and %
> exclude and ...,
> there's *at least* one other place that the test for %ghost/%exclude
> is needed)
> scoping over pathologies as in your example above, is worth the effort.
It is worth to have a correct algorithm for RPMTAG_SIZE counter.
The algorithm is correct iff cpio file data bytes match RPMTAG_SIZE
value (this is why we move the code to genCpioListAndHeader()).
rpm2cpio foo.rpm |catenate_cpio_file_data |wc -c
rpmquery --qf '%{SIZE}\n' -p foo.rpm
My point is that as far as we can build valid cpio archive, we can
also mimic some cpio logic a bit and get valid RPMTAG_SIZE value.
It has nothing to do with specfile pathologies (or we just can't
build cpio archive otherwise).
> With %ghost, the issue runs to a fundamental spec file design flaw,
> there
> is plain and simply no way _BY DEFINITION_ to know the file type
> associated
> with the path that has a %ghost attribute.
>
> The RPMTAG_FILEMODES associated with %ghost files has ugo rwx, but
> not the file type.
I can't quite understand what you mean. It looks like you're trying
to say that, in genCpioListAndHeader(), if (flp->flags & RPMFILE_HOST)
holds, then we cannot reliably check for S_ISREG(flp->fl_mode). I can't
see why yet.
> Why shouldn't all of the above be treated as syntax errors instead
> of quietly assuming that indeed, there is some real world need to
> have sloppy goosey-loosey spec file syntax permitting duplicates (and
> file marker attribute scoping across hard links, or primitive
> filtering directives like %exclude) anyways.
rpm seems to permit file dups by design, and, while issuing a warning,
it also has some code to fold dups and merge their flags correctly.
There is a good reason -- glob(3) is not quite flexible at times.
Sometimes you do:
%files
/foo/prefix.*
/foo/*.suffix
Overlaps are okay here.
> But as always, since there's no grammar for spec files, anything goes.
> Even with a grammar, the issues of scoping through implicit hard link
> aliasing,
> are semantic, not syntactical (but duplicates are syntax).
>
> Guess what happens in your example when the install runs with
> --excludepath=/foo/1
>
> What link count should be checked with --verify, particularly if
> another package also contains
> %ghost /foo/2
> and /foo/1 explicitly had --excludepath when installed?
>
> And to return to the original RPMTAG_SIZE issue, what value should
> --qf '%{size}
> report for a given package with excluded hard linked paths that span
> multiple
> packages as above?
I think that %{SIZE} should report cpio file data bytes (i.e. cpio
archive size excluding 110 bytes per cpio entry, filenames, and
alignment bytes).
- application/pgp-signature attachment: stored
Received on Tue Jun 17 01:50:31 2008