From 93869ba533b89cc23378a8ae76c170ba8fc224d5 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Tue, 16 Feb 2021 15:43:15 +1300 Subject: Add path to accommodate macOS' dynamic $TMPDIR Per a report from Lakshay Garg , the use of $TMPDIR in the Vim plugin's pattern match does not work on macOS X, due to the dynamic and symbolically-linked temporary dir structure this system uses. Lakshay's email to me, which includes a full explanation, is reproduced with his permission below. This change is reflected downstream in the password-store repository: >Date: Sat, 13 Feb 2021 23:59:22 -0800 >From: Lakshay Garg >To: tom@sanctum.geek.nz >Subject: [PATCH] vim: fix redact_pass.vim for macOS > >Hi Tom > >Thanks for maintaining redact_pass.vim. I came across an issue in the >plugin a few months ago and submitted a patch for it to the >password-store mailing list but did not get any responses. It seems >like since only you have been maintaining that file, I might have >better luck sending the patch to you. > >--- > >Problem: redact_pass.vim did not work on macOS machines >Fix: add resolve($TMPDIR) to the autcmd pattern list > >Explanation >=========== > >pass creates files under /private/var/ on macOS. >redact_pass.vim uses the following pattern to detect when to >enable the plugin: > >``` >$TMPDIR/pass.?*/?*.txt >``` > >This pattern expands to "/var///pass.?*/?*.txt" >on my macbook and has two problems: > >1. The double forward slash in the expanded pattern (after ) >2. pass uses /private/var but the pattern looks for /var > >Turns out, /var on macos is just a symlink to /private/var. >The autocmd fails to trigger because it is trying to match >the pattern: "/var///pass.?*/?*.txt" >to filename: "/private/var//pass./.txt" > >The simplest fix is to make $TMPDIR point to "/private/var/..." >which is achieved by calling resolve on $TMPDIR prior to running >the autocmd. This also handles the double forward-slash. > >Thanks again >Lakshay --- plugin/redact_pass.vim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugin/redact_pass.vim b/plugin/redact_pass.vim index 14705ac..bcb9227 100644 --- a/plugin/redact_pass.vim +++ b/plugin/redact_pass.vim @@ -21,4 +21,10 @@ augroup redact_pass \,$TMPDIR/pass.?*/?*.txt \,/tmp/pass.?*/?*.txt \ call redact_pass#() + " Work around macOS' dynamic symlink structure for temporary directories + if has('mac') + autocmd VimEnter + \ /private/var/?*/pass.?*/?*.txt + \ call redact_pass#() + endif augroup END -- cgit v1.2.3