Questions tagged [patch]

A patch is a piece of software designed to fix problems with, or update a computer program or its supporting data. This includes fixing security vulnerabilities and other bugs, and improving the usability or performance.

Programmers publish and apply patches in various forms. Because proprietary software authors withhold their source code, their patches are distributed as binary executables instead of source. This type of patch modifies the program executable—the program the user actually runs—either by modifying the binary file to include the fixes or by completely replacing it.

Patches can also circulate in the form of source code modifications. In these cases, the patches consist of textual differences between two source code files. These types of patches commonly come out of open source projects. In these cases, developers expect users to compile the new or changed files themselves.

Because the word "patch" carries the connotation of a small fix, large fixes may use different nomenclature. Bulky patches or patches that significantly change a program may circulate as "service packs" or as "software updates". Microsoft Windows NT and its successors (including Windows 2000, Windows XP, and later versions) use the "service pack" terminology.

In several Unix-like systems, particularly Linux, updates between releases are delivered as new software packages. These updates are in the same format as the original installation so they can be used either to update an existing package in-place (effectively patching) or be used directly for new installations.

2809 questions
23
votes
2 answers

What to do if git-am fails with "does not match index"?

I'm trying to apply a git patch created by someone else with git-format-patch. The patch was made against one commit behind HEAD, but as I understand it this shouldn't matter. When I run git am 0001.patch, I get the error: error: source.c: does not…
joshdoe
  • 441
  • 1
  • 4
  • 12
23
votes
5 answers

How to apply several patches using hg command line when there is already uncommitted changes?

I use the following command to apply a patch in Mercurial, without committing it : hg import patch.diff --no-commit It works great, however if I try to apply several patches at once like this : hg import patch1.diff --no-commit hg import…
tigrou
  • 4,236
  • 5
  • 33
  • 59
23
votes
2 answers

patch: Only garbage was found in the patch input

I produced a diff.txt file with the command (executed from ~): diff -r /full/path/to/directory/A /full/path/to/directory/B > diff.txt The generated diff file looks good. Now I run (always from ~) patch -p0
matteo
  • 2,934
  • 7
  • 44
  • 59
22
votes
5 answers

Install RT Linux patch for Ubuntu

Trying to make my generic Ubuntu to real time Ubuntu by modifying the kernel by patching / installing RT Linux but couldn't find a straight setup. Can someone help with the steps?
Abhay Nayak
  • 1,069
  • 1
  • 11
  • 25
22
votes
3 answers

diff'ing diffs with diff?

I need to know if the two patches are effectively the same. I have an old patch file and new patch file created with the unix diff command. Just diff'ing the patches reports differences due to the timestamp when the patch was created. Is there a…
srking
  • 4,512
  • 1
  • 30
  • 46
21
votes
4 answers

How to install the Bumblebee 2021.1.1 Android Studio Patch?

When I open Android Studio I receive a notification saying that an update is available: The latest stable release of Android Studio is now available for download. Android Studio Bumblebee | 2021.1.1 Patch 1 is a major new release and includes…
Greelings
  • 4,964
  • 7
  • 34
  • 70
21
votes
4 answers

How do I make a PATCH request in Python?

Is there a way to make a request using the PATCH HTTP method in Python? I tried using httplib, but it doesn't accept PATCH as method param.
Ricardo Augusto
  • 548
  • 1
  • 8
  • 18
20
votes
3 answers

How to apply a Perforce patch?

I generated a patch some time ago using the p4 diff command. However, now that I want to apply it, I realize that there is no way to apply a patch in Perforce. Since I did not use the -du option, the patch is in that obscure perforce format and…
slaphappy
  • 6,894
  • 3
  • 34
  • 59
20
votes
6 answers

Binary patch-generation in C#

Does anyone have, or know of, a binary patch generation algorithm implementation in C#? Basically, compare two files (designated old and new), and produce a patch file that can be used to upgrade the old file to have the same contents as the new…
Lasse V. Karlsen
  • 380,855
  • 102
  • 628
  • 825
20
votes
4 answers

How to patch a constant in Python using a mock as function parameter

I'm trying to understand the different ways to patch a constant in Python using mock.patch. My goal is to be able to use a variable defined in my Test class as the patching value for my constant. I've found this question which explains how to patch…
Kévin Barré
  • 330
  • 1
  • 4
  • 11
20
votes
4 answers

How to patch on Windows?

Given a (source) patch file, what's the easiest way to apply this patch on the source files under Windows? A GUI tool where I can visually compare the unchanged-changed source lines would be great.
Ashwin Nanjappa
  • 76,204
  • 83
  • 211
  • 292
20
votes
4 answers

subversion diff including new files

I have some local changes to an open source project which uses Subversion as its source control. (I do not have commit access on the original project repository.) My change adds a file, but this file is not included in the output of "svn diff". …
Jeremy Dunck
  • 5,724
  • 6
  • 25
  • 30
19
votes
2 answers

Can git format patch so it can be used with patch program?

I'd need to create simple patches from git repository that can be applied with plain simple patch command line utility. Can it be done?
Nikola Kotur
  • 1,954
  • 3
  • 13
  • 15
19
votes
3 answers

Using `git show` to create and apply patches spanning multiple commits

Lately I've been using git show to create diffs for later reference because it's easier to type than git diff ~ and it shows the commit information (timestamp, user, hash, comment). You can then use git apply to apply…
redbmk
  • 4,687
  • 3
  • 25
  • 49
18
votes
4 answers

How to email patches formatted with git format-patch?

I've got a series of patches I want to send to an open source project but I'm not able to figure out how to properly format an email. I tried running a git format-patch command then attached them all into an email from Thunderbird but they all got…
Chris H
  • 6,433
  • 5
  • 33
  • 51