Swap error when editing hosts with vi

Swap error when editing hosts with vi

Post by Dino Hs » Mon, 16 Apr 2001 18:19:17



Dear all,

When I try to edit hosts with vi, it prompts the following message:
<start>
ATTENTION
Found a swap file by the name ".hosts.swp"
             dated: Sun Apr 15 14:25:11 2001
          owned by: root
         file name: /etc/hosts
          modified: YES
         host name: dino-s2.renjubridge.com
         user name: root
        process ID: 718
While opening file "hosts"
             dated: Sun Apr 15 12:50:05 2001

(1) Another program may be editing the same file.
    If this is the case, be careful not to end up with two
    different instances of the same file when making changes.
    Quit, or continue with caution.

(2) An edit session for this file crashed.
    If this is the case, use ":recover" or "vim -r hosts"
    to recover the changes (see ":help recovery)".
    If you did this already, delete the swap file ".hosts.swp"
    to avoid this message.

-- More --
<end>

Can anyone tell me why and what to do about this? Thanks.

Regards,
Dino

 
 
 

Swap error when editing hosts with vi

Post by Steve Co » Mon, 16 Apr 2001 19:43:08




> Dear all,

> When I try to edit hosts with vi, it prompts the following message:
> <start>
> ATTENTION Found a swap file by the name ".hosts.swp"
>              dated: Sun Apr 15 14:25:11 2001
>           owned by: root
>          file name: /etc/hosts
>           modified: YES
>          host name: dino-s2.renjubridge.com user name: root
>         process ID: 718
> While opening file "hosts"
>              dated: Sun Apr 15 12:50:05 2001

> (1) Another program may be editing the same file.
>     If this is the case, be careful not to end up with two different
>     instances of the same file when making changes. Quit, or continue
>     with caution.

> (2) An edit session for this file crashed.
>     If this is the case, use ":recover" or "vim -r hosts" to recover the
>     changes (see ":help recovery)". If you did this already, delete the
>     swap file ".hosts.swp" to avoid this message.

> -- More --
> <end>

> Can anyone tell me why and what to do about this? Thanks.

> Regards, Dino

Yup - *.swp is a temporary file created by vi when it edit's a file. If
the file is already being edited with vi by someone else or in another
console, then when you try to edit it again, you get this warning.

Of course, as it says, if you were editing the file and it crashed out,
then this file will still exist - just delete it. However, vi (vim) is
very stable so I reckon there is more chance that you have another vi
session running with the file open (differnet window, maybe backgrounded
etc).

Steve

 
 
 

Swap error when editing hosts with vi

Post by Dino Hs » Mon, 16 Apr 2001 22:47:41


On Sun, 15 Apr 2001 11:43:08 +0100, "Steve Cox"




>> Dear all,

>> When I try to edit hosts with vi, it prompts the following message:
>> <start>
>> ATTENTION Found a swap file by the name ".hosts.swp"
>>              dated: Sun Apr 15 14:25:11 2001
>>           owned by: root
>>          file name: /etc/hosts
>>           modified: YES
>>          host name: dino-s2.renjubridge.com user name: root
>>         process ID: 718
>> While opening file "hosts"
>>              dated: Sun Apr 15 12:50:05 2001

>> (1) Another program may be editing the same file.
>>     If this is the case, be careful not to end up with two different
>>     instances of the same file when making changes. Quit, or continue
>>     with caution.

>> (2) An edit session for this file crashed.
>>     If this is the case, use ":recover" or "vim -r hosts" to recover the
>>     changes (see ":help recovery)". If you did this already, delete the
>>     swap file ".hosts.swp" to avoid this message.

>> -- More --
>> <end>

>> Can anyone tell me why and what to do about this? Thanks.

>> Regards, Dino

>Yup - *.swp is a temporary file created by vi when it edit's a file. If
>the file is already being edited with vi by someone else or in another
>console, then when you try to edit it again, you get this warning.

>Of course, as it says, if you were editing the file and it crashed out,
>then this file will still exist - just delete it. However, vi (vim) is
>very stable so I reckon there is more chance that you have another vi
>session running with the file open (differnet window, maybe backgrounded
>etc).

>Steve

After I deleted .hosts.swp, which is located in the same directory as
hosts (/etc), the message is gone. Thanks.

Regards,
Dino

 
 
 

Swap error when editing hosts with vi

Post by Dean Thompso » Tue, 17 Apr 2001 01:35:42


Hi!,

Quote:> ATTENTION
> Found a swap file by the name ".hosts.swp"
>              dated: Sun Apr 15 14:25:11 2001
>           owned by: root
>          file name: /etc/hosts
>           modified: YES
>          host name: dino-s2.renjubridge.com
>          user name: root
>         process ID: 718
> While opening file "hosts"
>              dated: Sun Apr 15 12:50:05 2001

[...]

> Can anyone tell me why and what to do about this? Thanks.

This message is telling you that the system thinks that this file is being
edited by another process.  It could also be the remains of a session which
was running at a time when the system was crashed or when it went down.  If no
one else is editing the file, you should probably issue the ":recover" command
like it suggests, or delte the .swp file if you have made changes since the
last edit.

See ya

Dean Thompson

--
+____________________________+____________________________________________+

| Bach. Computing (Hons)     | ICQ     - 45191180                         |
| PhD Student                | Office  - <Off-Campus>                     |
| School Comp.Sci & Soft.Eng | Phone   - +61 3 9903 2787 (Gen. Office)    |
| MONASH (Caulfield Campus)  | Fax     - +61 3 9903 1077                  |
| Melbourne, Australia       |                                            |
+----------------------------+--------------------------------------------+

 
 
 

1. Strange vi-editing behaviour in editing XF86Config

Hi,

Last week I was editing the /etc/X11/XF86Config of Debian Linux 2.0.6.
and XFree86 3.1.2. and I had the strangest experience.

I was editing in tty0 (alt-F1). When I wrote XF86Config and quitted vi,
and after that started X (startx) it seemed that there was something
odd. Startx didn't complete. When I tried xinit, everything was okay.

I tried to start X in tty1 (altF2) where it worked fine. Also did xinit
work.

This seems strange to me, because they both use the same file, (I made
sure that vi was properly closed) Both both terminals gave (very
different) results.

After a reboot everything was fine. Both (in fact all) terminals could
startx, until I edited XF86Config once more. startx doesn't work in a
terminal where I've edited XF86Config.
Several reboots later ander everything was still the same, it all works
fabulous, except after editing.
When I edited the file with 'ae' there were never any problems.

I hope someone can do something with this.

Sander
--

2. Simple upgrade from libc5 to glibc?

3. why doesn#t "set -o vi" enable vi style cmdln editing?

4. UNIXBBS FAQ Update

5. vi to swap the two columns of the file /etc/hosts

6. REDHAT IS OK...my guys cheated me !!

7. Authentication

8. vi and "write error in swap space"

9. plenty of swap space, but keep receiving error "swap space limit exceeded"

10. Try to mount a seocn SWAP space-- error" unable to find swap space signature"

11. Editing a 4.7Mb file (VI limit 2Mb)

12. command line editing using the vi keys