'tahoe ls' on unknown objects: error message should be clearer #837
Labels
No Label
0.2.0
0.3.0
0.4.0
0.5.0
0.5.1
0.6.0
0.6.1
0.7.0
0.8.0
0.9.0
1.0.0
1.1.0
1.10.0
1.10.1
1.10.2
1.10a2
1.11.0
1.12.0
1.12.1
1.13.0
1.14.0
1.15.0
1.15.1
1.2.0
1.3.0
1.4.1
1.5.0
1.6.0
1.6.1
1.7.0
1.7.1
1.7β
1.8.0
1.8.1
1.8.2
1.8.3
1.8β
1.9.0
1.9.0-s3branch
1.9.0a1
1.9.0a2
1.9.0b1
1.9.1
1.9.2
1.9.2a1
LeastAuthority.com automation
blocker
cannot reproduce
cloud-branch
code
code-dirnodes
code-encoding
code-frontend
code-frontend-cli
code-frontend-ftp-sftp
code-frontend-magic-folder
code-frontend-web
code-mutable
code-network
code-nodeadmin
code-peerselection
code-storage
contrib
critical
defect
dev-infrastructure
documentation
duplicate
enhancement
fixed
invalid
major
minor
n/a
normal
operational
packaging
somebody else's problem
supercritical
task
trivial
unknown
was already fixed
website
wontfix
worksforme
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Reference: tahoe-lafs/trac-2024-07-25#837
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
If you list a directory with
tahoe ls
, and it happens tocontain an object that your client doesn't recognize (say, a cap
type from the future, like DIR-IMM from a pre-1.6 client), the
child name is displayed normally. If you then try to list that
object, you get an error message (because your client doesn't
know how to download or interpret it), that looks like this:
We should make this error message more informative. The key word
in the message is "unknown", and means (from the point of view of
the code that emits it) that the
IFilesystemNode
object youpointed at is of type
UnknownNode
(as opposed toIFileNode
orIDirectoryNode
or something else itknows how to handle).
The CLI side should probably spot the webapi error message
(
if "unknown: can only do t=info" in data
) and appendsomething helpful, like "This means you tried to list a
filesystem object that was unrecognized by your tahoe client,
probably because it was created by a newer version. Upgrading
your tahoe client to the latest version may enable you to use
this object."""
Unfortunately this has regressed in 1.6 to printing no message at all. This is an unanticipated consequence of the patch for #833 having implemented
t=json
for unknown nodes. It happens becausetahoe_ls.py
no longer gets an error from the GET request, but the nodetype in the returned JSON is"unknown"
, which causes the code to [fall through the nodetype check]source:src/allmydata/scripts/tahoe_ls.py?rev=4142#L50 withchildren
still set to a empty dict.OTOH, the fact that
t=json
now works for unknown nodes makes it easy to fix this to display all the information we do know about the node. I have a patch to make it do that:Attachment improve-ls-for-unknown-objects-darcspatch.txt (52860 bytes) added
Improve behaviour of 'tahoe ls' for unknown objects (currently lacks tests)
Note that the patch also allows the filename to be displayed when the argument to
tahoe ls
is a path to a known file:Previously this would only have printed
unless the URI were specified with ":./", e.g.
tahoe ls -l URI:DIR2:bntvvn2bf37vwmrd3ttbygt4s4:qymwa2lcvhjvi3hnamxew6ywro5jmj7zfnspmrpqv3n7faibprlq:./test.txt
This is strictly a bug-fix, and it is a regression in v1.6.0, so it is appropriate for v1.6.1.
You have some trailing whitespace on line 66 of
tahoe_ls.py
Unless I'm mistaken, it isn't necessary to set
has_unknowns = True
on line 65 -- the same comparison (effectively) and the same operation are performed on line 113, in the formatting loop.It isn't immediately clear to me (as someone who has never viewed this ticket before) what the question marks in the output mean. Take, for example,
After reading your patch, I think that the first one means "I can't determine whether or not this is a dirnode", and the second one means "I can't determine the size of this object". Is that right?
tahoe ls --help
doesn't display anything in particular about the format of that output, though, instead showing:Would you consider amending that
--help
text as a part of this ticket? A general description of the long format would be great, but even a blurb about what?
s in the output mean would help. It's arguably out of scope for this ticket, I guess.Your changes to
get_alias
look good. Are you aware of any other CLI commands that will break somehow if allowed to accept arguments of the URI:blah/foo form (since so many of them useget_alias
)?Replying to kevan:
Fixed.
Agreed, fixed.
Yes.
tahoe ls --help
now ends with:No, I don't think there is anything that depends on the syntax of an URI in that way.
Attachment improve-ls-for-unknown-objects-2-darcspatch.txt (54095 bytes) added
Improve behaviour of 'tahoe ls' for unknown objects, addressing kevan's comments (still no tests)
Unsetting the
review-needed
tag until there are tests. (By the way, this sounds like a good improvement!)Attachment improve-ls-for-unknown-objects-3-darcspatch.txt (58166 bytes) added
Improve behaviour of 'tahoe ls' for unknown objects (with tweak to 'tahoe ls --help' output)
Attachment test-ls-for-unknown-objects-darcspatch.txt (57943 bytes) added
Test behaviour of 'tahoe ls' for unknown objects (#837)
The tests look good to me. This patch changes the semantics of
get_alias
, and what is printed when usingls
on an unknown file, and you test for both of those changes, so I don't think you're missing any tests, and the tests fail when your other patch isn't applied. I'm marking this as 'reviewed', since I've reviewed the other patch and am confident that they're both fine.Checked in as changeset:03134eedb5b7a059, changeset:9741b9655f08eaa7, changeset:6a7feea45569b15b.