All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Colomar <alx.manpages@gmail.com>
To: mtk.manpages@gmail.com
Cc: Alejandro Colomar <alx.manpages@gmail.com>, linux-man@vger.kernel.org
Subject: [PATCH] Makefile: Simplify error handling
Date: Sun,  9 May 2021 23:39:31 +0200	[thread overview]
Message-ID: <20210509213930.94120-37-alx.manpages@gmail.com> (raw)
In-Reply-To: <20210509213930.94120-1-alx.manpages@gmail.com>

Instead of having to write '|| exit $$?' all the time,
use the shell's '-Eeuo pipefail' options, which handle
errors even better.  However, pipefail needs bash,
so POSIX sh (default) is not valid.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
---

Hi Michael,

I'm not sure how much POSIX sh compatibility is needed for the man pages
Makefile.  There are probably projects out there that don't have bash,
and still want to use it.  So maybe we should't apply this.  I don't know.
Up to you.

Thanks,

Alex


 Makefile | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/Makefile b/Makefile
index fdfaf9645..4df4f5846 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,5 @@
 #!/usr/bin/make -f
+SHELL = /bin/bash -Eeuo pipefail
 
 # Do not print "Entering directory ..."
 MAKEFLAGS += --no-print-directory
@@ -33,15 +34,14 @@ html: | builddirs-html
 	|while read f; do \
 		man2html $(HTOPTS) "$$f" \
 		|sed -e '1,2d' \
-		>"$(htmlbuilddir)/$${f}$(htmlext)" \
-			|| exit $$?; \
+		>"$(htmlbuilddir)/$${f}$(htmlext)"; \
 	done;
 
 .PHONY: builddirs-html
 builddirs-html:
 	find man?/ -type d \
 	|while read d; do \
-		$(INSTALL_DIR) "$(htmlbuilddir)/$$d" || exit $$?; \
+		$(INSTALL_DIR) "$(htmlbuilddir)/$$d"; \
 	done;
 
 .PHONY: install-html
@@ -49,57 +49,57 @@ install-html: | installdirs-html
 	cd $(htmlbuilddir) && \
 	find man?/ -type f \
 	|while read f; do \
-		$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(htmldir_)/$$f" || exit $$?; \
+		$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(htmldir_)/$$f"; \
 	done;
 
 .PHONY: installdirs-html
 installdirs-html:
 	find man?/ -type d \
 	|while read d; do \
-		$(INSTALL_DIR) "$(DESTDIR)$(htmldir_)/$$d" || exit $$?; \
+		$(INSTALL_DIR) "$(DESTDIR)$(htmldir_)/$$d"; \
 	done;
 
 .PHONY: install
 install: | installdirs
 	find man?/ -type f \
 	|while read f; do \
-		$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(mandir)/$$f" || exit $$?; \
+		$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(mandir)/$$f"; \
 	done;
 
 .PHONY: installdirs
 installdirs:
 	find man?/ -type d \
 	|while read d; do \
-		$(INSTALL_DIR) "$(DESTDIR)$(mandir)/$$d" || exit $$?; \
+		$(INSTALL_DIR) "$(DESTDIR)$(mandir)/$$d"; \
 	done;
 
 .PHONY: uninstall remove
 uninstall remove:
 	find man?/ -type f \
 	|while read f; do \
-		rm -f "$(DESTDIR)$(mandir)/$$f" || exit $$?; \
-		rm -f "$(DESTDIR)$(mandir)/$$f".* || exit $$?; \
+		rm -f "$(DESTDIR)$(mandir)/$$f"; \
+		rm -f "$(DESTDIR)$(mandir)/$$f".*; \
 	done;
 
 .PHONY: uninstall-html
 uninstall-html:
 	find man?/ -type f \
 	|while read f; do \
-		rm -f "$(DESTDIR)$(htmldir_)/$$f".* || exit $$?; \
+		rm -f "$(DESTDIR)$(htmldir_)/$$f".*; \
 	done;
 
 .PHONY: clean
 clean:
 	find man?/ -type f \
 	|while read f; do \
-		rm -f "$(htmlbuilddir)/$$f".* || exit $$?; \
+		rm -f "$(htmlbuilddir)/$$f".*; \
 	done;
 
 # Check if groff reports warnings (may be words of sentences not displayed)
 # from https://lintian.debian.org/tags/groff-message.html
 .PHONY: check-groff-warnings
 check-groff-warnings:
