Last modified: 2011-04-30 01:16:50 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T19724, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 17724 - consider adding patch instructions, as recommended by patch man page
consider adding patch instructions, as recommended by patch man page
Status: RESOLVED WONTFIX
Product: MediaWiki
Classification: Unclassified
Installer (Other open bugs)
1.14.x
All All
: Lowest trivial (vote)
: ---
Assigned To: Nobody - You can work on this!
http://lists.wikimedia.org/pipermail/...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-02-28 21:32 UTC by Dan Jacobson
Modified: 2011-04-30 01:16 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Dan Jacobson 2009-02-28 21:32:02 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-*
# ....
Comment 1 Roan Kattouw 2009-02-28 21:33:48 UTC
(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
Comment 2 Dan Jacobson 2009-02-28 21:42:54 UTC
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!
Comment 3 Mike.lifeguard 2009-02-28 21:44:47 UTC
(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.
Comment 4 Roan Kattouw 2009-02-28 21:59:56 UTC
(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.
Comment 5 Dan Jacobson 2009-02-28 22:12:20 UTC
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.
Comment 6 Niklas Laxström 2009-02-28 22:16:29 UTC
I don't think patch files support comments.
Comment 7 Dan Jacobson 2009-02-28 22:21:05 UTC
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.
Comment 8 Dan Jacobson 2009-03-01 16:45:01 UTC
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.
Comment 9 Dan Jacobson 2009-03-01 16:49:09 UTC
(In reply to comment #8)
> the directory might still         be renamed by hand
                might still need to be renamed by hand
Comment 10 Chad H. 2009-03-28 16:54:57 UTC
(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.
Comment 11 Tim Starling 2009-03-28 17:15:34 UTC
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.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links