Allow patch of symlinks

Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
When I try to run a patch command with a patchfile against a link, patch gives me the error:
File
path/to/fileis not a regular file -- refusing to patch
The following command produces this error when I have links to the files in question in my staging directory.
~> cd staging
~/staging> ls -l path/to/
lrwxrwxrwx 1 user users 15 Jan 1 00:00 file1 -> ../../../actual/path/file1
lrwxrwxrwx 1 user users 15 Jan 1 00:00 file2 -> ../../../actual/path/file2
~/staging> patch -p 1 -i ../patchfile
File path/to/file1 is not a regular file -- refusing to patch
2 out of 2 hunks ignored -- saving rejects to file path/to/file1.rej
File path/to/file2 is not a regular file -- refusing to patch
1 out of 1 hunk ignored -- saving rejects to file path/to/file2.rej
How can I tell patch not to ignore the symbolic links and patch them in-place as if they were normal files?
symlink diff patch
add a comment |Â
up vote
1
down vote
favorite
When I try to run a patch command with a patchfile against a link, patch gives me the error:
File
path/to/fileis not a regular file -- refusing to patch
The following command produces this error when I have links to the files in question in my staging directory.
~> cd staging
~/staging> ls -l path/to/
lrwxrwxrwx 1 user users 15 Jan 1 00:00 file1 -> ../../../actual/path/file1
lrwxrwxrwx 1 user users 15 Jan 1 00:00 file2 -> ../../../actual/path/file2
~/staging> patch -p 1 -i ../patchfile
File path/to/file1 is not a regular file -- refusing to patch
2 out of 2 hunks ignored -- saving rejects to file path/to/file1.rej
File path/to/file2 is not a regular file -- refusing to patch
1 out of 1 hunk ignored -- saving rejects to file path/to/file2.rej
How can I tell patch not to ignore the symbolic links and patch them in-place as if they were normal files?
symlink diff patch
I can work around this by modifying the patch file itself, but that doesn't answer the question.
â palswim
Jun 14 at 21:09
1
Perhaps--follow-symlinksoption.
â Thomas Dickey
Jun 14 at 21:18
Not all implementations ofpatchhave such an option (e. g.patchprovided my Mac OS).
â DopeGhoti
Jun 14 at 21:30
None of the POSIX compliant patch implementations have this option and if they would be anhanced, they did most likely implement-H/-L/-Pthat has been chosen by POSIX approx. 20 years ago for this purpose.
â schily
Jun 15 at 8:46
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
When I try to run a patch command with a patchfile against a link, patch gives me the error:
File
path/to/fileis not a regular file -- refusing to patch
The following command produces this error when I have links to the files in question in my staging directory.
~> cd staging
~/staging> ls -l path/to/
lrwxrwxrwx 1 user users 15 Jan 1 00:00 file1 -> ../../../actual/path/file1
lrwxrwxrwx 1 user users 15 Jan 1 00:00 file2 -> ../../../actual/path/file2
~/staging> patch -p 1 -i ../patchfile
File path/to/file1 is not a regular file -- refusing to patch
2 out of 2 hunks ignored -- saving rejects to file path/to/file1.rej
File path/to/file2 is not a regular file -- refusing to patch
1 out of 1 hunk ignored -- saving rejects to file path/to/file2.rej
How can I tell patch not to ignore the symbolic links and patch them in-place as if they were normal files?
symlink diff patch
When I try to run a patch command with a patchfile against a link, patch gives me the error:
File
path/to/fileis not a regular file -- refusing to patch
The following command produces this error when I have links to the files in question in my staging directory.
~> cd staging
~/staging> ls -l path/to/
lrwxrwxrwx 1 user users 15 Jan 1 00:00 file1 -> ../../../actual/path/file1
lrwxrwxrwx 1 user users 15 Jan 1 00:00 file2 -> ../../../actual/path/file2
~/staging> patch -p 1 -i ../patchfile
File path/to/file1 is not a regular file -- refusing to patch
2 out of 2 hunks ignored -- saving rejects to file path/to/file1.rej
File path/to/file2 is not a regular file -- refusing to patch
1 out of 1 hunk ignored -- saving rejects to file path/to/file2.rej
How can I tell patch not to ignore the symbolic links and patch them in-place as if they were normal files?
symlink diff patch
edited Jun 14 at 22:42
asked Jun 14 at 21:03
palswim
1,26611627
1,26611627
I can work around this by modifying the patch file itself, but that doesn't answer the question.
â palswim
Jun 14 at 21:09
1
Perhaps--follow-symlinksoption.
â Thomas Dickey
Jun 14 at 21:18
Not all implementations ofpatchhave such an option (e. g.patchprovided my Mac OS).
â DopeGhoti
Jun 14 at 21:30
None of the POSIX compliant patch implementations have this option and if they would be anhanced, they did most likely implement-H/-L/-Pthat has been chosen by POSIX approx. 20 years ago for this purpose.
â schily
Jun 15 at 8:46
add a comment |Â
I can work around this by modifying the patch file itself, but that doesn't answer the question.
â palswim
Jun 14 at 21:09
1
Perhaps--follow-symlinksoption.
â Thomas Dickey
Jun 14 at 21:18
Not all implementations ofpatchhave such an option (e. g.patchprovided my Mac OS).
â DopeGhoti
Jun 14 at 21:30
None of the POSIX compliant patch implementations have this option and if they would be anhanced, they did most likely implement-H/-L/-Pthat has been chosen by POSIX approx. 20 years ago for this purpose.
â schily
Jun 15 at 8:46
I can work around this by modifying the patch file itself, but that doesn't answer the question.
â palswim
Jun 14 at 21:09
I can work around this by modifying the patch file itself, but that doesn't answer the question.
â palswim
Jun 14 at 21:09
1
1
Perhaps
--follow-symlinks option.â Thomas Dickey
Jun 14 at 21:18
Perhaps
--follow-symlinks option.â Thomas Dickey
Jun 14 at 21:18
Not all implementations of
patch have such an option (e. g. patch provided my Mac OS).â DopeGhoti
Jun 14 at 21:30
Not all implementations of
patch have such an option (e. g. patch provided my Mac OS).â DopeGhoti
Jun 14 at 21:30
None of the POSIX compliant patch implementations have this option and if they would be anhanced, they did most likely implement
-H/-L/-P that has been chosen by POSIX approx. 20 years ago for this purpose.â schily
Jun 15 at 8:46
None of the POSIX compliant patch implementations have this option and if they would be anhanced, they did most likely implement
-H/-L/-P that has been chosen by POSIX approx. 20 years ago for this purpose.â schily
Jun 15 at 8:46
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
GNU patch 2.7.1 (since 2012) has a --follow-symlinks option:
When looking for input files, follow symbolic links. Replaces the
symbolic links, instead of modifying the files the symbolic links
point to. Git-style patches to symbolic links will no longer apply.
This option exists for backwards compatibility with previous versions of patch; its use is discouraged.
My version ofpatch(GNU patch 2.7.4 on cygwin) did not list this option inpatch --help, but still supported it.
â palswim
Jun 14 at 22:45
Good answer, but that it replaces the link, rather than modifies the target file makes it not work for my case. I updated the question slightly.
â palswim
Jun 14 at 22:46
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
GNU patch 2.7.1 (since 2012) has a --follow-symlinks option:
When looking for input files, follow symbolic links. Replaces the
symbolic links, instead of modifying the files the symbolic links
point to. Git-style patches to symbolic links will no longer apply.
This option exists for backwards compatibility with previous versions of patch; its use is discouraged.
My version ofpatch(GNU patch 2.7.4 on cygwin) did not list this option inpatch --help, but still supported it.
â palswim
Jun 14 at 22:45
Good answer, but that it replaces the link, rather than modifies the target file makes it not work for my case. I updated the question slightly.
â palswim
Jun 14 at 22:46
add a comment |Â
up vote
1
down vote
GNU patch 2.7.1 (since 2012) has a --follow-symlinks option:
When looking for input files, follow symbolic links. Replaces the
symbolic links, instead of modifying the files the symbolic links
point to. Git-style patches to symbolic links will no longer apply.
This option exists for backwards compatibility with previous versions of patch; its use is discouraged.
My version ofpatch(GNU patch 2.7.4 on cygwin) did not list this option inpatch --help, but still supported it.
â palswim
Jun 14 at 22:45
Good answer, but that it replaces the link, rather than modifies the target file makes it not work for my case. I updated the question slightly.
â palswim
Jun 14 at 22:46
add a comment |Â
up vote
1
down vote
up vote
1
down vote
GNU patch 2.7.1 (since 2012) has a --follow-symlinks option:
When looking for input files, follow symbolic links. Replaces the
symbolic links, instead of modifying the files the symbolic links
point to. Git-style patches to symbolic links will no longer apply.
This option exists for backwards compatibility with previous versions of patch; its use is discouraged.
GNU patch 2.7.1 (since 2012) has a --follow-symlinks option:
When looking for input files, follow symbolic links. Replaces the
symbolic links, instead of modifying the files the symbolic links
point to. Git-style patches to symbolic links will no longer apply.
This option exists for backwards compatibility with previous versions of patch; its use is discouraged.
answered Jun 14 at 22:16
Thomas Dickey
49k584154
49k584154
My version ofpatch(GNU patch 2.7.4 on cygwin) did not list this option inpatch --help, but still supported it.
â palswim
Jun 14 at 22:45
Good answer, but that it replaces the link, rather than modifies the target file makes it not work for my case. I updated the question slightly.
â palswim
Jun 14 at 22:46
add a comment |Â
My version ofpatch(GNU patch 2.7.4 on cygwin) did not list this option inpatch --help, but still supported it.
â palswim
Jun 14 at 22:45
Good answer, but that it replaces the link, rather than modifies the target file makes it not work for my case. I updated the question slightly.
â palswim
Jun 14 at 22:46
My version of
patch (GNU patch 2.7.4 on cygwin) did not list this option in patch --help, but still supported it.â palswim
Jun 14 at 22:45
My version of
patch (GNU patch 2.7.4 on cygwin) did not list this option in patch --help, but still supported it.â palswim
Jun 14 at 22:45
Good answer, but that it replaces the link, rather than modifies the target file makes it not work for my case. I updated the question slightly.
â palswim
Jun 14 at 22:46
Good answer, but that it replaces the link, rather than modifies the target file makes it not work for my case. I updated the question slightly.
â palswim
Jun 14 at 22:46
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f449896%2fallow-patch-of-symlinks%23new-answer', 'question_page');
);
Post as a guest
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
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
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
I can work around this by modifying the patch file itself, but that doesn't answer the question.
â palswim
Jun 14 at 21:09
1
Perhaps
--follow-symlinksoption.â Thomas Dickey
Jun 14 at 21:18
Not all implementations of
patchhave such an option (e. g.patchprovided my Mac OS).â DopeGhoti
Jun 14 at 21:30
None of the POSIX compliant patch implementations have this option and if they would be anhanced, they did most likely implement
-H/-L/-Pthat has been chosen by POSIX approx. 20 years ago for this purpose.â schily
Jun 15 at 8:46