** Description changed:

+ Request for SRU
+ ===============
+ 
+ 1. Statement explaining the impact
+ If you happen to have a package that has an incorrect installed-size field 
which is not all numeric, smart will crash. For Landscape users, since 
Landscape uses smart on the client side, it means the managed machine will stop 
reporting package information to the server and any package activity won't work.
+ 
+ 2. How has the bug been addressed
+ The bug was fixed by upstream in smart 1.3.1. For this SRU, that specific 
change has been used for a patch which applied cleanly.
+ 
+ 3. Patch
+ The patch is attached to this bug report as a debdiff for each nominated 
ubuntu release. It includes the fix for the deb backend, a similar fix for the 
rpm backend and a test. It was taken from smart trunk and applies cleanly.
+ 
+ 4. How to reproduce
+ a) With the affected version of smart installed, edit /var/lib/dpkg/status 
and change the installed size field of the first package you see in there to 
include the letter "k" after the number. For example:
+ """
+ Package: xserver-xorg-input-vmmouse
+ Status: install ok installed
+ Priority: optional
+ Section: x11
+ Installed-Size: 176
+ (...)
+ """
+ 
+ Change it to:
+ """
+ Installed-Size: 176k
+ (...)
+ """
+ 
+ b) Run "/usr/share/smart/smart info xserver-xorg-input-vmmouse" (or the
+ package that you changed). You will get a backtrace
+ 
+ c) Install the fixed version of python-smartpm
+ 
+ d) Run the command from (c) again. No backtrace this time, and installed
+ size will be reported as unknown.
+ 
+ 5. Regression potential
+ Minimal. The patch is very focused and has been in smart since 1.3.1. 
Upstream is now at 1.4.0.
+ If suddenly many packages start reporting this field with a letter, smart, by 
ignoring it, would probably not be able to tell if there would be enough disk 
space after the installation, so users could be left with an out of disk error 
after installations. I don't know what apt does with that field. A quick test 
shows that installed-size is displayed when it has a letter, but I don't know 
if it's interpreted and taken into account in the disk free space calculations.
+ 
+ 
+ Original bug description below
+ -------------------------------
+ 
  Happened with a support customer:
  
  2010-01-24 16:26:20,947 ERROR    [MainThread] None
  Traceback (most recent call last):
-   File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 
317, in _runCallbacks
-     self.result = callback(self.result, *args, **kw)
-   File "/usr/lib/python2.5/site-packages/landscape/package/reporter.py", line 
47, in <lambda>
-     result.addCallback(lambda x: self.handle_tasks())
-   File "/usr/lib/python2.5/site-packages/landscape/package/taskhandler.py", 
line 37, in handle_tasks
-     self._handle_next_task(None, deferred)
-   File "/usr/lib/python2.5/site-packages/landscape/package/taskhandler.py", 
line 49, in _handle_next_task
-     result = self.handle_task(task)
-   File "/usr/lib/python2.5/site-packages/landscape/package/reporter.py", line 
163, in handle_task
-     return self._handle_package_ids(message)
-   File "/usr/lib/python2.5/site-packages/landscape/package/reporter.py", line 
191, in _handle_package_ids
-     result = self._handle_unknown_packages(unknown_hashes)
-   File "/usr/lib/python2.5/site-packages/landscape/package/reporter.py", line 
234, in _handle_unknown_packages
-     skeleton = self._facade.get_package_skeleton(package)
-   File "/usr/lib/python2.5/site-packages/landscape/package/facade.py", line 
127, in get_package_skeleton
-     return build_skeleton(pkg, with_info)
-   File "/usr/lib/python2.5/site-packages/landscape/package/skeleton.py", line 
89, in build_skeleton
-     skeleton.installed_size = info.getInstalledSize()
-   File "/usr/lib/python2.5/site-packages/smart/backends/deb/loader.py", line 
71, in getInstalledSize
-     return long(size)*1024
+   File "/usr/lib/python2.5/site-packages/twisted/internet/defer.py", line 
317, in _runCallbacks
+     self.result = callback(self.result, *args, **kw)
+   File "/usr/lib/python2.5/site-packages/landscape/package/reporter.py", line 
47, in <lambda>
+     result.addCallback(lambda x: self.handle_tasks())
+   File "/usr/lib/python2.5/site-packages/landscape/package/taskhandler.py", 
line 37, in handle_tasks
+     self._handle_next_task(None, deferred)
+   File "/usr/lib/python2.5/site-packages/landscape/package/taskhandler.py", 
line 49, in _handle_next_task
+     result = self.handle_task(task)
+   File "/usr/lib/python2.5/site-packages/landscape/package/reporter.py", line 
163, in handle_task
+     return self._handle_package_ids(message)
+   File "/usr/lib/python2.5/site-packages/landscape/package/reporter.py", line 
191, in _handle_package_ids
+     result = self._handle_unknown_packages(unknown_hashes)
+   File "/usr/lib/python2.5/site-packages/landscape/package/reporter.py", line 
234, in _handle_unknown_packages
+     skeleton = self._facade.get_package_skeleton(package)
+   File "/usr/lib/python2.5/site-packages/landscape/package/facade.py", line 
127, in get_package_skeleton
+     return build_skeleton(pkg, with_info)
+   File "/usr/lib/python2.5/site-packages/landscape/package/skeleton.py", line 
89, in build_skeleton
+     skeleton.installed_size = info.getInstalledSize()
+   File "/usr/lib/python2.5/site-packages/smart/backends/deb/loader.py", line 
71, in getInstalledSize
+     return long(size)*1024
  ValueError: invalid literal for long() with base 10: '221M'
  
- 
  I'm im touch with him to discover which package this is.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/512302

Title:
  Smart crashes on malformed "Installed-Size" deb package field

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to