-	GROFF_LOG="$$(mktemp --tmpdir manpages-checksXXXX)" || exit $$?; \
+	GROFF_LOG="$$(mktemp --tmpdir manpages-checksXXXX)"; \
 	for i in man?/*.[1-9]; \
 	do \
 		if grep -q 'SH.*NAME' "$$i"; then \
-- 
2.31.1


  parent reply	other threads:[~2021-05-09 21:44 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-09 21:38 [PATCH] fflush.3: SEE ALSO: Add fpurge(3) Alejandro Colomar
2021-05-09 21:38 ` [PATCH] scripts/bash_aliases, scripts/modified_pages.sh: Move scripts/modified_pages.sh to a function man_gitstaged() Alejandro Colomar
2021-05-09 23:27   ` Michael Kerrisk (man-pages)
2021-05-09 21:38 ` [PATCH] scripts/bash_aliases: man_gitstaged(): Script around a porcelain git command Alejandro Colomar
2021-05-09 23:31   ` Michael Kerrisk (man-pages)
2021-05-09 21:38 ` [PATCH] basename.3: SYNOPSIS: Add missing 'const' Alejandro Colomar
2021-05-09 23:59   ` Michael Kerrisk (man-pages)
2021-05-11  7:34     ` Alejandro Colomar (man-pages)
2021-05-09 21:38 ` [PATCH] dladdr.3: " Alejandro Colomar
2021-05-09 23:20   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] open.2: Fix bug in linkat(2) call example Alejandro Colomar
2021-05-10  0:50   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] malloc_usable_size.3: ffix Alejandro Colomar
2021-05-09 23:10   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] getutmp.3: ffix Alejandro Colomar
2021-05-09 23:10   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] on_exit.3: ffix Alejandro Colomar
2021-05-09 23:11   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] perror.3: ffix Alejandro Colomar
2021-05-09 23:12   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] copy_file_range.2: Update cross-filesystem support for 5.12 Alejandro Colomar
2021-05-10  0:01   ` Michael Kerrisk (man-pages)
2021-05-10  4:26     ` Amir Goldstein
2021-05-10 16:34       ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] sched_get_priority_max.2, open_memstream.3: tfix Alejandro Colomar
2021-05-09 23:19   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] __ppc_get_timebase.3: ffix Alejandro Colomar
2021-05-09 23:14   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] scripts/bash_aliases: Make man_lsfunc() more robust; Add sed_rm_ccomments() Alejandro Colomar
2021-05-09 23:32   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] scripts/bash_aliases: Add man_lsvar(), similar to man_lsfunc() but lists variables Alejandro Colomar
2021-05-09 23:32   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] pthread_attr_setinheritsched.3: SYNOPSIS: Use 'restrict' in prototypes Alejandro Colomar
2021-05-09 23:53   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] pthread_attr_setschedparam.3: " Alejandro Colomar
2021-05-09 23:53   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] strsignal.3: ffix Alejandro Colomar
2021-05-09 23:14   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] strsignal.3: SYNOPSIS: Add missing 'const' Alejandro Colomar
2021-05-09 23:16   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] rpc.3: SYNOPSIS: Fix prototypes (misc.) Alejandro Colomar
2021-05-09 23:50   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] pthread_getattr_default_np.3: SYNOPSIS: Add missing 'const' Alejandro Colomar
2021-05-09 23:19   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] pthread_mutexattr_setrobust.3: SYNOPSIS: Remove incorrect 'const' Alejandro Colomar
2021-05-09 23:18   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] tzset.3: ffix Alejandro Colomar
2021-05-09 23:16   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] xdr.3: SYNOPSIS: Fix prototype types Alejandro Colomar
2021-05-09 23:51   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] scripts/bash_aliases: man_section(): Accept multiple sections Alejandro Colomar
2021-05-09 23:33   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] scripts/bash_aliases: Fix error messages Alejandro Colomar
2021-05-09 23:33   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] epoll_wait.2: Move subsection to NOTES from BUGS Alejandro Colomar
2021-05-09 23:52   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] bswap.3: bswap_*() are implemented using functions Alejandro Colomar
2021-05-09 23:55   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] cpow.3: Use 'complex' after the type consistently Alejandro Colomar
2021-05-09 23:49   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] clone.2: tfix Alejandro Colomar
2021-05-09 23:17   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] scripts/bash_aliases: srcfix Alejandro Colomar
2021-05-09 23:34   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] Makefile: Fix bug when running in parallel Alejandro Colomar
2021-05-09 23:39   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] .gitignore: Add file Alejandro Colomar
2021-05-10  1:02   ` Michael Kerrisk (man-pages)
2021-05-10  7:15     ` Alejandro Colomar (man-pages)
2021-05-10 16:28       ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` [PATCH] system_data_types.7: tfix Alejandro Colomar
2021-05-09 23:46   ` Michael Kerrisk (man-pages)
2021-05-09 21:39 ` Alejandro Colomar [this message]
2021-05-09 23:45   ` [PATCH] Makefile: Simplify error handling Michael Kerrisk (man-pages)
2021-05-10  6:53     ` Alejandro Colomar (man-pages)
2021-05-10  1:03 ` [PATCH] fflush.3: SEE ALSO: Add fpurge(3) Michael Kerrisk (man-pages)
     [not found] ` <20210509213930.94120-33-alx.manpages@gmail.com>
     [not found]   ` <9f4a8c0c-ced3-4192-05a0-d126afda3285@gmail.com>
2021-05-10  7:13     ` [PATCH] Makefile: Use standard features (IMPORTANT: default prefix changed) Alejandro Colomar (man-pages)
2021-05-10 16:33       ` Michael Kerrisk (man-pages)
2021-05-10 16:41         ` Alejandro Colomar (man-pages)

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=20210509213930.94120-37-alx.manpages@gmail.com \
    --to=alx.manpages@gmail.com \
    --cc=linux-man@vger.kernel.org \
    --cc=mtk.manpages@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 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.