Apply patch to specified file, completely ignoring the path/filename stored in the patch file?
Clash Royale CLAN TAG#URR8PPP
I need to apply a patch to a file in a complicated directory and symlink scenario. No matter what I try, I can't figure out how to massage the patch
arguments so that it would find the desired file. Is there a way to completely circumvent the problem and just EXPLICITLY TELL patch
to which file it should apply the patch, ignoring the path/filename in the .patch file?
patch
add a comment |
I need to apply a patch to a file in a complicated directory and symlink scenario. No matter what I try, I can't figure out how to massage the patch
arguments so that it would find the desired file. Is there a way to completely circumvent the problem and just EXPLICITLY TELL patch
to which file it should apply the patch, ignoring the path/filename in the .patch file?
patch
I'm not sure if there's a way to do with withpatch
options, but can you just edit the patch file instead?
– Sparhawk
Feb 1 at 8:46
Last resort. This is an automated build scenario where the patch is downloaded from the web, so I would have to either script the editing (cp, sed, patch, rm), or... patch the patch, which is silly.
– Szczepan Hołyszewski
Feb 1 at 9:04
add a comment |
I need to apply a patch to a file in a complicated directory and symlink scenario. No matter what I try, I can't figure out how to massage the patch
arguments so that it would find the desired file. Is there a way to completely circumvent the problem and just EXPLICITLY TELL patch
to which file it should apply the patch, ignoring the path/filename in the .patch file?
patch
I need to apply a patch to a file in a complicated directory and symlink scenario. No matter what I try, I can't figure out how to massage the patch
arguments so that it would find the desired file. Is there a way to completely circumvent the problem and just EXPLICITLY TELL patch
to which file it should apply the patch, ignoring the path/filename in the .patch file?
patch
patch
edited Feb 1 at 9:14
Rui F Ribeiro
40.4k1479137
40.4k1479137
asked Feb 1 at 8:43
Szczepan HołyszewskiSzczepan Hołyszewski
1413
1413
I'm not sure if there's a way to do with withpatch
options, but can you just edit the patch file instead?
– Sparhawk
Feb 1 at 8:46
Last resort. This is an automated build scenario where the patch is downloaded from the web, so I would have to either script the editing (cp, sed, patch, rm), or... patch the patch, which is silly.
– Szczepan Hołyszewski
Feb 1 at 9:04
add a comment |
I'm not sure if there's a way to do with withpatch
options, but can you just edit the patch file instead?
– Sparhawk
Feb 1 at 8:46
Last resort. This is an automated build scenario where the patch is downloaded from the web, so I would have to either script the editing (cp, sed, patch, rm), or... patch the patch, which is silly.
– Szczepan Hołyszewski
Feb 1 at 9:04
I'm not sure if there's a way to do with with
patch
options, but can you just edit the patch file instead?– Sparhawk
Feb 1 at 8:46
I'm not sure if there's a way to do with with
patch
options, but can you just edit the patch file instead?– Sparhawk
Feb 1 at 8:46
Last resort. This is an automated build scenario where the patch is downloaded from the web, so I would have to either script the editing (cp, sed, patch, rm), or... patch the patch, which is silly.
– Szczepan Hołyszewski
Feb 1 at 9:04
Last resort. This is an automated build scenario where the patch is downloaded from the web, so I would have to either script the editing (cp, sed, patch, rm), or... patch the patch, which is silly.
– Szczepan Hołyszewski
Feb 1 at 9:04
add a comment |
2 Answers
2
active
oldest
votes
If the patch only contains changes to a single file, you should be able to tell patch
to apply those changes to a file of your choice by specifying it before the patch name:
patch myfile withthis.patch
will apply withthis.patch
to myfile
, ignoring the file name in the patch.
Quoting the man page:
The names of the files to be patched are usually taken from the patch file, but if there's just one file to be patched it can be specified on the command line as originalfile.
add a comment |
If the patch applies to only one file you could simply, put a symlink in that location pointing at the file you want it to be applied to. (assuming that the reason you need it applied else-ware is because that file does not exist) Then just apply the patch.
Even if it pointed at multiple files, it could be done this way, with more time.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f498089%2fapply-patch-to-specified-file-completely-ignoring-the-path-filename-stored-in-t%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
If the patch only contains changes to a single file, you should be able to tell patch
to apply those changes to a file of your choice by specifying it before the patch name:
patch myfile withthis.patch
will apply withthis.patch
to myfile
, ignoring the file name in the patch.
Quoting the man page:
The names of the files to be patched are usually taken from the patch file, but if there's just one file to be patched it can be specified on the command line as originalfile.
add a comment |
If the patch only contains changes to a single file, you should be able to tell patch
to apply those changes to a file of your choice by specifying it before the patch name:
patch myfile withthis.patch
will apply withthis.patch
to myfile
, ignoring the file name in the patch.
Quoting the man page:
The names of the files to be patched are usually taken from the patch file, but if there's just one file to be patched it can be specified on the command line as originalfile.
add a comment |
If the patch only contains changes to a single file, you should be able to tell patch
to apply those changes to a file of your choice by specifying it before the patch name:
patch myfile withthis.patch
will apply withthis.patch
to myfile
, ignoring the file name in the patch.
Quoting the man page:
The names of the files to be patched are usually taken from the patch file, but if there's just one file to be patched it can be specified on the command line as originalfile.
If the patch only contains changes to a single file, you should be able to tell patch
to apply those changes to a file of your choice by specifying it before the patch name:
patch myfile withthis.patch
will apply withthis.patch
to myfile
, ignoring the file name in the patch.
Quoting the man page:
The names of the files to be patched are usually taken from the patch file, but if there's just one file to be patched it can be specified on the command line as originalfile.
answered Feb 1 at 9:26
Stephen KittStephen Kitt
173k24393468
173k24393468
add a comment |
add a comment |
If the patch applies to only one file you could simply, put a symlink in that location pointing at the file you want it to be applied to. (assuming that the reason you need it applied else-ware is because that file does not exist) Then just apply the patch.
Even if it pointed at multiple files, it could be done this way, with more time.
add a comment |
If the patch applies to only one file you could simply, put a symlink in that location pointing at the file you want it to be applied to. (assuming that the reason you need it applied else-ware is because that file does not exist) Then just apply the patch.
Even if it pointed at multiple files, it could be done this way, with more time.
add a comment |
If the patch applies to only one file you could simply, put a symlink in that location pointing at the file you want it to be applied to. (assuming that the reason you need it applied else-ware is because that file does not exist) Then just apply the patch.
Even if it pointed at multiple files, it could be done this way, with more time.
If the patch applies to only one file you could simply, put a symlink in that location pointing at the file you want it to be applied to. (assuming that the reason you need it applied else-ware is because that file does not exist) Then just apply the patch.
Even if it pointed at multiple files, it could be done this way, with more time.
answered Feb 1 at 12:27
Michael ProkopecMichael Prokopec
1,504218
1,504218
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f498089%2fapply-patch-to-specified-file-completely-ignoring-the-path-filename-stored-in-t%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I'm not sure if there's a way to do with with
patch
options, but can you just edit the patch file instead?– Sparhawk
Feb 1 at 8:46
Last resort. This is an automated build scenario where the patch is downloaded from the web, so I would have to either script the editing (cp, sed, patch, rm), or... patch the patch, which is silly.
– Szczepan Hołyszewski
Feb 1 at 9:04