[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: |
Wed, 27 Oct 2021 00:07:22 +0200 |
On Tue, Oct 26, 2021 at 11:56:47PM +0200, Kusalananda Kähäri wrote:
> On Tue, Oct 26, 2021 at 12:47:49PM +0200, Axel Kielhorn wrote:
[cut]
> > 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.
Actually, that only makes it work with OpenBSD sed and GNU sed. It still fails
with
sed: Unrecognized command: .lf 1 doc/webpage.ms
when using Plan 9 sed. Not tested with macOS.
So it looks like the best bet is to insert a literal newline somehow,
after the \ like the Makefile *tries* to do. How to do that properly is
unfortunately beyond me as I don't grock Make quoting rules very well.
>
> 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
>
> .
--
Andreas (Kusalananda) Kähäri
SciLifeLab, NBIS, ICM
Uppsala University, Sweden
.
- Re: Sed failure in contrib/sboxes on MacOS, (continued)
- 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, 2021/10/26
- Re: Sed failure in contrib/sboxes on MacOS,
Andreas Kusalananda Kähäri <=
- 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
- Re: Portability to Mac OS X (was: Sed failure in contrib/sboxes on MacOS), Deri, 2021/10/29