← Back to team overview

openjdk team mailing list archive

Bug#821858: Bug#821858: openjdk-7-jre-headless: postinst turns /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/zi into a dangling symlink

 

Control: tag -1 patch

On 2016-04-20 22:10, Matthias Klose wrote:
> the package is being removed in unstable. It's kept in experimental
> only, to prepare and test security releases. These security release
> don't need this fix, and dpkg-maintscript-helper can't be used because
> it's not available in squeeze.  Feel free to send a patch working on
> squeeze, wheezy and stretch, or pretty please close the issue.

I don't understand what the package is supposed to do, since it contains
two conflicting things:

* it ships a zoneinfo tree as
  /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/zi/*/*

* postinst deletes /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/zi
  and replaces it with a symlink to /usr/share/javazi


So looking at the source I see

* debian/JB-jre-lib.postinst.in conditionalizes the symlink creation for
/@basedir@/jre/lib/zi on @with_tzdata@
* debian/JB-jre-headless.postinst.in does this unconditionally resulting
in above breakage

* in debian/rules the list of distributions that need with_tzdata=yes
misses jessie (and a comment explaining the meaning of this variable)


OK, an untested patch is attached. Should be safe for all distros.

- JB-jre-headless.postinst.in: conditionalize zi symlink handling on
@with_tzdata@
- rules: jessie has tzdata-java, too

I also tried to fix the handling of upgrades switching from external to
internal zoneinfo (e.g. jessie => experimental or experimental -3 => -4)
(delete an existing zi symlink in preinst if we are shipping the full
zoneinfo tree) (this may not cover all possible upgrade paths, e.g. from
pre-multiarch versions)

openjdk-7 FTBFS in sid while building the documentation, I don't plan to
investigate this further.


Andreas
diff -Nru openjdk-7-7u95-2.6.4/debian/JB-jre-headless.postinst.in openjdk-7-7u95-2.6.4/debian/JB-jre-headless.postinst.in
--- openjdk-7-7u95-2.6.4/debian/JB-jre-headless.postinst.in	2016-01-20 19:48:04.000000000 +0100
+++ openjdk-7-7u95-2.6.4/debian/JB-jre-headless.postinst.in	2016-04-21 17:17:41.000000000 +0200
@@ -3,6 +3,7 @@
 set -e
 
 multiarch=@multiarch@
+with_tzdata=@with_tzdata@
 priority=@priority@
 basedir=/@basedir@
 mandir=$basedir/jre/man
@@ -132,7 +133,7 @@
 	rm -f $log
     esac
 
-    if [ -n "$multiarch" ]; then
+    if [ "$with_tzdata" = yes ] && [ -n "$multiarch" ]; then
 	if [ ! -h /@basedir@/jre/lib/zi ] && [ -d /@basedir@/jre/lib/zi ]; then
 	    rm -rf /@basedir@/jre/lib/zi
 	    ln -s ../../../../../share/javazi /@basedir@/jre/lib/zi
diff -Nru openjdk-7-7u95-2.6.4/debian/JB-jre-headless.preinst.in openjdk-7-7u95-2.6.4/debian/JB-jre-headless.preinst.in
--- openjdk-7-7u95-2.6.4/debian/JB-jre-headless.preinst.in	2016-01-20 19:48:04.000000000 +0100
+++ openjdk-7-7u95-2.6.4/debian/JB-jre-headless.preinst.in	2016-04-21 17:36:27.000000000 +0200
@@ -7,6 +7,7 @@
 fi
 
 multiarch=@multiarch@
+with_tzdata=@with_tzdata@
 basedir=/@basedir@
 old_basedir=/usr/lib/jvm/java-7-openjdk
 jre_tools='java keytool pack200 rmid rmiregistry unpack200 orbd servertool tnameserv'
@@ -29,6 +30,13 @@
 		fi
 	    fi
 	fi
+
+	# upgrading from a version that used the timezone files from tzdata-java
+	if [ "$with_tzdata" != yes ] && [ -n "$multiarch" ]; then
+		if [ -h /@basedir@/jre/lib/zi ]; then
+			rm -f /@basedir@/jre/lib/zi
+		fi
+	fi
 	;;
 esac
 
diff -Nru openjdk-7-7u95-2.6.4/debian/changelog openjdk-7-7u95-2.6.4/debian/changelog
--- openjdk-7-7u95-2.6.4/debian/changelog	2016-03-24 15:42:07.000000000 +0100
+++ openjdk-7-7u95-2.6.4/debian/changelog	2016-04-21 18:09:33.000000000 +0200
@@ -1,3 +1,10 @@
+openjdk-7 (7u95-2.6.4-4) UNRELEASED; urgency=medium
+
+  * Fix handling of /usr/lib/jvm/*/jre/lib/zi if internal tzdata is used
+    (Closes: #821858)
+
+ -- Andreas Beckmann <anbe@xxxxxxxxxx>  Thu, 21 Apr 2016 17:13:06 +0200
+
 openjdk-7 (7u95-2.6.4-3) experimental; urgency=medium
 
   [ Tiago Stürmer Daitx ]
diff -Nru openjdk-7-7u95-2.6.4/debian/rules openjdk-7-7u95-2.6.4/debian/rules
--- openjdk-7-7u95-2.6.4/debian/rules	2016-03-24 15:42:24.000000000 +0100
+++ openjdk-7-7u95-2.6.4/debian/rules	2016-04-21 18:09:18.000000000 +0200
@@ -373,7 +373,8 @@
   endif
 endif
 
-ifneq (,$(filter $(distrel),squeeze wheezy precise lucid precise trusty vivid wily))
+ifneq (,$(filter $(distrel),squeeze wheezy jessie lucid precise trusty vivid wily))
+  # use the timezone files from tzdata-java
   with_tzdata = yes
 endif
 

References