lkml.org 
[lkml]   [2015]   [Jul]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] DocBook: Avoid stdout junk with no man pages to compress
Date
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


\
 
 \ /
  Last update: 2015-07-13 00:21    [W:0.056 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site