Accepting request 1095802 from home:pmonrealgonzalez:branches:Java:packages

- Update to 2.3.7: [bsc#1186065]
  * See full changelog in the NEWS file.
  * Add jython-fix-tty-detection.patch
  * Rebase patches:
    - jython-dont-validate-pom.patch
    - jython-build.patch
    - jython-cachedir.patch
  * Remove patches fixed upstream:
    - jython-makeCompiledFilename.patch
    - jython-module.patch
    - jython-nofullbuildpath.patch
    - jython-cacheperms.patch
    - jython-compareto.patch
    - jython-sourcetarget.patch
    - jython-cached-classes.patch

OBS-URL: https://build.opensuse.org/request/show/1095802
OBS-URL: https://build.opensuse.org/package/show/Java:packages/jython?expand=0&rev=38
This commit is contained in:
Fridrich Strba 2023-06-28 13:01:56 +00:00 committed by Git OBS Bridge
parent ea572771d1
commit 5391bc49d5
10 changed files with 32 additions and 216 deletions

View File

@ -1,68 +0,0 @@
From 85a88bcffe2d61d143b4f8c545bd28b152d8d05b Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lubo.rintel@gooddata.com>
Date: Wed, 3 Apr 2013 18:31:40 +0200
Subject: [PATCH 3/3] Use cache dir for classes too
Instead of attempting to write them next to source files.
Java 6 API does not allow for setting sane permissions (i.e. same as
those of a source file) and relying on defaults is a security hazard
which can lead to information disclosure, or, in case of a too relaxed
umask, arbitrary code execution.
Also, this will likely improve performance for non-privileged users
which can not write to their distribution's packaged jython tree.
---
src/org/python/core/PySystemState.java | 6 ++++++
src/org/python/core/imp.java | 12 ++++++++++--
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/org/python/core/PySystemState.java b/src/org/python/core/PySystemState.java
index 9de34e3..a124228 100644
--- a/src/org/python/core/PySystemState.java
+++ b/src/org/python/core/PySystemState.java
@@ -539,6 +539,12 @@ public class PySystemState extends PyObject
public static PackageManager packageManager;
public static File cachedir;
+ public static File classCache() {
+ if (cachedir == null)
+ return null;
+ return new File(cachedir, "classes");
+ }
+
public static boolean isPackageCacheEnabled() {
return cachedir != null;
}
diff --git a/src/org/python/core/imp.java b/src/org/python/core/imp.java
index a9868dd..67c33d6 100644
--- a/src/org/python/core/imp.java
+++ b/src/org/python/core/imp.java
@@ -117,8 +117,15 @@ public class imp {
}
private static String makeCompiledFilename(String filename) {
- return filename.substring(0, filename.length() - 3)
- + "$py.class";
+ String basename = filename.substring(0, filename.length() - 3)
+ + "$py.class";
+ File cache = Py.getSystemState().classCache();
+
+ if (cache == null) {
+ return basename;
+ } else {
+ return new File(cache, basename).getPath();
+ }
}
/**
@@ -144,6 +151,7 @@ public class imp {
}
FileOutputStream fop = null;
try {
+ new File(compiledFilename).getParentFile().mkdirs();
fop = new FileOutputStream(compiledFilename);
fop.write(compiledSource);
fop.close();
--
1.8.3.1

View File

@ -1,31 +0,0 @@
From 517883617472d53c3346ad419f0af42a7dd83705 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lubo.rintel@gooddata.com>
Date: Wed, 3 Apr 2013 18:24:46 +0200
Subject: [PATCH 1/3] Make cache not accessible by anyone else
Sensitive information might be being cached or umask can be too relaxed,
allowing writes.
---
src/org/python/core/CachedJarsPackageManager.java | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/org/python/core/CachedJarsPackageManager.java b/src/org/python/core/CachedJarsPackageManager.java
index 6953136..764f2f3 100644
--- a/src/org/python/core/CachedJarsPackageManager.java
+++ b/src/org/python/core/CachedJarsPackageManager.java
@@ -587,6 +587,12 @@ public abstract class CachedJarsPackageManager extends PackageManager {
return false;
}
+ aCachedir1.setReadable(false, false);
+ aCachedir1.setWritable(false, false);
+ aCachedir1.setExecutable(false, false);
+ aCachedir1.setReadable(true, true);
+ aCachedir1.setWritable(true, true);
+ aCachedir1.setExecutable(true, true);
this.cachedir = aCachedir1;
return true;
--
1.8.3.1

View File

@ -1,14 +0,0 @@
--- jython-svn-Release_2_2_1/Lib/test/javatests/AnonInner.java 2006-04-09 18:14:16.000000000 +0200
+++ jython-svn-Release_2_2_1/Lib/test/javatests/AnonInner.java 2017-09-08 11:14:45.116655838 +0200
@@ -9,11 +9,6 @@
public int hashCode() {
return 2000;
}
- //XXX: stuck compareTo to make the compiler happier.
- // hopefully this doesn't mess up the test.
- public int compareTo(Object x) {
- return 0;
- }
};
return d.hashCode();
}

View File

@ -1,5 +1,5 @@
--- src/shell/jython.orig 2017-08-11 16:24:32.831309328 +0100
+++ src/shell/jython 2017-08-11 16:23:55.346726416 +0100
--- jython-2.7.3/src/shell/jython.orig 2017-08-11 16:24:32.831309328 +0100
+++ jython-2.7.3/src/shell/jython 2017-08-11 16:23:55.346726416 +0100
@@ -242,6 +242,11 @@
fi
fi

View File

@ -1,34 +0,0 @@
From 9adf26828ecf5650a86885b344b93242f6617220 Mon Sep 17 00:00:00 2001
From: Lubomir Rintel <lubo.rintel@gooddata.com>
Date: Wed, 3 Apr 2013 18:32:14 +0200
Subject: [PATCH 2/3] Avoid code duplication with makeCompiledFilename()
---
src/org/python/core/imp.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/org/python/core/imp.java b/src/org/python/core/imp.java
index a902079..a9868dd 100644
--- a/src/org/python/core/imp.java
+++ b/src/org/python/core/imp.java
@@ -424,7 +424,7 @@ public class imp {
int nlen = name.length();
String sourceName = "__init__.py";
- String compiledName = "__init__$py.class";
+ String compiledName = makeCompiledFilename(sourceName);
String directoryName = defaultEmptyPathDirectory(entry.toString());
// First check for packages
@@ -437,7 +437,7 @@ public class imp {
if (!pkg) {
Py.writeDebug(IMPORT_LOG, "trying source " + dir.getPath());
sourceName = name + ".py";
- compiledName = name + "$py.class";
+ compiledName = makeCompiledFilename(sourceName);
sourceFile = new File(directoryName, sourceName);
compiledFile = new File(directoryName, compiledName);
} else {
--
1.8.3.1

View File

@ -1,11 +0,0 @@
--- jython-svn-Release_2_2_1/src/org/python/parser/TreeBuilder.java 2007-06-30 10:57:09.000000000 +0200
+++ jython-svn-Release_2_2_1/src/org/python/parser/TreeBuilder.java 2017-09-08 11:05:27.462211440 +0200
@@ -111,7 +111,7 @@
case JJTSINGLE_INPUT:
return new Interactive(makeStmts(arity));
case JJTFILE_INPUT:
- return new Module(makeStmts(arity));
+ return new org.python.parser.ast.Module(makeStmts(arity));
case JJTEVAL_INPUT:
return new Expression(makeExpr());

View File

@ -1,40 +0,0 @@
Index: jython-svn-Release_2_2_1/build.xml
===================================================================
--- jython-svn-Release_2_2_1.orig/build.xml 2007-10-13 20:44:01.000000000 +0200
+++ jython-svn-Release_2_2_1/build.xml 2011-03-11 13:44:32.516562588 +0100
@@ -551,7 +551,7 @@
<!-- build the .html files using the ht2html tool -->
- <target name="doc" depends="compile" if="full-build">
+ <target name="doc" depends="compile">
<fail unless="ht2html.dir" message="ht2html.dir is not set" />
<copy todir="${dist.dir}/Doc" preservelastmodified="true">
<fileset dir="Doc" includes="*.ht, **/*.gif" />
@@ -572,7 +572,7 @@
<!-- javadoc -->
- <target name="javadoc" depends="compile" if="full-build">
+ <target name="javadoc" depends="compile">
<javadoc sourcepath="${source.dir}"
destdir="${apidoc.dir}"
source="${jdk.source.version}"
@@ -588,7 +588,7 @@
<!-- copy for full distribution -->
- <target name="copy-full" if="full-build">
+ <target name="copy-full">
<!-- Misc files -->
<echo>copy misc files from ${jython.base.dir}</echo>
<copy todir="${dist.dir}" preservelastmodified="true">
@@ -599,7 +599,7 @@
<!-- copy the CPython license -->
<echo>copy CPython LICENSE from ${svn.checkout.dir}/python</echo>
- <copy file="${svn.checkout.dir}/python/LICENSE" tofile="${dist.dir}/LICENSE_CPython.txt" preservelastmodified="true" />
+ <copy file="LICENSE.txt" tofile="${dist.dir}/LICENSE_CPython.txt" preservelastmodified="true" />
<!-- sources: todir has to correspond with installer/**/JarInstaller.java -->
<echo>copy sources from ${jython.base.dir}</echo>

View File

@ -1,13 +0,0 @@
--- jython-svn-Release_2_2_1/build.xml 2007-10-13 20:44:01.000000000 +0200
+++ jython-svn-Release_2_2_1/build.xml 2017-09-08 11:01:08.947884132 +0200
@@ -174,8 +174,8 @@
<property file="${basedir}/ant.properties" />
<property name="build.compiler" value="modern" />
- <property name="jdk.target.version" value="1.4" />
- <property name="jdk.source.version" value="1.4" />
+ <property name="jdk.target.version" value="1.8" />
+ <property name="jdk.source.version" value="1.8" />
<property name="deprecation" value="off" />
<property name="debug" value="off" />
<property name="optimize" value="on" />

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Wed Jun 28 10:40:43 UTC 2023 - Pedro Monreal <pmonreal@suse.com>
- Update to 2.3.7: [bsc#1186065]
* See full changelog in the NEWS file.
* Add jython-fix-tty-detection.patch
* Rebase patches:
- jython-dont-validate-pom.patch
- jython-build.patch
- jython-cachedir.patch
* Remove patches fixed upstream:
- jython-makeCompiledFilename.patch
- jython-module.patch
- jython-nofullbuildpath.patch
- jython-cacheperms.patch
- jython-compareto.patch
- jython-sourcetarget.patch
- jython-cached-classes.patch
-------------------------------------------------------------------
Sun Mar 20 12:20:10 UTC 2022 - Fridrich Strba <fstrba@suse.com>

View File

@ -30,6 +30,8 @@ URL: https://www.jython.org/
Source0: %{name}-%{version}.tar.xz
Patch0: %{name}-build.patch
Patch1: %{name}-dont-validate-pom.patch
Patch2: %{name}-cachedir.patch
Patch3: %{name}-fix-tty-detection.patch
BuildRequires: ant
BuildRequires: ant-junit
BuildRequires: antlr3-java
@ -92,6 +94,8 @@ development and in shipping products.
%package javadoc
Summary: Javadoc for jython
Group: Development/Libraries/Java
Provides: jython-manual = %{version}
Obsoletes: jython-manual < %{version}
BuildArch: noarch
%description javadoc
@ -107,9 +111,7 @@ BuildArch: noarch
Demonstrations and samples for %{name}.
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%autosetup -p1
%build
build-jar-repository -s -p extlibs \
@ -160,6 +162,12 @@ build-jar-repository -s -p dist/javalib \
objectweb-asm/asm-util \
stringtemplate4/ST4
# remove shebangs from python files
find dist -type f -name '*.py' | xargs sed -i "s:#!\s*/usr.*::"
# fix env-script-interpreter
sed -i 's/env bash/bash/' dist/bin/%{name}{,.py}
%install
# jar
install -d -m 755 %{buildroot}%{_javadir}