print an error if a new state file can't be created in apt-mark,
authorDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 25 Nov 2009 21:47:45 +0000 (22:47 +0100)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Wed, 25 Nov 2009 21:47:45 +0000 (22:47 +0100)
thanks Carl Chenet! (Closes: #521289)

cmdline/apt-mark
debian/changelog

index 226d207..c44ce70 100755 (executable)
@@ -31,8 +31,12 @@ def mark_unmark_automatic(filename, action, pkgs):
     " mark or unmark automatic flag"
     # open the statefile
     if os.path.exists(STATE_FILE):
-        tagfile = apt_pkg.ParseTagFile(open(STATE_FILE))
-        outfile = open(STATE_FILE+".tmp","w")
+        try:
+            tagfile = apt_pkg.ParseTagFile(open(STATE_FILE))
+            outfile = open(STATE_FILE+".tmp","w")
+        except IOError, msg:
+            print "%s, are you root?" % (msg)
+            sys.exit(1)
         while tagfile.Step():
             pkgname = tagfile.Section.get("Package")
             autoInst = tagfile.Section.get("Auto-Installed")
index 4ac6eed..51f6cdf 100644 (file)
@@ -60,6 +60,9 @@ apt (0.7.25) UNRELEASED; urgency=low
   * apt-pkg/acquire-item.cc:
     - allow also to skip the last patch if target is reached,
       thanks Bernhard R. Link! (Closes: #545699)
+  * cmdline/apt-mark:
+    - print an error if a new state file can't be created,
+      thanks Carl Chenet! (Closes: #521289)
 
   [ Chris Leick ]
   * doc/ various manpages: