Patchworkβ Makefile: fix permissions mixup on install

login
register
about
Submitter Dan McGee
Date 2009-10-28 00:46:08
Message ID <1256690768-2577-1-git-send-email-dan@archlinux.org>
Download mbox | patch
Permalink /patch/56200/
State New
Headers show

Comments

Dan McGee - 2009-10-28 00:46:08
`install` by default uses 755 permissions; for everything but executables we
want to use 644 permissions.

Signed-off-by: Dan McGee <dan@archlinux.org>
---
 Makefile |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
Christopher Li - 2009-10-28 04:05:18
On Tue, Oct 27, 2009 at 5:46 PM, Dan McGee <dan@archlinux.org> wrote:
> `install` by default uses 755 permissions; for everything but executables we
> want to use 644 permissions.

So far so good.

> -define INSTALL_CMD
> +define INSTALL_PROG

I rename it to INSTALL_EXEC and INSTALL_FILE respectively.

>        $(Q)$(QUIET_INST_SH)install -v $1 $(DESTDIR)$2/$1 || exit 1;
> +endef

Your patch remove a newline which is critical here. It is very subtle when
using it inside a $(foreach ) loop. $(foreach ) blindly concatenate loop both.
'@' only have special meaning after a newline. I get "@echo" command
not found without this new line.

The others look good. I apply a version with the rename and newline
changes in chrisl branch. Let me know that works for you or not.
If you have other feed back of the change, I can still change it.

Thanks

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

Patch

diff --git a/Makefile b/Makefile
index 571673e..f6b0d2c 100644
--- a/Makefile
+++ b/Makefile
@@ -79,9 +79,12 @@  QUIET_LINK    = $(Q:@=@echo    '     LINK     '$@;)
 QUIET_INST_SH = $(Q:@=echo -n  '     INSTALL  ';)
 QUIET_INST    = $(Q:@=@echo -n '     INSTALL  ';)
 
-define INSTALL_CMD
+define INSTALL_PROG
 	$(Q)$(QUIET_INST_SH)install -v $1 $(DESTDIR)$2/$1 || exit 1;
+endef
 
+define INSTALL_OTHER
+	$(Q)$(QUIET_INST_SH)install -v -m 644 $1 $(DESTDIR)$2/$1 || exit 1;
 endef
 
 SED_PC_CMD = 's|@version@|$(VERSION)|g;		\
@@ -103,11 +106,11 @@  install: $(INST_PROGRAMS) $(LIBS) $(LIB_H) sparse.pc
 	$(Q)install -d $(DESTDIR)$(MAN1DIR)
 	$(Q)install -d $(DESTDIR)$(INCLUDEDIR)/sparse
 	$(Q)install -d $(DESTDIR)$(PKGCONFIGDIR)
-	$(foreach f,$(INST_PROGRAMS),$(call INSTALL_CMD,$f,$(BINDIR)))
-	$(foreach f,$(INST_MAN1),$(call INSTALL_CMD,$f,$(MAN1DIR)))
-	$(foreach f,$(LIBS),$(call INSTALL_CMD,$f,$(LIBDIR)))
-	$(foreach f,$(LIB_H),$(call INSTALL_CMD,$f,$(INCLUDEDIR)/sparse))
-	$(call INSTALL_CMD,sparse.pc,$(PKGCONFIGDIR))
+	$(foreach f,$(INST_PROGRAMS),$(call INSTALL_PROG,$f,$(BINDIR)))
+	$(foreach f,$(INST_MAN1),$(call INSTALL_OTHER,$f,$(MAN1DIR)))
+	$(foreach f,$(LIBS),$(call INSTALL_OTHER,$f,$(LIBDIR)))
+	$(foreach f,$(LIB_H),$(call INSTALL_OTHER,$f,$(INCLUDEDIR)/sparse))
+	$(call INSTALL_OTHER,sparse.pc,$(PKGCONFIGDIR))
 
 sparse.pc: sparse.pc.in
 	$(QUIET_GEN)sed $(SED_PC_CMD) sparse.pc.in > sparse.pc