rstrip() strips characters not strings

Bug #1155761 reported by Johannes Erdfelt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Undecided
Johannes Erdfelt

Bug Description

In nova/virt/powervm/blockdev.py:_copy_image_file, it uses rstrip() in an attempt to strip off a trailing file extension (".gz").

However, rstrip() works on characters and not strings. As a result, rstrip() could strip too many characters off.

Example:

>>> "foobaz.gz".rstrip(".gz")
'fooba'

Changed in nova:
assignee: nobody → Johannes Erdfelt (johannes.erdfelt)
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/24527
Committed: http://github.com/openstack/nova/commit/397bb31c243d03c050c14ed60a871109b1314b2d
Submitter: Jenkins
Branch: master

commit 397bb31c243d03c050c14ed60a871109b1314b2d
Author: Johannes Erdfelt <email address hidden>
Date: Fri Mar 15 15:08:58 2013 +0000

    rstrip() strips characters, not strings

    Fixes bug 1155761

    This use of rstrip() could end stripping off more than just the ".gz"
    suffix if the filename contains any of the ".gz" characters at the end
    of the string.

    Change-Id: Id75388453f286ca7b05bab51c9826c43c10ef516

Changed in nova:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in nova:
milestone: none → grizzly-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in nova:
milestone: grizzly-rc1 → 2013.1
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.