Johan: It appears that there is a bug in makepatch. If the file is
changed from non-existent to zero-length, it appears like the newfile
function in makepatch tries to create a patch, which it shouldn't.
3 things are fixed:
- No bogus diff for changing from no such file to empty file. `touch'
+ `chmod' is sufficient.
- It's bad style to do
while (<FH>) { ... }
. Use
while (defined <FH>) {...}
instead.
- `patch' was misspelled as `path'.
Thanks for creating makepatch. The XEmacs project has been using it successfully.
This patch to makepatch is naturally generated by makepatch.
(martin@lasker) ~cdx/import $ makepatch makepatch-2.00_03.tar.bz2 makepatch-2.00_03
Extracting makepatch-2.00_03.tar.bz2 to /usr/tmp/mp17352.d/old...
Manifest MANIFEST for makepatch-2.00_03 contains 11 files.
Manifest MANIFEST for makepatch-2.00_03 contains 11 files.
Processing the filelists ...
Collecting patches ...
# This is a patch for makepatch-2.00_03 to update it to makepatch-2.00_03
#
# 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 -c '/usr/tmp/mp17352.d/old/makepatch-2.00_03/script/makepatch'
'makepatch-2.00_03/script/makepatch'
Index: ./script/makepatch
Prereq: 1.121
*** ./script/makepatch Tue Oct 5 03:27:48 1999
--- ./script/makepatch Mon Mar 26 10:38:30 2001
***************
*** 581,587 ****
print $patch (`$cmd`);
}
! # By prepending $dot to the names, we can use 'path -p0' as well
# as 'patch -p1'.
print $patch ("Index: ", File::Spec->catfile($dot,$old),
"\n");
--- 581,587 ----
print $patch (`$cmd`);
}
! # By prepending $dot to the names, we can use 'patch -p0' as well
# as 'patch -p1'.
print $patch ("Index: ", File::Spec->catfile($dot,$old),
"\n");
***************
*** 667,678 ****
$skipped++;
return 0;
}
my $pos = $fh->getpos;
! while ( <$fh> ) {
$lines++;
}
$fh->setpos($pos);
my $cmd = $opt_diff . " " . $nul . " " . quotfn($newfn);
trace ("+ $cmd (inlined)\n");
print $patch ($cmd, "\n");
--- 667,684 ----
$skipped++;
return 0;
}
+
my $pos = $fh->getpos;
! while (defined <$fh> ) {
$lines++;
}
$fh->setpos($pos);
+ # Avoid creating a patch if the new file is empty.
+ if ($lines == 0) {
+ return 1;
+ }
+
my $cmd = $opt_diff . " " . $nul . " " . quotfn($newfn);
trace ("+ $cmd (inlined)\n");
print $patch ($cmd, "\n");
***************
*** 685,691 ****
print $patch (`$cmd`);
}
! # Prepending $dot, so we can use 'path -p0' as well as 'patch -p1'.
$new = File::Spec->catfile($dot,$new);
print $patch ("Index: $new\n");
--- 691,697 ----
print $patch (`$cmd`);
}
! # Prepending $dot, so we can use 'patch -p0' as well as 'patch
-p1'.
$new = File::Spec->catfile($dot,$new);
print $patch ("Index: $new\n");
#### End of Patch data ####
#### ApplyPatch data follows ####
# Data version : 1.0
# Date generated : Mon Mar 26 10:41:19 2001
# Generated by : makepatch 2.00_03
# Recurse directories : Yes
# p 'script/makepatch' 52403 985570710 0100755
#### End of ApplyPatch data ####
#### End of Patch kit [created: Mon Mar 26 10:41:19 2001] ####
#### Patch checksum: 84 2247 22146 ####
#### Checksum: 102 2942 14100 ####
1 file need to be patched.