Description

Sometimes strange characters in edit-logs prevents migration to 1.6.x.

I think we can ommit it using

   1 diff -r dfb257df7fe3 MoinMoin/script/migration/_conv160.py
   2 --- a/MoinMoin/script/migration/_conv160.py	Mon Feb 04 14:35:21 2008 +0100
   3 +++ b/MoinMoin/script/migration/_conv160.py	Thu Feb 07 19:07:46 2008 +0100
   4 @@ -131,17 +131,23 @@ class EditLog:
   5          """ read complete edit-log from disk """
   6          data = {}
   7          try:
   8 +            lineno = 0
   9              f = file(self.fname, 'r')
  10              for line in f:
  11 +                lineno += 1
  12                  line = line.replace('\r', '').replace('\n', '')
  13                  if not line.strip(): # skip empty lines
  14                      continue
  15                  fields = line.split('\t') + [''] * 9
  16                  timestamp, rev, action, pagename, ip, hostname, userid, extra, comment = fields[:9]
  17 -                timestamp = int(timestamp)
  18 -                rev = int(rev)
  19 -                pagename = wikiutil.unquoteWikiname(pagename)
  20 -                data[(timestamp, rev, pagename)] = (timestamp, rev, action, pagename, ip, hostname, userid, extra, comment)
  21 +                try:
  22 +                    timestamp = int(timestamp)
  23 +                    rev = int(rev)
  24 +                    pagename = wikiutil.unquoteWikiname(pagename)
  25 +                    data[(timestamp, rev, pagename)] = (timestamp, rev, action, pagename, ip, hostname, userid, extra, comment)
  26 +                except ValueError, err:
  27 +                    # corrupt event log line, log error and skip it
  28 +                    print "Error: invalid edit log (%s) line %d, err: %s, SKIPPING THIS LINE!" % (self.fname, lineno, str(err))
  29              f.close()
  30          except IOError, err:
  31              # no edit-log
_conv160.py.patch

-- ReimarBauer 2008-02-07 18:10:51

Steps to reproduce

  1. do this...

Example

Component selection

Details

MoinMoin Version

1.6.1

OS and Version

Python Version

Server Setup

Server Details

Language you are using the wiki in (set in the browser/UserPreferences)

Workaround

Discussion

It would be interesting to have a sample of such strange chars. is it wrong encoding? random garbage? zeroes?

e.g.

^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^
@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@1202403061620244  99999999        ATTNEW
                     SebastianDziallas(2f)Education  ##.##.##.##
                     proxy2.fedora.phx.redhat.com    1196429407.42.57

(!) I think we should not skip edit-log lines that can't be processed:

The bug in the edit-log is caused by using moin on NFS, file append mode is not working as it should on that NFS server.

Plan


CategoryMoinMoinNoBug

MoinMoin: MoinMoinBugs/StrangeCharactersInEditLog (last edited 2008-05-01 23:46:06 by ThomasWaldmann)