Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Util/helpfiles failing on old-fashioned unix



pda@xxxxxxx <pda@xxxxxxx> wrote:
> This pipeline looks like
> it could have an undetected error where man fails, but colcrt doesn't.

This is right, but I do not know a clean way how to solve this
problem in the lack of PIPESTATUS in posix - using known posix
tricks like piping error status to >&3 also has compatbility issues
(IIRC on cygwin).

A natural way is to start the man/nroff and colcrt/col processes
separately. Unfortunately, I do not know a way in perl to redirect
stdin *and* stdout of a subprocess simultaneously.
Perhaps the only clean way is to use a temporary file first for the
man/nroff output and then for the colcrc/col output.

Anyway, your patch only breaks usage on other systems:
The semantics of your patch is just a changed second open call and
that the error status of the first call to open is negated which
is certainly not intended:

> +unless( undef == open(MANPAGE, '-|', "man $manfile | colcrt -")) {
> +      ( undef == open(MANPAGE, '-|', "nroff -man $manfile | col -bx"))

The second open is executed if (and only if) the first open *succeeeds*.
This is certainly not intended.

Moreover, a clean patch should somehow attempt all 4 possible combinations
of the tools.



Messages sorted by: Reverse Date, Date, Thread, Author