changeset in /hg/icedtea6: 2008-07-15 Joshua Sumali <jsumali at r...

Joshua Sumali jsumali at redhat.com
Tue Jul 15 07:26:53 PDT 2008


changeset 3cbb75db29a0 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=3cbb75db29a0
description:
	2008-07-15  Joshua Sumali  <jsumali at redhat.com>

		* Makefile.am: Add icedtea-webstart-umask.patch.
		* patches/icedtea-webstart-umask.patch: Set default umask to 077 for
		javaws and pluginappletviewer, and also	provide the -umask argument to
		manually override this setting.
		* rt/net/sourceforge/jnlp/resources/Messages.properties: Update usage.
		* rt/net/sourceforge/jnlp/runtime/Boot.java: Likewise.

diffstat:

5 files changed, 176 insertions(+)
ChangeLog                                             |    9 
Makefile.am                                           |    1 
patches/icedtea-webstart-umask.patch                  |  164 +++++++++++++++++
rt/net/sourceforge/jnlp/resources/Messages.properties |    1 
rt/net/sourceforge/jnlp/runtime/Boot.java             |    1 

diffs (217 lines):

diff -r c079555ca9e6 -r 3cbb75db29a0 ChangeLog
--- a/ChangeLog	Mon Jul 14 16:26:08 2008 -0400
+++ b/ChangeLog	Tue Jul 15 10:26:42 2008 -0400
@@ -1,3 +1,12 @@ 2008-07-14  Joshua Sumali  <jsumali at redh
+2008-07-15  Joshua Sumali  <jsumali at redhat.com>
+
+	* Makefile.am: Add icedtea-webstart-umask.patch.
+	* patches/icedtea-webstart-umask.patch: Set default umask to 077 for
+	javaws and pluginappletviewer, and also	provide the -umask argument to
+	manually override this setting.
+	* rt/net/sourceforge/jnlp/resources/Messages.properties: Update usage.
+	* rt/net/sourceforge/jnlp/runtime/Boot.java: Likewise.
+
 2008-07-14  Joshua Sumali  <jsumali at redhat.com>
 
 	* Makefile.am (stamps/cacao.stamp): Only install if WITH_CACAO is used.
diff -r c079555ca9e6 -r 3cbb75db29a0 Makefile.am
--- a/Makefile.am	Mon Jul 14 16:26:08 2008 -0400
+++ b/Makefile.am	Tue Jul 15 10:26:42 2008 -0400
@@ -377,6 +377,7 @@ ICEDTEA_PATCHES = \
 	patches/icedtea-ssl.patch \
 	$(PLUGIN_PATCH) \
 	patches/icedtea-webstart.patch \
+	patches/icedtea-webstart-umask.patch \
 	patches/icedtea-rmi_amd64.patch \
 	patches/icedtea-tools.patch \
 	patches/icedtea-demos.patch \
diff -r c079555ca9e6 -r 3cbb75db29a0 patches/icedtea-webstart-umask.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/icedtea-webstart-umask.patch	Tue Jul 15 10:26:42 2008 -0400
@@ -0,0 +1,164 @@
+--- openjdk/jdk/make/launchers/Makefile.launcher.orig	2008-07-09 12:49:00.000000000 -0400
++++ openjdk/jdk/make/launchers/Makefile.launcher	2008-07-09 12:49:40.000000000 -0400
+@@ -148,6 +148,16 @@
+   endif
+ endif
+ 
++# pluginappletviewer only
++ifeq ($(PROGRAM), pluginappletviewer)
++  OTHER_CPPFLAGS += -DUSE_UMASK=\"077\"
++endif
++
++# javaws only
++ifeq ($(PROGRAM), javaws)
++  OTHER_CPPFLAGS += -DUSE_UMASK=\"077\"
++endif
++
+ # GUI tools
+ ifeq ($(GUI_TOOL),true)
+   ifneq ($(PLATFORM), windows)
+--- openjdk/jdk/src/share/bin/java.c.orig	2008-07-09 12:48:35.000000000 -0400
++++ openjdk/jdk/src/share/bin/java.c	2008-07-09 12:36:11.000000000 -0400
+@@ -56,6 +56,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <sys/stat.h>
+ 
+ #include <jni.h>
+ #include <jvm.h>
+@@ -69,6 +70,8 @@
+ #define FULL_VERSION JDK_MAJOR_VERSION "." JDK_MINOR_VERSION
+ #endif
+ 
++#define MAXMASK 4095 /* Same as octal 07777 */
++
+ /*
+  * The following environment variable is used to influence the behavior
+  * of the jre exec'd through the SelectVersion routine.  The command line
+@@ -184,6 +187,10 @@
+ 
+ int JNICALL JavaMain(void * args); /* entry point                  */
+ 
++/* umask things */
++static int FindUMask(int *, char ***, int *);
++static int VerifyMask(char *, int*);
++
+ struct JavaMainArgs {
+   int     argc;
+   char ** argv;
+@@ -307,6 +314,26 @@
+     SetClassPath(s);
+ #endif
+ 
++#ifdef USE_UMASK
++	/* Set umask */
++	int mask;
++    // Check to see if we can find a umask on the command line.
++    if (FindUMask(&argc, &argv, &mask) < 0)
++    {
++        // We didn't find a umask, so fall back to the default one.
++        char * defaultMask = (char *) JLI_MemAlloc(5 * sizeof(char));
++        strcpy(defaultMask, USE_UMASK);
++        int converted;
++        VerifyMask(defaultMask, &converted);
++        JLI_MemFree(defaultMask);
++		umask(converted); /* from sys/stat.h */
++    }
++    else
++    {
++		umask(mask);
++    }
++#endif
++
+     /*
+      *  Parse command line options; if the return value of
+      *  ParseArguments is false, the program should exit.
+@@ -2011,3 +2038,87 @@
+     }
+     DoSplashSetFileJarName(file_name, jar_name);
+ }
++
++/**
++ * Searches argv to find any parameters that start with "-umask=".
++ * Sets maskToSet with the mask if a -umask is found, and if the mask
++ * supplied is valid. Returns 1 if a valid mask was found and set,
++ * -1 otherwise.
++ */
++int FindUMask(int *pargc, char *** pargv, int *maskToSet)
++{
++    int found_mask = -1;
++
++    // our handles to the original list
++    int argc = *pargc;
++    char **argv = *pargv;
++
++    // the new set
++    int nargc = argc;
++    char ** nargv = (char **) JLI_MemAlloc((nargc + 1) * sizeof(char *));
++
++    // set the original set to the new set
++    *pargv = nargv;
++    *pargc = nargc;
++
++    char *maskString = (char *) JLI_MemAlloc(6 * sizeof(char *));
++	int i;
++    for (i = 0; i < argc; i++)
++    {
++        char *arg = argv[i];
++        if (strncmp(arg, "-umask=",7) == 0)
++        {
++            strncpy(maskString, arg+7, 5);
++
++            if (VerifyMask(maskString, maskToSet) < 0)
++            {
++                printf("Invalid umask %s, application stopped.\n", maskString);
++                exit(1);
++            }
++
++            found_mask = 1;
++            nargc--;
++            (*pargc)--;
++        }
++        else
++        {
++            *nargv++ = arg;
++        }
++    }
++
++    JLI_MemFree(maskString);
++
++    return found_mask;
++}
++
++/**
++ * Takes an octal mask in string form, and converts it to
++ * decimal form in convertedMask. The decimal form can then be
++ * easily passed to umask(). Returns 1 if the mask is valid, -1 otherwise.
++ */
++int VerifyMask(char * maskString, int * convertedMask)
++{
++    // Borrowed from coreutils modechange.c
++    if ('0' <= *maskString && *maskString < '8')
++    {
++        unsigned int decimal_mode = 0;
++
++        do {
++            decimal_mode = 8 * decimal_mode + *maskString++ - '0';
++        } while ('0' <= *maskString && *maskString < '8');
++
++        if (decimal_mode > MAXMASK)
++            return -1;
++        else if (*maskString)
++            return -1;
++        else
++            *convertedMask = decimal_mode;
++
++        return 1;
++    }
++    else
++    {
++        return -1;
++    }
++
++}
diff -r c079555ca9e6 -r 3cbb75db29a0 rt/net/sourceforge/jnlp/resources/Messages.properties
--- a/rt/net/sourceforge/jnlp/resources/Messages.properties	Mon Jul 14 16:26:08 2008 -0400
+++ b/rt/net/sourceforge/jnlp/resources/Messages.properties	Tue Jul 15 10:26:42 2008 -0400
@@ -123,6 +123,7 @@ BOHeadless  = Disables download window, 
 BOHeadless  = Disables download window, other UIs.
 BOStrict    = Enables strict checking of JNLP file format.
 BOViewer    = Shows the trusted certificate viewer.
+BOUmask     = Sets the umask for files created by an application.
 BOHelp      = Print this message and exit.
 
 # Cache
diff -r c079555ca9e6 -r 3cbb75db29a0 rt/net/sourceforge/jnlp/runtime/Boot.java
--- a/rt/net/sourceforge/jnlp/runtime/Boot.java	Mon Jul 14 16:26:08 2008 -0400
+++ b/rt/net/sourceforge/jnlp/runtime/Boot.java	Tue Jul 15 10:26:42 2008 -0400
@@ -100,6 +100,7 @@ public final class Boot implements Privi
         + "  -noupdate             "+R("BONoupdate")+"\n"
         + "  -headless             "+R("BOHeadless")+"\n"
         + "  -strict               "+R("BOStrict")+"\n"
+        + "  -umask=value          "+R("BOUmask")+"\n"
         + "  -help                 "+R("BOHelp")+"\n";
 
     private static final String doubleArgs = "-basedir -jnlp -arg -param -property -update";



More information about the distro-pkg-dev mailing list