When I build jtreg, I get this error:
/bin/chmod -w ../build/images/jtreg/lib/jtreg.jar
/bin/chmod: ../build/images/jtreg/lib/jtreg.jar: new permissions are r--rw-r--, not r--r--r--
make: *** [../build/images/jtreg/lib/jtreg.jar] Error 1
The problem is that chmod -w does not necessarily flip all the bits. chmod(1) says:
A combination of the letters ugoa controls which users' access to the
file will be changed: the user who owns it (u), other users in the
file's group (g), other users not in the file's group (o), or all users
(a). If none of these are given, the effect is as if a were given, but
bits that are set in the umask are not affected.
so users who have a umask of e.g. 022 will fail.
The fix is obvious (I haven't thought hard about whether a+x is actually desired - I think YES)
diff --git a/make/Rules.gmk b/make/Rules.gmk
--- a/make/Rules.gmk
+++ b/make/Rules.gmk
@@ -71,13 +71,13 @@
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $(@:$(JTREG_IMAGEDOCDIR)/%=$(SRCDOCDIR)/%) $@
- chmod -w $@
+ chmod a-w $@
$(JTREG_IMAGEDOCDIR)/%: $(SRCDOCDIR)/%
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $(@:$(JTREG_IMAGEDOCDIR)/%=$(SRCDOCDIR)/%) $@
- chmod -w $@
+ chmod a-w $@
#---------------------------------------------------------------------
@@ -112,7 +112,7 @@
`sh pkgsToFiles.sh $(CLASSDIR) $($(@F:%.jar=PKGS.JAR.%))` \
$(patsubst $(CLASSDIR)/%,-C $(CLASSDIR) %,$(sort $(FILES.JAR.$(@F:%.jar=%)))) \
$(JAR_EXTRAS)
- $(CHMOD) -w $@
+ $(CHMOD) a-w $@
#----------------------------------------------------------------------
#
diff --git a/make/jtdiff.gmk b/make/jtdiff.gmk
--- a/make/jtdiff.gmk
+++ b/make/jtdiff.gmk
@@ -64,7 +64,7 @@
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
- $(CHMOD) +x,-w $@
+ $(CHMOD) a+x,a-w $@
TARGETS.ZIP.jtreg += \
$(JTREG_IMAGEDIR)/bin/jtdiff
@@ -84,7 +84,7 @@
echo '#' ; \
) > $(BUILDDIR)/jtdiff.warning.sed
$(SED) -f $(BUILDDIR)/jtdiff.warning.sed $< > $@
- $(CHMOD) +x,-w $@
+ $(CHMOD) a+x,a-w $@
TARGETS.ZIP.jtreg += \
$(JTREG_IMAGEDIR)/linux/bin/jtdiff \
diff --git a/make/jtreg.gmk b/make/jtreg.gmk
--- a/make/jtreg.gmk
+++ b/make/jtreg.gmk
@@ -368,7 +368,7 @@
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
- $(CHMOD) +x,-w $@
+ $(CHMOD) a+x,a-w $@
TARGETS.ZIP.jtreg += \
$(JTREG_IMAGEDIR)/bin/jtreg
@@ -388,7 +388,7 @@
echo '#' ; \
) > $(BUILDDIR)/jtreg.warning.sed
$(SED) -f $(BUILDDIR)/jtreg.warning.sed $< > $@
- $(CHMOD) +x,-w $@
+ $(CHMOD) a+x,a-w $@
TARGETS.ZIP.jtreg += \
$(JTREG_IMAGEDIR)/linux/bin/jtreg \
/bin/chmod -w ../build/images/jtreg/lib/jtreg.jar
/bin/chmod: ../build/images/jtreg/lib/jtreg.jar: new permissions are r--rw-r--, not r--r--r--
make: *** [../build/images/jtreg/lib/jtreg.jar] Error 1
The problem is that chmod -w does not necessarily flip all the bits. chmod(1) says:
A combination of the letters ugoa controls which users' access to the
file will be changed: the user who owns it (u), other users in the
file's group (g), other users not in the file's group (o), or all users
(a). If none of these are given, the effect is as if a were given, but
bits that are set in the umask are not affected.
so users who have a umask of e.g. 022 will fail.
The fix is obvious (I haven't thought hard about whether a+x is actually desired - I think YES)
diff --git a/make/Rules.gmk b/make/Rules.gmk
--- a/make/Rules.gmk
+++ b/make/Rules.gmk
@@ -71,13 +71,13 @@
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $(@:$(JTREG_IMAGEDOCDIR)/%=$(SRCDOCDIR)/%) $@
- chmod -w $@
+ chmod a-w $@
$(JTREG_IMAGEDOCDIR)/%: $(SRCDOCDIR)/%
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $(@:$(JTREG_IMAGEDOCDIR)/%=$(SRCDOCDIR)/%) $@
- chmod -w $@
+ chmod a-w $@
#---------------------------------------------------------------------
@@ -112,7 +112,7 @@
`sh pkgsToFiles.sh $(CLASSDIR) $($(@F:%.jar=PKGS.JAR.%))` \
$(patsubst $(CLASSDIR)/%,-C $(CLASSDIR) %,$(sort $(FILES.JAR.$(@F:%.jar=%)))) \
$(JAR_EXTRAS)
- $(CHMOD) -w $@
+ $(CHMOD) a-w $@
#----------------------------------------------------------------------
#
diff --git a/make/jtdiff.gmk b/make/jtdiff.gmk
--- a/make/jtdiff.gmk
+++ b/make/jtdiff.gmk
@@ -64,7 +64,7 @@
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
- $(CHMOD) +x,-w $@
+ $(CHMOD) a+x,a-w $@
TARGETS.ZIP.jtreg += \
$(JTREG_IMAGEDIR)/bin/jtdiff
@@ -84,7 +84,7 @@
echo '#' ; \
) > $(BUILDDIR)/jtdiff.warning.sed
$(SED) -f $(BUILDDIR)/jtdiff.warning.sed $< > $@
- $(CHMOD) +x,-w $@
+ $(CHMOD) a+x,a-w $@
TARGETS.ZIP.jtreg += \
$(JTREG_IMAGEDIR)/linux/bin/jtdiff \
diff --git a/make/jtreg.gmk b/make/jtreg.gmk
--- a/make/jtreg.gmk
+++ b/make/jtreg.gmk
@@ -368,7 +368,7 @@
$(MKDIR) -p $(@D)
$(RM) $@
$(CP) $< $@
- $(CHMOD) +x,-w $@
+ $(CHMOD) a+x,a-w $@
TARGETS.ZIP.jtreg += \
$(JTREG_IMAGEDIR)/bin/jtreg
@@ -388,7 +388,7 @@
echo '#' ; \
) > $(BUILDDIR)/jtreg.warning.sed
$(SED) -f $(BUILDDIR)/jtreg.warning.sed $< > $@
- $(CHMOD) +x,-w $@
+ $(CHMOD) a+x,a-w $@
TARGETS.ZIP.jtreg += \
$(JTREG_IMAGEDIR)/linux/bin/jtreg \