exceptions when trying to use dirnode URIs #124

Closed
opened 2007-08-24 15:44:36 +00:00 by zooko · 5 comments
zooko commented 2007-08-24 15:44:36 +00:00
Owner

poor handling of user error: pasting a dirnode uri into the "get file" field of the wui

If you paste a dirnode uri into the "URI of file to download" field, you'll get:

An error occurred rendering the requested page. Additionally, an error occured rendering the error page.

The twistd.log contains:

          File "/Users/wonwinmcbrootles/playground/allmydata/tahoe/instdir/lib/allmydata/vdrive.py", line 128, in get_node
            node_uri = IURI(node_uri)
            # node_uri = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85cazf
aa8uyd8mb1u8esw'"
            # IURI = '<InterfaceClass allmydata.interfaces.IURI>'
          File "/lib/python2.5/site-packages/zope/interface/interface.py", line 697, in __call__
            
          File "/lib/python2.5/site-packages/zope/interface/interface.py", line 765, in __adapt__
            
          File "/usr/local/stow/Twisted-2.5.0/lib/python2.5/site-packages/twisted/python/components.py", line 113, in _hook
            return factory(ob)
            # ob = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85cazfaa8uyd
8mb1u8esw'"
          File "/Users/wonwinmcbrootles/playground/allmydata/tahoe/instdir/lib/allmydata/uri.py", line 205, in from_string
            raise RuntimeError("unknown URI type: %s.." % s[:10])
            # RuntimeError = "<type 'exceptions.RuntimeError'>"
            # s = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85cazfaa8uyd8
mb1u8esw'"
        exceptions.RuntimeError: unknown URI type:  URI:DIR:p..

and

          File "/usr/local/lib/python2.5/site-packages/nevow/appserver.py", line 82, in processingFailed
            handler.renderHTTP_exception(ctx, reason)
          File "/usr/local/lib/python2.5/site-packages/nevow/appserver.py", line 57, in renderHTTP_exception
            result = failure.formatFailure(reason)
            # reason = <twisted.python.failure.Failure <type 'exceptions.RuntimeError'>>
          File "/usr/local/stow/Nevow-0.9.18/lib/python2.5/site-packages/nevow/failure.py", line 248, in formatFailure
            for method, filename, lineno, localVars, globalVars in myFailure.frames:
            # myFailure = <twisted.python.failure.Failure <type 'exceptions.RuntimeError'>>

Ah, the same thing happens when I paste the dirnode uri into the "URI of new child" field!

Here is the twistd.log from that:

          File "/Users/wonwinmcbrootles/playground/allmydata/tahoe/instdir/lib/allmydata/dirnode.py", line 282, in set_uri
            write, read = self._split_uri(child_uri)
            # self = '<allmydata.dirnode.MutableDirectoryNode instance at 0x20e3170>'
            # child_uri = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85caz
faa8uyd8mb1u8esw'"
          File "/Users/wonwinmcbrootles/playground/allmydata/tahoe/instdir/lib/allmydata/dirnode.py", line 306, in _split_uri
            u = IURI(child_uri)
            # IURI = '<InterfaceClass allmydata.interfaces.IURI>'
            # child_uri = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85caz
faa8uyd8mb1u8esw'"
          File "/lib/python2.5/site-packages/zope/interface/interface.py", line 697, in __call__
            
          File "/lib/python2.5/site-packages/zope/interface/interface.py", line 765, in __adapt__
            
          File "/usr/local/stow/Twisted-2.5.0/lib/python2.5/site-packages/twisted/python/components.py", line 113, in _hook
            return factory(ob)
            # ob = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85cazfaa8uyd
8mb1u8esw'"
          File "/Users/wonwinmcbrootles/playground/allmydata/tahoe/instdir/lib/allmydata/uri.py", line 205, in from_string
            raise RuntimeError("unknown URI type: %s.." % s[:10])
            # RuntimeError = "<type 'exceptions.RuntimeError'>"
            # s = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85cazfaa8uyd8
mb1u8esw'"
        exceptions.RuntimeError: unknown URI type:  URI:DIR:p..
        
