Item5939: Rogue <p /> below </html> on every topic in every web

Priority: Urgent
Current State: Closed
Released In:
Target Release: patch
Applies To: Engine
Component:
Reported By: TWiki:Main.MichaelRubin
Waiting For:
Last Change By: KwangErnLiew
I first noticed this problem on my stock 4.2.1 installation. Doing a "View Source" on any topic of any web results in the following at the very bottom:
 
</body></html>
<p />

This, of course, doesn't validate as valid XHTML. I used the provided 4.2.1 -> 4.2.2 patch file (from the 4.2.2 comments page) to upgrade to 4.2.2. Now my installation says:
This site is running TWiki version *TWiki-4.2.2, Wed, 06 Aug 2008, build 17396*, Plugin API version *1.2*

but the problem is still present on every topic of every web. I have looked at every .tmpl file that defines "bodyend", but did not see the rogue <p /> in any definition ... leading me to believe that it is a bug in code somewhere (?).

-- TWiki:Main/MichaelRubin - 18 Aug 2008

This is also showing on http://twiki.net static html pages. They were probably generated from TWiki topic using some publish plug-in.

-- TWiki:Main.StephaneLenclud - 18 Aug 2008

No it is a real bug also in a naked 4.2.2. I am trying to analyse it now. There is no /p in the templates that define /html.

-- TWiki:Main.KennethLavrsen - 18 Aug 2008

I have the fix ready.

Checking in

-- TWiki:Main.KennethLavrsen - 18 Aug 2008

If we had a tool to detect those newlines at the end of templates...

-- TWiki:Main.ArthurClemens - 18 Aug 2008

checked in a fix which is to remove the empty line at the end of twiki.tmpl

Anyone can fix their current TWiki by simply deleting the empty line at the end so the last line reads %TMPL:P{"bodyend"}%

-- TWiki:Main.KennethLavrsen - 18 Aug 2008

I fixed my twiki.tmpl on a Windows installation a few days ago and it did the trick (I had used the ZIP file). Now I used the GZ file to setup a Linux installation and I still have that problem after checking and checking again twiki.tmpl with various text editor.

-- TWiki:Main.StephaneLenclud - 22 Aug 2008

I have confirmed the fix on 3 Linux machines now and other have too.

One thing that was noted is that an editor like nano seems to add the new line character at the end of the file by default so you may need to try a different editor.

-- TWiki:Main.KennethLavrsen - 22 Aug 2008

As text files not ending by a newline have historically been causing bugs in most unix tools (/etc/passwd, hosts, crontab, ...) for a long time, most unix/linux editors add an ending newline. So this is bound to happen again. And will bite anyone who makes a twiki.myskin.tmpl for his new skin. Maybe we should introduce a feature to expliciitely ignore the last newline? (\ before last newline? an optional explicit %EOF% to force the end of file?). Or have the template loading function ignore the last newline? Or better, all the routines emitting an XHTML document should trim the ending newlines (or P tags?) before sending the (x)html ?

-- TWiki:Main.ColasNahaboo - 23 Aug 2008

I tried nano, gedit and vi without luck. Any editor you recommend? vi does not even show the last new line character.

-- TWiki:Main.StephaneLenclud - 24 Aug 2008

Emacs and XEmacs by default prompt you for what to do if you save a file without a termianting newline. This is the variable require-final-newline. See http://www.delorie.com/gnu/docs/emacs/emacs_113.html

-- TWiki:Main.ColasNahaboo - 26 Aug 2008

I downloaded the file, opend it with Notepad++ removed the empty line, uploaded and the < / p > doesn't show up anymore. In this case being not that clever with linux is supposed to be something good wink

-- TWiki:Main.CarloSchulz - 27 Aug 2008

ItemTemplate edit

Summary Rogue <p /> below </html> on every topic in every web
ReportedBy TWiki:Main.MichaelRubin
Codebase
SVN Range TWiki-5.0.0, Mon, 11 Aug 2008, build 17408
AppliesTo Engine
Component
Priority Urgent
CurrentState Closed
WaitingFor
Checkins TWikirev:17428 TWikirev:17429
TargetRelease patch
ReleasedIn
Topic revision: r16 - 08 Jan 2009, KwangErnLiew
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons License