All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Makefile: fix temporary file handling and improve check-groff-warnings
@ 2016-04-13 23:04 Alexander Miller
       [not found] ` <20160414010434.1a7bdcfc.alex.miller-Mmb7MZpHnFY@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Alexander Miller @ 2016-04-13 23:04 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

Hello Michael,

a while ago I noticed that every time make is run a new empty file
would be created in /tmp. This has been annoying me since, so I
decided to have a look.

The first patch fixes this problem; the file is crated only for
"make check-groff-warnings" where it is needed.
While at it, I improved various bits for that target (in patch 2).
Finally, the last 2 patches are purely cosmetic trivial changes.

I also noticed that check-groff-warnings works only with man-db.
I happened to test it on a box with plain man and got a usage
error for every man page. I haven't included a patch to silence
these errors, since the old man has no equivalent for the --warnings
option, and so I think it doesn't make sense to support it, you'd
get the default warnings only. But if you like, I can provide a
patch.

Regards,
Alex

---
Alexander Miller (4):
  Makefile: Don't leave $(GROFF_LOG) files behind
  Makefile: Improve recipe for "check-groff-warnings" target
  Makefile: wsfix (trailing space)
  Makefile: Remove line continuation at end of "install" recipe

 Makefile | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/4] Makefile: Don't leave $(GROFF_LOG) files behind
       [not found] ` <20160414010434.1a7bdcfc.alex.miller-Mmb7MZpHnFY@public.gmane.org>
@ 2016-04-13 23:13   ` Alexander Miller
       [not found]     ` <20160414011304.289a6494.alex.miller-Mmb7MZpHnFY@public.gmane.org>
  2016-04-13 23:16   ` [PATCH 2/4] Makefile: Improve recipe for "check-groff-warnings" target Alexander Miller
                     ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Alexander Miller @ 2016-04-13 23:13 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

Convert "GROFF_LOG" into a shell variable local to the
recipe for "check-groff-warnings" target such that the
temporary file is only created when needed.

Signed-off-by: Alexander Miller <alex.miller-Mmb7MZpHnFY@public.gmane.org>
---
 Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 237310d..1003843 100644
--- a/Makefile
+++ b/Makefile
@@ -63,14 +63,14 @@ install:
 
 # Check if groff reports warnings (may be words of sentences not displayed)
 # from http://lintian.debian.org/tags/manpage-has-errors-from-man.html 
-GROFF_LOG := $(shell mktemp /tmp/manpages-checksXXXX)
 check-groff-warnings:
+	GROFF_LOG=$$(mktemp /tmp/manpages-checksXXXX); \
 	for i in man?/*.[1-9]; \
 	do \
 		if grep -q 'SH.*NAME' $$i; then \
-			LC_ALL=en_US.UTF-8 MANWIDTH=80 man --warnings -E UTF-8 -l $$i > /dev/null 2>$(GROFF_LOG); \
-			[ -s $(GROFF_LOG) ] && ( echo "$$i: " ; cat $(GROFF_LOG) ; echo "" ); \
-			rm $(GROFF_LOG) 2>/dev/null; \
+			LC_ALL=en_US.UTF-8 MANWIDTH=80 man --warnings -E UTF-8 -l $$i > /dev/null 2>$$GROFF_LOG; \
+			[ -s $$GROFF_LOG ] && ( echo "$$i: " ; cat $$GROFF_LOG ; echo "" ); \
+			rm $$GROFF_LOG 2>/dev/null; \
 		fi \
 	done
 
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/4] Makefile: Improve recipe for "check-groff-warnings" target
       [not found] ` <20160414010434.1a7bdcfc.alex.miller-Mmb7MZpHnFY@public.gmane.org>
  2016-04-13 23:13   ` [PATCH 1/4] Makefile: Don't leave $(GROFF_LOG) files behind Alexander Miller
@ 2016-04-13 23:16   ` Alexander Miller
  2016-04-13 23:17   ` [PATCH 3/4] Makefile: wsfix (trailing space) Alexander Miller
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Alexander Miller @ 2016-04-13 23:16 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

* Fix race condition (don't remove and re-create $GROFF_LOG repeatedly),
* check for failure to create $GROFF_LOG,
* use $TMPDIR if set instead of hardcoded "/tmp",
* quote variables,
* use clobbering redirection (just in case),
* don't create unnecessary subshells,
* add a semicolon for consistency.

Signed-off-by: Alexander Miller <alex.miller-Mmb7MZpHnFY@public.gmane.org>
---
Note: I didn't remove the trailing space from 'echo "$$i: "' since
some scripts out there may rely on the output format.
---
 Makefile | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 1003843..6531641 100644
--- a/Makefile
+++ b/Makefile
@@ -64,15 +64,15 @@ install:
 # Check if groff reports warnings (may be words of sentences not displayed)
 # from http://lintian.debian.org/tags/manpage-has-errors-from-man.html 
 check-groff-warnings:
-	GROFF_LOG=$$(mktemp /tmp/manpages-checksXXXX); \
+	GROFF_LOG="$$(mktemp --tmpdir manpages-checksXXXX)" || exit $$?; \
 	for i in man?/*.[1-9]; \
 	do \
-		if grep -q 'SH.*NAME' $$i; then \
-			LC_ALL=en_US.UTF-8 MANWIDTH=80 man --warnings -E UTF-8 -l $$i > /dev/null 2>$$GROFF_LOG; \
-			[ -s $$GROFF_LOG ] && ( echo "$$i: " ; cat $$GROFF_LOG ; echo "" ); \
-			rm $$GROFF_LOG 2>/dev/null; \
-		fi \
-	done
+		if grep -q 'SH.*NAME' "$$i"; then \
+			LC_ALL=en_US.UTF-8 MANWIDTH=80 man --warnings -E UTF-8 -l "$$i" > /dev/null 2>| "$$GROFF_LOG"; \
+			[ -s "$$GROFF_LOG" ] && { echo "$$i: "; cat "$$GROFF_LOG"; echo; }; \
+		fi; \
+	done; \
+	rm -f "$$GROFF_LOG"
 
 # someone might also want to look at /var/catman/cat2 or so ...
 # a problem is that the location of cat pages varies a lot
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/4] Makefile: wsfix (trailing space)
       [not found] ` <20160414010434.1a7bdcfc.alex.miller-Mmb7MZpHnFY@public.gmane.org>
  2016-04-13 23:13   ` [PATCH 1/4] Makefile: Don't leave $(GROFF_LOG) files behind Alexander Miller
  2016-04-13 23:16   ` [PATCH 2/4] Makefile: Improve recipe for "check-groff-warnings" target Alexander Miller
@ 2016-04-13 23:17   ` Alexander Miller
  2016-04-13 23:18   ` [PATCH 4/4] Makefile: Remove line continuation at end of "install" recipe Alexander Miller
  2016-04-18 12:51   ` [PATCH 0/4] Makefile: fix temporary file handling and improve check-groff-warnings Michael Kerrisk (man-pages)
  4 siblings, 0 replies; 7+ messages in thread
From: Alexander Miller @ 2016-04-13 23:17 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

Signed-off-by: Alexander Miller <alex.miller-Mmb7MZpHnFY@public.gmane.org>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 6531641..1b64974 100644
--- a/Makefile
+++ b/Makefile
@@ -62,7 +62,7 @@ install:
 	done; \
 
 # Check if groff reports warnings (may be words of sentences not displayed)
-# from http://lintian.debian.org/tags/manpage-has-errors-from-man.html 
+# from http://lintian.debian.org/tags/manpage-has-errors-from-man.html
 check-groff-warnings:
 	GROFF_LOG=$$(mktemp --tmpdir manpages-checksXXXX) || exit $$?; \
 	for i in man?/*.[1-9]; \
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/4] Makefile: Remove line continuation at end of "install" recipe
       [not found] ` <20160414010434.1a7bdcfc.alex.miller-Mmb7MZpHnFY@public.gmane.org>
                     ` (2 preceding siblings ...)
  2016-04-13 23:17   ` [PATCH 3/4] Makefile: wsfix (trailing space) Alexander Miller
@ 2016-04-13 23:18   ` Alexander Miller
  2016-04-18 12:51   ` [PATCH 0/4] Makefile: fix temporary file handling and improve check-groff-warnings Michael Kerrisk (man-pages)
  4 siblings, 0 replies; 7+ messages in thread
From: Alexander Miller @ 2016-04-13 23:18 UTC (permalink / raw)
  To: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w; +Cc: linux-man-u79uwXL29TY76Z2rM5mHXA