poor handling of user error: pasting a dirnode uri into the "get file" field of the wui If you paste a dirnode uri into the "URI of file to download" field, you'll get: ``` An error occurred rendering the requested page. Additionally, an error occured rendering the error page. ``` The twistd.log contains: ``` File "/Users/wonwinmcbrootles/playground/allmydata/tahoe/instdir/lib/allmydata/vdrive.py", line 128, in get_node node_uri = IURI(node_uri) # node_uri = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85cazf aa8uyd8mb1u8esw'" # IURI = '<InterfaceClass allmydata.interfaces.IURI>' File "/lib/python2.5/site-packages/zope/interface/interface.py", line 697, in __call__ File "/lib/python2.5/site-packages/zope/interface/interface.py", line 765, in __adapt__ File "/usr/local/stow/Twisted-2.5.0/lib/python2.5/site-packages/twisted/python/components.py", line 113, in _hook return factory(ob) # ob = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85cazfaa8uyd 8mb1u8esw'" File "/Users/wonwinmcbrootles/playground/allmydata/tahoe/instdir/lib/allmydata/uri.py", line 205, in from_string raise RuntimeError("unknown URI type: %s.." % s[:10]) # RuntimeError = "<type 'exceptions.RuntimeError'>" # s = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85cazfaa8uyd8 mb1u8esw'" exceptions.RuntimeError: unknown URI type: URI:DIR:p.. ``` and ``` File "/usr/local/lib/python2.5/site-packages/nevow/appserver.py", line 82, in processingFailed handler.renderHTTP_exception(ctx, reason) File "/usr/local/lib/python2.5/site-packages/nevow/appserver.py", line 57, in renderHTTP_exception result = failure.formatFailure(reason) # reason = <twisted.python.failure.Failure <type 'exceptions.RuntimeError'>> File "/usr/local/stow/Nevow-0.9.18/lib/python2.5/site-packages/nevow/failure.py", line 248, in formatFailure for method, filename, lineno, localVars, globalVars in myFailure.frames: # myFailure = <twisted.python.failure.Failure <type 'exceptions.RuntimeError'>> ``` Ah, the same thing happens when I paste the dirnode uri into the "URI of new child" field! Here is the twistd.log from that: ``` File "/Users/wonwinmcbrootles/playground/allmydata/tahoe/instdir/lib/allmydata/dirnode.py", line 282, in set_uri write, read = self._split_uri(child_uri) # self = '<allmydata.dirnode.MutableDirectoryNode instance at 0x20e3170>' # child_uri = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85caz faa8uyd8mb1u8esw'" File "/Users/wonwinmcbrootles/playground/allmydata/tahoe/instdir/lib/allmydata/dirnode.py", line 306, in _split_uri u = IURI(child_uri) # IURI = '<InterfaceClass allmydata.interfaces.IURI>' # child_uri = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85caz faa8uyd8mb1u8esw'" File "/lib/python2.5/site-packages/zope/interface/interface.py", line 697, in __call__ File "/lib/python2.5/site-packages/zope/interface/interface.py", line 765, in __adapt__ File "/usr/local/stow/Twisted-2.5.0/lib/python2.5/site-packages/twisted/python/components.py", line 113, in _hook return factory(ob) # ob = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85cazfaa8uyd 8mb1u8esw'" File "/Users/wonwinmcbrootles/playground/allmydata/tahoe/instdir/lib/allmydata/uri.py", line 205, in from_string raise RuntimeError("unknown URI type: %s.." % s[:10]) # RuntimeError = "<type 'exceptions.RuntimeError'>" # s = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85cazfaa8uyd8 mb1u8esw'" exceptions.RuntimeError: unknown URI type: URI:DIR:p.. ```
tahoe-lafs added the
unknown
major
defect
0.5.1
labels 2007-08-24 15:44:36 +00:00
tahoe-lafs added this to the undecided milestone 2007-08-24 15:44:36 +00:00
tahoe-lafs added
code-frontend-web
and removed
unknown
labels 2007-08-24 15:44:54 +00:00
tahoe-lafs added
code
and removed
code-frontend-web
labels 2007-08-24 15:47:31 +00:00
tahoe-lafs changed title from poor handling of user error: pasting a dirnode uri into the "get file" field of the wui to exceptions when trying to use dirnode URIs 2007-08-24 15:47:31 +00:00
warner commented 2007-08-25 00:32:36 +00:00
Author
Owner

The first is a user error, but the error message obviously needs improvement.

The second ought to have worked. Odd, it worked for me just now..

I'll look at the error message more closely. BTW, what version of the node were you running?

The first is a user error, but the error message obviously needs improvement. The second ought to have worked. Odd, it worked for me just now.. I'll look at the error message more closely. BTW, what version of the node were you running?
warner commented 2007-08-25 00:38:17 +00:00
Author
Owner

Hooray for bindann!

# s = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85cazfaa8uyd8
mb1u8esw'"

well, ok, the extra quotes are weird, I don't know whether those are an artifact
or not, but the leading space is the problem. There must have been a space in
the text field when you pasted the URI in, or the cut target must have had a
space in it.

I'm going to change webish.py to do a strip() on all the arguments that
it receives. This is obviously correct for URIs. For filenames, it isn't, but
I think it is the least surprising approach (imagine adding a filename that
is all spaces, or a filename with a trailing space, and then trying to access
it via the CLI!).

