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
18
votes
1 answer

setting color range in matplotlib patchcollection

I am plotting a PatchCollection in matplotlib with coords and patch color values read in from a file. The problem is that matplotlib seems to automatically scale the color range to the min/max of the data values. How can I manually set the color…
Mark W
  • 795
  • 2
  • 7
  • 9
18
votes
3 answers

How to create patch for a new file?

I know to create a patch for an existing file is easy: diff -aru oldFile newFile 2>&1 | tee myPatch.patch But what to do, if i want to create a patch for a totally new file? Assume my file is residing in a folder called TestDir. Earlier TestDir did…
RajSanpui
  • 11,556
  • 32
  • 79
  • 146
18
votes
2 answers

What is the difference between "from mock import patch" and "from unittest.mock import patch"?

What is the difference between these imports? from mock import patch vs from unittest.mock import patch Are they the same?
Woootiness
  • 1,882
  • 2
  • 15
  • 18
18
votes
3 answers

How should you create a patch for an older tag in source control?

Let's say I released a version of my software about a year ago and tagged it at 2.3 in Git. So I keep adding features and fixing bugs and before you know it, the software is now at version 3.0. But now I have a bug on version 2.3 of the software…
arjabbar
  • 6,044
  • 4
  • 30
  • 46
17
votes
7 answers

Is there are way to patch jar files?

Suppose I sent a large jar or war file to someone. Could I later just change one small section and send that to him? Suppose I just changed one class file. I recompiled the java for into a class file. Other then exchanging the new class file for…
GC_
  • 1,673
  • 6
  • 23
  • 39
17
votes
6 answers

How does one submit a potential patch to the Linux kernel?

We have some software which relied on certain behavior from another (very commonly used) application that has now changed, rendering our current implementation workable, but less than optimal. We believe that this change may have affected a number…
paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
17
votes
4 answers

Avoid Redundant @patch When Mocking with Python

Coming from a static programming language background, I am wondering how to best do mocking in Python. I am accustomed to dependency injection. Within tests, mocks are created and passed to the System Under Test (SUT). However, looking at Mock and…
Travis Parks
  • 8,435
  • 12
  • 52
  • 85
16
votes
11 answers

What language is to binary, as Perl is to text?

I am looking for a scripting (or higher level programming) language (or e.g. modules for Python or similar languages) for effortlessly analyzing and manipulating binary data in files (e.g. core dumps), much like Perl allows manipulating text files…
Eric Hansander
  • 944
  • 2
  • 11
  • 20
16
votes
4 answers

What causes git-apply "corrupt patch?"

(long story ...) I'm in the midst of bringing a gigantic PHP application up to the present century ... ;-) ... while other teams are continuing to maintain the existing version of it. This has lead, so far, to about 275 patches. Trouble is, one of…
Mike Robinson
  • 8,490
  • 5
  • 28
  • 41
16
votes
3 answers

Python: how to create a choropleth map out of a shapefile of Canada?

My goal here is to create a choropleth map of Canada in Python. Suppose I have a dictionary with values referring to each Canadian province/territory: myvalues={'Alberta': 1.0, 'British Columbia': 2.0, 'Manitoba': 3.0, 'New Brunswick': 4.0, …
FaCoffee
  • 7,609
  • 28
  • 99
  • 174
16
votes
4 answers

Is there something like bsdiff/Courgette for jar files?

Google uses bsdiff and Courgette for patching binary files like the Chrome distribution. Do any similar tools exist for patching jar files? I am updating jar files remotely over a bandwidth-limited connection and would like to minimize the amount of…
Ken Liu
  • 22,503
  • 19
  • 75
  • 98
16
votes
4 answers

Make `patch` return 0 when skipping an already applied patch

I have a build tool that runs a patch command and if the patch command returns non-zero, it will cause the build to fail. I am applying a patch that may or may not already be applied, so I use the -N option to patch, which skips as it should.…
zjm555
  • 781
  • 1
  • 5
  • 14
16
votes
3 answers

How to patch only a particular hunk from a diff

Is there a way to apply a single hunk from a diff to a file? For example, say I do a diff from file A and B, and that produces three chunks of differences, each denoted with something like... @@ -971,30 +977,28 @@ ...(in the case of unified…
khosrow
  • 8,799
  • 4
  • 21
  • 24
16
votes
6 answers

TortoiseSVN Apply Patch error

I am trying to apply patch but I get a blank error message (there is no text in it or anything). I have latest version of TortoiseSVN.
Chebz
  • 1,375
  • 3
  • 14
  • 27
15
votes
6 answers

How to apply a patch to a Java project?

The patch is for nutch 0.9: http://cvs.tty.org/~butch/blog/nutch_0.9_OR.patch How should I apply the patch correctly? OS is windows XP More specifically, I'm using eclipse to debug a nutch project. Here is my trial: D:\nutch-0.9.bak>patch -p0 <…
omg
  • 136,412
  • 142
  • 288
  • 348