On Wed, Mar 12, 2014 at 3:25 PM, Assaf Gordon <[email protected]> wrote:
> Trying the latest "Gnu Hello" on FreeBSD, "make distcheck" fails:
> ===
> <...>
> <snip... after hello is compiled and linked successfully ...>
> <...>
>
> depbase=`echo src/hello.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; cc
> -DLOCALEDIR=\"/usr/home/gordon/hello/hello-2.9.27-f95ba-dirty/_inst/share/locale\"
> -DHAVE_CONFIG_H -I. -I..  -Ilib -I../lib -Isrc -I../src    -g -O2 -MT
> src/hello.o -MD -MP -MF $depbase.Tpo -c -o src/hello.o ../src/hello.c && mv
> -f $depbase.Tpo $depbase.Po
> cc  -g -O2   -o hello src/hello.o  ./lib/libhello.a
> /bin/sh /usr/home/gordon/hello/hello-2.9.27-f95ba-dirty/build-aux/missing
> help2man --include=../man/hello.x ./hello -o ../hello.1
> help2man: can't unlink ../hello.1 (Permission denied)

Hi Assaf,
Thank you for that report.
I've fixed it with the attached patch.
From 2341649dda6c2217e9c6a4588120645594890faf Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Thu, 13 Mar 2014 09:06:30 -0700
Subject: [PATCH] build: do not fail due to an existing read-only hello.1

* Makefile.am (hello.1): In Makefile rules, never redirect directly
to the target.  Instead, redirect to a temporary, $@-t, and once
that succeeds, rename to target using "mv -f".
Also, since this is a generated file, explicitly make it read-only,
so one is less likely to think it is an editable primary source.
Reported by Assaf Gordon.
---
 Makefile.am | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 14aa203..eb02a4c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -48,7 +48,9 @@ EXTRA_DIST += $(man_MANS)
 CLEANFILES = $(man_MANS)

 hello.1: hello
-       $(HELP2MAN) --include=$(top_srcdir)/man/hello.x $(top_builddir)/hello 
-o $@
+       $(HELP2MAN) --include=$(top_srcdir)/man/hello.x $(top_builddir)/hello 
-o $@-t
+       chmod a=r $@-t
+       mv -f $@-t $@

 TESTS = \
        tests/greeting-1 \
-- 
1.9.0.152.g6ab4ae2

Reply via email to