"swift list -l -d /" doesn't work with faux directories

Bug #1399678 reported by Darrell Bishop
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-swiftclient
Fix Released
Undecided
Pete Zaitcev

Bug Description

I ran "swift list -l -d / some_container" and the JSON includes both:

[...
    {
        "hash": "d41d8cd98f00b204e9800998ecf8427e",
        "last_modified": "2014-10-31T00:21:51.215380",
        "bytes": 0,
        "name": "include",
        "content_type": "application/directory"
    }, {
        "subdir": "include/"
    },
 ...
]

And the swift CLI errors out with:

Traceback (most recent call last):
  File "/Users/darrell/.virtualenvs/ssdev2/bin/swift", line 11, in <module>
    sys.exit(main())
  File "/Users/darrell/.virtualenvs/ssdev2/lib/python2.7/site-packages/swiftclient/shell.py", line 1287, in main
    globals()['st_%s' % args[0]](parser, argv[1:], output)
  File "/Users/darrell/.virtualenvs/ssdev2/lib/python2.7/site-packages/swiftclient/shell.py", line 413, in st_list
    total_bytes += item_bytes

I'm guessing that the "long listing" loop isn't robust to list entries that only have the "subdir" key...

description: updated
summary: - "swift list -l -d /" doesn't work with faux directories
+ "swift list -l -d /" doesn't work
summary: - "swift list -l -d /" doesn't work
+ "swift list -l -d /" doesn't work with faux directories
Pete Zaitcev (zaitcev)
Changed in python-swiftclient:
assignee: nobody → Pete Zaitcev (zaitcev)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-swiftclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/154648

Changed in python-swiftclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-swiftclient (master)

Reviewed: https://review.openstack.org/154648
Committed: https://git.openstack.org/cgit/openstack/python-swiftclient/commit/?id=fec5d068a0056f5d9ec60e5fd3bbfad9b9f13b86
Submitter: Jenkins
Branch: master

commit fec5d068a0056f5d9ec60e5fd3bbfad9b9f13b86
Author: Pete Zaitcev <email address hidden>
Date: Wed Feb 18 19:38:05 2015 -0700

    Fix crash with -l, -d /, and pseudo folders

    Using -l, -d /, or a pseduo folder by itself works fine, but if you
    combine all of them, this happens:

    [zaitcev@guren s]$ swift list -d / testcont
    amazon_lili.jpg
    pseudodir/
    rin_shibuya_pixiv.jpg
    swift-c134855-5a.diff
    [zaitcev@guren s]$ swift list -d / -l testcont
          151954 2014-06-20 17:13:52 amazon_lili.jpg
    Traceback (most recent call last):
      File "/q/zaitcev/hail/python-swiftclient-tip/bin/swift", line 24, in <module>
        sys.exit(main())
      File "/q/zaitcev/hail/python-swiftclient-tip/swiftclient/shell.py", line 1301, in main
        globals()['st_%s' % args[0]](parser, argv[1:], output)
      File "/q/zaitcev/hail/python-swiftclient-tip/swiftclient/shell.py", line 414, in st_list
        total_bytes += item_bytes
    TypeError: unsupported operand type(s) for +=: 'int' and 'NoneType'

    The patch is a straightforward fix that assigns expected variables.

    Change-Id: If24dcc2491e8b8982455107d2aca30c0491a398a
    Closes-Bug: 1399678

Changed in python-swiftclient:
status: In Progress → Fix Committed
Changed in python-swiftclient:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-swiftclient 2.4.0

This issue was fixed in the openstack/python-swiftclient 2.4.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.