Package: jython
Version: 2.5.3-11
Severity: normal
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi,

The jython launcher currently forces the cachedir to $HOME/.jython-cache. But 
when the library is used directly the cachedir is still set from the upstream 
default in src/org/python/core/PySystemState.java:
 protected static final String CACHEDIR_DEFAULT_NAME = "cachedir";
Which results in the non-writable path /usr/share/jython/cachedir.

I think it would be more consistent to change the default directly into the 
PySystemState class and drop the corresponding configuration from the launcher.

Please see the attached patch proposal. I'm willing to team-upload it in a few 
days, unless you object.

thanks,

- -- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.7.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

-----BEGIN PGP SIGNATURE-----

iQEcBAEBCAAGBQJYNJlRAAoJEO/obGx//s+DjpgH/3cSm00TLH4+AhQ/Slv5PpGb
1nunZGfS/sBsKPezfGayNhezZCiWE+BFjUyi8ErL/Gb7hiHEGDGdBZYanJcAgQc8
XzyoIvXdVn3UuoZ0Uwlic5EMGNdgh/8uZNVs/ZhommZHs+VxuDDjATP0IAZ2pPhY
wH13hX4amZ7LVliTbKoCV6Wip4cookjdROyxvf5Q7sMVIpdZA6hWtc5RdczONF0j
cgXjnwWEc3aZEw6yEk12ZMcsEY40HmrE9lRtHL6AqPXj0ZUhvX+Lrt5HlgxfRf7m
QsFJz85HID0ZxCJCqCkIed13IuQ7xxWaHo1N9Hoeh/tU3Wok4FbK7vLwnxLrpb8=
=D7MZ
-----END PGP SIGNATURE-----
diff -Nru jython-2.5.3/debian/changelog jython-2.5.3/debian/changelog
--- jython-2.5.3/debian/changelog	2016-11-07 14:36:32.000000000 +0100
+++ jython-2.5.3/debian/changelog	2016-11-22 01:38:42.000000000 +0100
@@ -1,3 +1,12 @@
+jython (2.5.3-11.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * New patch 03-default-cachedir.patch: the Debian default cachedir
+    path is now set at the library intialization step, so that it works
+    for every use case
+
+ -- Gilles Filippini <p...@debian.org>  Tue, 22 Nov 2016 00:34:43 +0100
+
 jython (2.5.3-11) unstable; urgency=medium
 
   * Team upload.
diff -Nru jython-2.5.3/debian/jython_perl jython-2.5.3/debian/jython_perl
--- jython-2.5.3/debian/jython_perl	2015-12-21 15:05:26.000000000 +0100
+++ jython-2.5.3/debian/jython_perl	2016-11-22 01:33:37.000000000 +0100
@@ -92,21 +92,6 @@
 # Decide upon the python path.
 my $jythonPath = "/usr/lib/site-python:/usr/share/jython/Lib";
 
-# Set up the cache directory.
-#
-my $cacheDir = "$home/.jython-cache";
-if (-e $cacheDir and ! -d $cacheDir) {
-	# The expected cache directory exists but is not a directory.
-	# Use a temporary directory instead.
-	$cacheDir = `mktemp -dt jython-cache.XXXXXX` or
-		bail("Could not create temporary cache directory.");
-	chomp $cacheDir;
-}
-if (! -e $cacheDir) {
-	# Create a new cache directory.
-	mkdir $cacheDir or bail("Could not create cache directory $cacheDir.");
-}
-
 # We will build up a JNI library path from various places.
 #
 my $jniPath = '';
@@ -160,7 +145,6 @@
 push @fullCommandLine, "-Dpython.home=$jythonHome";
 push @fullCommandLine, "-Dpython.path=$jythonPath";
 push @fullCommandLine, "-Dpython.executable=$0";
-push @fullCommandLine, "-Dpython.cachedir=$cacheDir";
 push @fullCommandLine, "-Dpython.console=org.python.util.ReadlineConsole";
 push @fullCommandLine, "-Dpython.console.readlinelib=Editline";
 $ENV{CALLED_FROM_JYTHONC} and
diff -Nru jython-2.5.3/debian/jython.README.Debian jython-2.5.3/debian/jython.README.Debian
--- jython-2.5.3/debian/jython.README.Debian	2015-07-23 14:00:44.000000000 +0200
+++ jython-2.5.3/debian/jython.README.Debian	2016-11-22 01:42:00.000000000 +0100
@@ -7,6 +7,9 @@
 Consult the jython(1) man page for details about invocation
 of the Jython interpreter.
 
+On Debian, the default jython cachedir path is set to
+${user.home}/.jython-cache instead of ${python.home}/cachedir.
+
 The Jython API is provided by the jython-doc package in
 /usr/share/doc/jython-doc.
 
diff -Nru jython-2.5.3/debian/patches/03-default-cachedir.patch jython-2.5.3/debian/patches/03-default-cachedir.patch
--- jython-2.5.3/debian/patches/03-default-cachedir.patch	1970-01-01 01:00:00.000000000 +0100
+++ jython-2.5.3/debian/patches/03-default-cachedir.patch	2016-11-22 19:30:04.000000000 +0100
@@ -0,0 +1,14 @@
+Index: jython-2.5.3/src/org/python/core/PySystemState.java
+===================================================================
+--- jython-2.5.3.orig/src/org/python/core/PySystemState.java
++++ jython-2.5.3/src/org/python/core/PySystemState.java
+@@ -46,7 +46,8 @@ public class PySystemState extends PyObj
+     public static final String PYTHON_CACHEDIR = "python.cachedir";
+     public static final String PYTHON_CACHEDIR_SKIP = "python.cachedir.skip";
+     public static final String PYTHON_CONSOLE_ENCODING = "python.console.encoding";
+-    protected static final String CACHEDIR_DEFAULT_NAME = "cachedir";
++    protected static final String CACHEDIR_DEFAULT_NAME = System.getProperty("user.home") != null ?
++        (new File(System.getProperty("user.home"), ".jython-cache")).toString() : "cachedir";
+ 
+     public static final String JYTHON_JAR = "jython.jar";
+     public static final String JYTHON_DEV_JAR = "jython-dev.jar";
diff -Nru jython-2.5.3/debian/patches/series jython-2.5.3/debian/patches/series
--- jython-2.5.3/debian/patches/series	2015-09-03 12:12:49.000000000 +0200
+++ jython-2.5.3/debian/patches/series	2016-11-22 00:34:19.000000000 +0100
@@ -1,2 +1,3 @@
 01-build.patch
 02-jnr_refactoring.patch
+03-default-cachedir.patch

Reply via email to