Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #244505
| From | <tomas@tuxteam.de> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: I've been caught out |
| Date | 2022-01-24 11:30 +0100 |
| Message-ID | <DJ4LL-42A-9@gated-at.bofh.it> (permalink) |
| References | <DJ4sq-3Wj-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
On Mon, Jan 24, 2022 at 05:01:21AM -0500, gene heskett wrote:
> Greetings all;
>
> I must admit its been quite a few years since the last time I used patch.
> Basck in the early 90's when the amiga was king in the graphic arts.
> And it then had a syntax of 'patch -p1 < path/to/patchfile'
> But now I have a ../patch directory with 50 or so files in it, and patch
> is spanking me, starting with an ambiguous redirect if the < is used,
This ain't patch. This is the shell. If you do
foo < file
... then it's the shell's job to present file's content to foo on stdin.
Foo doesn't even get to see file "as a file on your file system", just
its content. Doing
foo < file1 file2 file3...
will lead the shell to present the complaint above.
This might seem like superfluous nitpicking, but you won't understand
what's going on unless you know that.
> And while it finds the patch file without it, its reporting an extra
> operand. So whats todays syntax for a ../dir full of patches?
Now if you go to the patch man page (I know, I know :) you'll see that
patch can take /the/ patch file either on stdin or as an optional second
argument, instead of taking stdin. I emphasised /the/, because, according
to the man page, it doesn't expect more than one. So that might be the
extra operand complaint you are seeing...
> Example:
> gene@coyote:~/Debian-arm/linux$ patch -p1 ../patches/*.patch
> patch: ../patches/0001-mm-memcg-Disable-threshold-event-handlers-on-
> PREEMPT.patch: extra operand
Yes, that's it: the expression "../patches/*.patch" gets expanded by the
shell to "../patches/foo.patch ../patches/bar.patch ..." and so on, so
your little /usr/bin/patch gets so see this long list of args. No good.
> And the man page doesn't address the 'extra operand' error.
Indirectly, yes:
SYNOPSIS
patch [options] [originalfile [patchfile]]
but usually just
patch -pnum <patchfile
...means it takes options, optionally an orig file name, and only then,
optionally a patch file name (so if you want to provide the patch file
name, you /have/ to provide the original file name, it seems).
Conclusion: you have to arrange for all those patches to be applied one
after the other, in some order. Guessing from your first one, they are
prefixed by a number, so that is most probably the one encoding that
order.
You could try doing something along the lines of
for f in ../patches/*.patch ; do
patch -p1 < "$f"
done
Or you could have a look into quilt, which is supposed to automate such
things.
Cheers
--
t
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
I've been caught out gene heskett <gheskett@shentel.net> - 2022-01-24 11:10 +0100
Re: I've been caught out "Thomas Schmitt" <scdbackup@gmx.net> - 2022-01-24 11:30 +0100
Re: I've been caught out gene heskett <gheskett@shentel.net> - 2022-01-24 12:10 +0100
Re: I've been caught out <tomas@tuxteam.de> - 2022-01-24 12:20 +0100
Re: I've been caught out gene heskett <gheskett@shentel.net> - 2022-01-24 21:40 +0100
Re: I've been caught out "Thomas Schmitt" <scdbackup@gmx.net> - 2022-01-24 12:40 +0100
Re: I've been caught out Mark Allums <mark@allums.email> - 2022-01-24 13:20 +0100
Re: I've been caught out <tomas@tuxteam.de> - 2022-01-24 11:30 +0100
Re: I've been caught out <tomas@tuxteam.de> - 2022-01-24 21:40 +0100
Re: I've been caught out gene heskett <gheskett@shentel.net> - 2022-01-24 21:40 +0100
Re: I've been caught out Greg Wooledge <greg@wooledge.org> - 2022-01-24 13:50 +0100
Re: I've been caught out Urs Thuermann <urs@isnogud.escape.de> - 2022-01-25 09:20 +0100
Re: I've been caught out Vincent Lefevre <vincent@vinc17.net> - 2022-01-25 13:50 +0100
Re: I've been caught out <tomas@tuxteam.de> - 2022-01-25 14:10 +0100
Re: I've been caught out Greg Wooledge <greg@wooledge.org> - 2022-01-25 13:50 +0100
Re: I've been caught out gene heskett <gheskett@shentel.net> - 2022-01-25 18:00 +0100
csiph-web