]> granicus.if.org Git - vim/commitdiff
patch 8.1.0318: the getftype() test may fail for char devices v8.1.0318
authorBram Moolenaar <Bram@vim.org>
Wed, 22 Aug 2018 18:16:16 +0000 (20:16 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 22 Aug 2018 18:16:16 +0000 (20:16 +0200)
Problem:    The getftype() test may fail for char devices if the file
            disappeared in between the listing and the getftype() call.
Solution:   Ignore empty result. (Ozaki Kiichi, closes #3360)

src/testdir/test_stat.vim
src/version.c

index c6272666462b7bfd2a6d2238ad49a10e4402009b..33509f02194b02b84b47e117fb55dc193a00927d 100644 (file)
@@ -141,17 +141,29 @@ func Test_getftype()
   endif
 
   for cdevfile in systemlist('find /dev -type c -maxdepth 2 2>/dev/null')
-    call assert_equal('cdev', getftype(cdevfile))
+    let type = getftype(cdevfile)
+    " ignore empty result, can happen if the file disappeared
+    if type != ''
+      call assert_equal('cdev', type)
+    endif
   endfor
 
   for bdevfile in systemlist('find /dev -type b -maxdepth 2 2>/dev/null')
-    call assert_equal('bdev', getftype(bdevfile))
+    let type = getftype(bdevfile)
+    " ignore empty result, can happen if the file disappeared
+    if type != ''
+      call assert_equal('bdev', type)
+    endif
   endfor
 
   " The /run/ directory typically contains socket files.
   " If it does not, test won't fail but will not test socket files.
   for socketfile in systemlist('find /run -type s -maxdepth 2 2>/dev/null')
-    call assert_equal('socket', getftype(socketfile))
+    let type = getftype(socketfile)
+    " ignore empty result, can happen if the file disappeared
+    if type != ''
+      call assert_equal('socket', type)
+    endif
   endfor
 
   " TODO: file type 'other' is not tested. How can we test it?
index d5993815c6e3c5fe7ab90617330dd4bd815d9825..1afe230cfb379c4847d17d49d8dd355006dc35e8 100644 (file)
@@ -794,6 +794,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    318,
 /**/
     317,
 /**/