Signed-off-by: Alexander Miller <alex.miller-Mmb7MZpHnFY@public.gmane.org>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 1b64974..61a1164 100644
--- a/Makefile
+++ b/Makefile
@@ -59,7 +59,7 @@ install:
 	for i in man?; do \
 		install -d -m 755 $(DESTDIR)$(MANDIR)/"$$i" || exit $$?; \
 		install -m 644 "$$i"/* $(DESTDIR)$(MANDIR)/"$$i" || exit $$?; \
-	done; \
+	done
 
 # Check if groff reports warnings (may be words of sentences not displayed)
 # from http://lintian.debian.org/tags/manpage-has-errors-from-man.html
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/4] Makefile: Don't leave $(GROFF_LOG) files behind
       [not found]     ` <20160414011304.289a6494.alex.miller-Mmb7MZpHnFY@public.gmane.org>
@ 2016-04-13 23:28       ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2016-04-13 23:28 UTC (permalink / raw)
  To: Alexander Miller
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, linux-man-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 287 bytes --]

On 14 Apr 2016 01:13, Alexander Miller wrote:
> Convert "GROFF_LOG" into a shell variable local to the
> recipe for "check-groff-warnings" target such that the
> temporary file is only created when needed.

Acked-by: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/4] Makefile: fix temporary file handling and improve check-groff-warnings
       [not found] ` <20160414010434.1a7bdcfc.alex.miller-Mmb7MZpHnFY@public.gmane.org>
                     ` (3 preceding siblings ...)
  2016-04-13 23:18   ` [PATCH 4/4] Makefile: Remove line continuation at end of "install" recipe Alexander Miller
@ 2016-04-18 12:51   ` Michael Kerrisk (man-pages)
  4 siblings, 0 replies; 7+ messages in thread
From: Michael Kerrisk (man-pages) @ 2016-04-18 12:51 UTC (permalink / raw)
  To: Alexander Miller
  Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w, linux-man-u79uwXL29TY76Z2rM5mHXA

Hello Alex,

On 04/14/2016 12:04 AM, Alexander Miller wrote:
> Hello Michael,
> 
> a while ago I noticed that every time make is run a new empty file
> would be created in /tmp. This has been annoying me since, so I
> decided to have a look.
> 
> The first patch fixes this problem; the file is crated only for
> "make check-groff-warnings" where it is needed.
> While at it, I improved various bits for that target (in patch 2).
> Finally, the last 2 patches are purely cosmetic trivial changes.

I've applied all 4 patches. Thanks!

> I also noticed that check-groff-warnings works only with man-db.
> I happened to test it on a box with plain man and got a usage
> error for every man page. I haven't included a patch to silence
> these errors, since the old man has no equivalent for the --warnings
> option, and so I think it doesn't make sense to support it, you'd
> get the default warnings only. But if you like, I can provide a
> patch.

Best not to worry about it, I'd say.

Cheers,

Michael

> ---
> Alexander Miller (4):
>   Makefile: Don't leave $(GROFF_LOG) files behind
>   Makefile: Improve recipe for "check-groff-warnings" target
>   Makefile: wsfix (trailing space)
>   Makefile: Remove line continuation at end of "install" recipe
> 
>  Makefile | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-04-18 12:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-13 23:04 [PATCH 0/4] Makefile: fix temporary file handling and improve check-groff-warnings Alexander Miller
     [not found] ` <20160414010434.1a7bdcfc.alex.miller-Mmb7MZpHnFY@public.gmane.org>
2016-04-13 23:13   ` [PATCH 1/4] Makefile: Don't leave $(GROFF_LOG) files behind Alexander Miller
     [not found]     ` <20160414011304.289a6494.alex.miller-Mmb7MZpHnFY@public.gmane.org>
2016-04-13 23:28       ` Mike Frysinger
2016-04-13 23:16   ` [PATCH 2/4] Makefile: Improve recipe for "check-groff-warnings" target Alexander Miller
2016-04-13 23:17   ` [PATCH 3/4] Makefile: wsfix (trailing space) Alexander Miller
2016-04-13 23:18   ` [PATCH 4/4] Makefile: Remove line continuation at end of "install" recipe Alexander Miller
2016-04-18 12:51   ` [PATCH 0/4] Makefile: fix temporary file handling and improve check-groff-warnings Michael Kerrisk (man-pages)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.