Comments (13)
Some things that are looking for global configuration will actually end up in REBAR_CACHE_DIR/.config/rebar3/... which is wrong (in my opinion).
I faced this issue today when I tried to use rebar3 with kerl, where kerl defines the REBAR_CACHE_DIR environment variable specific for each OTP installation. The rebar3 new
command didn't look up ~/.config/rebar3/templates, and it took a few hours for me to find out why by thoroughly reviewing the source code.
from rebar3.
I looked at this, and reading @eproxus' comment, I'm as confused regarding what should be set. I do agree that it seems odd we're setting global_rebar_dir
for REBAR_CACHE_DIR
(this appears to be done twice), but I didn't dig much further.
from rebar3.
Yeah I think I recall digging in slack, and the unfortunate state is that this stuff is all very inconsistent and will be hard to fix without breaking anyone's setup. This would need a full re-mapping and clean-up to re-define where the values are set, what they mean, and how they're used.
It's very possible right now that it was intended one way in a code area, and was used another one in another area, and that there's no way to fix this without willingly breaking either pattern in a specific context.
from rebar3.
One thing I'd like to suggest is that this behavior of ${REBAR_CACHE_DIR/.config/rebar3/templates
and the other affected settings should be documented. I couldn't find the document.
from rebar3.
I just came across this issue as well (with an automated template install that wasn't being recognized), and my solution was to make a little plugin for outputting directories.
https://github.com/choptastic/rebar3_dirs and https://hex.pm/packages/rebar3_dirs
At least this way, I can use something that, should this functionality ever change, will hopefully remain backwards compatible, rather than having to know and then code around the internal logic for where the config directory ends up.
$ rebar3 dirs template_dir
/home/gumm/kerl/26.2.4/.cache/rebar3/.config/rebar3/templates
$ rebar3 dirs
base_dir: /home/gumm/code/myapp/_build/default
deps_dir: /home/gumm/code/myapp/_build/default/lib
root_dir: /home/gumm/code/myapp/.
checkouts_dir: /home/gumm/code/myapp/_checkouts
checkouts_out_dir: /home/gumm/code/myapp/_build/default/checkouts
plugins_dir: /home/gumm/code/myapp/_build/default/plugins
lib_dirs: apps/*lib/*.
project_plugin_dirs: plugins/*
global_config_dir: /home/gumm/kerl/26.2.4/.cache/rebar3/.config/rebar3
global_config: /home/gumm/kerl/26.2.4/.cache/rebar3/.config/rebar3/rebar.config
template_dir: /home/gumm/kerl/26.2.4/.cache/rebar3/.config/rebar3/templates
from rebar3.
@choptastic That should be built into Rebar itself! ❤️
from rebar3.
@choptastic That should be built into Rebar itself! ❤️
I certainly appreciate the appreciation.
I'll gladly submit a PR to rebar3 if the team wants.
from rebar3.
I wouldn't be opposed to having this sort of stuff built in, though there's some potential confusion around what we do for subtasks and hooks' env vars: https://github.com/erlang/rebar3/blob/main/apps/rebar/src/rebar_env.erl
from rebar3.
I'm facing a related issue, and I'm not sure what is the right way to proceed. We use kerl to install Erlang on multi-user systems, and the recent change involving REBAR_CACHE_DIR requires that those users have write access to the location in which kerl has installed the Erlang package.
===> Could not write to "/opt/kerl/lib/26.2.5/.cache/rebar3/hex". Please ensure the path is writeable.
The pain point for me as system administrator, is that I would rather not expose this path as writeable to the users on the system.
I believe before the change in kerl (#457), rebar would have used the default ~/.cache/rebar3/hex
.
I'm unsure if my question belongs in the rebar project or kerl project, but discussion on this topic seems to be centered here for now.
As a temporary workaround, I've instructed users to use the following when activating a kerl installation:
. /opt/kerl/lib/26.2.5/activate
unset REBAR_CACHE_DIR
unset REBAR_PLT_DIR
from rebar3.
@JesseStimpson, this might also be of interest: kerl/kerl#495.
from rebar3.
At this point I don't think it is possible to solve this, we just made too many inconsistent choices within Rebar3 over the years. The only thing that seems reasonable is to map out all the use cases and breakage points, and pick and choose what is a clearer future behavior, and whatever option we pick will be backwards incompatible for some users and use cases.
from rebar3.
Ugh, was global_rebar_dir
inherited from rebar2? It seems off...
from rebar3.
Also was meaning forever to move templates to XDG_DATA_HOME or ~/.local/share/rebar3
from rebar3.
Related Issues (20)
- rebar3 auto: Error loading module enotify HOT 1
- Tag usage in newer rebar3 versions HOT 14
- Hooks env variables documentation HOT 1
- {mode, ...} overrides variables explicitly set in the profile
- rebar3 killed spawned processes after compile HOT 1
- Dependency post_hooks clean override not executed. HOT 3
- `rebar3 version` compiles dependencies before outputting value HOT 5
- cover aggregation bug HOT 6
- `REBAR_SRC_DIRS` not available in hook HOT 5
- code:lib_dir/2 is deprecated; this functionality will be removed in a future release HOT 4
- How to execute a Function just before aborting rebar3 shell? HOT 6
- Cannot deploy application because of "Uncaught error in rebar_core" HOT 1
- tests in separate test modules are performed twice by eunit command HOT 6
- error rebar_core HOT 2
- Request new `rebar3` release HOT 4
- rebar3 shell doesn't return prompt HOT 1
- ENV variable replacement with nested configs in releases HOT 3
- Fetching dependency by git ref fails when upgrading to Erlang 26 HOT 2
- `bootstrap --offline` uses https_proxy HOT 3
- rebar3 shell randomly fails on Windows in OTP 27 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rebar3.