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

tempname() fails when NVIM_APPNAME is set to subdirectory #23056

Closed
Subjective opened this issue Apr 12, 2023 · 1 comment · Fixed by #23211 or #25233
Closed

tempname() fails when NVIM_APPNAME is set to subdirectory #23056

Subjective opened this issue Apr 12, 2023 · 1 comment · Fixed by #23211 or #25233
Labels
bug issues reporting wrong behavior

Comments

@Subjective
Copy link

Subjective commented Apr 12, 2023

Problem

When NVIM_APPNAME contains a subdirectory, tempname() fails to return anything. For example, I store all of my nvim configs in $HOME/nvim-profiles and use an alias to run nvim with the the NVIM_APPNAME variable set. However, any plugins that rely on tempname() to generate a temporary directory are not able to run properly.

Before NVIM_APPNAME, I just set the various XDG_HOME variables using the following shell script, and everything worked fine:

Shell Script
#!/bin/sh
NVIM_PROFILE_NAME=""
NVIM_COMMAND="nvim"

exec env XDG_CONFIG_HOME="$HOME/.config/nvim-profiles/${NVIM_PROFILE_NAME}" \
         XDG_DATA_HOME="$HOME/.local/share/nvim-profiles/${NVIM_PROFILE_NAME}" \
         XDG_STATE_HOME="$HOME/.local/state/nvim-profiles/${NVIM_PROFILE_NAME}" \
         XDG_CACHE_HOME="$HOME/.cache/nvim-profiles/${NVIM_PROFILE_NAME}" \
         ${NVIM_COMMAND} \
         "$@"

Steps to reproduce

  1. Run the following commands in terminal
cd $HOME
NVIM_APPNAME="some_directory/TestVim" nvim
  1. execute "echo tempname()" in neovim
  2. Nothing gets returned
  3. Run NVIM_APPNAME="TestVim" nvim
  4. tempname() returns a temporary directory path

Expected behavior

I would expect tempname() to return the path to a temporary directory:

Screen Recording 2023-04-12 at 1 50 51 PM

Interestingly enough, calling the alias in the ~/.local/state directory allows tempname() to return a directory. No clue why this happens.

Screen_Recording_2023-04-12_at_12 39 51_PM

Neovim version (nvim -v)

NVIM v0.10.0-dev-46+ge23c6ebed

Vim (not Nvim) behaves the same?

no

Operating system/version

macOS 13.3

Terminal name/version

Kitty 0.27.1

$TERM environment variable

xterm-kitty

Installation

bob

@Subjective Subjective added the bug issues reporting wrong behavior label Apr 12, 2023
@bfredl
Copy link
Member

bfredl commented Apr 12, 2023

as of 0.9, NVIM_APPNAME only supports, well, a name, not a full path, which was never intended. The simplest solution would be to add a proper error message for this instead of random errors down the line, as you get now.

glacambre added a commit to glacambre/neovim that referenced this issue Apr 20, 2023
glacambre added a commit to glacambre/neovim that referenced this issue Apr 20, 2023
glacambre added a commit to glacambre/neovim that referenced this issue Apr 20, 2023
glacambre added a commit to glacambre/neovim that referenced this issue Apr 20, 2023
glacambre added a commit to glacambre/neovim that referenced this issue Apr 20, 2023
glacambre added a commit to glacambre/neovim that referenced this issue Apr 20, 2023
glacambre added a commit to glacambre/neovim that referenced this issue Apr 20, 2023
glacambre added a commit to glacambre/neovim that referenced this issue Apr 20, 2023
glacambre added a commit to glacambre/neovim that referenced this issue Apr 20, 2023
glacambre added a commit to glacambre/neovim that referenced this issue May 7, 2023
glacambre added a commit to glacambre/neovim that referenced this issue May 7, 2023
glacambre added a commit to glacambre/neovim that referenced this issue May 7, 2023
justinmk pushed a commit to RoryNesbitt/neovim that referenced this issue Sep 27, 2023
Problem:
NVIM_APPNAME does not allow path separators in the name, which means
relative paths can't be used:

    NVIM_APPNAME="neovim-configs/first-config" nvim
    NVIM_APPNAME="neovim-configs/second-config" nvim

Solution:
- Let NVIM_APPNAME be a relative path. Absolute paths are not supported.
- Also change tempname() to replace "/" with "%" instead of "_", for
  consistency.

fix neovim#23056
fix neovim#24966
justinmk pushed a commit to RoryNesbitt/neovim that referenced this issue Sep 27, 2023
Problem:
NVIM_APPNAME does not allow path separators in the name, so relative
paths can't be used:

    NVIM_APPNAME="neovim-configs/first-config" nvim
    NVIM_APPNAME="neovim-configs/second-config" nvim

Solution:
Let NVIM_APPNAME be a relative path. Absolute paths are not supported.

fix neovim#23056
fix neovim#24966
justinmk pushed a commit to RoryNesbitt/neovim that referenced this issue Sep 27, 2023
Problem:
NVIM_APPNAME does not allow path separators in the name, so relative
paths can't be used:

    NVIM_APPNAME="neovim-configs/first-config" nvim
    NVIM_APPNAME="neovim-configs/second-config" nvim

Solution:
Let NVIM_APPNAME be a relative path. Absolute paths are not supported.

fix neovim#23056
fix neovim#24966
justinmk pushed a commit to RoryNesbitt/neovim that referenced this issue Sep 27, 2023
Problem:
NVIM_APPNAME does not allow path separators in the name, so relative
paths can't be used:

    NVIM_APPNAME="neovim-configs/first-config" nvim
    NVIM_APPNAME="neovim-configs/second-config" nvim

Solution:
Let NVIM_APPNAME be a relative path. Absolute paths are not supported.

fix neovim#23056
fix neovim#24966
justinmk pushed a commit to RoryNesbitt/neovim that referenced this issue Sep 27, 2023
Problem:
NVIM_APPNAME does not allow path separators in the name, so relative
paths can't be used:

    NVIM_APPNAME="neovim-configs/first-config" nvim
    NVIM_APPNAME="neovim-configs/second-config" nvim

Solution:
Let NVIM_APPNAME be a relative path. Absolute paths are not supported.

fix neovim#23056
fix neovim#24966
justinmk pushed a commit that referenced this issue Sep 27, 2023
Problem:
NVIM_APPNAME does not allow path separators in the name, so relative
paths can't be used:

    NVIM_APPNAME="neovim-configs/first-config" nvim
    NVIM_APPNAME="neovim-configs/second-config" nvim

Solution:
Let NVIM_APPNAME be a relative path. Absolute paths are not supported.

fix #23056
fix #24966
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug issues reporting wrong behavior
Projects
None yet
2 participants