Skip to content

Repository.writeall() does not "write all" and may leave repo in inconsistent state  #958

@lukpueh

Description

@lukpueh

Description of issue or feature request:

The name and docstring of Repository.writeall()-classmethod and its commented use in the tuf tutorial, suggest that it writes all the metadata that needs to be written upon a metadata change, when in practice it only writes metadata that is marked as dirty.

This may leave the repository metadata in an inconsistent state, as is the case in above linked tutorial part.

Current behavior:

writeall only writes metadata that is marked as dirty, ignoring metadata interdependencies, i.e. timestamp needs to be re-written if snapshot changes, snapshot needs to be rewritten if targets or delegated targets changes, which may leave a repository in an inconsistent state.

Expected behavior:
Two options are conceivable:

  • Update documentation but above all the tutorial to clarify that writeall might require a prior call to mark_dirty (I will add a quick fix in Fix TUTORIAL.md and add regression testing for future issues #775)

  • Update writeall to indeed write all the metadata that is required to be written upon any metadata change (preferred solution).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions