Free Downloads, Community Forum,
FAQs and Developer Resources


Make /Tools Your Home | Link to us

Today's posts | Posts since last visit | Most Active Topics

All Forums Register Login Search Subscriptions My Profile Inbox
Tool Warehouse FAQs Resources Help Member List Address Book Logout

trash at end of filed edited by vim

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [SFU / Interix / SUA Technology] >> Tools Discussion Forum >> trash at end of filed edited by vim Page: [1]
Login
Message << Older Topic   Newer Topic >>
trash at end of filed edited by vim - Jul. 17, '04, 6:28:22 AM   
wtf1101

 

Posts: 5
Joined: Jul. 17, '04,
From: NYC
Status: offline
I'm having a problem with files edited by vim-6.2. For some reason, some files, upon writing and closing, end up with several lines of "garbage text" placed at their end. This "garbage text" is always a sequential chunk of text from the file itself - it's not random garbage or bits-n-pieces from here and there. And it seem that this spurious chunk of text is a portion near the end or from the end of the file. These erroneous lines can be deleted, but once you save and close, you'll get 'em back (and sometimes with more). A quick 'cat' will prove this.

This garbage only accumulates at the bottom; it doesn't appear anywhere else in a file. I have no choice but to "head -#_of_good_lines orig > aaa; mv -f aaa orig" to get rid of it.

At first I thought it had to do with editing a file through a symbolic link. Then I thought maybe it was editing a file in DOS format. I was wrong on both counts. There's no solid pattern to vim's behavior, but some files are plagued more often than others; my .profile for example is always getting "trashed." Maybe that's because it's a 'dot' file? But that's doubtful as I have other text files that are not 'dot' files that still get trashed.

I must make it clear that it is vim doing this. If I never edit these files - or use a different editor - I experience no ill effects. It's vim.

Am I the only one suffering this? Am I the only one using vim?
I love vim. I want my "split-pane VI." Does anyone have any suggestions?
Thanks!

- Liam
Post #: 1
RE: trash at end of filed edited by vim - Jul. 18, '04, 12:36:57 AM   
Rodney

 

Posts: 3728
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
I know that there are a fair number of vim users.
That's why the port happened in the first place

Perhaps it's something to do with the size of the file?
What are the sizes of the files getting trashed?
On to what type of filesystems are they? (NTFS, FAT, SMB, ...)
Is what's in the extra chunk the same info or random? Is it readable, binary or mixed?

< Message edited by Rodney -- Jul. 18, '04, 12:37:13 AM >

(in reply to wtf1101)
Post #: 2
RE: trash at end of filed edited by vim - Jul. 18, '04, 10:28:56 AM   
wtf1101

 

Posts: 5
Joined: Jul. 17, '04,
From: NYC
Status: offline
Alas, I wish it were related to something as perdictable as file size, but that doesn't seem to be a factor. I've had this "mystery trash" appear in a 5-line password file equally as often as in an 840+ line script. One thing that may be an issue: if the file contains a ^M when it's opened. This sometimes happens when I'm editing a file which was created on the DOS/Windows side. I've now made it my SOP to strip the unwanted line-ending CR's from my files before vim-ing them. It doesn't always do the trick, but it seems to help a little. (Maybe that's just wishful thinking on my part, for if it were bc. of the ^M's, then it should work all the time.)

Anyway ... All this occurs on my WinXP Pro box using NTFS partitions. And the "mystery trash," as a said, is always a portion of the text file being edited.

For example, take my "jrun" script:

quote:

#!/usr/local/bin/bash
ufil=$(ufile / $TEMP)
env2prop > "$ufil"
if [ "$1" = "-cp" -o "$1" = "-classpath" ]
then
  __CP="$2;$CLASSPATH"
  shift 2
else
  __CP="$CLASSPATH"
fi
java -Denv.properties="$ufil" -classpath "$__CP" $*
rm -rf "$ufil"
# end of script


A perfect example of how this trash might appear would be as follows:

quote:

#!/usr/local/bin/bash
ufil=$(ufile / $TEMP)
env2prop > "$ufil"
if [ "$1" = "-cp" -o "$1" = "-classpath" ]
then
  __CP="$2;$CLASSPATH"
  __shift 2
else
  __CP="$CLASSPATH"
fi
java -Denv.properties="$ufil" -classpath "$__CP" $*
rm -rf "$ufil"
# end of script
operties="$ufil" -classpath "$__CP" $*
rm -rf "$ufil"
# end of script


As I said, I could delete the trash lines - and they'll go away in the vim session - I can ":w" - and they'll still look to be gone. But ... and here's the scary part ... if I ":e" to reload the file, they're baaaack! (I could have just as easily saved the changes, quit vim, and re-entered the editor; the trash would still have reappeared.) To make 'em really go away, I have to get a count of the good lines, in this case 13, then do the following

  head -13 jrun > crappy; mv crappy jrun

(in reply to Rodney)
Post #: 3
RE: trash at end of filed edited by vim - Jul. 18, '04, 1:19:00 PM   
Rodney

 

Posts: 3728
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
I'm not able to replicate the problem even with your 'jrun' file.
What is "trash" at the end of the file is telling though. It's information
from within the file. This indicates that the problem is something to do
with the buffer (what specifically is unclear right now).
The last 70 characters (counting line endings) are what's repeated.
It looks to me that the original is 255 characters. Which is a wonderfully
interesting number. Perhaps I've copied your file incorrectly. What is the
size on your system for this file ('jrun')?

Also, do you have a ".virc" resource file? If so, what's in it?

< Message edited by Rodney -- Jul. 18, '04, 1:21:28 PM >

