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

Tempdir code tries writing to root owned path #124

Closed
jrudess opened this issue Jul 16, 2019 · 10 comments
Closed

Tempdir code tries writing to root owned path #124

jrudess opened this issue Jul 16, 2019 · 10 comments

Comments

@jrudess
Copy link

jrudess commented Jul 16, 2019

The new tempdir code in 310ca5b is trying to access a root owned path using Vim 8.1 in linux.

The problem is a missing / between the temp-directory and sha-hash so the paths end up in the form "/tmp3ab83353affetcetc"

The following patch appears to solve it for my environment which has $TMPDIR set to '/tmp'

let tmp = '/' . sha256(fnamemodify(bufname(t:vista.source.bufnr), ":p"))
@daveyarwood
Copy link

I'm experiencing this issue as well, even after updating to e08bb0b.

I can see why e08bb0b doesn't fix the issue. On my system, TMPDIR is set to a directory that doesn't have a slash on the end -- which makes sense, I think, as a convention:

$ echo $TMPDIR
/tmp/user/1000

I think the slash was added in the wrong place, i.e. vista.vim should assume that TMPDIR does not end in a slash, and prepend a slash to the route being added to it. Hopefully that makes sense.

@daveyarwood
Copy link

2019-07-17-124656_1727x115_scrot

^ This is the symptom.

liuchengxu added a commit that referenced this issue Jul 18, 2019
@liuchengxu
Copy link
Owner

I have pushed a commit to catch the error and fall back to the safe tempname() way. Hopefully it could fix your issue. @dav

@petobens
Copy link

When running :Vista I'm now seeing the following:

Error detected while processing function vista#[24]..vista#sidebar#Open[12]..vista#executive#ctags#Execute[2]..<SNR>168_Dispatch[12]..<SNR>168_Execute[3]..<SNR>168_ApplyExecute[1]..<SNR>168_IntoTemp:
line   38:
E121: Undefined variable: tmp
E116: Invalid arguments for function writefile
E15: Invalid expression: writefile(lines, tmp) == 0

@liuchengxu
Copy link
Owner

@petobens Can you provide a minimal vimrc? I can't reproduce.

@daveyarwood
Copy link

That commit fixes the issue for me.

@joshuarubin
Copy link

Same issue as @petobens, $TMPDIR is not set so there is nothing to catch as a result tmp is never initialized.

liuchengxu added a commit that referenced this issue Jul 18, 2019
@liuchengxu
Copy link
Owner

Thanks @petobens @joshuarubin . Please pull the latest commit, should be fixed.

@joshuarubin
Copy link

looks good, thx

@petobens
Copy link

Thanks!

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

No branches or pull requests

5 participants