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

Reading a file and then overwriting it in Python

I've been trying to read a file and then overwrite it with some updated data. I've tried doing it like this: #Created filename.txt with some data with open('filename.txt', 'r+') as f: data = f.read() new_data = process(data) # data is being…
pystudent
  • 531
  • 1
  • 5
  • 19
13
votes
3 answers

How do I "inverse" a diff file?

Say I have a diff file looking basically like the following. +line a -line b Is it possible to do one (or both) of the following: Inverse this file (so I'd get) -line a +line b Pass some argument to patch so the end result the same as…
One Two Three
  • 22,327
  • 24
  • 73
  • 114
13
votes
1 answer

Can I modify git-add's **default** hunk size?

Using git add -p, one can select changes to a file for staging. One can manually change the hunk size (Can I modify git-add's hunk size?), but I would like to know how to change the default hunk size (for example to a single line).
user2298337
13
votes
3 answers

Override "private" function in JavaScript

I'm monkey-patching some of the jQuery's Draggable code*. The goal is to avoid modifying the original source files and patch dynamically one of the internal functions. The function _generatePosition is declared like this: (function($) { …
Art
  • 23,747
  • 29
  • 89
  • 101
13
votes
1 answer

Pipe git diff to git apply

Why won't this command work ? git diff | git --git-dir=/other/location/.git --work-tree=/other/location apply The following works perfectly: git diff > /tmp/my.patch cd /other/location && git apply /tmp/my.patch /other/location is a mirror of the…
Alasdair
  • 173
  • 1
  • 8
13
votes
1 answer

How to Label patch in matplotlib

I am plotting rectangular patches in matplotlib in interactive mode. I want to add text to each patch. I do not want to annotate them as it decreases the speed. I am using 'label' property of patch but it is not working. Ayone know how to add 1…
TonyParker
  • 2,024
  • 5
  • 18
  • 27
13
votes
4 answers

How to create a PATCH file for the binary difference output file

I want to know how to create a PATCH for the difference file I got by comparing two binary files. $cmp -l > output file name I checked for text files 'diff" can be used to compare and generate a PATCH file $ diff -u oldFile newFile > mods.diff …
sujitnist
  • 131
  • 1
  • 1
  • 4
13
votes
3 answers

How to check Oracle patches are installed?

How do I check that all services and patches are installed in Oracle? I have an Oracle 10.2.0.2.0 db version and want to install patches. Also I want to get a list with all services and patches.
user3497717
  • 133
  • 1
  • 1
  • 5
13
votes
4 answers

How to apply git diff --binary patches without git installed?

I use to git diff to generate patches that can be applied to remote server to update a project. Locally, I run: git diff --no-prefix HEAD~1 HEAD > example.patch Upload example.patch to remote server and run: patch --dry-run -p0 < example.patch If…
Taras Mankovski
  • 1,639
  • 3
  • 16
  • 30
13
votes
2 answers

How to Merge multiple patch files?

We use subversion and during every check-in, a script creates a patch file with all the diff. Now for the same issue/defect there could be multiple check-ins and we end up with multiple patch files. Now to see consolidated changes for an issue all…
amit
  • 10,612
  • 11
  • 61
  • 60
13
votes
1 answer

git checkout --patch by words?

We have a project where the files contain unfortunately long lines, with no possibility of shortening them. We could streamline our workflow significantly if we could use git checkout --patch also with such files. This does not work since if there…
aleator
  • 4,436
  • 20
  • 31
12
votes
3 answers

How to apply two patches against the same git revision?

This is a imaginary problem, but I'm having real problems with patches. Let's say I have a project with the following git history: A - B - C Now if I receive two patches, C1 and C2, that are meant to be applied on C, how should I handle them? If I…
phunehehe
  • 8,618
  • 7
  • 49
  • 79
12
votes
2 answers

REST API PATCH without request body

I'm developing an API for events management. I have the basic GET and POST methods but now I have to deal with the event resource edition. A user can edit all the event information using: PUT /event/:eventId But also it can cancel the event (not…
Elias Garcia
  • 6,772
  • 11
  • 34
  • 62
12
votes
2 answers

Can Mercurial do a reverse-patch?

Scenario: I've "inherited" a program, kept under Mercurial, that only works on my system with specific tweaks to certain files that are checked in. I do not want to check these tweaks in. My most recent solution to this is to create a mercurial…
eternicode
  • 6,805
  • 4
  • 33
  • 39
12
votes
2 answers

How do I create a patch from diff between revisions using TortoiseSVN?

I'm working on a project where Subversion is used to maintain version control. I use TortoiseSVN to access the project repository. Some changes were made between two revisions on a project (let's call them rev1 and rev2), and I want to be able to…
Tola Odejayi
  • 3,019
  • 9
  • 31
  • 46