public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ulf Magnusson <ulfalizer.lkml@gmail.com>
To: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Cc: mmarek@suse.cz, corbet@lwn.net, herbert@gondor.apana.org.au,
	smueller@chronox.de, Ulf Magnusson <ulfalizer@gmail.com>
Subject: [PATCH] DocBook: Avoid stdout junk with no man pages to compress
Date: Sun, 12 Jul 2015 23:59:18 +0200	[thread overview]
Message-ID: <1436738358-19546-1-git-send-email-ulfalizer@gmail.com> (raw)

gzip would run as 'gzip -f' when no uncompressed man pages were found,
making it compress the (empty) stdin to stdout.

A few alternative solutions:

  - 'find' with {} + might be speedier, but maybe that's not portable
    enough (though it's in POSIX 2001 at least AFAICS)

  - xargs --no-run-if-empty, but that's a GNU extension

  - Always discarding stdout, if it's unlikely to ever be helpful

  - More fancy stuff like the following, though maybe some of them could
    run into shell limits too, re. d56fcf299fb4 (DocBook: Do not exceed
    argument list limit)

    * A plain shell 'for' loop

    * mandocs: $(MAN)
      	if [ `find $(obj)/man -name '*.9' | wc -l` -gt 0 ]; then \
      		find $(obj)/man -name '*.9' | xargs gzip -f; \
      	fi

    * mandocs: $(MAN)
      	man_pages=`find $(obj)/man -name '*.9'`; \
      	if [ -n "$$man_pages" ]; then \
      		echo "$$man_pages" | xargs gzip -f; \
      	fi

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
---
 Documentation/DocBook/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
index b6a6a2e..73bddf7 100644
--- a/Documentation/DocBook/Makefile
+++ b/Documentation/DocBook/Makefile
@@ -56,7 +56,7 @@ htmldocs: $(HTML)
 
 MAN := $(patsubst %.xml, %.9, $(BOOKS))
 mandocs: $(MAN)
-	find $(obj)/man -name '*.9' | xargs gzip -f
+	find $(obj)/man -name '*.9' -exec gzip -f {} \;
 
 installmandocs: mandocs
 	mkdir -p /usr/local/man/man9/
-- 
2.1.4


             reply	other threads:[~2015-07-12 21:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-12 21:59 Ulf Magnusson [this message]
2015-07-12 23:36 ` [PATCH] DocBook: Avoid stdout junk with no man pages to compress Jim Davis
2015-07-13  0:46   ` Ulf Magnusson
2015-07-14  4:27     ` Ulf Magnusson
2015-07-14  4:35       ` Ulf Magnusson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1436738358-19546-1-git-send-email-ulfalizer@gmail.com \
    --to=ulfalizer.lkml@gmail.com \
    --cc=corbet@lwn.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.cz \
    --cc=smueller@chronox.de \
    --cc=ulfalizer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox