[vim/vim] Test_recover_corrupted_swap_file is broken on 32bit systems (#8479)

8 views
Skip to first unread message

Ondřej Súkup

unread,
Jun 30, 2021, 5:13:50 AM6/30/21
to vim/vim, Subscribed

Describe the bug
Test_recover_corrupted_swap_file is broken on 32bit systems like x86 and 32bit arm

To Reproduce
run vim testsuite

Expected behaviour
test pass

Screenshots

From test_recover.vim:

�Executed Test_nocatch_process_still_running()      in   1.010242 seconds�[m�

Executed Test_noname_buffer()                      in   0.004784 seconds

Executed Test_recover_corrupted_swap_file()        in   0.058540 seconds

Executed Test_recover_empty_swap_file()            in   0.005846 seconds

Executed Test_recover_encrypted_swap_file()        in   0.115394 seconds�[m�

Executed Test_recover_invalid_cursor_pos()         in   0.007951 seconds

Executed Test_recover_multiple_swap_files()        in   0.018030 seconds

Executed Test_recover_root_dir()                   in   0.002785 seconds

Executed Test_recover_symbolic_link()              in   0.017381 seconds

Executed Test_recover_unmodified_file()            in   0.007047 seconds

Executed Test_recover_unreadble_swap_file()        in   0.014217 seconds

Executed Test_swap_file()                          in   0.809606 seconds�[m�

Executed 12 tests                        in   2.082277 seconds�[m�

1 FAILED:

Found errors in Test_recover_corrupted_swap_file():

command line..script /home/abuild/rpmbuild/BUILD/vim-8.2.3075/src/testdir/runtest.vim[473]..function RunTheTest[44]..Test_recover_corrupted_swap_file line 69: Expected ['???LINES MISSING'] but got ['???MANY LINES MISSING']

command line..script /home/abuild/rpmbuild/BUILD/vim-8.2.3075/src/testdir/runtest.vim[473]..function RunTheTest[44]..Test_recover_corrupted_swap_file line 95: command did not fail: recover Xfile1

command line..script /home/abuild/rpmbuild/BUILD/vim-8.2.3075/src/testdir/runtest.vim[473]..function RunTheTest[44]..Test_recover_corrupted_swap_file line 97: Expected ['???'] but got ['']



Environment (please complete the following information):

  • 8.2.3075
  • OS: openSUSE Tumbleweed
  • Terminal: linux console

Additional context


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Bram Moolenaar

unread,
Jun 30, 2021, 6:38:52 AM6/30/21
to vim/vim, Subscribed

I do not have a 32 bit Unix system to try this on. Perhaps you can check the code that's added using "little_endian" and add something similar for 32 bit systems?

Ondřej Súkup

unread,
Jun 30, 2021, 7:08:25 AM6/30/21
to vim/vim, Subscribed

I think patch 2981 is the cause of this problem ...

in my builds, 2980 and older run tests without problems, after including 2981 fails in this test

Dominique Pellé

unread,
Jun 30, 2021, 7:54:33 AM6/30/21
to vim/vim, Subscribed

@brammool wrote:

I do not have a 32 bit Unix system to try this on.

For information, I can build for 32-bits x86 on Ubuntu-18.04.05 x86_64 by adding -m32 in CFLAGS and LDFLAGS and by configuring without a few libs (canberra, sodium and acl) for which I do not have 32 bits versions (maybe those libs have 32-bits package, I did not bother checking, I disabled them instead):

$ cd vim/src
$ git diff Makefile
diff --git a/src/Makefile b/src/Makefile
index 0efee5195..53fe66b5d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -619,7 +619,8 @@ CClink = $(CC)
 # Add -Wpedantic to find // comments and other C99 constructs.
 # Better disable Perl and Python to avoid a lot of warnings.
 #CFLAGS = -g -Wall -Wextra -Wshadow -Wmissing-prototypes -Wpedantic -Wunreachable-code -Wunused-result -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
-#CFLAGS = -g -O2 -Wall -Wextra -Wshadow -Wmissing-prototypes -Wpedantic -Wunreachable-code -Wno-cast-function-type -Wunused-result -Wno-deprecated-declarations -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
+CFLAGS = -g -m32 -O2 -Wall -Wextra -Wshadow -Wmissing-prototypes -Wpedantic -Wunreachable-code -Wno-cast-function-type -Wunused-result -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
+LDFLAGS = -m32
 #PYTHON_CFLAGS_EXTRA = -Wno-missing-field-initializers
 #MZSCHEME_CFLAGS_EXTRA = -Wno-unreachable-code -Wno-unused-parameter

$ ./configure
CC=gcc ./configure --with-features=huge --enable-gui=none  --disable-canberra   --disable-libsodium --disable-acl
$ make -j9
$ make test
...snip...
$ Executed:  4072 Tests
 Skipped:    66 Tests
  FAILED:     1 Tests


Failures: 
	From test_recover.vim:
	Found errors in Test_recover_corrupted_swap_file():
	command line..script /home/pel/sb/vim/src/testdir/runtest.vim[473]..function RunTheTest[44]..Test_recover_corrupted_swap_file line 69: Expected ['???LINES MISSING'] but got ['???MANY LINES MISSING']
	command line..script /home/pel/sb/vim/src/testdir/runtest.vim[473]..function RunTheTest[44]..Test_recover_corrupted_swap_file line 95: command did not fail: recover Xfile1
	command line..script /home/pel/sb/vim/src/testdir/runtest.vim[473]..function RunTheTest[44]..Test_recover_corrupted_swap_file line 97: Expected ['???'] but got ['']

TEST FAILURE
Makefile:43: recipe for target 'report' failed
make: *** [report] Error 1

So I can at least reproduce the issue.
I don't have time to look at it further, but I can look further this coming weekend.

Bram Moolenaar

unread,
Jun 30, 2021, 9:16:18 AM6/30/21
to vim/vim, Subscribed


Ondřej Súkup wrote:

> I think patch 2981 is the cause of this problem ...
>
> in my builds, 2980 and older run tests without problems, after
> including 2981 fails in this test

That makes sense, it added the little-endian check. So the solution is
probably to disable little-endian when detecting a 32 bit system.
Not sure how to reliable do that. Or the test for little endian should
check with "!=" instead of "==", instead of:

let little_endian = b[1008:1015] == 0z33323130.00000000

use:

let little_endian = b[1008:1015] != (big-endian value)

--
Master: Boy, there is nothing more for you to learn
Student: I didn't know that!

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Yegappan Lakshmanan

unread,
Jun 30, 2021, 12:00:20 PM6/30/21
to vim_dev, reply+ACY5DGGYXUGCYJNS3Q...@reply.github.com, vim/vim, Subscribed
Hi,

On Wed, Jun 30, 2021 at 6:16 AM Bram Moolenaar <vim-dev...@256bit.org> wrote:


Ondřej Súkup wrote:

> I think patch 2981 is the cause of this problem ...
>
> in my builds, 2980 and older run tests without problems, after
> including 2981 fails in this test

That makes sense, it added the little-endian check. So the solution is
probably to disable little-endian when detecting a 32 bit system.
Not sure how to reliable do that. Or the test for little endian should
check with "!=" instead of "==", instead of:

let little_endian = b[1008:1015] == 0z33323130.00000000

use:

let little_endian = b[1008:1015] != (big-endian value)



I have created PR #8485 to address this issue.

Regards,
Yegappan

vim-dev ML

unread,
Jun 30, 2021, 12:00:43 PM6/30/21
to vim/vim, vim-dev ML, Your activity

Hi,

On Wed, Jun 30, 2021 at 6:16 AM Bram Moolenaar ***@***.***>

Bram Moolenaar

unread,
Jun 30, 2021, 3:30:36 PM6/30/21
to vim/vim, vim-dev ML, Comment

Closed #8479 via 576cb75.


You are receiving this because you commented.

Reply all
Reply to author
Forward
0 new messages