After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 742454 - ostree refs --delete=PREFIX deletes everything
ostree refs --delete=PREFIX deletes everything
Status: RESOLVED FIXED
Product: ostree
Classification: Infrastructure
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: OSTree maintainer(s)
OSTree maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2015-01-06 13:11 UTC by Stef Walter
Modified: 2015-01-06 15:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (1.51 KB, patch)
2015-01-06 14:39 UTC, Matthew Barnes
committed Details | Review

Description Stef Walter 2015-01-06 13:11:16 UTC
All refs are deleted when you run the following command:

# ostree --repo=/mine refs --delete=PREFIX

Even though this is how 'ostree refs' is documented to work

# ostree refs --help
Usage:
  ostree refs [OPTION...] [PREFIX] - List refs

Help Options:
  -h, --help       Show help options

Application Options:
  --delete=PREFIX  Delete refs which match PREFIX, rather than listing them
Comment 1 Matthew Barnes 2015-01-06 14:27:47 UTC
Ugh, the help output is wrong.  --delete doesn't actually take an argument, the PREFIX is specified separately.

Looks like this has been a bug from the beginning:
https://git.gnome.org/browse/ostree/diff/src/ostree/ot-builtin-refs.c?id=dc0f3c3dcbdd63d6a41ebc172b38c65576db9cd3

I wonder if a PREFIX should be mandatory when using --delete to prevent accidents like this.
Comment 2 Matthew Barnes 2015-01-06 14:39:21 UTC
Created attachment 293937 [details] [review]
Proposed patch
Comment 3 Colin Walters 2015-01-06 14:44:45 UTC
Review of attachment 293937 [details] [review]:

Ouch.  Yes.  Can you also add a test case to `tests/test-basic.sh`?  There are already a few refs tests there.  Good to commit with that change.
Comment 4 Matthew Barnes 2015-01-06 15:46:05 UTC
Pushed with a test case.

https://git.gnome.org/browse/ostree/commit/?id=7727fe84d90099efadb535538f9aa22d83f78507