quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Quilt-dev] Non-portable sed command in find_patch


From: Jean Delvare
Subject: Re: [Quilt-dev] Non-portable sed command in find_patch
Date: Thu, 22 Sep 2005 11:28:08 +0200 (CEST)

Hi Andreas,

> > There is a non-portable sed command used in the find_patch function:
> >
> > sed -e "/^$bre\(\|\.patch\|\.diff\?\)\(\|\.gz\|\.bz2\)\([
> > "$'\t'"]\|$\)/!d"
>
> Not sure what breaks. Does this sed support the construct sed -ne
> 's/aaa/bbb/p'? If so, then I'd prefer that.

For one thing, the '!d' seems to cause some trouble because the shell
erroneously attempts to find an event by that name. That might not
affect non-interactive shells though, just me when testing, and working
around it is easy anyway.

The real blocker is that this version of sed doesn't support
\(foo\|bar\) constructs, just like the version of grep found on this
system doesn't. This means that John's suggested replacement doesn't
work either. I installed GNU grep to workaround the grep problem, which
is why my proposed grep replacement works for me.

This leaves us with three possibilities:

1* Go with the grep replacement I suggested, and its slight performance
drop.

2* Go with awk, as my version of awk seems to be happy with (foo|bar)
constructs, and awk regexps seem to be slightly more standard than
sed's and grep's.

3* Let the code as is, and I install GNU sed.

For information, there seems to be only two other uses of this sed
construct in quilt (in quilt/fork.in and test/conflicts.test).

I'm fine with either solution, but I wouldn't want to make quilt's
code slower or harder to read/maintain just because some systems ship
with a very limited version of sed.

Two additional notes:

* Now that we have a compat directory, if would be great if the test
suite could use it, so that the calls to grep, sed etc... in the test
suite respect the user's choices. If the user had to tell quilt to use
a specific version of grep or sed, chances are good that the version
found in the PATH are somehow broken and the tests are likely to fail
because of this.

* Could someone comment on the relative merits of the patch_in_series and
find_patch functions? Looks to me like the latter does a better job.
Shouldn't the former be deprecated?

Thanks,
--
Jean Delvare




reply via email to

[Prev in Thread] Current Thread [Next in Thread]