jeromejj / vim

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

gVim alters file type from Unix to DOS, with propert configuration directives in place. #157

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Make sure proper file settings are in place in .vimrc like set 
fileformats=unix,dos 2. Edit a known unix type file in gVim on a Linux system, 
using ftp://user@system/path/filename
3. Immediately write out the file.

What is the expected output? What do you see instead?
I expect to see file type Unix. I see DOS.

What version of the product are you using? On what operating system?
7.2.411 on CentOs 6.4.

Please provide any additional information below.
vsftp is on remote system. Ascii mangling is shutoff.

Original issue reported on code.google.com by octopusg...@gmail.com on 24 Jul 2013 at 7:26

Attachments:

GoogleCodeExporter commented 9 years ago
Using the attached file (which I called simple6.vimrc):

 and running  vim -u simple6.vimrc, then :e ftp://www.drchip.org/... and then :w newfile , the newfile was in unix format.

Translated: I am unable to duplicate this issue.  Please try the above file, 
temporarily deactivate your personal plugins (mv ~/.vim ~/DOTVIM), and try the 
editing with ftp:// again.

Original comment by drc...@campbellfamily.biz on 25 Jul 2013 at 2:05

Attachments:

GoogleCodeExporter commented 9 years ago
First, thanks for your prompt reply.

In /home/cnorton, I moved the .vim directory and .vimrc to other respective 
names.

I copied simple6.vimrc to ~/.vimrc

I tested using command line vim and gvim.

Command line vim can read the unix file, write the file, and re-read. gVim 
cannot do this.

gVim results in the same behavior. I'm willing to try anything else you can 
think of including uninstalling and re-installing vim if you think that will 
work.

Original comment by octopusg...@gmail.com on 25 Jul 2013 at 5:29

GoogleCodeExporter commented 9 years ago
Since I didn't say previously, I used gvim 7.4a.35 to perform the test on a 
Scientific Linux system; gvim had no problem reading simple6.vimrc nor did it 
have any problem reading and writing the file via ftp.

So: may I suggest reading :help netrw-debug to get a trace of what's happening. 
 You may send a copy to me (Chip Campbell) at NdrOchip@ScampbellPfamily.AbizM - 
NOSPAM.  Please elide any passwords (unless you actually want me to have them 
:)).

Original comment by drc...@campbellfamily.biz on 25 Jul 2013 at 6:14

GoogleCodeExporter commented 9 years ago
I've got Decho installed, but am confused as to what script to write for netrw. 
This is reproduceable by just editing, writing, and re-editing the same file. 
Also, how can I get 7.4a.35's source? I can't use Mercurial. For some reason it 
blows up installing on my system.

Original comment by octopusg...@gmail.com on 25 Jul 2013 at 8:27

GoogleCodeExporter commented 9 years ago
Chip:

I got output and with DEcho on, the file is re-read back in as Unix.

---------
Decho Tab /usr/share/vim/vim72/autoload/netrw.vim
---------
doing autoload/netrw.vim version v140
netrw#NetrwSavePosn() {
|currently, win#1 line#1 col#1
|netrw#NetrwRestorePosn() a:0=0 winnr=1 line=1 col=1 hline=1 {
||restore window: exe silent! 1wincmd w
||restore topofscreen: exe norm! 1G0z
||restore posn: exe norm! 1G01|
||return netrw#NetrwRestorePosn }
|return netrw#NetrwSavePosn : winnr=1 line=1 col=1 hline=1 }
netrw#NetRead(mode=2,...) a:0=1 v140 {
|s:NetrwOptionSave(vt<w:>) win#1 
buf#1<ftp://csm@ics//home/csm/vim_test_file.txt> winnr($)=1 {
||w:netrw_optionsave doesn't exist
||fo=tcq acd=0 diff=0
||return s:NetrwOptionSave : win#1 buf#1 }
|s:NetrwSafeOptions() win#1 buf#1<ftp://csm@ics//home/csm/vim_test_file.txt> 
winnr($)=1 {
||win#1's ft=
||s:NetrwCursorline() liststyle=0 g:netrw_cursorline=1 s:netrw_usercuc=0 
s:netrw_usercul=0 {
|||setlocal cursorline
|||return s:NetrwCursorline : l:cursorline=1 l:cursorcolumn=0 }
||ft<> ei=
||fo=nroql2 acd=0
||return s:NetrwSafeOptions }
|s:RestoreCursorline() currently, cul=1 cuc=0 win#1 buf#1 {
||return s:RestoreCursorline : restored cul=0 cuc=0 }
|readcmd<%r> ichoice=1
|s:GetTempfile(fname<>) {
||tmpfile</tmp/vXrrX2Z/0> : from tempname()
||tmpfile</tmp/vXrrX2Z/0> : chgd any \ -> /
||tmpfile</tmp/vXrrX2Z/0> s:netrw_tmpfile</tmp/vXrrX2Z/0>
||o/s dependent fixed tempname</tmp/vXrrX2Z/0>
||ro=0 ma=1 mod=0 wrap=1
||return s:GetTempfile </tmp/vXrrX2Z/0> }
|no lastfile: choice<ftp://csm@ics//home/csm/vim_test_file.txt>
|choice<ftp://csm@ics//home/csm/vim_test_file.txt>
|NetrwMethod(a:choice<ftp://csm@ics//home/csm/vim_test_file.txt>) {
||determine method:
||ftp://...
||g:netrw_machine<ics>
||s:FileReadable(fname</home/cnorton/.netrc>) {
|||return s:FileReadable 0 }
||NetUserPass(a:1<csm>) {
|||a:0=1 case <=1:
|||return NetUserPass }
||a:choice       <ftp://csm@ics//home/csm/vim_test_file.txt>
||b:netrw_method <3>
||g:netrw_machine<ics>
||g:netrw_port   <>
||g:netrw_uid    <csm>
||s:netrw_passwd <cash.out>
||b:netrw_fname  </home/csm/vim_test_file.txt>
||return NetrwMethod : b:netrw_method=3 }
|s:GetTempfile(fname</home/csm/vim_test_file.txt>) {
||tmpfile</tmp/vXrrX2Z/0> re-using
||using fname</home/csm/vim_test_file.txt>'s suffix
||suffix<.txt>
||chgd tmpfile</tmp/vXrrX2Z/0> (removed any .tmp suffix)
||chgd tmpfile</tmp/vXrrX2Z/0.txt> (added .txt suffix) 
netrw_fname</home/csm/vim_test_file.txt>
||ro=0 ma=1 mod=0 wrap=1
||return s:GetTempfile </tmp/vXrrX2Z/0.txt> }
|checking if NetrwBrowse() should handle 
choice<ftp://csm@ics//home/csm/vim_test_file.txt> with netrw_list_cmd<ssh 
USEPORT HOSTNAME ls -FLa>
|read via ftp+mipf (method #3)
|s:SaveBufVars() buf#1 {
||return s:SaveBufVars }
|s:RestoreBufVars() {
||return s:RestoreBufVars }
|filter input: open ics
|filter input: user "csm" "cash.out"
|filter input: binary
|filter input: get "/home/csm/vim_test_file.txt" /tmp/vXrrX2Z/0.txt
|executing: %!ftp -i -n
|s:SaveBufVars() buf#3 {
||return s:SaveBufVars }
|s:RestoreBufVars() {
||return s:RestoreBufVars }
|NetrwGetFile(readcmd<%r>,tfile</tmp/vXrrX2Z/0.txt> method<3>) {
||rfile<ftp://csm@ics//home/csm/vim_test_file.txt>
||get file into buffer
||exe sil! keepalt file /tmp/vXrrX2Z/0.txt
||edit temporary file
||exe sil! keepalt file ftp://csm@ics//home/csm/vim_test_file.txt
||renamed buffer back to remote 
filename<ftp://csm@ics//home/csm/vim_test_file.txt> : 
expand(%)<ftp://csm@ics//home/csm/vim_test_file.txt>
||redir<ls!>: 
||redir<ls!>:   1 %a   "ftp://csm@ics//home/csm/vim_test_file.txt" line 1
||redir<ls!>:   2u a-  "Decho Tab"                    line 0
||redir<ls!>:   3u     "[No Name]"                    line 1
||redir<ls!>:   5u     "/tmp/vXrrX2Z/0.txt"           line 1
||NetReadFixup() not called, doesn't exist  (line1=1 line2=490)
||s:UpdateBuffersMenu() {
|||return s:UpdateBuffersMenu }
||s:FileReadable(fname</tmp/vXrrX2Z/0.txt>) {
|||return s:FileReadable 1 }
||readcmd<%r> cmdarg<> tfile</tmp/vXrrX2Z/0.txt> readable=1
||ro=0 ma=1 mod=0 wrap=1
||return NetrwGetFile }
|cleanup b:netrw_method and b:netrw_fname
|s:FileReadable(fname</tmp/vXrrX2Z/0.txt>) {
||return s:FileReadable 1 }
|cleanup by deleting tmpfile</tmp/vXrrX2Z/0.txt>
|s:NetrwDelete(path</tmp/vXrrX2Z/0.txt>) {
||netrw#WinPath(path</tmp/vXrrX2Z/0.txt>) {
|||return netrw#WinPath </tmp/vXrrX2Z/0.txt> }
||let result= delete(/tmp/vXrrX2Z/0.txt)
||return s:NetrwDelete 0 }
|s:NetrwOptionRestore(vt<w:>) win#1 buf#1 winnr($)=1 {
||g:netrw_keepdir=1: getcwd</home/cnorton> acd=0
||g:netrw_keepdir=1: getcwd</home/cnorton> acd=0
||fo=tcq acd=0
||ro=0 ma=1 mod=0 wrap=1
||diff=0 win#1 w:netrw_diffkeep=doesn't exist
||return s:NetrwOptionRestore : win#1 buf#1 }
|return netrw#NetRead :5 getcwd</home/cnorton> }
netrw#NetrwRestorePosn() a:0=0 winnr=1 line=1 col=1 hline=1 {
|restore window: exe silent! 1wincmd w
|restore topofscreen: exe norm! 1G0z
|restore posn: exe norm! 1G01|
|return netrw#NetrwRestorePosn }
netrw#NetrwSavePosn() {
|currently, win#1 line#19 col#1
|netrw#NetrwRestorePosn() a:0=0 winnr=1 line=19 col=1 hline=1 {
||restore window: exe silent! 1wincmd w
||restore topofscreen: exe norm! 1G0z
||restore posn: exe norm! 19G01|
||return netrw#NetrwRestorePosn }
|return netrw#NetrwSavePosn : winnr=1 line=19 col=1 hline=1 }
netrw#NetWrite(a:0=1) v140 {
|s:NetrwOptionSave(vt<w:>) win#1 
buf#1<ftp://csm@ics//home/csm/vim_test_file.txt> winnr($)=1 {
||w:netrw_optionsave doesn't exist
||fo=tcq acd=0 diff=0
||return s:NetrwOptionSave : win#1 buf#1 }
|s:NetrwSafeOptions() win#1 buf#1<ftp://csm@ics//home/csm/vim_test_file.txt> 
winnr($)=1 {
||win#1's ft=conf
||s:NetrwCursorline() liststyle=0 g:netrw_cursorline=1 s:netrw_usercuc=0 
s:netrw_usercul=0 {
|||setlocal cursorline
|||return s:NetrwCursorline : l:cursorline=1 l:cursorcolumn=0 }
||ft<conf> ei=
||fo=nroql2 acd=0
||return s:NetrwSafeOptions }
|s:GetTempfile(fname<>) {
||tmpfile</tmp/vXrrX2Z/0> re-using
||ro=0 ma=1 mod=0 wrap=1
||return s:GetTempfile </tmp/vXrrX2Z/0> }
|curbufname<ftp://csm@ics//home/csm/vim_test_file.txt>
|(write selected portion) silent exe 1,490w!  /tmp/vXrrX2Z/0
|choice<ftp://csm@ics//home/csm/vim_test_file.txt> ichoice=2
|NetrwMethod(a:choice<ftp://csm@ics//home/csm/vim_test_file.txt>) {
||curmachine<ics>
||determine method:
||ftp://...
||g:netrw_machine<ics>
||a:choice       <ftp://csm@ics//home/csm/vim_test_file.txt>
||b:netrw_method <3>
||g:netrw_machine<ics>
||g:netrw_port   <>
||g:netrw_uid    <csm>
||s:netrw_passwd <cash.out>
||b:netrw_fname  </home/csm/vim_test_file.txt>
||return NetrwMethod : b:netrw_method=3 }
|read via ftp+mipf (method #3)
|filter input: open ics
|filter input: user "csm" "cash.out"
|filter input: binary
|filter input: put "/tmp/vXrrX2Z/0" "/home/csm/vim_test_file.txt"
|executing: %!ftp -i -n
|cleanup
|s:FileReadable(fname</tmp/vXrrX2Z/0>) {
||return s:FileReadable 1 }
|tmpfile</tmp/vXrrX2Z/0> readable, will now delete it
|s:NetrwDelete(path</tmp/vXrrX2Z/0>) {
||netrw#WinPath(path</tmp/vXrrX2Z/0>) {
|||return netrw#WinPath </tmp/vXrrX2Z/0> }
||let result= delete(/tmp/vXrrX2Z/0)
||return s:NetrwDelete 0 }
|s:NetrwOptionRestore(vt<w:>) win#1 buf#1 winnr($)=1 {
||g:netrw_keepdir=1: getcwd</home/cnorton> acd=0
||g:netrw_keepdir=1: getcwd</home/cnorton> acd=0
||fo=tcq acd=0
||ro=0 ma=1 mod=0 wrap=1
||diff=0 win#1 w:netrw_diffkeep=doesn't exist
||return s:NetrwOptionRestore : win#1 buf#1 }
|return netrw#NetWrite }
netrw#NetrwRestorePosn() a:0=0 winnr=1 line=19 col=1 hline=1 {
|restore window: exe silent! 1wincmd w
|restore topofscreen: exe norm! 1G0z
|restore posn: exe norm! 19G01|
|return netrw#NetrwRestorePosn }
netrw#NetrwSavePosn() {
|currently, win#1 line#1 col#1
|netrw#NetrwRestorePosn() a:0=0 winnr=1 line=1 col=1 hline=1 {
||restore window: exe silent! 1wincmd w
||restore topofscreen: exe norm! 1G0z
||restore posn: exe norm! 1G01|
||return netrw#NetrwRestorePosn }
|return netrw#NetrwSavePosn : winnr=1 line=1 col=1 hline=1 }
netrw#NetRead(mode=2,...) a:0=1 v140 {
|s:NetrwOptionSave(vt<w:>) win#1 
buf#1<ftp://csm@ics//home/csm/vim_test_file.txt> winnr($)=1 {
||w:netrw_optionsave doesn't exist
||fo=tcq acd=0 diff=0
||return s:NetrwOptionSave : win#1 buf#1 }
|s:NetrwSafeOptions() win#1 buf#1<ftp://csm@ics//home/csm/vim_test_file.txt> 
winnr($)=1 {
||win#1's ft=conf
||s:NetrwCursorline() liststyle=0 g:netrw_cursorline=1 s:netrw_usercuc=0 
s:netrw_usercul=0 {
|||setlocal cursorline
|||return s:NetrwCursorline : l:cursorline=1 l:cursorcolumn=0 }
||ft<conf> ei=
||fo=nroql2 acd=0
||return s:NetrwSafeOptions }
|s:RestoreCursorline() currently, cul=1 cuc=0 win#1 buf#1 {
||return s:RestoreCursorline : restored cul=0 cuc=0 }
|readcmd<%r> ichoice=1
|s:GetTempfile(fname<>) {
||tmpfile</tmp/vXrrX2Z/0> re-using
||ro=0 ma=1 mod=0 wrap=1
||return s:GetTempfile </tmp/vXrrX2Z/0> }
|no lastfile: choice<ftp://csm@ics//home/csm/vim_test_file.txt>
|choice<ftp://csm@ics//home/csm/vim_test_file.txt>
|NetrwMethod(a:choice<ftp://csm@ics//home/csm/vim_test_file.txt>) {
||curmachine<ics>
||determine method:
||ftp://...
||g:netrw_machine<ics>
||a:choice       <ftp://csm@ics//home/csm/vim_test_file.txt>
||b:netrw_method <3>
||g:netrw_machine<ics>
||g:netrw_port   <>
||g:netrw_uid    <csm>
||s:netrw_passwd <cash.out>
||b:netrw_fname  </home/csm/vim_test_file.txt>
||return NetrwMethod : b:netrw_method=3 }
|s:GetTempfile(fname</home/csm/vim_test_file.txt>) {
||tmpfile</tmp/vXrrX2Z/0> re-using
||using fname</home/csm/vim_test_file.txt>'s suffix
||suffix<.txt>
||chgd tmpfile</tmp/vXrrX2Z/0> (removed any .tmp suffix)
||chgd tmpfile</tmp/vXrrX2Z/0.txt> (added .txt suffix) 
netrw_fname</home/csm/vim_test_file.txt>
||ro=0 ma=1 mod=0 wrap=1
||return s:GetTempfile </tmp/vXrrX2Z/0.txt> }
|checking if NetrwBrowse() should handle 
choice<ftp://csm@ics//home/csm/vim_test_file.txt> with netrw_list_cmd<ssh 
USEPORT HOSTNAME ls -FLa>
|read via ftp+mipf (method #3)
|s:SaveBufVars() buf#1 {
||return s:SaveBufVars }
|s:RestoreBufVars() {
||return s:RestoreBufVars }
|filter input: open ics
|filter input: user "csm" "cash.out"
|filter input: binary
|filter input: get "/home/csm/vim_test_file.txt" /tmp/vXrrX2Z/0.txt
|executing: %!ftp -i -n
|s:SaveBufVars() buf#7 {
||return s:SaveBufVars }
|s:RestoreBufVars() {
||return s:RestoreBufVars }
|NetrwGetFile(readcmd<%r>,tfile</tmp/vXrrX2Z/0.txt> method<3>) {
||rfile<ftp://csm@ics//home/csm/vim_test_file.txt>
||get file into buffer
||exe sil! keepalt file /tmp/vXrrX2Z/0.txt
||edit temporary file
||exe sil! keepalt file ftp://csm@ics//home/csm/vim_test_file.txt
||renamed buffer back to remote 
filename<ftp://csm@ics//home/csm/vim_test_file.txt> : 
expand(%)<ftp://csm@ics//home/csm/vim_test_file.txt>
||redir<ls!>: 
||redir<ls!>:   1 %a   "ftp://csm@ics//home/csm/vim_test_file.txt" line 1
||redir<ls!>:   2u a-  "Decho Tab"                    line 0
||redir<ls!>:   3u     "[No Name]"                    line 1
||redir<ls!>:   7u     "[No Name]"                    line 1
||redir<ls!>:   9u     "/tmp/vXrrX2Z/0.txt"           line 1
||NetReadFixup() not called, doesn't exist  (line1=1 line2=490)
||s:UpdateBuffersMenu() {
|||return s:UpdateBuffersMenu }
||s:FileReadable(fname</tmp/vXrrX2Z/0.txt>) {
|||return s:FileReadable 1 }
||readcmd<%r> cmdarg<> tfile</tmp/vXrrX2Z/0.txt> readable=1
||ro=0 ma=1 mod=0 wrap=1
||return NetrwGetFile }
|cleanup b:netrw_method and b:netrw_fname
|s:FileReadable(fname</tmp/vXrrX2Z/0.txt>) {
||return s:FileReadable 1 }
|cleanup by deleting tmpfile</tmp/vXrrX2Z/0.txt>
|s:NetrwDelete(path</tmp/vXrrX2Z/0.txt>) {
||netrw#WinPath(path</tmp/vXrrX2Z/0.txt>) {
|||return netrw#WinPath </tmp/vXrrX2Z/0.txt> }
||let result= delete(/tmp/vXrrX2Z/0.txt)
||return s:NetrwDelete 0 }
|s:NetrwOptionRestore(vt<w:>) win#1 buf#1 winnr($)=1 {
||g:netrw_keepdir=1: getcwd</home/cnorton> acd=0
||g:netrw_keepdir=1: getcwd</home/cnorton> acd=0
||fo=tcq acd=0
||ro=0 ma=1 mod=0 wrap=1
||diff=0 win#1 w:netrw_diffkeep=doesn't exist
||return s:NetrwOptionRestore : win#1 buf#1 }
|return netrw#NetRead :5 getcwd</home/cnorton> }
netrw#NetrwRestorePosn() a:0=0 winnr=1 line=1 col=1 hline=1 {
|restore window: exe silent! 1wincmd w
|restore topofscreen: exe norm! 1G0z
|restore posn: exe norm! 1G01|
|return netrw#NetrwRestorePosn }

Original comment by octopusg...@gmail.com on 25 Jul 2013 at 8:37

GoogleCodeExporter commented 9 years ago
Once netwr.vim is replaced with the non-debug statements, the behavior returns. 
Re-read file comes back dos, not Unix.

Original comment by octopusg...@gmail.com on 25 Jul 2013 at 8:40

GoogleCodeExporter commented 9 years ago
This problem is resolved 7.4a beta. Thanks for your help.

Original comment by octopusg...@gmail.com on 29 Jul 2013 at 4:15

GoogleCodeExporter commented 9 years ago
Problem resolved by upgrading vim (to 7.4a beta).

Original comment by drc...@campbellfamily.biz on 29 Jul 2013 at 6:40