#693 closed defect (fixed)

CLI stats on empty directory chokes reporting the size histogram

Reported by: bhyde Owned by: nobody
Priority: major Milestone: 1.5.0
Component: code-frontend-cli Version: 1.4.1
Keywords: easy Cc:
Launchpad Bug:

Description

bash-3.2$ tahoe --version
allmydata-tahoe: 1.4.1, foolscap: 0.3.2, pycryptopp: 0.5.10, zfec: 1.4.2, Twisted: 2.4.0, Nevow: 0.9.32, zope.interface: 3.3.0, python: 2.5.1, platform: Darwin-9.6.0-i386-32bit, simplejson: 2.0.1, argparse: 0.8.0, pyOpenSSL: 0.6, pyutil: 1.3.28, zbase32: 1.1.1, setuptools: 0.6c12dev
bash-3.2$ tahoe create-alias example
Alias 'example' created
bash-3.2$ tahoe ls example:
bash-3.2$ tahoe stats example:
Counts and Total Sizes:
 count-immutable-files: 0
   count-mutable-files: 0
   count-literal-files: 0
           count-files: 0
     count-directories: 1
  size-immutable-files: 0
    size-literal-files: 0
      size-directories: 0
     largest-directory: 0
largest-immutable-file: 0
Size Histogram:
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 439, in stats
    rc = tahoe_manifest.stats(options)
  File "/Users/bhyde/p/allmydata-tahoe-1.4.1/src/allmydata/scripts/tahoe_manifest.py", line 140, in stats
    return StatsGrabber().run(options)
  File "/Users/bhyde/p/allmydata-tahoe-1.4.1/src/allmydata/scripts/slow_operation.py", line 37, in run
    return self.wait_for_results()
  File "/Users/bhyde/p/allmydata-tahoe-1.4.1/src/allmydata/scripts/slow_operation.py", line 53, in wait_for_results
    if self.poll():
  File "/Users/bhyde/p/allmydata-tahoe-1.4.1/src/allmydata/scripts/slow_operation.py", line 72, in poll
    self.write_results(data)
  File "/Users/bhyde/p/allmydata-tahoe-1.4.1/src/allmydata/scripts/tahoe_manifest.py", line 124, in write_results
    in data["size-files-histogram"]])
ValueError: max() arg is an empty sequence
bash-3.2$ tahoe cp happyBaby.jpg example:
Success: files copied
 tahoe cp stats example:
No such file or directory stats
bash-3.2$ tahoe stats example:
Counts and Total Sizes:
 count-immutable-files: 1
   count-mutable-files: 0
   count-literal-files: 0
           count-files: 1
     count-directories: 1
  size-immutable-files: 19518    (19.52 kB, 19.06 kiB)
    size-literal-files: 0
      size-directories: 417
     largest-directory: 417
largest-immutable-file: 19518    (19.52 kB, 19.06 kiB)
Size Histogram:
10001-31622 : 1    (31.62 kB, 30.88 kiB)

Change History (4)

comment:1 Changed at 2009-05-04T01:00:36Z by bhyde

Needs a condition here.

comment:2 Changed at 2009-06-10T16:38:47Z by zooko

  • Keywords easy added

Thanks for the bug report, bhyde.

comment:3 Changed at 2009-07-11T11:28:29Z by warner

  • Component changed from unknown to code-frontend-cli

comment:4 Changed at 2009-07-15T07:53:57Z by warner

  • Milestone changed from undecided to 1.5.0
  • Resolution set to fixed
  • Status changed from new to closed

Oops, good catch. Fixed in efa608a1353e91fe. Thanks!

Note: See TracTickets for help on using tickets.