Re: [PATCH] gitweb: Fix handling of non-ASCII characters in inserted HTML files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jakub Narebski <jnareb@xxxxxxxxx> writes:

> Use new insert_file() subroutine to insert HTML chunks from external
> files: $site_header, $home_text (by default indextext.html),
> $site_footer, and $projectroot/$project/REAME.html.
>
> All non-ASCII chars of those files will be broken by Perl IO layer
> without decoding to utf8, so insert_file() does to_utf8() on each
> printed line; alternate solution would be to open those files with
> "binmode $fh, ':utf8'", or even all files with "use open qw(:std :utf8)".
>
> Note that inserting README.html lost one of checks for simplicity.
>
> Noticed-by: Tatsuki Sugiura <sugi@xxxxxxxxx>
> Signed-off-by: Jakub Narebski <jnareb@xxxxxxxxx>
> ---
> This is more complete solution that the one provided by Tatsuki Sugiura
> in original patch
>
>   [PATCH] gitweb: fix encode handling for site_{header,footer}
>   Msg-Id: <87vdumbxgc.wl@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
>   http://thread.gmane.org/gmane.comp.version-control.git/101199

It may be more complete but it is obviously untested.  Please help me
trust you better with your future patches.  Because I personally do not
run gitweb myself, I really need a trustworthy lieutenant(s) in the area.

[Wed Dec  3 01:52:07 2008] gitweb.perl: Global symbol "$fd" requires explicit package name at /git.git/t/../gitweb/gitweb.perl line 4500.
[Wed Dec  3 01:52:07 2008] gitweb.perl: Execution of /git.git/t/../gitweb/gitweb.perl aborted due to compilation errors.

> but it is in principle the same solution.
>
> I think this one as it is a bugfix should go in git 1.6.1

Trading a gitweb with a small bug with a gitweb that does not even pass
its test script does not feel like a good change to me.

I think the breakage is the "close $fd" at the end of this hunk:

> @@ -4472,13 +4475,11 @@ sub git_summary {
>  	print "</table>\n";
>  
>  	if (-s "$projectroot/$project/README.html") {
> -		if (open my $fd, "$projectroot/$project/README.html") {
> -			print "<div class=\"title\">readme</div>\n" .
> -			      "<div class=\"readme\">\n";
> -			print $_ while (<$fd>);
> -			print "\n</div>\n"; # class="readme"
> -			close $fd;
> -		}
> +		print "<div class=\"title\">readme</div>\n" .
> +		      "<div class=\"readme\">\n";
> +		insert_file("$projectroot/$project/README.html");
> +		print "\n</div>\n"; # class="readme"
> +		close $fd;
>  	}
>  
>  	# we need to request one more than 16 (0..15) to check if

I'll queue it to 'pu', with the "close $fd" removed, for now.

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux