home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.3 / 7.3.1295 < prev    next >
Encoding:
Internet Message Format  |  2013-07-02  |  10.5 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.1295
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.3.1295
  11. Problem:    glob() and globpath() do not handle escaped special characters
  12.         properly.
  13. Solution:   Handle escaped characters differently. (Adnan Zafar)
  14. Files:        src/testdir/Makefile, src/testdir/test97.in,
  15.         src/testdir/test97.ok, src/testdir/Make_amiga.mak,
  16.         src/testdir/Make_dos.mak, src/testdir/Make_ming.mak,
  17.         src/testdir/Make_os2.mak, src/testdir/Make_vms.mms, src/fileio.c,
  18.         src/misc1.c
  19.  
  20.  
  21. *** ../vim-7.3.1294/src/testdir/Makefile    2013-07-01 21:24:40.000000000 +0200
  22. --- src/testdir/Makefile    2013-07-03 16:20:47.000000000 +0200
  23. ***************
  24. *** 29,35 ****
  25.           test79.out test80.out test81.out test82.out test83.out \
  26.           test84.out test85.out test86.out test87.out test88.out \
  27.           test89.out test90.out test91.out test92.out test93.out \
  28. !         test94.out test95.out test96.out
  29.   
  30.   SCRIPTS_GUI = test16.out
  31.   
  32. --- 29,35 ----
  33.           test79.out test80.out test81.out test82.out test83.out \
  34.           test84.out test85.out test86.out test87.out test88.out \
  35.           test89.out test90.out test91.out test92.out test93.out \
  36. !         test94.out test95.out test96.out test97.out
  37.   
  38.   SCRIPTS_GUI = test16.out
  39.   
  40. *** ../vim-7.3.1294/src/testdir/test97.in    2013-07-03 16:52:09.000000000 +0200
  41. --- src/testdir/test97.in    2013-07-03 16:24:24.000000000 +0200
  42. ***************
  43. *** 0 ****
  44. --- 1,17 ----
  45. + Test whether glob()/globpath() return correct results with certain escaped
  46. + characters.
  47. + STARTTEST
  48. + :so small.vim
  49. + :set shell=doesnotexist
  50. + :e test.out
  51. + :put =glob('Xxx\{')
  52. + :put =glob('Xxx\$')
  53. + :w! Xxx{
  54. + :w! Xxx\$
  55. + :put =glob('Xxx\{')
  56. + :put =glob('Xxx\$')
  57. + :w
  58. + :qa!
  59. + ENDTEST
  60. *** ../vim-7.3.1294/src/testdir/test97.ok    2013-07-03 16:52:09.000000000 +0200
  61. --- src/testdir/test97.ok    2013-07-03 16:14:50.000000000 +0200
  62. ***************
  63. *** 0 ****
  64. --- 1,5 ----
  65. + Xxx{
  66. + Xxx$
  67. *** ../vim-7.3.1294/src/testdir/Make_amiga.mak    2013-07-01 21:24:40.000000000 +0200
  68. --- src/testdir/Make_amiga.mak    2013-07-03 16:21:39.000000000 +0200
  69. ***************
  70. *** 33,39 ****
  71.           test76.out test77.out test78.out test79.out test80.out \
  72.           test81.out test82.out test83.out test84.out test88.out \
  73.           test89.out test90.out test91.out test92.out test93.out \
  74. !         test94.out test95.out test96.out
  75.   
  76.   .SUFFIXES: .in .out
  77.   
  78. --- 33,39 ----
  79.           test76.out test77.out test78.out test79.out test80.out \
  80.           test81.out test82.out test83.out test84.out test88.out \
  81.           test89.out test90.out test91.out test92.out test93.out \
  82. !         test94.out test95.out test96.out test97.out
  83.   
  84.   .SUFFIXES: .in .out
  85.   
  86. ***************
  87. *** 146,148 ****
  88. --- 146,149 ----
  89.   test94.out: test94.in
  90.   test95.out: test95.in
  91.   test96.out: test96.in
  92. + test97.out: test97.in
  93. *** ../vim-7.3.1294/src/testdir/Make_dos.mak    2013-07-01 21:24:40.000000000 +0200
  94. --- src/testdir/Make_dos.mak    2013-07-03 16:21:46.000000000 +0200
  95. ***************
  96. *** 32,38 ****
  97.           test79.out test80.out test81.out test82.out test83.out \
  98.           test84.out test85.out test86.out test87.out test88.out \
  99.           test89.out test90.out test91.out test92.out test93.out \
  100. !         test94.out test95.out test96.out
  101.   
  102.   SCRIPTS32 =    test50.out test70.out
  103.   
  104. --- 32,38 ----
  105.           test79.out test80.out test81.out test82.out test83.out \
  106.           test84.out test85.out test86.out test87.out test88.out \
  107.           test89.out test90.out test91.out test92.out test93.out \
  108. !         test94.out test95.out test96.out test97.out
  109.   
  110.   SCRIPTS32 =    test50.out test70.out
  111.   
  112. *** ../vim-7.3.1294/src/testdir/Make_ming.mak    2013-07-01 21:24:40.000000000 +0200
  113. --- src/testdir/Make_ming.mak    2013-07-03 16:21:49.000000000 +0200
  114. ***************
  115. *** 52,58 ****
  116.           test79.out test80.out test81.out test82.out test83.out \
  117.           test84.out test85.out test86.out test87.out test88.out \
  118.           test89.out test90.out test91.out test92.out test93.out \
  119. !         test94.out test95.out test96.out
  120.   
  121.   SCRIPTS32 =    test50.out test70.out
  122.   
  123. --- 52,58 ----
  124.           test79.out test80.out test81.out test82.out test83.out \
  125.           test84.out test85.out test86.out test87.out test88.out \
  126.           test89.out test90.out test91.out test92.out test93.out \
  127. !         test94.out test95.out test96.out test97.out
  128.   
  129.   SCRIPTS32 =    test50.out test70.out
  130.   
  131. *** ../vim-7.3.1294/src/testdir/Make_os2.mak    2013-07-01 21:24:40.000000000 +0200
  132. --- src/testdir/Make_os2.mak    2013-07-03 16:21:51.000000000 +0200
  133. ***************
  134. *** 33,39 ****
  135.           test76.out test77.out test78.out test79.out test80.out \
  136.           test81.out test82.out test83.out test84.out test88.out \
  137.           test89.out test90.out test91.out test92.out test93.out \
  138. !         test94.out test95.out test96.out
  139.   
  140.   .SUFFIXES: .in .out
  141.   
  142. --- 33,39 ----
  143.           test76.out test77.out test78.out test79.out test80.out \
  144.           test81.out test82.out test83.out test84.out test88.out \
  145.           test89.out test90.out test91.out test92.out test93.out \
  146. !         test94.out test95.out test96.out test97.out
  147.   
  148.   .SUFFIXES: .in .out
  149.   
  150. *** ../vim-7.3.1294/src/testdir/Make_vms.mms    2013-07-01 21:24:40.000000000 +0200
  151. --- src/testdir/Make_vms.mms    2013-07-03 16:21:54.000000000 +0200
  152. ***************
  153. *** 4,10 ****
  154.   # Authors:    Zoltan Arpadffy, <arpadffy@polarhome.com>
  155.   #        Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
  156.   #
  157. ! # Last change:  2013 Jul 01
  158.   #
  159.   # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
  160.   # Edit the lines in the Configuration section below to select.
  161. --- 4,10 ----
  162.   # Authors:    Zoltan Arpadffy, <arpadffy@polarhome.com>
  163.   #        Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
  164.   #
  165. ! # Last change:  2013 Jul 03
  166.   #
  167.   # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
  168.   # Edit the lines in the Configuration section below to select.
  169. ***************
  170. *** 78,84 ****
  171.        test77.out test78.out test79.out test80.out test81.out \
  172.        test82.out test83.out test84.out test88.out test89.out \
  173.        test90.out test91.out test92.out test93.out test94.out \
  174. !      test95.out test96.out
  175.   
  176.   # Known problems:
  177.   # Test 30: a problem around mac format - unknown reason
  178. --- 78,84 ----
  179.        test77.out test78.out test79.out test80.out test81.out \
  180.        test82.out test83.out test84.out test88.out test89.out \
  181.        test90.out test91.out test92.out test93.out test94.out \
  182. !      test95.out test96.out test97.out
  183.   
  184.   # Known problems:
  185.   # Test 30: a problem around mac format - unknown reason
  186. *** ../vim-7.3.1294/src/fileio.c    2013-06-26 19:17:58.000000000 +0200
  187. --- src/fileio.c    2013-07-03 16:27:10.000000000 +0200
  188. ***************
  189. *** 10301,10307 ****
  190.            * foo\,bar -> foo,bar
  191.            * foo\ bar -> foo bar
  192.            * Don't unescape \, * and others that are also special in a
  193. !          * regexp. */
  194.           if (*++p == '?'
  195.   #ifdef BACKSLASH_IN_FILENAME
  196.               && no_bslash
  197. --- 10301,10310 ----
  198.            * foo\,bar -> foo,bar
  199.            * foo\ bar -> foo bar
  200.            * Don't unescape \, * and others that are also special in a
  201. !          * regexp.
  202. !          * An escaped { must be unescaped since we use magic not
  203. !          * verymagic.
  204. !          */
  205.           if (*++p == '?'
  206.   #ifdef BACKSLASH_IN_FILENAME
  207.               && no_bslash
  208. ***************
  209. *** 10309,10315 ****
  210.               )
  211.               reg_pat[i++] = '?';
  212.           else
  213. !             if (*p == ',' || *p == '%' || *p == '#' || *p == ' ')
  214.               reg_pat[i++] = *p;
  215.               else
  216.               {
  217. --- 10312,10319 ----
  218.               )
  219.               reg_pat[i++] = '?';
  220.           else
  221. !             if (*p == ',' || *p == '%' || *p == '#'
  222. !                             || *p == ' ' || *p == '{')
  223.               reg_pat[i++] = *p;
  224.               else
  225.               {
  226. *** ../vim-7.3.1294/src/misc1.c    2013-06-17 19:26:29.000000000 +0200
  227. --- src/misc1.c    2013-07-03 16:39:46.000000000 +0200
  228. ***************
  229. *** 10457,10462 ****
  230. --- 10457,10510 ----
  231.   }
  232.   #endif
  233.   
  234. + static int has_env_var __ARGS((char_u *p));
  235. + /*
  236. +  * Return TRUE if "p" contains what looks like an environment variable.
  237. +  * Allowing for escaping.
  238. +  */
  239. +     static int
  240. + has_env_var(p)
  241. +     char_u *p;
  242. + {
  243. +     for ( ; *p; mb_ptr_adv(p))
  244. +     {
  245. +     if (*p == '\\' && p[1] != NUL)
  246. +         ++p;
  247. +     else if (vim_strchr((char_u *)
  248. + #if defined(MSDOS) || defined(MSWIN) || defined(OS2)
  249. +                     "$%"
  250. + #else
  251. +                     "$"
  252. + #endif
  253. +                     , *p) != NULL)
  254. +         return TRUE;
  255. +     }
  256. +     return FALSE;
  257. + }
  258. + #ifdef SPECIAL_WILDCHAR
  259. + static int has_special_wildchar __ARGS((char_u *p));
  260. + /*
  261. +  * Return TRUE if "p" contains a special wildcard character.
  262. +  * Allowing for escaping.
  263. +  */
  264. +     static int
  265. + has_special_wildchar(p)
  266. +     char_u  *p;
  267. + {
  268. +     for ( ; *p; mb_ptr_adv(p))
  269. +     {
  270. +     if (*p == '\\' && p[1] != NUL)
  271. +         ++p;
  272. +     else if (vim_strchr((char_u *)SPECIAL_WILDCHAR, *p) != NULL)
  273. +         return TRUE;
  274. +     }
  275. +     return FALSE;
  276. + }
  277. + #endif
  278.   /*
  279.    * Generic wildcard expansion code.
  280.    *
  281. ***************
  282. *** 10507,10513 ****
  283.        */
  284.       for (i = 0; i < num_pat; i++)
  285.       {
  286. !     if (vim_strpbrk(pat[i], (char_u *)SPECIAL_WILDCHAR) != NULL
  287.   # ifdef VIM_BACKTICK
  288.           && !(vim_backtick(pat[i]) && pat[i][1] == '=')
  289.   # endif
  290. --- 10555,10561 ----
  291.        */
  292.       for (i = 0; i < num_pat; i++)
  293.       {
  294. !     if (has_special_wildchar(pat[i])
  295.   # ifdef VIM_BACKTICK
  296.           && !(vim_backtick(pat[i]) && pat[i][1] == '=')
  297.   # endif
  298. ***************
  299. *** 10537,10543 ****
  300.           /*
  301.            * First expand environment variables, "~/" and "~user/".
  302.            */
  303. !         if (vim_strchr(p, '$') != NULL || *p == '~')
  304.           {
  305.           p = expand_env_save_opt(p, TRUE);
  306.           if (p == NULL)
  307. --- 10585,10591 ----
  308.           /*
  309.            * First expand environment variables, "~/" and "~user/".
  310.            */
  311. !         if (has_env_var(p) || *p == '~')
  312.           {
  313.           p = expand_env_save_opt(p, TRUE);
  314.           if (p == NULL)
  315. ***************
  316. *** 10548,10554 ****
  317.            * variable, use the shell to do that.  Discard previously
  318.            * found file names and start all over again.
  319.            */
  320. !         else if (vim_strchr(p, '$') != NULL || *p == '~')
  321.           {
  322.               vim_free(p);
  323.               ga_clear_strings(&ga);
  324. --- 10596,10602 ----
  325.            * variable, use the shell to do that.  Discard previously
  326.            * found file names and start all over again.
  327.            */
  328. !         else if (has_env_var(p) || *p == '~')
  329.           {
  330.               vim_free(p);
  331.               ga_clear_strings(&ga);
  332. *** ../vim-7.3.1294/src/version.c    2013-07-03 15:46:59.000000000 +0200
  333. --- src/version.c    2013-07-03 15:51:54.000000000 +0200
  334. ***************
  335. *** 730,731 ****
  336. --- 730,733 ----
  337.   {   /* Add new patch number below this line */
  338. + /**/
  339. +     1295,
  340.   /**/
  341.  
  342. -- 
  343. When I look deep into your eyes, I see JPEG artifacts.
  344. I can tell by the pixels that we're wrong for each other.  (xkcd)
  345.  
  346.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  347. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  348. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  349.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  350.