(in reply to wtf1101)
Post #: 4
RE: trash at end of filed edited by vim - Jul. 18, '04, 7:51:47 PM   
wtf1101

 

Posts: 5
Joined: Jul. 17, '04,
From: NYC
Status: offline
Yeah, that's the tricky part. I can't even reproduce the problem with the same file. However, it does seem that my .profile is more often plagued than any other file, but .profile is by no means the only one suffering.

As for a .virc file ... I have both a .vimrc and .exrc

.vimrc
set tabstop=4 shiftwidth=4 ruler

.exrc
set tabstop=4 shiftwidth=4 ruler=on

(in reply to Rodney)
Post #: 5
RE: trash at end of filed edited by vim - Jul. 18, '04, 11:02:22 PM   
Rodney

 

Posts: 3728
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
> As for a .virc file ... I have both a .vimrc and .exrc
Sorry, that was a typo (I dropped the 'm').
Anyway, nothing in them that looks like it could be contributing.

I'll walk through the 'save' code and see if there is anything obvious.
Given I know several people who have been using vim since January
it's kinda odd no one's mentioned anything similar before.

BTW: you can change files with DOS endings to Unix ending using the flip
utility (it's part of the regular install). It does to/from Mac conversions too.

< Message edited by Rodney -- Jul. 19, '04, 1:35:31 AM >

(in reply to wtf1101)
Post #: 6
RE: trash at end of filed edited by vim - Jul. 19, '04, 3:06:57 AM   
Rodney

 

Posts: 3728
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
There are no source code changes for vim at all from the
regular Unix code. I looked to see if such a bug was listed against
version 6.2, but I noticed that version 6.3 has been out since last
month. So I've updated vim to 6.3. Try updating to 6.3 and see
if that helps. Vim.org listed a number of bug that have been fixed so
*maybe* whatever problem you're experiencing will have been corrected.
pkg_add ftp://ftp.interopsystems.com/pkgs/3.5/vim-current-bin.tgz

(in reply to Rodney)
Post #: 7
RE: trash at end of filed edited by vim - Jul. 20, '04, 6:31:05 AM   
wtf1101

 

Posts: 5
Joined: Jul. 17, '04,
From: NYC
Status: offline
Thanks so much for all the effort you've put into this.

I've updated my VIM package to 6.3, but the problem hasn't gone away.

One thing I did realize this morning ... 99% of the time, the files I'm working on are located on my SNAP drive - a wonderful 180G NAS drive where I keep most of my work. The beauty of this beast is that I can access it from any machine on my network regardless of OS. As for Windows, the drive [partitions] are mounted as any other network drive using SMB. So, quite frankly, it's no different than mounting a share advertised by another Windows box (or one from my local box, for that fact). However, maybe there's something funky going on with data caching. (I dunno; I'm just grasping at straws here.)

I will say this, though ... the shared partitions on my SNAP device are not [generally] used by both UNIX/Linux and Windows - meaning, I have shares on the SNAP that are used by Windows [95, 98, NT, XP] and shares that are used by Linux. I don't really use the same shares from both platforms - at least, not in this situation.

I'll make it a point today (20-Jul) to work VIM to death on files that are totally local - i.e. only on C: Let's see if the problem persists. If it does, I don't know what I'll do. SFU/Interix is my last hope. MKS, Cygwin, U/WIN ... none of them work quite right under XP; I'm always doing something exotic, it seems.

But thanks again for all your efforts. I'll keep you posted as to today's results.

(in reply to Rodney)
Post #: 8
RE: trash at end of filed edited by vim - Jul. 29, '04, 5:30:46 PM   
wtf1101

 

Posts: 5
Joined: Jul. 17, '04,
From: NYC
Status: offline
Ok Rodney ... here's the deal ...

It's pretty much confirmed (at least in my mind) ... vim will not behave in a friendly fashion with files that reside on a mounted share. It doesn't matter if that share is exported from a remote box (WinXP or other) or from the same physical box.

For example: I share a "local" directory c:\local as \\endora2\local$

If I mount this share *on* endora2 itself as, say L: using

    net use L: \\endora2\local$ /persistent:yes

then use vim on a file, say

    vim -X /dev/fs/L/some-file

... there's a 99.9% chance that at some point, I'll have trash tacked on to the end of my file.

But if I use vim and access the file locally: vim -X /dev/fs/C/local/some-file, all will be fine.

So, I don't know if the problem is vim itself, or if it's something funky in the underlying POSIX file emulation.

(in reply to wtf1101)
Post #: 9
RE: trash at end of filed edited by vim - Jul. 29, '04, 11:13:12 PM   
markfunk

 

Posts: 673
Joined: Mar. 31, '03,
Status: offline
it is not likey a subsystem problem.
It could very well be a VIM problem. Some coding assumption that doesn't work in Interix perhaps.

I personally do not use vim. I prefer the original vi.
Although I know that there are a few big vim users.
Perhaps we'll get some feedback from them.

(in reply to wtf1101)
Post #: 10
RE: trash at end of filed edited by vim - Jul. 31, '04, 2:26:59 PM   
Rodney

 

Posts: 3728
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
I'll have to take a look when I get back from vacation.
I agree with Mark that it's unlikely a subsystem/Interix
problem. Given, as diagnosed a while back that the "junk"
at the end of the file is a repeat of the last bit of the
actual file. But given that a local file is okay and an SMB
mounted file isn't okay may be the big clue.

(in reply to markfunk)
Post #: 11
Page:   [1]
All Forums >> [SFU / Interix / SUA Technology] >> Tools Discussion Forum >> trash at end of filed edited by vim Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Search All Forums -

Advanced search


SPONSORS



Forum Software © ASPPlayground.NET Advanced Edition 2.5 ANSI

0.047