[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: maint.mk: sed portability
From: |
Jim Meyering |
Subject: |
Re: maint.mk: sed portability |
Date: |
Thu, 24 May 2012 10:24:27 +0200 |
Paul Eggert wrote:
> On 05/23/2012 02:23 AM, Jim Meyering wrote:
>> + | sed -n '/^\[GNUPG:\] ERRSIG /{s///;s/ .*//p;q;}')
>
> The use of {...;...} isn't portable in sed scripts. You
> have to write it something like this instead, I'm afraid:
>
> | sed -n '/^\[GNUPG:\] ERRSIG /{
> s///
> s/ .*//p
> q
> }'
>
> except of course this can't easily be done in a Makefile.
>
> This restriction is in POSIX-2008 and I've been burned by
> it with some less-commonly-used sed implementations
> (Interix or something like that....). Dunno if this
> matters in a 'maint' rule, but Akim's report was
> about 'sed' portability, so I thought I'd mention it.
Hi Paul,
It's easy to work around, so here's a patch.
Using awk is even a few bytes shorter:
>From 3ad4565f55945294cc543c7aace0e1bfc80e19b9 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Thu, 24 May 2012 10:22:29 +0200
Subject: [PATCH] maint.mk: compute $(gpg_key_ID) more portably
* top/maint.mk (gpg_key_ID): Use awk in place of sed '{...;...;}'.
That use of sed is not portable to some fringe systems.
Reported by Paul Eggert in
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/30793/focus=30802
---
ChangeLog | 8 ++++++++
top/maint.mk | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 89ed235..66f18ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-05-24 Jim Meyering <address@hidden>
+
+ maint.mk: compute $(gpg_key_ID) more portably
+ * top/maint.mk (gpg_key_ID): Use awk in place of sed '{...;...;}'.
+ That use of sed is not portable to some fringe systems.
+ Reported by Paul Eggert in
+ http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/30793/focus=30802
+
2012-05-23 Akim Demaille <address@hidden>
announce-gen: du -h is more portable than du --human
diff --git a/top/maint.mk b/top/maint.mk
index 8cea95b..9746410 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -1234,7 +1234,7 @@ bootstrap-tools ?= autoconf,automake,gnulib
gpg_key_ID ?= \
$$(git cat-file tag v$(VERSION) \
| gpgv --status-fd 1 --keyring /dev/null - - 2>/dev/null \
- | sed -n '/^\[GNUPG:\] ERRSIG /{s///;s/ .*//p;q;}')
+ | awk '/^\[GNUPG:\] ERRSIG / {print $3; exit}')
translation_project_ ?= address@hidden
--
1.7.10.2.552.gaa3bb87