Skip to contentSkip to conversation

Supply explicit permission bits to 'install'.

PATCH In review Jeffrey C. Ollie 2 participants 2 messages Jun 15, 2016 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Supply explicit permission bits to 'install'.

'install' will install files with permissions set to '0755' if the permissions are not specified on the command line. Having the execute bits set on non-executable content is not desireable. Specify mode 0644 for non-executable content as well as specify mode 0755 for executable content (in case the defaults change or are different on different systems). Also tell 'install' to preserve timestamps.

---
 Makefile |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Makefile +3 -3
index 57196b0..f9adecb 100644
@@ -38,7 +38,7 @@ doc-html: $(HTMLDOC)
 install: all
 	mkdir -p $(DESTDIR)$(bindir) && \
 	for prog in $(PROGS); do \
-		install $$prog $(DESTDIR)$(bindir); \
+		install -p -m 0755 $$prog $(DESTDIR)$(bindir); \
 	done
 
 install-doc-man: doc-man
@@ -46,8 +46,8 @@ install-doc-man: doc-man
 		 $(DESTDIR)$(mandir)/man5
 	for doc in $(MANDOC); do \
 		case "$$doc" in \
-		*.1) install $$doc $(DESTDIR)$(mandir)/man1 ;; \
-		*.5) install $$doc $(DESTDIR)$(mandir)/man5 ;; \
+		*.1) install -p -m 0644 $$doc $(DESTDIR)$(mandir)/man1 ;; \
+		*.5) install -p -m 0644 $$doc $(DESTDIR)$(mandir)/man5 ;; \
 		esac \
 	done
 
Signature · 1 line
1.5.2.GIT
#1 lore raw

Jeffrey C. Ollie <[email protected]> wrote Thu, May 31, 2007:

Quoted 6 lines

'install' will install files with permissions set to '0755' if the permissions are not specified on the command line. Having the execute bits set on non-executable content is not desireable. Specify mode 0644 for non-executable content as well as specify mode 0755 for executable content (in case the defaults change or are different on different systems). Also tell 'install' to preserve timestamps.

Thank you. I updated the patch to install HTML files with explicit permissions.

Signature · 1 line
Jonas Fonseca