def parseArgs(self, where=""):
self.where = where
- longdesc = """List the contents of some portion of the grid."""
+ longdesc = """
+ List the contents of some portion of the grid.
+
+ When the -l or --long option is used, each line is shown in the
+ following format:
+
+ drwx <size> <date/time> <name in this directory>
+
+ where each of the letters on the left may be replaced by '-'.
+ If 'd' is present, it indicates that the object is a directory.
+ If the 'd' is replaced by a '?', the object type is unknown.
+ 'rwx' is a Unix-like permissions mask: if the mask includes 'w',
+ then the object is writable through its link in this directory.
+ The 'x' is a legacy of Unix filesystems. In Tahoe it is used
+ only to indicate that the contents of a directory can be listed.
+
+ Directories have no size, so their size field is shown as '-'.
+ Otherwise the size of the file, when known, is given in bytes.
+ The size of mutable files or unknown objects is shown as '?'.
+
+ The date/time shows when this link in the Tahoe filesystem was
+ last modified.
+ """
class GetOptions(VDriveOptions):
def parseArgs(self, arg1, arg2=None):
# raised.
path = path.strip()
if uri.has_uri_prefix(path):
- # The only way to get a sub-path is to use URI:blah:./foo, and we
- # strip out the :./ sequence.
+ # We used to require "URI:blah:./foo" in order to get a subpath,
+ # stripping out the ":./" sequence. We still allow that for compatibility,
+ # but now also allow just "URI:blah/foo".
sep = path.find(":./")
if sep != -1:
return path[:sep], path[sep+3:]
+ sep = path.find("/")
+ if sep != -1:
+ return path[:sep], path[sep+1:]
return path, ""
colon = path.find(":")
if colon == -1:
children = {}
if nodetype == "dirnode":
children = d['children']
- elif nodetype == "filenode":
+ else:
childname = path.split("/")[-1]
children = {childname: (nodetype, d)}
if "metadata" not in d:
# maxwidth so we can format them tightly. Size, filename, and URI are the
# variable-width ones.
rows = []
+ has_unknowns = False
for name in childnames:
name = unicode(name)
classify = "/"
elif childtype == "filenode":
t0 = "-"
- size = str(child[1]['size'])
+ size = str(child[1].get("size", "?"))
classify = ""
if rw_uri:
classify = "*"
else:
+ has_unknowns = True
t0 = "?"
size = "?"
classify = "?"
for row in rows:
print >>stdout, (fmt % tuple(row)).rstrip()
+ if has_unknowns:
+ print >>stderr, "\nThis listing included unknown objects. Using a webapi server that supports" \
+ "\na later version of Tahoe may help."
+
return 0
# error cases that need improvement: