!125 [sync] PR-121: fix garbled characters display when file name matches

Merge pull request !125 from openeuler-sync-bot/sync-pr121-openEuler-22.03-LTS-to-openEuler-22.03-LTS-Next
This commit is contained in:
openeuler-ci-bot 2022-02-08 03:20:46 +00:00 committed by Gitee
commit d3fc029884
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From 150fab01a9e9eb61061bf145998b608c5c9c470e Mon Sep 17 00:00:00 2001
From: lvying6 <lvying6@huawei.com>
Date: Tue, 14 Jul 2020 16:43:33 +0800
Subject: [PATCH] vim: fix garbled characters display when file name matches
warning or error in tar file
Reference: https://github.com/vim/vim/issues/6425
The problem is, the tar.vim plugin checks if the last line matches
warning or error or a few other keywords and if it does, it aborts.
Signed-off-by: lvying6 <lvying6@huawei.com>
---
runtime/autoload/tar.vim | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim
index dc670db..168a2f1 100644
--- a/runtime/autoload/tar.vim
+++ b/runtime/autoload/tar.vim
@@ -184,7 +184,12 @@ fun! tar#Browse(tarfile)
" call Dret("tar#Browse : a:tarfile<".a:tarfile.">")
return
endif
- if line("$") == curlast || ( line("$") == (curlast + 1) && getline("$") =~ '\c\%(warning\|error\|inappropriate\|unrecognized\)')
+ " If there was an error message, the last line probably matches some keywords but
+ " should also contain whitespace for readability. Make sure not to match a
+ " filename that contains the keyword (error/warning/unrecognized/inappropriate, etc)
+ if line("$") == curlast || ( line("$") == (curlast + 1) &&
+ \ getline("$") =~# '\c\<\%(warning\|error\|inappropriate\|unrecognized\)\>' &&
+ \ getline("$") =~ '\s' )
redraw!
echohl WarningMsg | echo "***warning*** (tar#Browse) ".a:tarfile." doesn't appear to be a tar file" | echohl None
keepj sil! %d
--
1.8.3.1

View File

@ -12,7 +12,7 @@
Name: vim
Epoch: 2
Version: 8.2
Release: 20
Release: 21
Summary: Vim is a highly configurable text editor for efficiently creating and changing any kind of text.
License: Vim and MIT
URL: http://www.vim.org
@ -72,6 +72,7 @@ Patch6035: backport-CVE-2021-4193.patch
Patch6036: backport-CVE-2022-0213.patch
Patch6037: backport-CVE-2022-0261.patch
Patch6038: backport-CVE-2022-0318.patch
Patch6039: backport-vim-fix-garbled-characters-display-when-file-name-ma.patch
Patch9000: bugfix-rm-modify-info-version.patch
@ -460,6 +461,12 @@ popd
%{_mandir}/man1/evim.*
%changelog
* Sun Jan 30 2022 yuanxin<yuanxin24@h-partners.com> - 2:8.2-21
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:fix garbled characters display when file name matches
* Sat Jan 29 2022 guozhaorui<guozhaorui1@h-partners.com> - 2:8.2-20
- Type:CVE
- ID:CVE-2022-0213 CVE-2022-0261 CVE-2022-0318