groff
[Top][All Lists]
Advanced

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

Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana


From: Bruno Haible
Subject: Re: groff 1.23.0.rc4 on Solaris 11 OpenIndiana
Date: Sun, 16 Apr 2023 15:41:47 +0200

G. Branden Robinson wrote:
> > On Solaris 11 OpenIndiana, 1 see 1 test failure:
> > 
> > FAIL: tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh
> > ===============================================================
> > 
> > pdfpic.tmac:<standard input>:5: error: retrieval of 
> > '/export/home/bruno/groff-1.23.0.rc4/build-64-gcc/doc/gnu-no-choke-on-pdfinfo.pdf'
> >  image dimensions failed; skipping
> > FAIL tmac/tests/pdfpic_does-not-choke-on-bad-pdfinfo-output.sh (exit 
> > status: 1)
> 
> This might be a sed(1) portability issue.

Indeed: When I put GNU sed 4.9 into $PATH, "make check" succeeds.

> pdfpic.tmac does a pretty hairy thing.
> 
> .  \" Get image dimensions.  The `tr` command to strip null bytes is
> .  \" distasteful, but its necessity is imposed on us.  See
> .  \" <https://gitlab.freedesktop.org/poppler/poppler/-/issues/776>.
> .  ec @
> .  sy pdfinfo @$1 | \
> tr -d '\000' | \
> grep "Page *size" | \
> sed -e 's/Page *size: *\\([[:digit:].]*\\) *x *\\([[:digit:].]*\\).*$/\
> .nr pdfpic*width (p;\\1)\\n\
> .nr pdfpic*height  (p;\\2)/' \
> > @*[pdfpic*temporary-file]
> .  ec
> 
> (Quick *roff background: `ec` means "change (or reset) the *roff escape
> character" and `sy` means "run the C library's `system()` function.  So
> after the comment, the backslashes we see above are "real" and go to "sh
> -c" arguments.)
> 
> If you can try to run that same pipeline on an OpenIndiana system--my
> guess is that _any_ PDF input file will do--and let me know what sort of
> diagnostics and exit status you get, it would help me track this down.

When I run

pdfinfo doc/automake.pdf | tr -d '\000' | grep "Page *size" | sed -e 's/Page 
*size: *\\([[:digit:].]*\\) *x *\\([[:digit:].]*\\).*$/\
.nr pdfpic*width (p;\\1)\\n\
.nr pdfpic*height  (p;\\2)/'

I get the same result, regardless of which of the two 'sed' programs is used,
namely:

Page size:      612 x 792 pts (letter)

However, the doubled backslashes in this 'sed' program don't really make
sense. When I replace them with single backslashes, then I see a difference
between the two 'sed' programs.

pdfinfo doc/automake.pdf | tr -d '\000' | grep "Page *size" | sed -e 's/Page 
*size: *\([[:digit:].]*\) *x *\([[:digit:].]*\).*$/\
.nr pdfpic*width (p;\1)\n\
.nr pdfpic*height  (p;\2)/'

This produces
* with GNU sed:

.nr pdfpic*width (p;612)

.nr pdfpic*height  (p;792)

* with /usr/bin/sed:

.nr pdfpic*width (p;612)n
.nr pdfpic*height  (p;792)

The difference is that instead of producing a blank line, it produced a literal 
'n'.

I would suggest to remove the \\n entirely.

pdfinfo doc/automake.pdf | tr -d '\000' | grep "Page *size" | sed -e 's/Page 
*size: *\([[:digit:].]*\) *x *\([[:digit:].]*\).*$/\
.nr pdfpic*width (p;\1)\
.nr pdfpic*height  (p;\2)/'

With both sed implementations, this produces the output:

.nr pdfpic*width (p;612)
.nr pdfpic*height  (p;792)

Which should be what you need, right?

Bruno






reply via email to

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