[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: patch: questions: prereq and backup?
From: |
Gary Funck |
Subject: |
Re: patch: questions: prereq and backup? |
Date: |
Thu, 22 Feb 2001 10:28:46 -0800 |
On Feb 22, 10:14am, Paul Eggert wrote:
> Subject: Re: patch: questions: prereq and backup?
> > From: address@hidden (Gary Funck)
> > Date: Wed, 21 Feb 2001 18:16:22 -0800
> >
> > The 2.1 version appeared to back up original files to *.orig by
> > default (so, no -b is required). But the newer version (2.5.4)
> > appears *not* to back up originals by default.
>
> The default is --backup-if-mismatch.
>
> > If I want the backup behavior, should I explicitly supply -b, and
> > that'll work for both versions of patch?
>
> No, because -b changed in meaning between the two versions.
> (POSIX required this, unfortunately.)
oh well. :)
>
> > the patch program doesn't just use the next "word" on the
> > "Prereq:" line, it uses everything on the line following "Prereq:",
> > ignoring any whitespace characters following "Prereq:".
>
> Hmm, looking at the 2.5.4 code, it appears to me that it looks at just
> the first word (i.e. no spaces) after "Prereq:". Which version of
> "patch" are you looking at here?
Yes, sorry. I misread the code. Here it is (in pch.c version 2.5.4):
362 else if (strnEQ(s, "Prereq:", 7)) {
363 for (t = s + 7; ISSPACE ((unsigned char) *t); t++)
364 continue;
365 revision = t;
366 for (t = revision; *t && !ISSPACE ((unsigned char) *t);
t++)
367 continue;
368 if (t == revision)
369 revision = 0;
370 else {
371 char oldc = *t;
372 *t = '\0';
373 revision = savestr (revision);
374 *t = oldc;
375 }
So, I guess what I was seeing is that when I supplied
Prereq: "2.95.2 19991024 (release)";
it was being handled in an equivalent fashion to:
Prereq: "2.95.2
Thanks looking into this, and answering my questions.
> > is the Prereq line above ("2.95.2 19991024 (release)";) incorrect
> > in that it specifies more than one "word".
>
> Yes.
>
> > What I would have preferred, is that Prereq use a defintion of word
> > that is consistent with something like the egrep/ed meaning
> > of: '\<word\>', and that Pre-req allow only one 'word' on the
> > line following "Prereq:" and issue an error if more than word is
> > supplied.
>
> It might be nice to issue a diagnostic in that case, yes.