Hi guys
It shows garbled characters when I open a "*.tar.gz" file, which is compressed from the file with “error” in the name.
For example:
[root@192-168-100-100 ~]# touch error_test.log
[root@192-168-100-100 ~]# tar -zcvf test.tar.gz error_test.log
error_test.log
[root@192-168-100-100 ~]# vim test.tar.gz
My os version: CentOS Linux release 7.5.1804 (Core)
My vim version: vim-enhanced-7.4.160-4.el7.x86_64
Wating for your help
Thank you
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
You have a very old version of Vim installed. Nevertheless, I can reproduce the problem in tar.vim.
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.
If we make the regex a bit more strict and also require to have it match a space (after all an error message should contain some spaces to be more readable and unix files are very unlikely to contain spaces) we can work around this:
diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim index 9f9609434..56d125cf6 100644 --- a/runtime/autoload/tar.vim +++ b/runtime/autoload/tar.vim @@ -204,7 +204,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
cc Charles, the maintainer: @cecamp
You have a very old version of Vim installed. Nevertheless, I can reproduce the problem in tar.vim.
The problem is, the tar.vim plugin checks if the last line matches
warningorerroror a few other keywords and if it does, it aborts.If we make the regex a bit more strict and also require to have it match a
space(after all an error message should contain some spaces to be more readable and unix files are very unlikely to contain spaces) we can work around this:diff --git a/runtime/autoload/tar.vim b/runtime/autoload/tar.vim index 9f9609434..56d125cf6 100644 --- a/runtime/autoload/tar.vim +++ b/runtime/autoload/tar.vim @@ -204,7 +204,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! %dcc Charles, the maintainer: @cecamp
@cecamp
Hi cecmap, is this issue a problem, would chrisbra's patch be merged into mainline?
Thank you, Christian -- I'll include it. Eventually it will get to Bram...
Closed #6425.
When will this be resolved? thanks!
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.![]()
@brammool Why is this solution not intergrated into the master?Are there any other reasons?thanks
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
It looks like version 33 of the tar plugin wasn't finished. You can find the unfinished version on Charles website.
@cecamp can you send me the version to included?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
It looks like version 33 of the tar plugin wasn't finished. You can find the unfinished version on Charles website.
Thank you for your response!
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()