Skip Menu |

This queue is for tickets about the makepatch CPAN distribution.

Report information
The Basics
Id: 5786
Status: resolved
Priority: 0/
Queue: makepatch

People
Owner: Nobody in particular
Requestors:
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.00_07
Fixed in: 2.00_12



Subject: makepatch under utf-8 locale
It seems that makepatch creates for the combination: * perl 5.8.0 * unicode locale (i.e. LANG=en_US.UTF-8, which is default under RedHat 8.0) * files with iso-8859-1 characters with ord > 160 wrong patchfiles, i.e. the iso-8859-1 are transliterated into utf-8 characters, and the sizes will be expressed in characters instead of bytes. Maybe makepatch/applypatch should use binmode() to always ensure byte semantics? Regards, Slaven
From: Johan Vromans <jvromans [...] squirrel.nl>
Date: Wed, 24 Mar 2004 20:50:53 +0100
To: bug-makepatch [...] rt.cpan.org
Subject: Re: [cpan #5786] makepatch under utf-8 locale
CC: SREZIC [...] cpan.org
RT-Send-Cc:
"Slaven_Rezic via RT" <bug-makepatch@rt.cpan.org> writes: Show quoted text
> Maybe makepatch/applypatch should use binmode() to always ensure > byte semantics?
Slaven, Please try 2.00_11. It has binmode's all over the place ;-). -- Johan
[jvromans@squirrel.nl - Wed Mar 24 14:51:20 2004]: Show quoted text
> "Slaven_Rezic via RT" <bug-makepatch@rt.cpan.org> writes: >
> > Maybe makepatch/applypatch should use binmode() to always ensure > > byte semantics?
> > Slaven, > > Please try 2.00_11. It has binmode's all over the place ;-). >
Unfortunately an important one is missing --- the final write to STDOUT. Patch attached. Regards, Slaven
# # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # STEP 2: Run the 'patch' program with this file as input. # #### End of Preamble #### #### Patch data follows #### diff -up 'makepatch-2.00_11/script/makepatch' 'makepatch-2.00_11.patched/script/makepatch' Index: ./script/makepatch Prereq: 1.132 --- ./script/makepatch Wed Mar 24 19:35:03 2004 +++ ./script/makepatch Thu Mar 25 14:06:07 2004 @@ -701,6 +701,7 @@ sub dodiff ($$$$) { # The RCS code is based on a suggestion by jima@netcom.com, who also # pointed out that patch requires blanks around the prereq string. if ( $fh->open($oldfn) ) { + binmode($fh); while ( <$fh> ) { next unless (/(\@\(\#\)\@?|\$Header\:|\$Id\:)(.*)$/); next unless $+ =~ /(\s\d+(\.\d+)*\s)/; # e.g. 5.4 @@ -1090,6 +1091,7 @@ EOD my $all_sum = 0; $fh->open ($tmpfile) || die ("$tmpfile: $!\n"); binmode($fh); + binmode(STDOUT); while ( <$fh> ) { $lines = $bytes = $sum = 0 if /^#### Patch data follows ####/; #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Thu Mar 25 14:08:08 2004 # Generated by : makepatch 2.00_11* # Recurse directories : Yes # Excluded files : (\A|/).*\~\Z # (\A|/).*\.a\Z # (\A|/).*\.bak\Z # (\A|/).*\.BAK\Z # (\A|/).*\.elc\Z # (\A|/).*\.exe\Z # (\A|/).*\.gz\Z # (\A|/).*\.ln\Z # (\A|/).*\.o\Z # (\A|/).*\.obj\Z # (\A|/).*\.olb\Z # (\A|/).*\.old\Z # (\A|/).*\.orig\Z # (\A|/).*\.rej\Z # (\A|/).*\.so\Z # (\A|/).*\.Z\Z # (\A|/)\.del\-.*\Z # (\A|/)\.make\.state\Z # (\A|/)\.nse_depinfo\Z # (\A|/)core\Z # (\A|/)tags\Z # (\A|/)TAGS\Z # p 'script/makepatch' 57315 1080219967 0100755 #### End of ApplyPatch data #### #### End of Patch kit [created: Thu Mar 25 14:08:08 2004] #### #### Patch checksum: 55 2092 65149 #### #### Checksum: 73 2716 51145 ####
From: slaven [...] rezic.de
[jvromans@squirrel.nl - Wed Mar 24 14:51:20 2004]: Show quoted text
> "Slaven_Rezic via RT" <bug-makepatch@rt.cpan.org> writes: >
> > Maybe makepatch/applypatch should use binmode() to always ensure > > byte semantics?
> > Slaven, > > Please try 2.00_11. It has binmode's all over the place ;-). >
And another one is needed for applypatch. The indentation is left wrong in the patch, so you can see what I have actually changed. Regards, Slaven
# # # To apply this patch: # STEP 1: Chdir to the source directory. # STEP 2: Run the 'applypatch' program with this patch file as input. # # If you do not have 'applypatch', it is part of the 'makepatch' package # that you can fetch from the Comprehensive Perl Archive Network: # http://www.perl.com/CPAN/authors/Johan_Vromans/makepatch-x.y.tar.gz # In the above URL, 'x' should be 2 or higher. # # To apply this patch without the use of 'applypatch': # STEP 1: Chdir to the source directory. # STEP 2: Run the 'patch' program with this file as input. # #### End of Preamble #### #### Patch data follows #### diff -up 'makepatch-2.00_11/script/applypatch' 'makepatch-2.00_11.patched/script/applypatch' Index: ./script/applypatch Prereq: 1.17 --- ./script/applypatch Wed Mar 24 19:33:59 2004 +++ ./script/applypatch Thu Mar 25 14:40:52 2004 @@ -115,7 +115,11 @@ sub copy_input () { print STDERR ("Validate input.\n") if $verbose; - while ( <> ) { + @ARGV = "-" if !@ARGV; + for my $file (@ARGV) { + open(FH, $file) or die "Can't open $file: $!"; + binmode(FH); + while ( <FH> ) { chomp; if ( /^#### Patch data follows ####/ ) { print STDERR (": $_\n") if $trace; @@ -229,6 +233,8 @@ sub copy_input () { # Copy the line to the temp file. print $tmpfile ($_); } + close FH; + } # If we saw an ApplyPatch data section, it must be reliable. if ( $applypatch == 1 ) { #### End of Patch data #### #### ApplyPatch data follows #### # Data version : 1.0 # Date generated : Thu Mar 25 14:41:31 2004 # Generated by : makepatch 2.00_11* # Recurse directories : Yes # Excluded files : (\A|/).*\~\Z # (\A|/).*\.a\Z # (\A|/).*\.bak\Z # (\A|/).*\.BAK\Z # (\A|/).*\.elc\Z # (\A|/).*\.exe\Z # (\A|/).*\.gz\Z # (\A|/).*\.ln\Z # (\A|/).*\.o\Z # (\A|/).*\.obj\Z # (\A|/).*\.olb\Z # (\A|/).*\.old\Z # (\A|/).*\.orig\Z # (\A|/).*\.rej\Z # (\A|/).*\.so\Z # (\A|/).*\.Z\Z # (\A|/)\.del\-.*\Z # (\A|/)\.make\.state\Z # (\A|/)\.nse_depinfo\Z # (\A|/)core\Z # (\A|/)tags\Z # (\A|/)TAGS\Z # (\A|/)script\/makepatch\Z # p 'script/applypatch' 17512 1080222052 0100755 #### End of ApplyPatch data #### #### End of Patch kit [created: Thu Mar 25 14:41:31 2004] #### #### Patch checksum: 62 2120 616 #### #### Checksum: 80 2742 52029 ####
[SREZIC - Thu Mar 25 08:44:25 2004]: Thanks, Both patches applied. 2.00_12 is on its way to CPAN.