[Koha-cvs] CVS: koha/misc/translator tmpl_process3.pl,1.12,1.13 xgettext.pl,1.8,1.9

Ambrose C. LI acli at users.sourceforge.net
Tue Feb 24 15:20:49 CET 2004


Update of /cvsroot/koha/koha/misc/translator
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23699

Modified Files:
	tmpl_process3.pl xgettext.pl 
Log Message:
tmpl_process3.pl did not know how to handle absolute pathnames in -i.
(Actually, xgettext.pl did not know how to handle them in the files listed
in the list of files.)

If the po file is empty (corrupted), $href->{'""'} will be undefined.
We just blindly dereferenced this null value without checking.


Index: tmpl_process3.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/tmpl_process3.pl,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** tmpl_process3.pl	24 Feb 2004 00:47:53 -0000	1.12
--- tmpl_process3.pl	24 Feb 2004 14:20:46 -0000	1.13
***************
*** 222,225 ****
--- 222,227 ----
  # guess the charsets. HTML::Templates defaults to iso-8859-1
  if (defined $href) {
+     die "$str_file: PO file is corrupted, or not a PO file\n"
+ 	    unless defined $href->{'""'};
      $charset_out = TmplTokenizer::charset_canon $2
  	    if $href->{'""'}->msgstr =~ /\bcharset=(["']?)([^;\s"'\\]+)\1/;
***************
*** 242,246 ****
  if ($action eq 'create')  {
      # updates the list. As the list is empty, every entry will be added
!     die "$str_file: Output file already exists" if -f $str_file;
      my($tmph, $tmpfile) = tmpnam();
      # Generate the temporary file that acts as <MODULE>/POTFILES.in
--- 244,252 ----
  if ($action eq 'create')  {
      # updates the list. As the list is empty, every entry will be added
!     if (!-s $str_file) {
! 	warn "Removing empty file $str_file\n";
! 	unlink $str_file || die "$str_file: $!\n";
!     }
!     die "$str_file: Output file already exists\n" if -f $str_file;
      my($tmph, $tmpfile) = tmpnam();
      # Generate the temporary file that acts as <MODULE>/POTFILES.in

Index: xgettext.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/translator/xgettext.pl,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** xgettext.pl	24 Feb 2004 00:48:18 -0000	1.8
--- xgettext.pl	24 Feb 2004 14:20:46 -0000	1.9
***************
*** 292,299 ****
      while (<INPUT>) {
  	chomp;
! 	my $h = TmplTokenizer->new( "$directory/$_" );
  	$h->set_allow_cformat( 1 );
! 	VerboseWarnings::set_input_file_name "$directory/$_";
! 	print STDERR "$0: Processing file \"$directory/$_\"\n" if $verbose_p;
  	text_extract( $h );
      }
--- 292,300 ----
      while (<INPUT>) {
  	chomp;
! 	my $input = /^\//? $_: "$directory/$_";
! 	my $h = TmplTokenizer->new( $input );
  	$h->set_allow_cformat( 1 );
! 	VerboseWarnings::set_input_file_name $input;
! 	print STDERR "$0: Processing file \"$input\"\n" if $verbose_p;
  	text_extract( $h );
      }





More information about the Koha-cvs mailing list