Please sync jde (2.3.5.1-5) from Debian unstable

Bug #234690 reported by Chook Gek
4
Affects Status Importance Assigned to Milestone
jde (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Binary package hint: jde

54jde.el - function debian-jde-register-jdks - reports and registers wrong version of java. If package sun-java5-bin is installed, then debian-jde-register-jdks reports "53" as a version, instead of "1.5.0_15".

As a result of this, jde-mode failed in the middle of processing, on line 901:
"(if (and (not (jde-debugger-running-p)) jde-project-context-switching-enabled-p)"

Probable source of problem is the way how debian-jde-register-jdks interpret output from "/usr/sbin/update-java-alternatives --list":
"java-1.5.0-sun 53 /usr/lib/jvm/java-1.5.0-sun"

- it treats second column (which is "priority" in /usr/lib/jvm/.java-1.5.0-sun.jinfo) as a java version.

Workaround: comment out (debian-jde-register-jdks) in 54jde.el:95.

Info:
$ lsb_release -rd
Description: Ubuntu 8.04
Release: 8.04

$ apt-cache policy jde
jde:
  Installed: 2.3.5.1-4ubuntu1

Revision history for this message
Reinhard Tartler (siretart) wrote :

As quick reference, here the code for 'debian-jde-register-jdks' as of version 2.3.5.1-4ubuntu1:

  ;; Register all available JDKs on the system
  (defun debian-jde-register-jdks ()
    "Register all available JDKs automatically given the output of
update-java-alternatives."
    (when (file-executable-p "/usr/sbin/update-java-alternatives")
      (with-temp-buffer
        (shell-command "/usr/sbin/update-java-alternatives --list" t)
        (goto-char (point-min))
        (let (jdks)
          (while (and (< (point) (point-max))
                      (looking-at
                       "\\([^ \n]+\\) \\([^ \n]+\\) \\([^ \n]+\\)$"))
            (let ((name (match-string 1))
                  (version (match-string 2))
                  (jdk-path (match-string 3)))
              (when (string-match "\\`[0-9]\\{4\\}\\'" version)
                (setq version (concat
                               (substring version 0 1) "."
                               (number-to-string
                                (string-to-number (substring version 1 3)))
                               "." (substring version 3 4))))
              (add-to-list 'jdks (cons version jdk-path)))
            (forward-line 1))
          (jde-set-jdk-dir-type 'jde-jdk-registry (nreverse jdks))))))
  (debian-jde-register-jdks))

Revision history for this message
Reinhard Tartler (siretart) wrote :

On my system, `/usr/sbin/update-java-alternatives --list` gives the following output:

java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk
java-6-sun 63 /usr/lib/jvm/java-6-sun
java-7-icedtea 1060 /usr/lib/jvm/java-7-icedtea

So using the 2nd coloumn for this is not a good indicator for the version. However calling $found_jdk/bin/java -version takes more time than acceptable. I'm out of ideas here how to fix it properly. I'd therefore suggest to take out this convenience function. Its intention is of course to help new users. However, it doesn't help when its broken.

Changed in jde:
importance: Undecided → Low
status: New → Triaged
Revision history for this message
Michael Olson (mwolson) wrote :

Nuts. I see now that update-java-alternatives gives the priority rather than the Java version as the second column. I'm trying to think of other heuristics that could be used to determine the version. Worst case, I might try using nil for the version and patching jde to error out if the version is nil, with an error message that tells the user to edit this variable themselves and specify the version. That way, at least they would not have to manually type in the path to each JVM.

Revision history for this message
Michael Olson (mwolson) wrote : Re: [Bug 234690] Re: 54jde.el registers wrong java version

Reinhard Tartler <email address hidden> writes:

> On my system, `/usr/sbin/update-java-alternatives --list` gives the
> following output:
>
> java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk
> java-6-sun 63 /usr/lib/jvm/java-6-sun
> java-7-icedtea 1060 /usr/lib/jvm/java-7-icedtea
>
> So using the 2nd coloumn for this is not a good indicator for the
> version. However calling $found_jdk/bin/java -version takes more time
> than acceptable. I'm out of ideas here how to fix it properly. I'd
> therefore suggest to take out this convenience function. Its intention
> is of course to help new users. However, it doesn't help when its
> broken.

I'm going to try to fix this on Thursday.

--
| Michael Olson | FSF Associate Member #652 |
| http://mwolson.org/ | Hobbies: Lisp, HCoop |
| Projects: Emacs, Muse, ERC, EMMS, ErBot, DVC, Planner |
`-------------------------------------------------------'

Changed in jde:
assignee: nobody → mwolson
status: Triaged → In Progress
Revision history for this message
Michael Olson (mwolson) wrote : Re: 54jde.el registers wrong java version

I've made a new Debian package with these fixes and have contacted my Debian sponsor to get it uploaded. Once it makes it into debian unstable, it will be safe to take it directly from there into Ubuntu.

Revision history for this message
Michael Olson (mwolson) wrote :

This includes all Ubuntu changes:

jde (2.3.5.1-5) unstable; urgency=low

  * debian/README.Debian:
    - Update for latest changes.
  * debian/control:
    - Suggests: Change libtomcat5-java to libtomcat5.5-java (LP: 204804).
    - Bump Standards-Version to 3.8.0.
  * debian/copyright:
    - Add basic copyright notice to silence lintian.
  * debian/emacsen-startup:
    - Don't use the 2nd field of update-java-alternatives to determine the
      version of Java, because that is not the purpose of the field
      (LP: #234690).
  * debian/jde.doc-base:
    - Change section to Programming.
  * debian/rules:
    - Keep patches in debian/patches, in order to make it potentially
      easier for upstream to apply them. They are managed using git, and
      applied using patch -p1.
  * lisp/jde-import.el:
    - Fix error with jde-import-kill-extra-imports in emacs22. Thanks to
      Mike Gratton for the report (LP: #145437).

 -- Michael W. Olson (GNU address) <email address hidden> Wed, 09 Jul 2008 08:47:51 -0700

Changed in jde:
assignee: mwolson → nobody
status: In Progress → Confirmed
Revision history for this message
Reinhard Tartler (siretart) wrote :

I testbuilt the package locally, and now confirm the sync request.

Revision history for this message
Sebastien Bacher (seb128) wrote :

[Updating] jde (2.3.5.1-4ubuntu1 [Ubuntu] < 2.3.5.1-5 [Debian])
 * Trying to add jde...
  - <jde_2.3.5.1.orig.tar.gz: already in distro - downloading from librarian>
  - <jde_2.3.5.1-5.diff.gz: downloading from http://ftp.debian.org/debian/>
  - <jde_2.3.5.1-5.dsc: downloading from http://ftp.debian.org/debian/>
I: jde [multiverse] -> jde_2.3.5.1-4ubuntu1 [multiverse].

Changed in jde:
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.