Patch 8.2.2981
Problem:    Recovery test is not run on big-endian systems.
Solution:   Make it work on big-endian systems. (James McCoy, closes #8368)
Files:      src/testdir/test_recover.vim


*** ../vim-8.2.2980/src/testdir/test_recover.vim        2021-06-10 
21:52:11.813718366 +0200
--- src/testdir/test_recover.vim        2021-06-12 14:02:12.729146271 +0200
***************
*** 198,300 ****
    let b = readblob(sn)
    let save_b = copy(b)
    bw!
!   " Run these tests only on little-endian systems. These tests fail on a
!   " big-endian system (IBM S390x system).
!   if b[1008:1011] == 0z33323130
!         \ && b[4096:4097] == 0z7470
!         \ && b[8192:8193] == 0z6164
! 
!     " clear the B0_MAGIC_LONG field
!     let b[1008:1011] = 0z00000000
!     call writefile(b, sn)
!     let msg = execute('recover Xfile1')
!     call assert_match('the file has been damaged', msg)
!     call assert_equal('Xfile1', @%)
!     call assert_equal([''], getline(1, '$'))
!     bw!
! 
!     " reduce the page size
!     let b = copy(save_b)
!     let b[12:15] = 0z00010000
!     call writefile(b, sn)
!     let msg = execute('recover Xfile1')
!     call assert_match('page size is smaller than minimum value', msg)
!     call assert_equal('Xfile1', @%)
!     call assert_equal([''], getline(1, '$'))
!     bw!
! 
!     " clear the pointer ID
!     let b = copy(save_b)
!     let b[4096:4097] = 0z0000
!     call writefile(b, sn)
!     call assert_fails('recover Xfile1', 'E310:')
!     call assert_equal('Xfile1', @%)
!     call assert_equal([''], getline(1, '$'))
!     bw!
! 
!     " set the number of pointers in a pointer block to zero
!     let b = copy(save_b)
!     let b[4098:4099] = 0z0000
!     call writefile(b, sn)
!     call assert_fails('recover Xfile1', 'E312:')
!     call assert_equal('Xfile1', @%)
!     call assert_equal(['???EMPTY BLOCK'], getline(1, '$'))
!     bw!
! 
!     " set the block number in a pointer entry to a negative number
!     let b = copy(save_b)
!     let b[4104:4111] = 0z00000000.00000080
!     call writefile(b, sn)
!     call assert_fails('recover Xfile1', 'E312:')
!     call assert_equal('Xfile1', @%)
!     call assert_equal(['???LINES MISSING'], getline(1, '$'))
!     bw!
! 
!     " clear the data block ID
!     let b = copy(save_b)
!     let b[8192:8193] = 0z0000
!     call writefile(b, sn)
!     call assert_fails('recover Xfile1', 'E312:')
!     call assert_equal('Xfile1', @%)
!     call assert_equal(['???BLOCK MISSING'], getline(1, '$'))
!     bw!
! 
!     " set the number of lines in the data block to zero
!     let b = copy(save_b)
!     let b[8208:8211] = 0z00000000
!     call writefile(b, sn)
!     call assert_fails('recover Xfile1', 'E312:')
!     call assert_equal('Xfile1', @%)
!     call assert_equal(['??? from here until ???END lines may have been 
inserted/deleted',
!           \ '???END'], getline(1, '$'))
!     bw!
! 
!     " use an invalid text start for the lines in a data block
!     let b = copy(save_b)
!     let b[8216:8219] = 0z00000000
!     call writefile(b, sn)
!     call assert_fails('recover Xfile1', 'E312:')
!     call assert_equal('Xfile1', @%)
!     call assert_equal(['???'], getline(1, '$'))
!     bw!
! 
!     " use an incorrect text end (db_txt_end) for the data block
!     let b = copy(save_b)
!     let b[8204:8207] = 0z80000000
!     call writefile(b, sn)
!     call assert_fails('recover Xfile1', 'E312:')
!     call assert_equal('Xfile1', @%)
!     call assert_equal(['??? from here until ???END lines may be messed up', 
'',
!           \ '???END'], getline(1, '$'))
!     bw!
! 
!     " remove the data block
!     let b = copy(save_b)
!     call writefile(b[:8191], sn)
!     call assert_fails('recover Xfile1', 'E312:')
!     call assert_equal('Xfile1', @%)
!     call assert_equal(['???MANY LINES MISSING'], getline(1, '$'))
!   endif
  
    bw!
    call delete(sn)
--- 198,299 ----
    let b = readblob(sn)
    let save_b = copy(b)
    bw!
! 
!   " Not all fields are written in a system-independent manner.  Detect whether
!   " the test is running on a little or big-endian system, so the correct
!   " corruption values can be set.
!   let little_endian = b[1008:1015] == 0z33323130.00000000
! 
!   " clear the B0_MAGIC_LONG field
!   let b[1008:1015] = 0z0000000000000000
!   call writefile(b, sn)
!   let msg = execute('recover Xfile1')
!   call assert_match('the file has been damaged', msg)
!   call assert_equal('Xfile1', @%)
!   call assert_equal([''], getline(1, '$'))
!   bw!
! 
!   " reduce the page size
!   let b = copy(save_b)
!   let b[12:15] = 0z00010000
!   call writefile(b, sn)
!   let msg = execute('recover Xfile1')
!   call assert_match('page size is smaller than minimum value', msg)
!   call assert_equal('Xfile1', @%)
!   call assert_equal([''], getline(1, '$'))
!   bw!
! 
!   " clear the pointer ID
!   let b = copy(save_b)
!   let b[4096:4097] = 0z0000
!   call writefile(b, sn)
!   call assert_fails('recover Xfile1', 'E310:')
!   call assert_equal('Xfile1', @%)
!   call assert_equal([''], getline(1, '$'))
!   bw!
! 
!   " set the number of pointers in a pointer block to zero
!   let b = copy(save_b)
!   let b[4098:4099] = 0z0000
!   call writefile(b, sn)
!   call assert_fails('recover Xfile1', 'E312:')
!   call assert_equal('Xfile1', @%)
!   call assert_equal(['???EMPTY BLOCK'], getline(1, '$'))
!   bw!
! 
!   " set the block number in a pointer entry to a negative number
!   let b = copy(save_b)
!   let b[4104:4111] = little_endian ? 0z00000000.00000080 : 0z80000000.00000000
!   call writefile(b, sn)
!   call assert_fails('recover Xfile1', 'E312:')
!   call assert_equal('Xfile1', @%)
!   call assert_equal(['???LINES MISSING'], getline(1, '$'))
!   bw!
! 
!   " clear the data block ID
!   let b = copy(save_b)
!   let b[8192:8193] = 0z0000
!   call writefile(b, sn)
!   call assert_fails('recover Xfile1', 'E312:')
!   call assert_equal('Xfile1', @%)
!   call assert_equal(['???BLOCK MISSING'], getline(1, '$'))
!   bw!
! 
!   " set the number of lines in the data block to zero
!   let b = copy(save_b)
!   let b[8208:8215] = 0z00000000.00000000
!   call writefile(b, sn)
!   call assert_fails('recover Xfile1', 'E312:')
!   call assert_equal('Xfile1', @%)
!   call assert_equal(['??? from here until ???END lines may have been 
inserted/deleted',
!         \ '???END'], getline(1, '$'))
!   bw!
! 
!   " use an invalid text start for the lines in a data block
!   let b = copy(save_b)
!   let b[8216:8219] = 0z00000000
!   call writefile(b, sn)
!   call assert_fails('recover Xfile1', 'E312:')
!   call assert_equal('Xfile1', @%)
!   call assert_equal(['???'], getline(1, '$'))
!   bw!
! 
!   " use an incorrect text end (db_txt_end) for the data block
!   let b = copy(save_b)
!   let b[8204:8207] = little_endian ? 0z80000000 : 0z00000080
!   call writefile(b, sn)
!   call assert_fails('recover Xfile1', 'E312:')
!   call assert_equal('Xfile1', @%)
!   call assert_equal(['??? from here until ???END lines may be messed up', '',
!         \ '???END'], getline(1, '$'))
!   bw!
! 
!   " remove the data block
!   let b = copy(save_b)
!   call writefile(b[:8191], sn)
!   call assert_fails('recover Xfile1', 'E312:')
!   call assert_equal('Xfile1', @%)
!   call assert_equal(['???MANY LINES MISSING'], getline(1, '$'))
  
    bw!
    call delete(sn)
*** ../vim-8.2.2980/src/version.c       2021-06-12 13:59:00.417806488 +0200
--- src/version.c       2021-06-12 14:04:23.704644170 +0200
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     2981,
  /**/

-- 
ARTHUR:       You are indeed brave Sir knight, but the fight is mine.
BLACK KNIGHT: Had enough?
ARTHUR:       You stupid bastard.  You havn't got any arms left.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/202106121206.15CC6ASu309504%40masaka.moolenaar.net.

Raspunde prin e-mail lui