Skip to content

CLI: opencloud decomposedfs metadata dump|get|set reject --root and --node #4083

Description

@asaah262

The subcommands of opencloud decomposedfs metadata can't be used: they reject the flags they need.

$ opencloud decomposedfs metadata dump --root /var/lib/opencloud/storage/users --node <id>
unknown flag: --root

Giving the flags before the subcommand (metadata --root … --node … dump) fails the same way.

--root and --node are defined with Flags() on the metadata command (opencloud/pkg/command/decomposedfs.go:186-188), and cobra doesn't pass those on to the subcommands dump, get and set, which read them. check-treesize isn't affected, as it defines its own flags.

Fix: define both flags with PersistentFlags(), so that the subcommands inherit them, and add a test that runs a subcommand with them.

Activity

  1. added theissue type on Nov 20, 2026
  2. moved this from Qualification to Prio <= 3 in OpenCloud Team Boardon Nov 20, 2026
  3. asaah262 commented on Nov 20, 2026

    @asaah262
    ContributorAuthor

    Some background for the issue: the commands broke with the migration from urfave/cli to cobra in 56324ca (December 2025).

    • Before, --root and --node were flags of metadata, and dump, get and set read them with c.String("root"), which in urfave/cli also looks at the flags of the parent commands. So opencloud decomposedfs metadata --root … --node … dump worked.
    • The migration turned them into metaCmd.Flags(). In cobra, those belong to metadata alone, so the subcommands don't know them. PersistentFlags() is cobra's counterpart of the old behaviour.
    • 35b3e51 ("fix opencloud decomposedfs flags") fixed the flags of check-treesize afterwards, but not those of metadata.

    The commands have no tests, which is probably why it went unnoticed. A test that runs metadata dump with --root and --node would catch it next time.

    Note: these commands are for decomposed storage (e.g. the system storage); they don't support posix, the default for user files.

  4. self-assigned this
    on Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions