Ticket #4027 (closed defect: fixed)
Error showing patch file - "no newline at end of file" sign accepted
| Reported by: | jl <linne@…> | Owned by: | cboos |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.11 |
| Component: | general | Version: | 0.10 |
| Severity: | minor | Keywords: | mimeview |
| Cc: |
Description
When attaching a patch-file with an incomplete line sign the trac system hangs.
The following error is found in the log:
2006-10-25 10:29:09,480 Trac[__init__] DEBUG: Trying to open attachment at D:\SCM\trac\data\testproject\attachments\ticket\22\Neu%20Textdokument.patch
2006-10-25 10:29:09,480 Trac[__init__] DEBUG: Rendering preview of file Neu Textdokument.patch with mime-type text/x-diff; charset=iso-8859-15
2006-10-25 10:29:09,480 Trac[__init__] DEBUG: Trying to render HTML preview using PatchRenderer
2006-10-25 10:29:09,496 Trac[__init__] WARNING: HTML preview using <trac.mimeview.patch.PatchRenderer object at 0x04EAE3B0> failed (Invalid unified diff content)
Traceback (most recent call last):
File "D:\PROGRA~1\Python23\Lib\site-packages\trac\mimeview\api.py", line 448, in render
filename, url)
File "D:\PROGRA~1\Python23\Lib\site-packages\trac\mimeview\patch.py", line 72, in render
raise TracError, 'Invalid unified diff content'
TracError: Invalid unified diff content
2006-10-25 10:29:09,496 Trac[__init__] DEBUG: Trying to render HTML preview using EnscriptRenderer
2006-10-25 10:29:09,496 Trac[__init__] DEBUG: Enscript command line: enscript --color -h -q --language=html -p - -Ediffu
It seems that it not understand the diff character '\'
Here is the patch file, that is not shown up:
Index: applications/BestFitDataLog/BestFitDataLog.bpr =================================================================== --- applications/BestFitDataLog/BestFitDataLog.bpr (revision 621) +++ applications/BestFitDataLog/BestFitDataLog.bpr (working copy) @@ -129,4 +129,4 @@ LinkDebugVcl=0 LinkCGLIB=0 </IDEOPTIONS> -</PROJECT> \ No newline at end of file +</PROJECT>
I attached the test file, that is unable to preview.
Also a small patch that solves the problem is here:
Index: patch.py
===================================================================
--- patch.py (revision 4044)
+++ patch.py (working copy)
@@ -176,7 +176,8 @@
elif command == '-':
blocks[-1]['base.lines'].append(line)
fromline += 1
- else:
+ # Ignore incomplete line command, other commands exit
+ elif command != '\\':
return None
line = lines.next()
except StopIteration:
Attachments
Change History
Note: See
TracTickets for help on using
tickets.


