patch 8.2.3388: fnamemodify('path/..', ':p') differs from using 'path/../'
Problem: fnamemodify('path/..', ':p') differs from using 'path/../'.
Solution: Include the "/.." in the directory name. (closes #8808)
diff --git a/src/os_unix.c b/src/os_unix.c
index b603927..a3e5430 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -2602,6 +2602,10 @@
*/
if (p != NULL)
{
+ if (STRCMP(p, "/..") == 0)
+ // for "/path/dir/.." include the "/.."
+ p += 3;
+
#ifdef HAVE_FCHDIR
/*
* Use fchdir() if possible, it's said to be faster and more
@@ -2644,8 +2648,10 @@
vim_strncpy(buf, fname, p - fname);
if (mch_chdir((char *)buf))
retval = FAIL;
- else
+ else if (*p == '/')
fname = p + 1;
+ else
+ fname = p;
*buf = NUL;
}
}