summaryrefslogtreecommitdiff
path: root/data/vim/patches/8.1.0485
blob: 73837dfcc4a98be54a4cac261a8aa28e4757965d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
To: vim_dev@googlegroups.com
Subject: Patch 8.1.0485
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 8.1.0485
Problem:    term_start() does not check if directory is accessible.
Solution:   Add mch_access() call. (Jason Franklin)
Files:	    src/channel.c, src/testdir/test_terminal.vim


*** ../vim-8.1.0484/src/channel.c	2018-09-13 15:33:39.601712271 +0200
--- src/channel.c	2018-10-19 16:52:39.981396959 +0200
***************
*** 4916,4922 ****
  		if (!(supported2 & JO2_CWD))
  		    break;
  		opt->jo_cwd = get_tv_string_buf_chk(item, opt->jo_cwd_buf);
! 		if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd))
  		{
  		    EMSG2(_(e_invargval), "cwd");
  		    return FAIL;
--- 4916,4923 ----
  		if (!(supported2 & JO2_CWD))
  		    break;
  		opt->jo_cwd = get_tv_string_buf_chk(item, opt->jo_cwd_buf);
! 		if (opt->jo_cwd == NULL || !mch_isdir(opt->jo_cwd)
! 				|| mch_access((char *)opt->jo_cwd, X_OK) != 0)
  		{
  		    EMSG2(_(e_invargval), "cwd");
  		    return FAIL;
*** ../vim-8.1.0484/src/testdir/test_terminal.vim	2018-08-07 16:33:15.255728441 +0200
--- src/testdir/test_terminal.vim	2018-10-19 16:52:03.413741075 +0200
***************
*** 478,483 ****
--- 478,505 ----
    call delete('Xdir', 'rf')
  endfunc
  
+ func Test_terminal_cwd_failure()
+   " Case 1: Provided directory is not actually a directory.  Attempt to make
+   " the file executable as well.
+   call writefile([], 'Xfile')
+   call setfperm('Xfile', 'rwx------')
+   call assert_fails("call term_start(&shell, {'cwd': 'Xfile'})", 'E475:')
+   call delete('Xfile')
+ 
+   " Case 2: Directory does not exist.
+   call assert_fails("call term_start(&shell, {'cwd': 'Xdir'})", 'E475:')
+ 
+   " Case 3: Directory exists but is not accessible.
+   call mkdir('Xdir', '', '0600')
+   " return early if the directory permissions could not be set properly
+   if getfperm('Xdir')[2] == 'x'
+     call delete('Xdir', 'rf')
+     return
+   endif
+   call assert_fails("call term_start(&shell, {'cwd': 'Xdir'})", 'E475:')
+   call delete('Xdir', 'rf')
+ endfunc
+ 
  func Test_terminal_servername()
    if !has('clientserver')
      return
*** ../vim-8.1.0484/src/version.c	2018-10-19 16:26:39.964404727 +0200
--- src/version.c	2018-10-19 16:50:33.270601082 +0200
***************
*** 794,795 ****
--- 794,797 ----
  {   /* Add new patch number below this line */
+ /**/
+     485,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
241. You try to look for Net Search even when you're in File Manager.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///