#61393 closed defect (fixed)
TypeError: StringIO() argument 1 must be string or buffer, not None
Reported by: | ryandesign (Ryan Carsten Schmidt) | Owned by: | neverpanic (Clemens Lang) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | trac | Version: | |
Keywords: | Cc: | ||
Port: |
Change History (3)
comment:1 Changed 4 years ago by neverpanic (Clemens Lang)
Owner: | changed from admin@… to neverpanic |
---|---|
Status: | new → accepted |
comment:2 Changed 4 years ago by neverpanic (Clemens Lang)
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
See https://trac.edgewall.org/ticket/13327 for upstream report and patch.
I've backported the patch to our installation.
Note: See
TracTickets for help on using
tickets.
Can reproduce. This is a bug in Trac that happens at https://trac.edgewall.org/browser/trunk/tracopt/versioncontrol/git/PyGIT.py#L693.
To read the contents of a file, Trac spawns a
git cat-file --batch
process, and repeatedly writes a tree identifer (obtained usinggit ls-tree -zl $revision -- $path
) to stdin of that process. The answer is a line with that same hash, the type of object, and its size. It then proceeds to read that number of bytes from the socket.However, if the file is larger than 65535 bytes (which portconfigure.tcl is with 72044 bytes) the
self.__cat_file_pipe.stdout.read()
call can and will return fewer bytes than the size passed toread()
. This is expected, because the operating system will buffer data written into a pipe and block the writing process. Trac should handle this situation and continue to read until the expected size is reached, but does not do so. The next attempt to read a file then fails, because the next line to be read from the stream is not the tuple of (hash, type, size), but a line from the contents of the last file that was read, which cannot be parsed correctly and causes aNone
return value, which then gets passed to the constructor ofStringIO()
, and that's the error you see.I'll file that with trac upstream and submit a patch.