Skip to content

Arduino15/library_index.json.tmp.gz is not refreshed #4272

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

Closed
MichaelJonker opened this issue Dec 7, 2015 · 1 comment
Closed

Arduino15/library_index.json.tmp.gz is not refreshed #4272

MichaelJonker opened this issue Dec 7, 2015 · 1 comment
Labels
Component: Board/Lib Manager Boards Manager or Library Manager
Milestone

Comments

@MichaelJonker
Copy link

Hello, I see still an issue with the library manager. This was also reported in #4139

I noticed the issue is still there after I released a new version of a contributed library, which not did show up in the library manager. I tried this with the latest nightly build (of 20151204 02:17).

The symptoms are still the same, the file library_index.json.tmp.gz is not refreshed and I do not see the new libraries versions.

After renaming the file library_index.json.tmp.gz to something different, the IDE loads a new library_index.json.tmp.gz version and I see the new library updates in the library manager.
When I delete the newly copied library_index.json.tmp.gz and rename the old one back again, then I only see the old versions in the library manager.

Michael Jonker

@vicnevicne
Copy link

I checked the code. The issue is that the downloaded gz file is never deleted.
Consequently, when a new version is downloaded again, the "tmpFile.renameTo(gzipTmpFile)" fails (at cc/arduino/contributions/GZippedJsonDownloader.java:56 ).
The result (false) is not checked, so the process goes on and uncompresses the old version over and over again.

The fix is to delete the previous file by adding

      gzipTmpFile.delete();

As the file is named "tmp", I guess the intention of the author was to delete it once uncompressed so I would add the delete right after the call to decompress(), as follows :

      new JsonDownloader(downloader, gzippedUrl).download(tmpFile, progress, statusText, progressListener);
      File gzipTmpFile = new File(tmpFile.getParentFile(), GzipUtils.getCompressedFilename(tmpFile.getName()));
      tmpFile.renameTo(gzipTmpFile);
      decompress(gzipTmpFile, tmpFile);
      gzipTmpFile.delete();

Alternately, to ease debugging, the delete could also be called just before the rename, to always keep one version on the disk, as follows :

      new JsonDownloader(downloader, gzippedUrl).download(tmpFile, progress, statusText, progressListener);
      File gzipTmpFile = new File(tmpFile.getParentFile(), GzipUtils.getCompressedFilename(tmpFile.getName()));
      gzipTmpFile.delete();
      tmpFile.renameTo(gzipTmpFile);
      decompress(gzipTmpFile, tmpFile);

Can someone review and include that fix ?

KR. Vicne

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Board/Lib Manager Boards Manager or Library Manager
Projects
None yet
Development

No branches or pull requests

4 participants