[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#521284: apt-mark crashes when python-apt is not installed



Package: apt
Version: 0.7.9ubuntu17.1
Severity: normal
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


apt-mark crashes when python-apt is not installed. The actual version
0.7.20.2 warns the user that python-apt is missing but eventually
crashes anyway. Here is a really simple patch which ends apt-mark
properly, returning a value error of 1.

Regards,
Carl Chenet

- -- Package-specific info:

- -- (no /etc/apt/preferences present) --


- -- (/etc/apt/sources.list present, but not submitted) --


- -- System Information:
Debian Release: lenny/sid
  APT prefers hardy-updates
  APT policy: (500, 'hardy-updates'), (500, 'hardy-security'), (500, 'hardy')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.24-23-generic (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages apt depends on:
ii  libc6                   2.7-10ubuntu4    GNU C Library: Shared libraries
ii  libgcc1                 1:4.2.4-1ubuntu3 GCC support library
ii  libstdc++6              4.2.4-1ubuntu3   The GNU Standard C++ Library v3

Versions of packages apt recommends:
ii  ubuntu-keyring                2008.03.04 GnuPG keys of the Ubuntu archive

- -- no debconf information

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFJy35A8lge+lYYJUgRAla6AJ9R1eDK6XbYCILH1GxAg08X+x8+QwCcDupR
vm+svP01EWTLTSGVtN2aMXU=
=UcXW
-----END PGP SIGNATURE-----
*** apt-mark.ori	2009-03-26 13:44:54.000000000 +0100
--- apt-mark	2009-03-26 13:45:57.000000000 +0100
***************
*** 1,14 ****
  #!/usr/bin/python
  
  from optparse import OptionParser
! 
  try:
      import apt_pkg
  except ImportError:
      print "Error importing apt_pkg, is python-apt installed?"
!     
! import sys
! import os.path
      
  actions = { "markauto" : 1,
              "unmarkauto": 0
--- 1,14 ----
  #!/usr/bin/python
  
  from optparse import OptionParser
! import sys
! import os.path
!     
  try:
      import apt_pkg
  except ImportError:
      print "Error importing apt_pkg, is python-apt installed?"
!     sys.exit(1)
      
  actions = { "markauto" : 1,
              "unmarkauto": 0

Reply to: