yalay / vim

Automatically exported from code.google.com/p/vim
0 stars 0 forks source link

opening file with .gz extension #276

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The default behaviour of vim when opening a file with ".gz" extension, is to 
decompress and then re-compress it again when saving it. In a situation when 
the file has a  ".gz" extension, BUT IT IS NOT GZIPPED, vim gives error in the 
first part of decompression. But the 2nd part of re-compression goes ahead as 
it is, which has an unwanted side-effect that the original file gets 
compressed. Although not a bug, it would be better if the behaviour was more 
consistent and vim didn't try to re-compress the file if it was not able to 
decompress it originally.

What steps will reproduce the problem?
1. Create a file txt-file (no compression) with ".gz" extension
$ echo -e "one\ntwo" > vimtmp.gz

2. open the file with vim, it spits the following error msg:

--
"vimtmp.gz" 2L, 8C
Error detected while processing function gzip#read:
line   44:
Error: Could not read uncompressed file
Press ENTER or type command to continue 
--

Press ENTER and continue to open the file.

3. Save the file using ":wq"
Here, vim doesn't give any warning or error and compresses the file using gzip.

What is the expected output? What do you see instead?
No compression of the original file, if vim encountered an error in 
decompression. 

What version of the product are you using? On what operating system?

version 7.2.108 on Mac OS X (10.6.8)
version 7.3.49 on Ubuntu 12-04.4 LTS 

Please provide any additional information below.
It seems to be more generic issue related to how vim "gzip" plugin handles 
".gz" file, and can be potentially affecting all versions (on all OSes)

Original issue reported on code.google.com by santosh....@gmail.com on 29 Oct 2014 at 1:40

GoogleCodeExporter commented 9 years ago
Patch posted at https://groups.google.com/d/msg/vim_dev/5toZk0Y7rFg/_7uA4ypDYFUJ

Original comment by chrisbr...@googlemail.com on 2 Nov 2014 at 7:20

GoogleCodeExporter commented 9 years ago
Fixed as of https://code.google.com/p/vim/source/detail?r=4abac

Original comment by chrisbr...@googlemail.com on 5 Nov 2014 at 6:47