Hooray for bindann! ``` # s = "' URI:DIR:pb://xextf3eap44o3wi27mf7ehiur6wvhzr6@207.7.153.180:56677,127.0.0.1:56677/vdrive:y1obs85cazfaa8uyd8 mb1u8esw'" ``` well, ok, the extra quotes are weird, I don't know whether those are an artifact or not, but the leading space is the problem. There must have been a space in the text field when you pasted the URI in, or the cut target must have had a space in it. I'm going to change webish.py to do a `strip()` on all the arguments that it receives. This is obviously correct for URIs. For filenames, it isn't, but I think it is the least surprising approach (imagine adding a filename that is all spaces, or a filename with a trailing space, and then trying to access it via the CLI!).
zooko commented 2007-08-25 02:52:24 +00:00
Author
Owner

(imagine adding a filename that is all spaces, or a filename with a trailing space, and then trying to access it via the CLI!).

That's easy! You just have to quote or escape it. :-)

> (imagine adding a filename that is all spaces, or a filename with a trailing space, and then trying to access it via the CLI!). That's easy! You just have to quote or escape it. :-)
warner commented 2007-08-25 19:21:33 +00:00
Author
Owner

true, but display is a problem: before I got into the habit of using
tab-completion everywhere, I'd spend entire minutes trying to figure out why
the file that 'ls' is showing me couldn't be deleted (because ls was unable
to tell me that there was a space at the end of the filename).

I've fixed these in changeset:5946985c0789ca5d and changeset:ed525f74780159c2 (separately in case we decide that
stripping filenames is a bad idea).

The first problem (pasting a dirnode URI into the 'download file' box)
suggests that maybe we should have a "View a directory" box on the front
page, that accepts a dirnode URI. Or maybe we should have a "do something
useful with a URI" box that accepts either, although the filename parameter
is still a nuisance.

Thinking about this more carefully, the real issue is one of typing. When a
user shares a file or directory, they're using an edge of their own vdrive
graph to identify it, so they have some idea in mind of how they want the
data (sequence of bytes) that they're sharing to be used. I see five cases:
sharing just bytes (with no type information), sharing bytes + mime-type,
sharing bytes + mime-type + suggested filename, sharing a directory, sharing
a directory + suggested dirname.

Our current URI syntax collapses the type information into one bit: filenode
or dirnode. Filenodes can be treated as a variety of mime-types, but that
information is in the edge (implied by the filename).

Hm, maybe the box on the front page should accept a "sharing link", which is
more than a URI, maybe a URI combined with some information about suggested
filename/dirname.

Anyways, I'm going to close this one out. Zooko, do you think the front-page
box I just described is useful? I'm not so sure. If you think it is, we can
open a new ticket for it.

true, but display is a problem: before I got into the habit of using tab-completion everywhere, I'd spend entire minutes trying to figure out why the file that 'ls' is showing me couldn't be deleted (because ls was unable to tell me that there was a space at the end of the filename). I've fixed these in changeset:5946985c0789ca5d and changeset:ed525f74780159c2 (separately in case we decide that stripping filenames is a bad idea). The first problem (pasting a dirnode URI into the 'download file' box) suggests that maybe we should have a "View a directory" box on the front page, that accepts a dirnode URI. Or maybe we should have a "do something useful with a URI" box that accepts either, although the filename parameter is still a nuisance. Thinking about this more carefully, the real issue is one of typing. When a user shares a file or directory, they're using an edge of their own vdrive graph to identify it, so they have some idea in mind of how they want the data (sequence of bytes) that they're sharing to be used. I see five cases: sharing just bytes (with no type information), sharing bytes + mime-type, sharing bytes + mime-type + suggested filename, sharing a directory, sharing a directory + suggested dirname. Our current URI syntax collapses the type information into one bit: filenode or dirnode. Filenodes can be treated as a variety of mime-types, but that information is in the edge (implied by the filename). Hm, maybe the box on the front page should accept a "sharing link", which is more than a URI, maybe a URI combined with some information about suggested filename/dirname. Anyways, I'm going to close this one out. Zooko, do you think the front-page box I just described is useful? I'm not so sure. If you think it is, we can open a new ticket for it.
tahoe-lafs added the
fixed
label 2007-08-25 19:21:33 +00:00
tahoe-lafs modified the milestone from undecided to 0.6.0 2007-08-25 19:21:33 +00:00
warner closed this issue 2007-08-25 19:21:33 +00:00
zooko commented 2007-08-27 12:32:43 +00:00
Author
Owner

true, but display is a problem: before I got into the habit of using tab-completion
everywhere, I'd spend entire minutes trying to figure out why the file that 'ls' is
showing me couldn't be deleted (because ls was unable to tell me that there was a
space at the end of the filename).

I guess this means that "ls" ought to display the result in quotes, right?

> true, but display is a problem: before I got into the habit of using tab-completion > everywhere, I'd spend entire minutes trying to figure out why the file that 'ls' is > showing me couldn't be deleted (because ls was unable to tell me that there was a > space at the end of the filename). I guess this means that "ls" ought to display the result in quotes, right?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: tahoe-lafs/trac-2024-07-25#124
No description provided.