commit:     7f1425b229c93c7b13bef1b2d76b34e2a9e2476c
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri May 23 18:48:51 2014 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri May 23 19:59:38 2014 +0000
URL:        
http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=7f1425b2

fileio: workaround for small plain text files

Some text files (containing only a few chars) seem to be xz-readable.

---
 roverlay/util/fileio.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/roverlay/util/fileio.py b/roverlay/util/fileio.py
index d4019d7..be81ef0 100644
--- a/roverlay/util/fileio.py
+++ b/roverlay/util/fileio.py
@@ -79,7 +79,12 @@ def read_text_file ( filepath, preparse=None, 
try_harder=True ):
             except ( StopIteration, EOFError ):
                # empty file (?)
                CH.close()
-               return
+               CH = None
+               # *** FIXME: workaround ***
+               # retry as normal file,
+               #  EOFError may be caused by small plain text files, too
+               # COULDFIX: ?empty compressed files?
+               #return
 
             except IOError as ioerr:
                # failed to open (gzip, bzip2)

Reply via email to