Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update format documentation in the manual #2835

Closed
wants to merge 3 commits into from

Conversation

dralley
Copy link
Contributor

@dralley dralley commented Jan 6, 2024

Make it (mostly) up to date with RPMv4 standards.
Also fix some broken links, and mark old signature tags as deprecated.

docs/manual/format.md Outdated Show resolved Hide resolved
docs/manual/format.md Outdated Show resolved Hide resolved
it is used for both the Header and the Signature. The details of the
header structure are given below, and you'll want to read them so the
rest of this makes sense. The tags for the Signature are defined in
lib/signature.h.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everywhere that mentioned source code previously was broken 💔

package header. Which tag is present depends on which of the two (supported)
OpenPGP algorithms was used at signing time. Using a key based upon the RSA
algorithm to sign the package will result in the signature being stored in the
RSAHEADER tag, whereas the use of the EdDSA (ed25519) algorithm will use the
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a cryptography person, I'm unsure if this is an appropriate way to refer to an EdDSA signature that uses curve ed25519, or if it's OK to just refer to it as EdDSA (as happens in a few other places)

you should not assume that this document is kept up to date with the
latest RPM code. That said, the 3.0 format should not change for
quite a while, and when it does, it will not be 3.0 anymore :-).
This document describes the RPM file format version 4.0. The format is subject
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "4.0" fine or ought we to use something along the lines of "V4" instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not describe v4 file format, so we should not bump the number either. For v4, the by far most important item is the immutable region and that is not even mentioned anywhere here. Not surprising since most of the content is from the initial commit in 1996 (cdd4c29)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add some descriptions of the immutable region. I believe that's documented somewhere, maybe it's worth merging into this document.

Copy link
Contributor Author

@dralley dralley Jan 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Any other features to mention?

docs/manual/format.md Outdated Show resolved Hide resolved
RSAHEADER tag, whereas the use of the EdDSA (ed25519) algorithm will use the
DSAHEADER tag instead. The name of the DSAHEADER tag is a historical artifact,
it originally referred to the long-obsolete DSA algorithm but was later reused
for EdDSA (ed25519) signatures.
Copy link
Contributor Author

@dralley dralley Jan 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to define an alias for DSAHEADER such that it can be referred to as EDDSAHEADER?

Is there any particular reason to have two tags in the first place, other than that a pattern was started with RSAHEADER that might as well continue? AFAIK the PGP certificate embeds enough information to know which algorithm it was created with.

edit: actually this was discussed when they were added too #1571 (comment)

I don’t particularly care which tag is used, so long as it works. Can we eliminate the distinction in RPMv6?

We'd need some way to tell what keys are what type, but there are certainly better ways to do it. Ideally, RPMv6 would also include fixing support for multiple signatures.

There was some discussion in other threads about creating RPMTAG_OPENPGPHEADER, doesn't look like that went anywhere though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible? Technically yes but it doesn't make it any more right or any easier for the user, only more confusing.

@dralley dralley force-pushed the update-manual branch 2 times, most recently from a561596 to b891bfc Compare January 6, 2024 22:17
The next two bytes (8-9) form an int16 that indicates the architecture
the package was built for. While this is used by file(1), the true
architecture is stored as a string in the Header. See, lib/misc.c for
a list of architecture->int16 translations. In this case, 1 == i386.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find that mapping anymore, but I don't know if we have much need to discuss it anyway.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No wonder, the arch translations have been in the declarative rpmrc config file for over twenty years. This is one of the docs thats so old it makes you wonder if its worth trying to patch it up...

@dralley dralley force-pushed the update-manual branch 2 times, most recently from f446376 to dbd7eb8 Compare January 7, 2024 02:10
docs/manual/format.md Outdated Show resolved Hide resolved
docs/manual/format.md Outdated Show resolved Hide resolved
docs/manual/tags.md Outdated Show resolved Hide resolved
include/rpm/rpmtag.h Outdated Show resolved Hide resolved
@dralley dralley force-pushed the update-manual branch 4 times, most recently from 019b544 to 0449658 Compare January 9, 2024 19:56
@@ -264,3 +256,101 @@ could start at byte 589, byte that is an improper boundary for an INT32.
As a result, 3 null bytes are inserted and the date for the SIZE actually
starts at byte 592: "00 09 9b 31", which is 629553).

### Immutable header regions
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept any changes to this document in a separate commit so they can be more easily reviewed.

There's plenty of room for improvement still, but this seems halfway reasonable?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's lots in the hregion text that fits neither the style or content otherwise (like lack of technical detail), but it's a start. Documenting the details is going to be quite a bit of work that I need to do anyhow sooner than later.

Make it (mostly) up to date with RPMv4 standards.
Also fix some broken links, and mark old signature tags as deprecated.
docs/manual/format.md Outdated Show resolved Hide resolved
@dralley
Copy link
Contributor Author

dralley commented Jan 10, 2024

Updated

@pmatilai pmatilai self-assigned this Jan 17, 2024
@pmatilai
Copy link
Member

The more I looked at this and the existing docs, the more clear it became that the stuff needs more than a touch-up job to be credible.

I ended up rewriting much of bit of it, updating and preserving the v3 docs too for historians and the like: #2861. That was quite the pile to chew out in a day, so there will be gaps and mistakes and all but I think it's now a more solid place to build on now.

After that churn, this PR wont be anywhere near applicable, but. There's good stuff in this PR and I initially tried to pull as much content from this PR as possible but got nowhere with that approach, because the initial state is what it is. I'll go through this once more once the dust settles to double-check what additions I missed and apply manually.

Thanks for the patch and initiative to get this updated! Getting v4 documented was one of my goals for last year and this PR was apparently the necessary kick to get started 😄

@dralley
Copy link
Contributor Author

dralley commented Jan 20, 2024

Understood, thanks! Feel free to close this once you're done with it.

@dralley dralley closed this Jan 23, 2024
@pmatilai
Copy link
Member

I'm not actually finished with this, but I do have a local backup anyway, closing is okay.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants