[Git][java-team/jython][upstream] New upstream version 2.7.2~rc1+repack1

Gilles Filippini gitlab at salsa.debian.org
Mon Mar 9 21:38:22 GMT 2020



Gilles Filippini pushed to branch upstream at Debian Java Maintainers / jython


Commits:
70b68ad5 by Gilles Filippini at 2020-03-08T10:10:53+01:00
New upstream version 2.7.2~rc1+repack1
- - - - -


16 changed files:

- .gitignore
- .hgignore
- .hgtags
- Lib/test/test_httpservers.py
- Lib/test/test_import.py
- NEWS
- build.gradle
- build.xml
- installer/src/java/org/python/util/install/JarInstaller.java
- registry
- src/org/python/core/PyStringMap.java
- src/org/python/core/PySystemState.java
- src/org/python/core/imp.java
- src/org/python/core/packagecache/CachedJarsPackageManager.java
- src/org/python/expose/generate/ExposeTask.java
- src/org/python/modules/posix/PythonPOSIXHandler.java


Changes:

=====================================
.gitignore
=====================================
@@ -33,13 +33,18 @@ nbbuild.xml
 .DS_Store
 .settings
 __pycache__
-ant.properties
 bin
 
+# Jython specific
+ant.properties
 build
 build2
 cachedir
+.jython_cache
 dist
-target
+publications
+reports
+jffi*.dll
 
 profile.txt
+out


=====================================
.hgignore
=====================================
@@ -35,9 +35,11 @@ ant.properties
 build
 build2
 cachedir
+.jython_cache
 dist
 publications
 reports
+jffi*.dll
 
 profile.txt
 out


=====================================
.hgtags
=====================================
@@ -112,3 +112,4 @@ dd7e191d4c90d9f5d5fe8f0840f186697ecf272a v2.7.1
 dfc49bafbe79566bd54c8d417829e001ff2316ea v2.7.2a1
 328e162ec1178fb38b81b342f84c1268bf21d7fb v2.7.2b1
 b9b60766cabebf007b7584ec21a69b3f58587525 v2.7.2b2
+6d3659465010fd2a8fb11a93953bae5bf9e9db80 v2.7.2b3


=====================================
Lib/test/test_httpservers.py
=====================================
@@ -417,10 +417,7 @@ class CGIHTTPServerTestCase(BaseTestCase):
             os.chdir(self.cwd)
             if self.pythonexe != sys.executable:
                 os.remove(self.pythonexe)
-            os.remove(self.file1_path)
-            os.remove(self.file2_path)
-            os.rmdir(self.cgi_dir)
-            os.rmdir(self.parent_dir)
+            test_support.rmtree(self.parent_dir)
         finally:
             BaseTestCase.tearDown(self)
 


=====================================
Lib/test/test_import.py
=====================================
@@ -142,9 +142,9 @@ class ImportTests(unittest.TestCase):
             # Write a Python file, make it read-only and import it
             with open(fname, 'w') as f:
                 f.write("x = 'original'\n")
-            # Tweak the mtime of the source to ensure pyc gets updated later
+            # Tweak the mtime of the source 10s later to ensure compiled looks out of date
             s = os.stat(fname)
-            os.utime(fname, (s.st_atime, s.st_mtime-100000000))
+            os.utime(fname, (s.st_atime, s.st_mtime+10000))
             os.chmod(fname, 0400)
             m1 = __import__(TESTFN)
             self.assertEqual(m1.x, 'original')


=====================================
NEWS
=====================================
@@ -6,6 +6,12 @@ of that version.
 For more details of issue [ n ], please see https://hg.python.org/jython, or for tags [ GH-n ] see
 https://github.com/jythontools/jython
 
+Jython 2.7.2rc1
+  Bugs fixed
+    - [ 2858 ] test_ssl failure due to embedding Bouncy Castle (doc change only)
+    - [ GH-156 ] Race condition in PyStringMap keys method
+    - [ 2862 ] Jython fails on Linux for normal user when installed by root
+
 Jython 2.7.2b3
   Bugs fixed
     - [ 2810 ] NoSuchMethodError in test_jython_initializer (Java 10+)
@@ -118,6 +124,14 @@ Jython 2.7.2b1
     - There is much improved support for locale, but as a backward-incompatible change, it is
       provided as an opt-in. Define property python.locale.control=settable on the command line
       or via the Jython registry, to enable. This  may become the default in a later version.
+    - The default location of the Jython package cache has moved from the installation directory
+      to the current working directory and is called ".jython_cache". Previously, Jython installed
+      system-wide either exposed the cache as world read-write (a security risk) or disabled it.
+    - BouncyCastle SSL support is incomplete as bundled. The Jython JAR is not signed, and may not
+      be trusted by your JVM as a security provider. This manifests as a PEMException: "Unable to
+      create OpenSSL PBDKF: PBKDF-OpenSSL SecretKeyFactory not available" during certain
+      operations. If this is a problem, place genuine BouncyCastle JARs on the class path, and
+      Jython will use those in preference to the classes we include. The slim JAR is not affected.
 
 Jython 2.7.2a1
   Bugs fixed


=====================================
build.gradle
=====================================
@@ -45,7 +45,7 @@ import java.text.SimpleDateFormat
 // Versions are specified in this grammar:
 // <major> . <minor> ( . <micro> )? ( <release> <serial> )? ( - <word> )?
 
-version = '2.7.2b3'
+version = '2.7.2rc1'
 
 // Valid examples (please preserve in comments):
 //version = '2.7.2a2'


=====================================
build.xml
=====================================
@@ -106,10 +106,10 @@ informix.jar = ../support/jdbc-4.10.12.jar
         <property name="jython.major_version" value="2"/>
         <property name="jython.minor_version" value="7"/>
         <property name="jython.micro_version" value="2"/>
-        <property name="jython.release_level" value="${PY_RELEASE_LEVEL_BETA}"/>
+        <property name="jython.release_level" value="${PY_RELEASE_LEVEL_GAMMA}"/>
 
         <!-- Zero at full release: one-up number for alpha, beta and candidate versions. -->
-        <property name="jython.release_serial" value="3"/>
+        <property name="jython.release_serial" value="1"/>
     </target>
 
     <target name="common-constants">
@@ -157,6 +157,9 @@ informix.jar = ../support/jdbc-4.10.12.jar
         <property name="python.lib" value="${basedir}/lib-python/2.7" />
         <property name="extlibs.dir" value="${basedir}/extlibs" />
 
+        <!-- Cache we need to clean (now it is not in dist.dir) -->
+        <property name="cache.dir" value="${basedir}/.jython_cache" />
+
         <!-- Source specifically for test: -->
         <property name="test.source.dir" value="${basedir}/tests/java" />
         <property name="bugtests.dir" value="${basedir}/bugtests" />
@@ -413,12 +416,14 @@ informix.jar = ../support/jdbc-4.10.12.jar
     <target name="clean" depends="common-dirs, clean-test"
         description="Delete contents of working directories">
         <delete includeemptydirs="true" failonerror="false">
+            <!-- the package cache (now it is not in dist.dir). -->
+            <fileset dir="${cache.dir}" includes="**/*" erroronmissingdir="false" />
             <!-- all files and subdirectories of ${build.dir}, without ${build.dir} itself. -->
             <fileset dir="${build.dir}" includes="**/*" defaultexcludes="false" />
             <!-- all files and subdirectories of ${dist.dir}, without ${dist.dir} itself. -->
             <fileset dir="${dist.dir}" includes="**/*" defaultexcludes="false" />
             <!-- all files and subdirectories of ${pubs.dir}, without ${pubs.dir} itself. -->
-            <fileset dir="${pubs.dir}" includes="**/*" />
+            <fileset dir="${pubs.dir}" includes="**/*" erroronmissingdir="false" />
         </delete>
     </target>
 
@@ -428,7 +433,7 @@ informix.jar = ../support/jdbc-4.10.12.jar
             <!-- all files and subdirectories of ${build.dir}, without ${build.dir} itself. -->
             <fileset dir="${build.dir}" includes="**/*" excludes="gensrc/**" />
             <!-- all files and subdirectories of ${dist.dir}, without ${dist.dir} itself. -->
-            <fileset dir="${dist.dir}" includes="**/*" excludes="cachedir/**, Lib/**" />
+            <fileset dir="${dist.dir}" includes="**/*" excludes="Lib/**" />
         </delete>
     </target>
 
@@ -1190,7 +1195,7 @@ The text for an official release would continue like ...
         </copy>
 
         <echo>building installer .jar file</echo>
-        <jar destfile="${dist.dir}/jython-installer.jar" update="${jar.update}">
+        <jar destfile="${dist.dir}/jython-installer.jar" update="${jar.update}" roundup="false">
             <fileset dir="${dist.dir}">
                 <exclude name="jython-installer.jar"/>
                 <exclude name="${jython.dev.jar}"/>


=====================================
installer/src/java/org/python/util/install/JarInstaller.java
=====================================
@@ -49,7 +49,7 @@ public class JarInstaller {
      * <li>generate the start scripts
      * <li>run ensurepip if selected
      * </ul>
-     * 
+     *
      * @param targetDirectory
      * @param installationType
      */
@@ -102,8 +102,9 @@ public class JarInstaller {
                     }
                 }
                 // exclude build.xml when not installing source
