Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Customizer runs forever with error that destination file exists #12

Open
msoutopico opened this issue Sep 4, 2020 · 3 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@msoutopico
Copy link
Collaborator

msoutopico commented Sep 4, 2020

Preconditions

OmegaT 4.x.x installed in a machine running Windows 10.
Script application_startup\updateConfigBundle.groovy is version 0.4.9 and def customUrl = ""
File customisation.properties has url: https://cat.capstan.be/OmegaT/dev2021_049/index.php
Local customization version 57_cs0 (2020-11-25)
Remote customization version 58_c0p (2020-11-26)

Local plugins:

  • okapiFiltersForOmegaT-1.6-m40-capstan.jar
  • omegat-bidimarkers-0.2.0-all.jar
  • plugin-omt-package-1.6.3.jar

Remote plugins:

  • okapiFiltersForOmegaT-1.8-1.40.0-capstan.jar (NEW)
  • omegat-bidimarkers-0.2.0-all.jar
  • plugin-omt-package-1.6.3.jar

Steps to reproduce

Just launch OmegaT.

Expected results

The script runs and sees that okapiFiltersForOmegaT-1.8-1.40.0-capstan.jar is a new version of okapiFiltersForOmegaT-1.6-m40-capstan.jar, so the former must replace the latter.

The new version is downloaded and, after OmegaT shuts down, the old version of the plugin is deleted (by means of the bat file triggered by the script).

Actual results

The progress bar dialog runs forever and the script fails with error javax.script.ScriptException: javax.script.ScriptException: org.apache.commons.io.FileExistsException: Destination 'C:\Users\souto\AppData\Roaming\OmegaT\plugins\omegat-bidimarkers-0.2.0-all.jar' already exists.

See full console output:

========================================
          Customisation Update
========================================
Local customisation version is 51_c0p.
Remote customisation version is 53_cs0.
Customisation update available:
* Config needs to be updated.
* Scripts need to be updated.
* Plugins need to be updated.
----------------------------------------
config.zip is being downloaded...
config.zip is being unpacked...
Customisation is being updated...
OmegaT will need to be restarted.
    -- Done --
----------------------------------------
scripts.zip is being downloaded...
scripts.zip is being unpacked...
Scripts are being installed...
Scripts provided 
in the customisation bundle 
copied to 
  C:\Users\souto\AppData\Roaming\OmegaT\scripts.
    -- Done --
----------------------------------------
plugins.zip is being downloaded...
plugins.zip is being unpacked...
Plugins are being installed...
  --
Folder
  C:\Program Files\OmegaT\plugins
is not writable, but it contains file(s)
which should be updated by this
customisation update utility:

    C:\Program Files\OmegaT\plugins\plugin-omt-package-1.6.3.jar
    C:\Program Files\OmegaT\plugins\plugin-omt-package-1.6.3.jar

Make sure the listed files are deleted
before you start OmegaT again.
The newer versions of these files
will be installed
into user's configuration folder.
  --
An error occurred
javax.script.ScriptException: javax.script.ScriptException: org.apache.commons.io.FileExistsException: Destination 'C:\Users\souto\AppData\Roaming\OmegaT\plugins\omegat-bidimarkers-0.2.0-all.jar' already exists

Reproduced in my machine. Other users haver reported same behaviour (customizer runs forever), although I couldn't see whether they had the same error.

The only way to stop that is to close the progress bar dialog, which closes OmegaT. The version_notes.txt is updated/overwritten, whereas the local_version_notes.txt remains unaltered.

@msoutopico msoutopico added the bug Something isn't working label Sep 4, 2020
@msoutopico msoutopico changed the title Customizer runs forever with error Customizer runs forever with error that destination file exists Sep 4, 2020
@msoutopico
Copy link
Collaborator Author

Sample jar files can be downloaded from https://capps.capstan.be/Files/plugins.zip

@msoutopico
Copy link
Collaborator Author

msoutopico commented Sep 7, 2020

Screencast that shows the problem: https://recordit.co/8qceTOldMj

Another one, although with a less realistic scenario: https://recordit.co/BD63bmEs34

@msoutopico
Copy link
Collaborator Author

msoutopico commented Nov 26, 2020

Not sure why this issue happens, but I assume it is because the script tries to put a jar file in the plugins folder and it can't because the file (a file with the same name) is already there (with the same name) and/or because the file is locked.

If that's the case, to make things easier, I think it should be reasonable to assume that a new version of a plugin should always have a new name (a higher version number). The implication is that script doesn't try to overwrite jar files that have the same name.

In other words, for each jar file in the plugins.zip bundle, it checks whether it is in the plugins folder already):

  1. if it is, it passes and moves to the next one
  2. if it's not,
    a. it writes the jar file to the plugins folder and
    b. checks whether there's a older version of the same plugin, to delete it later (after OmegaT is killed) by means of the bat file.

In a nutshell: skip file instead of overwriting (that would be the only change).

The above is of course a compromise, because the ideal behavior is that it writes all files in the plugins.zip bundle to the plugins folder, overwrites any file that might be already there. If that's not feasible or easy to achieve, we can go with the above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants