Patch 9.0.0028
Problem: MS-Windows: tests fail if there is a stray "runtime" directory.
Solution: Only use a "runtime" directory if it contains "defaults.vim".
Files: src/misc1.c, src/filepath.c
*** ../vim-9.0.0027/src/misc1.c 2022-06-27 18:55:57.000000000 +0100
--- src/misc1.c 2022-07-02 17:26:35.404926367 +0100
***************
*** 1655,1661 ****
vim_free(p);
p = concat_fnames(vimdir, (char_u *)RUNTIME_DIRNAME, TRUE);
if (p != NULL && mch_isdir(p))
! return p;
vim_free(p);
return NULL;
}
--- 1655,1675 ----
vim_free(p);
p = concat_fnames(vimdir, (char_u *)RUNTIME_DIRNAME, TRUE);
if (p != NULL && mch_isdir(p))
! {
! char_u *fname = concat_fnames(p, (char_u *)"defaults.vim", TRUE);
!
! // Check that "defaults.vim" exists in this directory, to avoid picking
! // up a stray "runtime" directory, it would make many tests fail in
! // mysterious ways.
! if (fname != NULL)
! {
! int exists = file_is_readable(fname);
!
! vim_free(fname);
! if (exists)
! return p;
! }
! }
vim_free(p);
return NULL;
}
*** ../vim-9.0.0027/src/filepath.c 2022-06-16 11:31:18.000000000 +0100
--- src/filepath.c 2022-07-02 17:25:51.052917595 +0100
***************
*** 774,779 ****
--- 774,799 ----
shorten_dir_len(str, 1);
}
+ /*
+ * Return TRUE if "fname" is a readable file.
+ */
+ int
+ file_is_readable(char_u *fname)
+ {
+ int fd;
+
+ #ifndef O_NONBLOCK
+ # define O_NONBLOCK 0
+ #endif
+ if (*fname && !mch_isdir(fname)
+ && (fd = mch_open((char *)fname, O_RDONLY | O_NONBLOCK, 0)) >= 0)
+ {
+ close(fd);
+ return TRUE;
+ }
+ return FALSE;
+ }
+
#if defined(FEAT_EVAL) || defined(PROTO)
/*
***************
*** 894,919 ****
}
/*
- * Return TRUE if "fname" is a readable file.
- */
- int
- file_is_readable(char_u *fname)
- {
- int fd;
-
- #ifndef O_NONBLOCK
- # define O_NONBLOCK 0
- #endif
- if (*fname && !mch_isdir(fname)
- && (fd = mch_open((char *)fname, O_RDONLY | O_NONBLOCK, 0)) >= 0)
- {
- close(fd);
- return TRUE;
- }
- return FALSE;
- }
-
- /*
* "filereadable()" function
*/
void
--- 914,919 ----
*** ../vim-9.0.0027/src/version.c 2022-07-02 16:29:15.031193541 +0100
--- src/version.c 2022-07-02 17:36:11.064535993 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 28,
/**/
--
Those who live by the sword get shot by those who don't.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///