Commits

Armin Rigo  committed 42123f5

Various tweaks

  • Participants
  • Parent commits a8661e4

Comments (0)

Files changed (4)

File hack/bin/lookup

     return "'%s'" % (s.replace("'", "'\\''"),)
 
 quoted_args = [quote(s) for s in sys.argv[1:]]
-os.system("find -H -type d -name .svn -prune -o -type f -name %s -print0 | xargs -0 grep %s | less -S" % (
+os.system("find -H -type d -name .svn -prune -o -type f -name %s -print0 | xargs -n20 -0 grep %s | less -S" % (
     quoted_args[0],
     ' '.join(quoted_args[1:])))

File hack/hg/hgtree.py

     for line in sys.stdin:
         output_diff_line(line)
 
+def print_ioerror(e):
+    sys.stderr.write('%s\n' % e)
+
 def log_mode():
     global symbols
     ignoreline = False
             break
         #
         if line.startswith('diff -r '):
-            return diff_mode(line)
+            try:
+                return diff_mode(line)
+            except IOError, e:
+                return print_ioerror(e)
         #
         if ignoreline:
             s = line.strip()
         try:
             sys.stdout.write(line)
             sys.stdout.flush()
-        except IOError:
-            break
+        except IOError, e:
+            return print_ioerror(e)
 
 log_mode()

File hack/misc/krell

          }
 HOSTS = {'wyvern': 'wyvern.cs.uni-duesseldorf.de',
          'cobra':  'cobra.cs.uni-duesseldorf.de',
-         'tannit': '83.140.78.199',
-         's-tannit': '83.140.78.199',
+         'tannit': 'tannit.openend.se',
+         's-tannit': 'tannit.openend.se',
          's-speed': 'speed.python.org',
          }
 DELAYS = {'tuatara': 25,

File hack/misc/zipfilepart.py

 
 BadZipfile = zipfile.BadZipfile
 
+class BadCRC(BadZipfile):
+    pass
+
 
 def read_one_entry(fp):
     fname = None
         print "Bad magic number %r for file header, synchronizing..." % fheader
         skip = 0
         while True:
-            skip += 1
             fp.seek(-3, 1)
-            fheader = _read(4)
-            if fheader == zipfile.stringCentralDir:
-                print "End of zipfile found"
-                return None
-            if fheader == zipfile.stringFileHeader:
+            buf = fp.read(65536)
+            i = buf.find(zipfile.stringCentralDir)
+            j = buf.find(zipfile.stringFileHeader)
+            if j >= 0 and (i < 0 or j < i):
+                i = j
+            if i < 0:
+                if len(buf) < 4:
+                    raise EOFError("end of zipfile found")
+                skip += len(buf) - 3
+            else:
+                fp.seek(i - len(buf), 1)
+                fheader = _read(4)
+                if fheader == zipfile.stringCentralDir:
+                    raise EOFError("end of zipfile found")
+                assert fheader == zipfile.stringFileHeader
                 break
         print "Synchronized after skipping %d bytes" % skip
     fheader += _read(26)
             if i1 >= 0 or i2 >= 0 or i3 >= 0:
                 break
             if len(rawbuf) <= 4:
-                raise FileTruncatedError("no size available and no following "
-                                         "magic number found starting at %d" %
-                                         start)
+                raise EOFError("no size available and no following "
+                               "magic number found starting at %d" %
+                               start)
             skipto += len(rawbuf) - 4
         i = min([i for i in [i1, i2, i3] if i >= 0])
         skipto += i
               "Unsupported compression method %d for file %s" % (ct, fname)
     crc = binascii.crc32(bytes)
     if crc != expectedcrc:
-        raise BadZipfile, "Bad CRC-32 for file %s" % fname
+        raise BadCRC, "Bad CRC-32 for file %s" % fname
     return fname, bytes
 
 def enum_zip_file(file, follow=False):
             sys.stderr.write('\x08'*3)
             fp.seek(srcpos)
             continue
+        except BadCRC, e:
+            print >> sys.stderr, e
+            continue
         if entry is None:
             break
         yield entry