Patch 9.0.0113
Problem: has() is not strict about parsing the patch version.
Solution: Check the version more strictly. (Ken Takata, closes #10752)
Files: src/evalfunc.c, src/testdir/test_expr.vim
*** ../vim-9.0.0112/src/evalfunc.c 2022-07-30 14:56:11.767483770 +0100
--- src/evalfunc.c 2022-07-30 15:42:51.234436850 +0100
***************
*** 6458,6476 ****
x = TRUE;
if (name[5] == '-'
&& STRLEN(name) >= 11
! && vim_isdigit(name[6])
! && vim_isdigit(name[8])
! && vim_isdigit(name[10]))
{
! int major = atoi((char *)name + 6);
! int minor = atoi((char *)name + 8);
! // Expect "patch-9.9.01234".
! n = (major < VIM_VERSION_MAJOR
! || (major == VIM_VERSION_MAJOR
! && (minor < VIM_VERSION_MINOR
! || (minor == VIM_VERSION_MINOR
! && has_patch(atoi((char *)name + 10))))));
}
else if (isdigit(name[5]))
n = has_patch(atoi((char *)name + 5));
--- 6458,6483 ----
x = TRUE;
if (name[5] == '-'
&& STRLEN(name) >= 11
! && (name[6] >= '1' && name[6] <= '9'))
{
! char *end;
! int major, minor;
! // This works for patch-8.1.2, patch-9.0.3, patch-10.0.4, etc.
! // Not for patch-9.10.5.
! major = (int)strtoul((char *)name + 6, &end, 10);
! if (*end == '.' && vim_isdigit(end[1])
! && end[2] == '.' && vim_isdigit(end[3]))
! {
! minor = atoi(end + 1);
!
! // Expect "patch-9.9.01234".
! n = (major < VIM_VERSION_MAJOR
! || (major == VIM_VERSION_MAJOR
! && (minor < VIM_VERSION_MINOR
! || (minor == VIM_VERSION_MINOR
! && has_patch(atoi(end + 3))))));
! }
}
else if (isdigit(name[5]))
n = has_patch(atoi((char *)name + 5));
*** ../vim-9.0.0112/src/testdir/test_expr.vim 2022-07-18 20:48:43.428351586
+0100
--- src/testdir/test_expr.vim 2022-07-30 15:39:42.911589382 +0100
***************
*** 35,47 ****
--- 35,56 ----
call assert_true(has('patch-6.9.999'))
call assert_true(has('patch-7.1.999'))
call assert_true(has('patch-7.4.123'))
+ call assert_true(has('patch-7.4.123 ')) " Traling space can be allowed.
call assert_false(has('patch-7'))
call assert_false(has('patch-7.4'))
call assert_false(has('patch-7.4.'))
call assert_false(has('patch-9.1.0'))
call assert_false(has('patch-9.9.1'))
+
call assert_false(has('patch-abc'))
+ call assert_false(has('patchabc'))
+
+ call assert_false(has('patch-8x001'))
+ call assert_false(has('patch-9X0X0'))
+ call assert_false(has('patch-9-0-0'))
+ call assert_false(has('patch-09.0.0'))
+ call assert_false(has('patch-9.00.0'))
endfunc
func Test_op_ternary()
*** ../vim-9.0.0112/src/version.c 2022-07-30 15:35:08.329140430 +0100
--- src/version.c 2022-07-30 15:43:47.782135393 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 113,
/**/
--
hundred-and-one symptoms of being an internet addict:
197. Your desk collapses under the weight of your computer peripherals.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20220730144426.3B10A1C0ECD%40moolenaar.net.