Last modified: 2011-04-30 01:16:50 UTC
>> How does one apply mediawiki-1.14.0.patch.gz and >> mediawiki-i18n-1.14.0.patch.gz to mediawiki-1.14.0rc1 to produce >> mediawiki-1.14.0? >> >> # ls mediawiki-1.14.0rc1 >> # zcat mediawiki-1.14.0.patch.gz | patch >> can't find file to patch at input line 4 >> Perhaps you should have used the -p or --strip option? RK> I think you have to use -p1 here. Doesn't work. Without proper instructions commented into the tops of mediawiki patch files, they are next to worthless. The instructions should say # 1) cd to the directory where you have the directory tree to be # patched, and put the patch files there. # 2) ls should now show you # $ ls -dl mediawiki-* # -rw-r--r-- 1 fuz fuz 5310 2009-02-26 07:10 mediawiki-1.14.0.patch.gz # drwxr-xr-x 15 fuz fuz 2048 2009-02-26 20:22 mediawiki-1.14.0rc1 # -rw-r--r-- 1 fuz fuz 1952692 2009-02-26 07:10 mediawiki-i18n-1.14.0.patch.gz # 3) proceed with the patching as follows # $ zcat mediawiki-1.14.0.patch.gz | patch -...... # $ zcat mediawiki-i18n-1.14.0 | patch -...... # 4) ls should now show # $ ls -dl mediawiki-* # ....
(In reply to comment #0) > >> How does one apply mediawiki-1.14.0.patch.gz and > >> mediawiki-i18n-1.14.0.patch.gz to mediawiki-1.14.0rc1 to produce > >> mediawiki-1.14.0? > >> > >> # ls mediawiki-1.14.0rc1 > >> # zcat mediawiki-1.14.0.patch.gz | patch > >> can't find file to patch at input line 4 > >> Perhaps you should have used the -p or --strip option? > RK> I think you have to use -p1 here. > > Doesn't work. > > Without proper instructions commented into the tops of mediawiki patch > files, they are next to worthless. > > The instructions should say > # 1) cd to the directory where you have the directory tree to be > # patched, and put the patch files there. > # 2) ls should now show you > # $ ls -dl mediawiki-* > # -rw-r--r-- 1 fuz fuz 5310 2009-02-26 07:10 mediawiki-1.14.0.patch.gz > # drwxr-xr-x 15 fuz fuz 2048 2009-02-26 20:22 mediawiki-1.14.0rc1 > # -rw-r--r-- 1 fuz fuz 1952692 2009-02-26 07:10 mediawiki-i18n-1.14.0.patch.gz > # 3) proceed with the patching as follows > # $ zcat mediawiki-1.14.0.patch.gz | patch -...... > # $ zcat mediawiki-i18n-1.14.0 | patch -...... > # 4) ls should now show > # $ ls -dl mediawiki-* > # .... > Knowing how to apply a patch is not something MediaWiki should be documenting IMO; people who download a patch instead of a full tarball should know how to apply a patch or at least be prepared to find out. Recommend WONTFIX
Well OK, but what if it turns out that nobody knows how to apply the patch... because the patch was invalid in the first place! Not you, nor I, can apply the patch!
(In reply to comment #2) > Well OK, but what if it turns out that nobody knows how to apply the patch... > because the patch was invalid in the first place! > > Not you, nor I, can apply the patch! > Then please submit a bug for that.
(In reply to comment #2) > Well OK, but what if it turns out that nobody knows how to apply the patch... > because the patch was invalid in the first place! > > Not you, nor I, can apply the patch! > If you have a directory called mediawiki-1.14.0-rc1 already, you should be able to apply the patch from the directory above it either without options or by using -p0. If you're *in* the mediawiki-1.14.0-rc1 directory, -p1 should work. Alternatively, the problem could simply be that you've removed the config/ directory, which the patch is trying to modify.
OK, it finally worked. Please add at least the following to the script that makes the tops of each patch file: # To apply patches like this one, do # $ cd mediawiki-*/.. # $ wget this_patch.gz # $ zcat this_patch.gz|patch -p0 Thank you.
I don't think patch files support comments.
man page says: patch tries to skip any leading garbage, apply the diff, and then skip any trailing garbage. Thus you could feed an article or message containing a diff listing to patch, and it should work. If the entire diff is indented by a consistent amount, or if a context diff contains lines ending in CRLF or is encapsulated one or more times by prepending "- " to lines starting with "-" as specified by Internet RFC 934, this is taken into account. After removing indenting or encapsulation, lines beginning with # are ignored, as they are considered to be comments.
The patch man page also says: NOTES FOR PATCH SENDERS There are several things you should bear in mind if you are going to be sending out patches. Create your patch systematically. A good method is the command diff -Naur old new where old and new identify the old and new directories. The names old and new should not contain any slashes... Tell your recipients how to apply the patch by telling them which directory to cd to, and which patch options to use. The option string -Np1 is recommended. Test your procedure by pretending to be a recipient and applying your patch to a copy of the original files. You can save people a lot of grief by... So I'll reopen the bug so Tim can consider adding patch instructions to a comment at the top of each patch file or not. Also perhaps note in the instructions that after applying the patch, the directory might still be renamed by hand, to the new name shown in the patch.
(In reply to comment #8) > the directory might still be renamed by hand might still need to be renamed by hand
(In reply to comment #1) > Knowing how to apply a patch is not something MediaWiki should be documenting > IMO; people who download a patch instead of a full tarball should know how to > apply a patch or at least be prepared to find out. Recommend WONTFIX > Agreed, marking as such.
I think a comment in the gzip-compressed patch file would be kind of pointless, nobody is going to look in there. But it wouldn't hurt to have a documentation link or a brief explanation on the relevant wiki page.