{"action":"created","issue":{"url":"https://api.github.com/repos/erlang/rebar3/issues/1823","repository_url":"https://api.github.com/repos/erlang/rebar3","labels_url":"https://api.github.com/repos/erlang/rebar3/issues/1823/labels{/name}","comments_url":"https://api.github.com/repos/erlang/rebar3/issues/1823/comments","events_url":"https://api.github.com/repos/erlang/rebar3/issues/1823/events","html_url":"https://github.com/erlang/rebar3/issues/1823","id":334476031,"node_id":"MDU6SXNzdWUzMzQ0NzYwMzE=","number":1823,"title":"Upgrading a global plug-in doesn't clean old files","user":{"login":"eproxus","id":112878,"node_id":"MDQ6VXNlcjExMjg3OA==","avatar_url":"https://avatars1.githubusercontent.com/u/112878?v=4","gravatar_id":"","url":"https://api.github.com/users/eproxus","html_url":"https://github.com/eproxus","followers_url":"https://api.github.com/users/eproxus/followers","following_url":"https://api.github.com/users/eproxus/following{/other_user}","gists_url":"https://api.github.com/users/eproxus/gists{/gist_id}","starred_url":"https://api.github.com/users/eproxus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eproxus/subscriptions","organizations_url":"https://api.github.com/users/eproxus/orgs","repos_url":"https://api.github.com/users/eproxus/repos","events_url":"https://api.github.com/users/eproxus/events{/privacy}","received_events_url":"https://api.github.com/users/eproxus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-06-21T12:42:55Z","updated_at":"2018-06-22T13:45:32Z","closed_at":null,"author_association":"NONE","body":"### Pre-Check ###\r\n\r\n- For bugs, mention if you are willing or interested in helping fix the issue: **Yes**\r\n\r\n### Environment ###\r\n\r\n```\r\n$ rebar3 report \"plugin upgrade rebar3_grisp\"\r\nRebar3 report\r\n version 3.6.0\r\n generated at 2018-06-21T12:33:48+00:00\r\n=================\r\nPlease submit this along with your issue at https://github.com/erlang/rebar3/issues (and feel free to edit out private information, if any)\r\n-----------------\r\nTask: plugin\r\nEntered as:\r\n  plugin upgrade rebar3_grisp\r\n-----------------\r\nOperating System: x86_64-apple-darwin17.6.0\r\nERTS: Erlang/OTP 21 [erts-10.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [hipe]\r\nRoot Directory: /Users/user/.asdf/installs/erlang/21.0\r\nLibrary directory: /Users/user/.asdf/installs/erlang/21.0/lib\r\n-----------------\r\nLoaded Applications:\r\nbbmustache: 1.5.0\r\ncertifi: 2.0.0\r\ncf: 0.2.2\r\ncommon_test: 1.16\r\ncompiler: 7.2\r\ncrypto: 4.3\r\ncth_readable: 1.4.2\r\ndialyzer: 3.3\r\nedoc: 0.9.3\r\nerlware_commons: 1.1.0\r\neunit: 2.3.6\r\neunit_formatters: 0.5.0\r\ngetopt: 1.0.1\r\nhipe: 3.18\r\ninets: 7.0\r\nkernel: 6.0\r\nproviders: 1.7.0\r\npublic_key: 1.6\r\nrelx: 3.25.0\r\nsasl: 3.2\r\nsnmp: 5.2.11\r\nssl_verify_fun: 1.1.3\r\nstdlib: 3.5\r\nsyntax_tools: 2.1.5\r\ntools: 3.0\r\n\r\n-----------------\r\nEscript path: undefined\r\nProviders:\r\n  app_discovery as auto build clean compile compile config cover ct cut deploy deps dialyzer do docs edoc escriptize eunit get-deps help info install install_deps key list lock new owner path pkgs publish release relup report search shell state tar tree unlock update upgrade upgrade upgrade user version xref\r\n\r\n$ cat ~/.config/rebar3/rebar.config\r\n{plugins, [\r\n    rebar3_hex,\r\n    rebar3_auto,\r\n    rebar3_grisp\r\n]}.\r\n```\r\n\r\n### Current behaviour ###\r\n\r\nThe latest version of the `rebar3_grisp` plug-in has [OTP 21 configured in the template file](https://github.com/grisp/rebar3_grisp/blob/master/priv/templates/grispapp.template#L6). However, when upgrading to that version the old `priv` directory seems to be kept. We also see this problem with old beam files being kept, even though the new version of the plug-in is installed resulting in users thinking they're running the newest version (which Rebar 3 confirms) but actually are running old beam files. Because of #1417 it is almost impossible to tell which version is actually installed, and in addition to that, which version is actually used.\r\n\r\n```\r\n$ rebar3 update\r\n===> Updating package registry...\r\n===> Writing registry to /Users/user/.cache/rebar3/hex/default/registry\r\n===> Generating package index...\r\n===> Writing index to /Users/user/.cache/rebar3/hex/default/packages.idx\r\n\r\n\r\n$ rebar3 plugins upgrade rebar3_grisp\r\n===> No upgrade needed for rebar3_grisp\r\n\r\n$ cat ~/.cache/rebar3/plugins/rebar3_grisp/priv/templates/grispapp.template\r\n...\r\n{variables, [\r\n    ...\r\n    {otp_version, \"20.2\", \"Target GRiSP Erlang/OTP version\"}\r\n]}.\r\n...\r\n```\r\n\r\nRemoving the plug-in and \"upgrading\" it again creates the lates versions of the files:\r\n\r\n```\r\n$ rebar3 plugins upgrade rebar3_grisp\r\n===> Fetching rebar3_grisp ({pkg,<<\"rebar3_grisp\">>,<<\"1.1.4\">>})\r\n===> Version cached at /Users/user/.cache/rebar3/hex/default/packages/rebar3_grisp-1.1.4.tar is up to date, reusing it\r\n===> Compiling rebar3_grisp\r\n===> No upgrade needed for rebar3_grisp\r\n\r\n$ cat ~/.cache/rebar3/plugins/rebar3_grisp/priv/templates/grispapp.template\r\n...\r\n{variables, [\r\n    ...\r\n    {otp_version, \"21.0\", \"Target GRiSP Erlang/OTP version\"}\r\n]}.\r\n...\r\n```\r\n\r\n### Expected behaviour ###\r\n\r\n`plugin upgrade` should properly unpack and replace all files bundled with the plugin archive from Hex.\r\n"},"comment":{"url":"https://api.github.com/repos/erlang/rebar3/issues/comments/399447676","html_url":"https://github.com/erlang/rebar3/issues/1823#issuecomment-399447676","issue_url":"https://api.github.com/repos/erlang/rebar3/issues/1823","id":399447676,"node_id":"MDEyOklzc3VlQ29tbWVudDM5OTQ0NzY3Ng==","user":{"login":"ferd","id":111141,"node_id":"MDQ6VXNlcjExMTE0MQ==","avatar_url":"https://avatars2.githubusercontent.com/u/111141?v=4","gravatar_id":"","url":"https://api.github.com/users/ferd","html_url":"https://github.com/ferd","followers_url":"https://api.github.com/users/ferd/followers","following_url":"https://api.github.com/users/ferd/following{/other_user}","gists_url":"https://api.github.com/users/ferd/gists{/gist_id}","starred_url":"https://api.github.com/users/ferd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ferd/subscriptions","organizations_url":"https://api.github.com/users/ferd/orgs","repos_url":"https://api.github.com/users/ferd/repos","events_url":"https://api.github.com/users/ferd/events{/privacy}","received_events_url":"https://api.github.com/users/ferd/received_events","type":"User","site_admin":false},"created_at":"2018-06-22T13:45:32Z","updated_at":"2018-06-22T13:45:32Z","author_association":"CONTRIBUTOR","body":"I've added a section to the docs about this: http://www.rebar3.org/v3/docs/using-available-plugins#section-upgrading-plugins\r\n\r\nLet me know if this solves the problem."}}
{"actor":{"display_login":"ferd"}}