#695 closed defect (duplicate)

error message could be more helpful re: CLI rm confused by URL:DIR in at least two cases

Reported by: bhyde Owned by: davidsarah
Priority: major Milestone: 1.9.0
Component: code-frontend-cli Version: 1.4.1
Keywords: tahoe-rm error Cc:
Launchpad Bug:

Description

The assertion that fails here doesn't like the empty path which comes back from resolving get_alias. This happens both if you hand it a directory URL, or an alias without a path (which you'd do trying to delete an alias).

It doesn't like removing a directory given it's full URI.

bash-3.2$ tahoe ls example:
bash-3.2$ tahoe mkdir example:Docs
URI:DIR2:vvsbxdcrfsecq...etc...tzkxvacyqcwa
bash-3.2$ tahoe ls example:
Docs
bash-3.2$ tahoe rm example:Docs
200 OK
bash-3.2$ tahoe mkdir example:Docs2
URI:DIR2:ouj6x4n6cxcs65im...etc...x7uq
bash-3.2$ tahoe rm URI:DIR2:ouj6x4n6cxcs65im...etc...x7uq
Traceback (most recent call last):
  File "/Users/bhyde/p/allmydata-tahoe-1.4.1/support/bin/tahoe", line 8, in <module>
    load_entry_point('allmydata-tahoe==1.4.1', 'console_scripts', 'tahoe')()
  File "/Users/bhyde/p/allmydata-tahoe-1.4.1/src/allmydata/scripts/runner.py", line 91, in run
    rc = runner(sys.argv[1:])
  File "/Users/bhyde/p/allmydata-tahoe-1.4.1/src/allmydata/scripts/runner.py", line 78, in runner
    rc = cli.dispatch[command](so)
  File "/Users/bhyde/p/allmydata-tahoe-1.4.1/src/allmydata/scripts/cli.py", line 409, in rm
    rc = tahoe_rm.rm(options)
  File "/Users/bhyde/p/allmydata-tahoe-1.4.1/src/allmydata/scripts/tahoe_rm.py", line 25, in rm
    assert path
AssertionError
bash-3.2$ 

A similar failure occurs if you do:

tahoe create-alias foobar
tahoe ls foobar:
tahoe rm foobar:

Change History (6)

comment:1 Changed at 2009-05-04T23:34:00Z by bhyde

  • Resolution set to invalid
  • Status changed from new to closed

Ok. This bug is in error.

rm removes things (files, subdirectories) from directories; i.e. unlinks them. Since things do not have back pointers to the zero or more directories that might link to them, you must pass a path to the object to be unlinked. That path then denotes both the thing, and the directory it's in. Both the examples above fail, as they should, because the parent & child can't be puzzled out from what was passed in.

comment:2 Changed at 2009-06-10T17:40:19Z by zooko

  • Component changed from unknown to code-frontend-cli
  • Priority changed from major to minor
  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Summary changed from CLI rm confused by URL:DIR in at least two cases to error message could be more helpful re: CLI rm confused by URL:DIR in at least two cases

I'm reopening this and renaming it to indicate that the tahoe cli ought to emit a helpful error message explaining that you can't rm files or directories directly by their cap.

comment:3 Changed at 2010-06-12T23:21:43Z by davidsarah

  • Keywords tahoe-rm error added
  • Milestone changed from undecided to soon
  • Owner changed from nobody to davidsarah
  • Priority changed from minor to major
  • Status changed from reopened to new

comment:4 Changed at 2010-07-17T03:52:09Z by davidsarah

  • Milestone changed from soon to 1.8β

comment:5 Changed at 2010-09-11T00:33:13Z by davidsarah

  • Milestone changed from 1.8β to 1.9.0
  • Status changed from new to assigned

Out of time for 1.8.

comment:6 Changed at 2011-08-14T01:07:07Z by davidsarah

  • Resolution set to duplicate
  • Status changed from assigned to closed

This is a duplicate of #1292, and was fixed by 52963f4a76809cde. On trunk, both cases (the one using an URI and the one using an alias) print:

'tahoe rm' can only unlink directory entries, so a path must be given.
Note: See TracTickets for help on using tickets.