[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Sed failure in contrib/sboxes on MacOS
From: |
Andreas Kusalananda Kähäri |
Subject: |
Re: Sed failure in contrib/sboxes on MacOS |
Date: |
Tue, 26 Oct 2021 23:56:47 +0200 |
On Tue, Oct 26, 2021 at 12:47:49PM +0200, Axel Kielhorn wrote:
> Hello,
>
> I get the following error when building on MacOS 11:
>
> sed: 17: ./contrib/sboxes/notquine.sed: unexpected EOF (pending }’s)
>
> If I remove
>
> /\\##/{
> s/\\##//
> b}
>
> It works:
If you insert a semicolon or a newline after the b command, you will
make it more portable. Also, there is no need to repeat the regular
expression a second time.
/\\##/ { s///; b; }
or even just
s/\\##//
t
The sed script also has another substitution further up that requries
GNU sed:
s/.*\\##.*/&\n&/
POSIX sed can't insert a newline with its s command using \n. However,
the following would be portable:
s/.*\\##.*/&\
&/
That is, escape the literal newline.
>
> /Applications/Xcode.app/Contents/Developer/usr/bin/make all-am
> GEN contrib/sboxes/msboxes.ms
> GROFF contrib/sboxes/msboxes.pdf
>
> Later I get:
>
> sed: 1: "1i .lf 1 contrib/sboxes ...": command i expects \ followed by text
This is from another GNU sed convinience feature taht allows you to
insert text with the i command on the same line as the command itself:
1i\ .lf 1
With POSIX sed, that needs to be written
1i\
.lf 1
Now, looking at the Makefile or Makefile.in, at around line 4538 (search
for where DOC_SED is being used), it seems as if someone has tried to
write this properly, with a literal newline and everything. The only
issue is that Make will remove that literal newline, which turns it into
a sed expression that only GNU sed understands.
DOC_GROFF = $(DOC_SED) -e '1i\
.lf 1 $<' $< | $(DOC_GROFF_ONLY)
The above is turned into something like
LANG=C LC_ALL=C sed -e "...blah blah..." -e '1i\n .lf 1 ...etc.'
which on my OpenBSD system generates
sed: 1: "1i\n .lf 1 doc/webpage.ms": extra characters after \ at the
end of i command
Instead, that line in the Makefile should look like
DOC_GROFF = $(DOC_SED) -e '1i\' -e '.lf 1 $<' $< | $(DOC_GROFF_ONLY)
That is, break the single expression string up into two.
I've only tested with OpenBSD sed.
>
> Sed doesn’t tell me its version but the man pages says March 27, 2017.
>
> Greetings
>
> Axel
--
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden
.
- Sed failure in contrib/sboxes on MacOS, Axel Kielhorn, 2021/10/26
- Re: Sed failure in contrib/sboxes on MacOS, G. Branden Robinson, 2021/10/26
- Re: Sed failure in contrib/sboxes on MacOS, James K. Lowden, 2021/10/26
- Re: Sed failure in contrib/sboxes on MacOS, Ralph Corderoy, 2021/10/26
- Re: Sed failure in contrib/sboxes on MacOS, G. Branden Robinson, 2021/10/27
- Re: Sed failure in contrib/sboxes on MacOS, John Gardner, 2021/10/27
- Re: Sed failure in contrib/sboxes on MacOS, James K. Lowden, 2021/10/30
- Re: Sed failure in contrib/sboxes on MacOS, Andreas Kusalananda Kähäri, 2021/10/31
- Re: Sed failure in contrib/sboxes on MacOS, James K. Lowden, 2021/10/31
- Re: Sed failure in contrib/sboxes on MacOS, James K. Lowden, 2021/10/30
Re: Sed failure in contrib/sboxes on MacOS,
Andreas Kusalananda Kähäri <=
- Re: Sed failure in contrib/sboxes on MacOS, Andreas Kusalananda Kähäri, 2021/10/26
- Portability to Mac OS X (was: Sed failure in contrib/sboxes on MacOS), G. Branden Robinson, 2021/10/27
- Re: Portability to Mac OS X, Werner LEMBERG, 2021/10/27
- Re: Portability to Mac OS X (was: Sed failure in contrib/sboxes on MacOS), John Gardner, 2021/10/28
- Re: Portability to Mac OS X, Ingo Schwarze, 2021/10/28
- Re: Portability to Mac OS X, Deri, 2021/10/28
- Re: Portability to Mac OS X (was: Sed failure in contrib/sboxes on MacOS), John Gardner, 2021/10/28
- Re: Portability to Mac OS X (was: Sed failure in contrib/sboxes on MacOS), Larry McVoy, 2021/10/28
- Re: Portability to Mac OS X (was: Sed failure in contrib/sboxes on MacOS), Ralph Corderoy, 2021/10/29
- Re: Portability to Mac OS X (was: Sed failure in contrib/sboxes on MacOS), T. Kurt Bond, 2021/10/29