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
51
votes
2 answers

@patch decorator cannot set Provider

I tried patching a provider class by decorating a test method with @patch: class TestMyUnit(unittest.TestCase): ... @patch(provider.Provider,autospec=True) def test_init(self, mock_provider): pass However, when I run the test, I get the…
bavaza
  • 10,319
  • 10
  • 64
  • 103
50
votes
5 answers

Git: How can I find a commit that most closely matches a directory?

Someone took a version (unknown to me) of Moodle, applied many changes within a directory, and released it (tree here). How can I determine which commit of the original project was most likely edited to form this tree? this would allow me to form a…
Steve Clay
  • 8,671
  • 2
  • 42
  • 48
48
votes
4 answers

How to edit a diff/patch file cleanly ? Are there any patch file editors?

Scenario: I have a patch file that applies cleanly to my working files, but I do not want all the changes from the patch. Usually, I do vim example.patch, remove unwanted changes and them apply patch -p0 -i example.patch but at times the patch does…
My_patch_question
  • 481
  • 1
  • 4
  • 3
48
votes
8 answers

Git apply skips patches

I'm trying to apply a patch that includes binary files with git apply but only the files are added. I tried running git apply failing.patch -v and it prints something like: Skipped patch 'file.txt'. Checking patch file.bin... Applied patch…
Iulian Onofrei
  • 9,188
  • 10
  • 67
  • 113
48
votes
4 answers

How to patch a constant in python

I have two different modules in my project. One is a config file which contains LOGGING_ACTIVATED = False This constant is used in the second module (lets call it main) like the following: if LOGGING_ACTIVATED: amqp_connector = Connector() In…
d.a.d.a
  • 1,296
  • 1
  • 12
  • 28
45
votes
5 answers

Using the output of diff to create the patch

I have something like this src/sim/simulate.cc 41d40 < #include "mem/mem-interface.h" 90,91d88 < dram_print_stats_common(curTick/500); < src/mem/physical.hh 52d51 < public: 55,56d53 < public: < 58a56,57 > …
Eduardo
  • 19,928
  • 23
  • 65
  • 73
44
votes
2 answers

Git apply patch fails silently (no errors but nothing happens)

I'm trying to apply a patch, and git apply patch doesn't give me any errors: sashoalm@SASHOALM-PC /c/Workspace/tesseract-git/api (master) $ git apply ../../commit-d0d9477 sashoalm@SASHOALM-PC /c/Workspace/tesseract-git/api (master) $ As you can…
sashoalm
  • 75,001
  • 122
  • 434
  • 781
44
votes
2 answers

apply svn patch to git repository

Ok, I've tried all answers i could find on stackoverflow, but apparently none seem to be able to solve my problem. I want to apply a patch made by SVN to a git repository. Apparently the easiest way to do it is by using 'git apply', but that does…
victor
  • 1,626
  • 1
  • 14
  • 23
43
votes
4 answers

Permanently reversing a patch-file

Sometimes, for whatever reason, I have to produce patch-files (under Linux) that are in the wrong direction. I know that I can deal with this by using the -R switch when applying it via patch, but it would be nice if there were a way of permanently…
Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680
42
votes
3 answers

Patch vs. Hotfix vs. Maintenance Release vs. Service Pack vs

When you are somewhere between version 1 and version 2, what do you do to maintain your software? The terms Patch, Hotfix, Maintenance Release, Service Pack, and others are all blurry from my point of view, with different definitions depending on…
Rob Hunter
  • 2,787
  • 4
  • 35
  • 52
41
votes
3 answers

How to visualize or format a diff / patch file?

I have a patch file (unified diff), like the output from svn diff, git diff, or diff -u .... I want to review it, but the unified diff format - especially with many files & changes - is hard on my eyes. How can I get a nicely-formatted diff view…
orip
  • 73,323
  • 21
  • 116
  • 148
41
votes
9 answers

A visual patch tool for Linux

I've got a file and a patch for it. I'd like to visually apply the patch, t.i. see how the changes proposed by the patch look in context, make some corrections, and save the resulting file. What tool can do that? Neither of the visual diff tools…
Eugene Kirpichov
  • 411
  • 1
  • 4
  • 3
41
votes
3 answers

git-apply fails mysteriously, how do I troubleshoot/fix?

I'm currently trying to to code-style checking on the PRs of a (github) repository, and I want to deliver patches to the submitters with which they can easily fix the codestyle. To this end, I'm pulling down their PR, run our uncrustify script over…
Christoph
  • 5,480
  • 6
  • 36
  • 61
40
votes
1 answer

What is the difference between patches vs patchesJson6902 in Kustomize

Based on the docs that I've read, there are 3 methods of patching: patches patchesStrategicMerge patchesJson6902. The difference between patchesStrategicMerge and patchesJson6902 is obvious. patchesStrategicMerge requires a duplicate structure of…
Alex
  • 1,293
  • 1
  • 13
  • 26
39
votes
4 answers

How can you combine git add patch -p mode with diff's ignore-all-space

How can I do git add with patch mode but ignoring whitespace changes. The use case is for when you've reformatted a file and also made changes to it. I want to commit the real code changes separately first (as shown by git diff -w path) and then…
Sam
  • 14,642
  • 6
  • 27
  • 39