-                if (!installationType.installSources() && zipEntryName.equals("build.xml"))
+                if (!installationType.installSources() && zipEntryName.equals("build.xml")) {
                     exclude = true;
+                }
                 // handle exclusion of core Lib files
                 if (!exclude) {
                     exclude = shouldExcludeFile(installationType,
@@ -182,9 +183,9 @@ public class JarInstaller {
         try {
             String command[];
             if (Installation.isWindows()) {
-                command = new String[]{ bindir.resolve("jython.exe").toString(), "-m", "ensurepip" };
+                command = new String[] {bindir.resolve("jython.exe").toString(), "-m", "ensurepip"};
             } else {
-                command = new String[]{ Paths.get(".", "jython").toString(), "-m", "ensurepip"};
+                command = new String[] {Paths.get(".", "jython").toString(), "-m", "ensurepip"};
             }
             ChildProcess childProcess = new ChildProcess(command);
             childProcess.setCWD(bindir);


=====================================
registry
=====================================
@@ -15,8 +15,8 @@
 
 # Set the directory to use for caches (currently just package information)
 #   This directory should be writable by the user. If this is an absolute path it is used as given,
-#   otherwise it is interpreted relative to sys.prefix (typically the directory of this file).
-python.cachedir = cachedir
+#   otherwise it is interpreted relative to the current working directory (at initialisation).
+#python.cachedir = .jython_cache
 
 # Setting this property to true disables the package scan for the cachedir.
 # Please be aware that disabling this will break importing * from java packages
@@ -24,6 +24,7 @@ python.cachedir = cachedir
 
 # Properties to check for initializing and updating the package cache
 # Values shown here are those hard-coded in Jython's cache manager.
+
 #   Treat JARs on the classpath and (up to Java 8) in the JRE as a source of Python packages.
 #python.packages.paths = java.class.path, sun.boot.class.path   # up to Java 8
 #python.packages.paths = java.class.path                        # from Java 9
@@ -31,6 +32,7 @@ python.cachedir = cachedir
 #python.packages.directories = java.ext.dirs    # up to Java 8
 #python.packages.directories                    # undefined from Java 9
 
+
 # DEPRECATED way to set the verbosity of messages output by Jython. If
 # specified, "python.verbose" will set logging level for "org.python" when
 # the runtime is initialised. It is better to use java.util.logging


=====================================
src/org/python/core/PyStringMap.java
=====================================
@@ -637,9 +637,10 @@ public class PyStringMap extends AbstractDict implements Traverseproc {
 
     @ExposedMethod(doc = BuiltinDocs.dict_keys_doc)
     final PyList stringmap_keys() {
-        PyObject[] keyArray = new PyObject[table.size()];
+        Object[] keys = table.keySet().toArray();
+        PyObject[] keyArray = new PyObject[keys.length];
         int i = 0;
-        for (Object key : table.keySet()) {
+        for (Object key : keys) {
             keyArray[i++] = keyToPy(key);
         }
         return new PyList(keyArray);


=====================================
src/org/python/core/PySystemState.java
=====================================
@@ -62,7 +62,7 @@ public class PySystemState extends PyObject
 
     private static final Logger logger = Logger.getLogger("org.python.core");
 
-    protected static final String CACHEDIR_DEFAULT_NAME = "cachedir";
+    private static final String CACHEDIR_DEFAULT_NAME = ".jython_cache";
 
     public static final String JYTHON_JAR = "jython.jar";
     public static final String JYTHON_DEV_JAR = "jython-dev.jar";
@@ -1270,9 +1270,11 @@ public class PySystemState extends PyObject
         }
         cachedir = new File(props.getProperty(PYTHON_CACHEDIR, CACHEDIR_DEFAULT_NAME));
         if (!cachedir.isAbsolute()) {
-            String prefixString = Py.fileSystemDecode(prefix);
+            String prefixString = props.getProperty("user.dir", "");
             cachedir = new File(prefixString, cachedir.getPath());
+            cachedir = cachedir.getAbsoluteFile();
         }
+        logger.log(Level.CONFIG, "cache at {0}", cachedir);
     }
 
     private static void initPackages(Properties props) {


=====================================
src/org/python/core/imp.java
=====================================
@@ -7,6 +7,7 @@ import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.Date;
 import java.util.Map;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.logging.Level;
@@ -396,10 +397,16 @@ public class imp {
             }
         }
 
-        // Check source-last-modified time fossilised in the class file against that expected
+        /*
+         * The source-last-modified time is fossilised in the class file. The source may have been
+         * installed from a JAR, and this will have resulted in rounding of the last-modified time
+         * down (see build.xml::jar-sources) to the nearest 2 seconds.
+         */
         if (testing && sourceLastModified != NO_MTIME) {
-            long mtime = ar.getMTime();
-            if (sourceLastModified != mtime) {
+            long diff = ar.getMTime() - sourceLastModified;
+            if (diff > 2000L) { // = 2000 milliseconds
+                logger.log(Level.FINE, "# {0} time is {1} ms later than source",
+                        new Object[] {name, diff});
                 return null;
             }
         }
@@ -925,6 +932,10 @@ public class imp {
                         if (ret != null) {
                             return ret;
                         }
+                    } else {
+                        logger.log(Level.FINE,
+                                "# {0} dated ({1,date} {1,time,long}) < ({2,date} {2,time,long})",
+                                new Object[] {name, new Date(classTime), new Date(pyTime)});
                     }
                 }
 


=====================================
src/org/python/core/packagecache/CachedJarsPackageManager.java
=====================================
@@ -841,24 +841,20 @@ public abstract class CachedJarsPackageManager extends PackageManager {
      * before {@link #initCache}. cachedir is the cache repository directory, this is eventually
      * created. Returns true if dir works.
      */
-    protected boolean useCacheDir(File aCachedir1) {
-
-        if (aCachedir1 == null) {
-            return false;
-        }
-
+    protected boolean useCacheDir(File cachedir) {
         try {
-            if (!aCachedir1.isDirectory() && aCachedir1.mkdirs() == false) {
-                warning("failed to create cache dir ''{0}''", aCachedir1);
-                return false;
+            if (cachedir != null) {
+                if (cachedir.isDirectory() || cachedir.mkdirs()) {
+                    this.cachedir = cachedir;
+                    return true;
+                } else {
+                    warning("failed to create cache dir ''{0}''", cachedir);
+                }
             }
         } catch (AccessControlException ace) {
-            warning("Not permitted to access cache ''{0}'' ({1})", aCachedir1, ace.getMessage());
-            return false;
+            warning("Not permitted to access cache ''{0}'' ({1})", cachedir, ace.getMessage());
         }
-
-        this.cachedir = aCachedir1;
-        return true;
+        return false;
     }
 
 }


=====================================
src/org/python/expose/generate/ExposeTask.java
=====================================
@@ -8,8 +8,6 @@ import java.util.Set;
 
 import org.apache.tools.ant.BuildException;
 import org.objectweb.asm.ClassWriter;
-import org.python.core.Py;
-import org.python.core.Options;
 import org.python.util.GlobMatchingTask;
 
 public class ExposeTask extends GlobMatchingTask {
@@ -32,14 +30,7 @@ public class ExposeTask extends GlobMatchingTask {
             log("Exposing 1 class");
         }
 
-        // Quiet harmless unbootstrapped warnings during the expose process
-        int verbose = Options.verbose;
-        Options.verbose = Py.ERROR;
-        try {
-            expose(toExpose);
-        } finally {
-            Options.verbose = verbose;
-        }
+        expose(toExpose);
     }
 
     private void expose(Set<File> toExpose) {


=====================================
src/org/python/modules/posix/PythonPOSIXHandler.java
=====================================
@@ -4,12 +4,14 @@ package org.python.modules.posix;
 import java.io.File;
 import java.io.InputStream;
 import java.io.PrintStream;
+import java.util.logging.Level;
 
 import jnr.constants.platform.Errno;
 import jnr.posix.POSIXHandler;
 
 import org.python.core.imp;
 import org.python.core.Options;
+import org.python.core.PrePy;
 import org.python.core.Py;
 import org.python.core.PyObject;
 
@@ -19,14 +21,17 @@ import org.python.core.PyObject;
  */
 public class PythonPOSIXHandler implements POSIXHandler {
 
+    @Override
     public void error(Errno error, String extraData) {
         throw Py.OSError(error, Py.newStringOrUnicode(extraData));
     }
 
+    @Override
     public void error(Errno error, String methodName, String extraData) {
         throw Py.OSError(error, Py.newStringOrUnicode(extraData));
     }
 
+    @Override
     public void unimplementedError(String methodName) {
         if (methodName.startsWith("stat.")) {
             // Ignore unimplemented FileStat methods
@@ -35,17 +40,22 @@ public class PythonPOSIXHandler implements POSIXHandler {
         throw Py.NotImplementedError(methodName);
     }
 
+    @Override
     public void warn(WARNING_ID id, String message, Object... data) {
     }
 
+    @Override
     public boolean isVerbose() {
-        return Options.verbose >= Py.DEBUG;
+        // Verbose if the general threshold for logging is FINE or lower.
+        return PrePy.getLoggingLevel().intValue() <= Level.FINE.intValue();
     }
 
+    @Override
     public File getCurrentWorkingDirectory() {
         return new File(Py.getSystemState().getCurrentWorkingDir());
     }
 
+    @Override
     public String[] getEnv() {
         PyObject items = imp.load("os").__getattr__("environ").invoke("items");
         String[] env = new String[items.__len__()];
@@ -56,18 +66,22 @@ public class PythonPOSIXHandler implements POSIXHandler {
         return env;
     }
 
+    @Override
     public InputStream getInputStream() {
         return System.in;
     }
 
+    @Override
     public PrintStream getOutputStream() {
         return System.out;
     }
 
+    @Override
     public int getPID() {
         return 0;
     }
 
+    @Override
     public PrintStream getErrorStream() {
         return System.err;
     }



View it on GitLab: https://salsa.debian.org/java-team/jython/-/commit/70b68ad5c42e4cf392759142f20272f2bc2b3b4c

-- 
View it on GitLab: https://salsa.debian.org/java-team/jython/-/commit/70b68ad5c42e4cf392759142f20272f2bc2b3b4c
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20200309/483fef53/attachment.html>


More information about the pkg-java-commits mailing list