{"action":"opened","issue":{"url":"https://api.github.com/repos/xodio/xod/issues/1205","repository_url":"https://api.github.com/repos/xodio/xod","labels_url":"https://api.github.com/repos/xodio/xod/issues/1205/labels{/name}","comments_url":"https://api.github.com/repos/xodio/xod/issues/1205/comments","events_url":"https://api.github.com/repos/xodio/xod/issues/1205/events","html_url":"https://github.com/xodio/xod/issues/1205","id":322212766,"number":1205,"title":"Durable toolchain download and install","user":{"login":"nkrkv","id":146383,"avatar_url":"https://avatars2.githubusercontent.com/u/146383?v=4","gravatar_id":"","url":"https://api.github.com/users/nkrkv","html_url":"https://github.com/nkrkv","followers_url":"https://api.github.com/users/nkrkv/followers","following_url":"https://api.github.com/users/nkrkv/following{/other_user}","gists_url":"https://api.github.com/users/nkrkv/gists{/gist_id}","starred_url":"https://api.github.com/users/nkrkv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nkrkv/subscriptions","organizations_url":"https://api.github.com/users/nkrkv/orgs","repos_url":"https://api.github.com/users/nkrkv/repos","events_url":"https://api.github.com/users/nkrkv/events{/privacy}","received_events_url":"https://api.github.com/users/nkrkv/received_events","type":"User","site_admin":false},"labels":[{"id":423698424,"url":"https://api.github.com/repos/xodio/xod/labels/s:client","name":"s:client","color":"c5def5","default":false},{"id":244645487,"url":"https://api.github.com/repos/xodio/xod/labels/t:bug","name":"t:bug","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-11T08:31:13Z","updated_at":"2018-05-11T08:31:13Z","closed_at":null,"author_association":"OWNER","body":"The issue appears on the forum from time to time. Manual recovering is cumbersome. And the flaw affects newcomers.\r\n\r\n### Steps to reproduce\r\n\r\n1. Make a fresh install of the desktop IDE (no packages or tools installed)\r\n2. Connect a board and try to upload an empty patch\r\n3. Close IDE quickly before it has a chance to complete 100 MB download\r\n4. Open IDE again and try to upload again\r\n\r\n### Expected behavior\r\n\r\n- The incomplete toolchain download/install is restarted or resumed\r\n\r\n### Actual behavior\r\n\r\n- Depending on the stage when it was interrupted: an ENOENT error about `boards.txt`, or hanging\r\n\r\n### How to fix\r\n\r\nThe problems are in `doesXxxxExist` in `packages/xod-arduino-deploy/src/packageManager.js`. They use directory existence as a sign the toolchain was successfully installed. However, the directory is created right at the start of big archives download so in case of an interruption XOD IDE cannot differentiate between complete and incomplete toolchain install.\r\n\r\nThe algorithm should be changed to be more durable:\r\n\r\n* Use the full path to a marker file `INSTALLED` when checking whether a toolchain is installed or not\r\n* Use the full path to an archive to check whether the required tool bundle is present on FS or should be downloaded\r\n* Download archives into files with temporary `.part` extension like web-browsers do\r\n* When a download is complete, rename the file to drop the `.part` extension\r\n* When unarchiving is complete, touch the `INSTALLED` marker file in the destination directory"}}
{"actor":{"display_login":"nkrkv"}}