Skip to contentSkip to conversation

patch for ipkg-utils

PATCH Philip Black 1 participant 1 message Mar 14, 2009

lore
Share & tools
lore
#0 lore raw

I found a bug with how the arfile.py works when parsing ar files. Basically, the code assumed whitespace delimited when it should have been fixed sized fields.

arfile.py +8 -1
diff -wubr ipkg-utils.old/arfile.py ipkg-utils/arfile.py
@@ -74,7 +74,14 @@
             if l == "\n":
                 l = self.f.readline()
                 if not l: break
-            descriptor = l.split()
+            descriptor = [ l[0:15].strip() # filename 
+                                , l[16:27].strip() # timestamp
+                                , l[28:33].strip() # owner ID
+                                , l[34:39].strip() # gid
+                                , l[40:47].strip() # mode
+                                , l[48:57].strip() # size in bytes
+                                , l[58:59].strip() # file magic
+            ]
 #            print descriptor
             size = int(descriptor[5])
             memberName = descriptor[0][:-1]