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

bug: Need to set a temporary directory for sed commands when setting global version. (When installed via Nix) #1575

Closed
andrewcrook opened this issue Jun 9, 2023 · 1 comment · Fixed by #1592
Labels

Comments

@andrewcrook
Copy link

andrewcrook commented Jun 9, 2023

Describe the Bug

On a nix system the main ASDF static script files are in a read only directory under the nix store which is generated on building the environment. All files that require write permissions and are generated are taken care by XDG and ASDF environment variables storing then under the users home directory..

However, there is one issue that I have found which is setting ASDF global.
The issue here is that sed wants to create a temporary file under the nix store.

A fix would be to make it use the system's temporary directory and/or add an ASDF environment variable to set it manually
(maybe .asdfrc aswell)

Steps to Reproduce

  1. setup nix
  2. install asdf via nixpkgs
  3. install asdf-python plugin
  4. install python 3.11.3 via asdf
  5. asdf global python python 3.11.3

Expected Behaviour

To set python (or other specified plugin and version ) as the global version

Actual Behaviour

asdf global python 3.11.3
sed: couldn't open temporary file /nix/store/496bar1jwx2a646wnyqzhvqw8iq3pz8i-home-manager-files/sed3ylRgw: Permission denied

Environment

> asdf info

OS:
Darwin Andrews-MBP 22.5.0 Darwin Kernel Version 22.5.0: Mon Apr 24 20:53:44 PDT 2023; root:xnu-8796.121.2~5/RELEASE_ARM64_T8103 arm64

SHELL:
zsh 5.9 (aarch64-apple-darwin21.6.0)

ASDF VERSION:
v0.11.3

ASDF ENVIRONMENT VARIABLES:
ASDF_DATA_DIR=/Users/andrew/.local/share/asdf
ASDF_DIR=/nix/store/hymd5xkvyjr76ppw3pwf2plnzyp0yspa-asdf-vm-0.11.3/share/asdf-vm
ASDF_CONFIG_FILE=/Users/andrew/.config/asdf/asdfrc

ASDF INSTALLED PLUGINS:
nodejs
python
rust

# --------------------------------------------------------

 > nix-info -m
 - system: `"aarch64-darwin”`
 - host os: `Darwin 22.5.0, macOS 13.4`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 2.13.3`
 - channels(andrew): `””`
 - channels(root): `””`
 - nixpkgs: `/nix/store/w18hyx1dwk4pa591rjyv5g6w0ayf3qcz-source`
# ------------------------------------------------------------------

> echo $TMPDIR
/var/folders/tg/wd1yw6m12mz7vyb1nw2wz9n80000gn/T/

# ------------------------------------------------------------------
> sed --version
sed (GNU sed) 4.9

# ------------------------------------------------------------------

> which sed
/run/current-system/sw/bin/sed

 which is a symbolic link to the nix store 
/run/current-system/sw/bin/sed -> /nix/store/c3g4kbjz47jksvzid2qarxnx8mqdacr1-gnused-4.9/bin/sed

# -------------------------------------------------------------------
The directory Sed tried to write to is in fact root of nix home-managers Applications directory under nix store.  
/nix/store/496bar1jwx2a646wnyqzhvqw8iq3pz8i-home-manager-files/

this contains "Applications/Home manager Apps" which is symbolically linked to the main macOS Applications directory. I have no idea why sed is trying to temporary store data here.

asdf plugins affected (if relevant)

seems to be most if not all plugins
I think its asdf itself.

@andrewcrook andrewcrook added the bug label Jun 9, 2023
@hyperupcall
Copy link
Contributor

hyperupcall commented Jul 11, 2023

Related/duplicate of #1556

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants