Opened 10 months ago

Closed 6 weeks ago

Last modified 6 weeks ago

#19006 closed defect (fixed)

Incorrect plugins path used

Reported by: skyper Owned by: GerdP
Priority: normal Milestone: 20.12
Component: Core Version: latest
Keywords: template_report update plugin path Cc:

Description (last modified by skyper)

Edit: This problem only appears with plugins under several valid paths, see comment 7.

What steps will reproduce the problem?

  1. Have several plugins with older version installed
  2. In Plugin Preferences click on "Update plugins"
  3. Get a message about plugins' updates
  4. Close message window and preferences
  5. Restart JOSM
  6. Look at plugin version in Plugin Preferences.

What is the expected result?

All installed plugins are up to date

What happens instead?

Plugins with still lower local version installed

Please provide any additional information below. Attach a screenshot if possible.

Plugin update policy is set to always start without asking after update. Sadly, I did not recognize the last updates with this setting but, maybe, it helps to smaller the time range the regression was introduced.
Last plugin update seems to be 35330 but "ejml" (35313) failed before.

Edit: You need to have plugins in several valid path like .josm/cache/plugins, .local/share/JOSM/plugins, .config/JOSM/cache/plugins, /usr/share/josm/plugins or /usr/local/share/josm/plugins on Linux

In my case updates are stored under .local/share/JOSM/plugins but on startup the .jar files from .config/JOSM/cache/plugins are used.
If several paths are allowed, please, use the correct order, e.g.

  1. /usr/share/josm/plugins
  2. /usr/local/share/josm/plugins
  3. {$HOME}/.config/[<>]/cache/plugins or {$HOME}/.josm/cache/plugins
  4. {$HOME}/.local/share/[<]>/plugins

and use the highest version that fits the JOSM revision.
Thanks a lot.

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2020-03-27 15:39:19 +0100 (Fri, 27 Mar 2020)
Build-Date:2020-03-28 02:30:56

+ ImproveWay (29)
+ OpeningHoursEditor (35250)
+ apache-commons (35092)
+ comfort0 (35314)
+ conflation (0.6.4)
+ ejml (35122)
+ geotools (35169)
+ imagery_offset_db (35248)
+ jaxb (35092)
+ jts (35122)
+ opendata (35330)
+ reverter (35313)
+ undelete (35313)
+ utilsplugin2 (35248)
+ waydownloader (35092)

Attachments (0)

Change History (17)

comment:1 Changed 10 months ago by skyper

Description: modified (diff)

comment:2 Changed 10 months ago by skyper

Strange, with settings set to update every day (1) and another restart everything is updated or did someone fix it meanwhile ?

comment:3 Changed 10 months ago by skyper

Forgot to mention that I am not the only one with problem see Klumbumbus' comment 5 and followups on #19000.

comment:4 Changed 10 months ago by Don-vip

Resolution: irreproducible
Status: newclosed

comment:5 Changed 8 months ago by skyper

Resolution: irreproducible
Status: closedreopened

Today it happened again. I did download the plugin updates for the third time now to only have the old version loaded on startup.

comment:6 Changed 8 months ago by skyper

For the record:

  • manual update with r16402 did not work, yesterday.
  • version based automatically update with r16403 did work, today.

comment:7 Changed 8 months ago by skyper

Ok, I found the reason for my problems.

I had an additional cache folder under .config/ with old plugins. Deleting the folder does solve the problems.

Why does JOSM refer to this old folder if a folder under .local/share/ exists and is used? This way I ran the new versions only if installed on startup.

Last edited 8 months ago by skyper (previous) (diff)

comment:8 Changed 8 months ago by skyper

Oh, in fact, this is the same problem as in #7483 and #14702 which were never fixed. Is it really not possible to have a priority in search paths and to always use the same/proper order. Or simply only support one path and only use that one.

comment:9 Changed 8 months ago by skyper

Description: modified (diff)
Keywords: path added; regression removed
Priority: majornormal
Summary: Plugin update failsIncorrect plugins path used
Version: latest

comment:10 Changed 8 months ago by skyper

Description: modified (diff)

comment:11 Changed 6 months ago by skyper

See #19513 for a ticket caused by this bug.

comment:12 Changed 5 months ago by skyper

See #19756 for a request about a preference setting for the plugin paths.

comment:13 Changed 6 weeks ago by GerdP

Owner: changed from team to GerdP
Status: reopenednew

comment:14 Changed 6 weeks ago by GerdP

Several problems here:

  1. JOSM stores possible paths for preferences in an unordered set. This looks completely wrong. See
  2. When looking for the version of a plugin JOSM searches in all of those directories, sometimes in a subdirectory plugins, sometimes in the directory name with plugins appended (because it doesn't always add the separator character). This is probably not intended. On my MS Windows machine this gives
  3. When loading the plugins JOSM only seems to search in the user data directory, in my case C:\Users\Gerd\AppData\Roaming\JOSM\plugins

To fix the problem I think I'll just change the code that looks for the version to use the same directory as the loader.
The undordered set of preferences is also used when imgages are searched. Did not yet look at that, but it seems wrong that the order is more or less random.

Last edited 6 weeks ago by GerdP (previous) (diff)

comment:15 Changed 6 weeks ago by GerdP

Hmm, this is quite confusing. The problem was introduced with r3130. Don't know if it worked at that time, but nowadays JOSM only checks one directory when loading plugins, and I think that was introduced with r2817. Still, javadoc in class PluginInformation suggests a different logic:

Try to find a plugin after some criteria. Extract the plugin-information from the plugin and return it. The plugin is searched in the following way:

    first look after an MANIFEST.MF in the package org.openstreetmap.josm.plugins.<plugin name> (After removing all fancy characters from the plugin name). If found, the plugin is loaded using the bootstrap classloader.
    If not found, look for a jar file in the user specific plugin directory (~/.josm/plugins/<plugin name>.jar)
    If not found and the environment variable JOSM_RESOURCES + "/plugins/" exist, look there.
    Try for the java property josm.resources + "/plugins/" (set via java -Djosm.plugins.path=...)
    If the environment variable ALLUSERSPROFILE and APPDATA exist, look in ALLUSERSPROFILE/<the last stuff from APPDATA>/JOSM/plugins. (*sic* There is no easy way under Windows to get the All User's application directory)
    Finally, look in some typical unix paths:

Most of this text was introduced in r247 (!) and wasn't changed much since then. My understanding is that I should revert r3130 and update this class to remove dead code which looks for plugins in further directories.

comment:16 Changed 6 weeks ago by GerdP

Resolution: fixed
Status: newclosed

In 17404/josm:

fix #19006: Incorrect plugins path used
revert r3130, only scan directory returned by Preferences.main().getPluginsDirectory()

comment:17 Changed 6 weeks ago by GerdP

Milestone: 20.12

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain GerdP.
as The resolution will be set.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.