Operating System - HP-UX
1835004 Members
2385 Online
110073 Solutions
New Discussion

Editing open files (LTSB)

 
HP System Handle Owner
Occasional Advisor

Editing open files (LTSB)

Dear all,

Can anyone supply any words surrounding what happens of user2 tries to edit/change a file which user1 is already changing.

I have tried it, and it seems that if user1 is editing a file, and at the same time, user2 tries to vi it, the vi session for user2 opens ok with no warning that the files is being changed by user1.

If user1 has made many changes, and exits out, even if user2 makes one character change, user1 loses all his/her alterations.

I am doing something wrong. Should there not be warning to say files is in use ?

Many thanks to all people who spend time supplying some help.

Regards

Russell
Not another questionnaire !!
4 REPLIES 4
Bill McNAMARA_1
Honored Contributor

Re: Editing open files (LTSB)

vi edits from temporary file in /var/tmp.
The write operation save the modifications to the original file system postition.

If you really want to do something like this you need something like cvs versioning system or some type of checkout checkin editing system... which will warn and try to intelligently merge in changes.

For s/w development I used to use clearcase, although cvs was also used.

Later,
Bill
It works for me (tm)
Bill McNAMARA_1
Honored Contributor

Re: Editing open files (LTSB)

or was it rcs (revision control system)
You need to man ci and rcs cvs for more.

Later,
Bill
It works for me (tm)
Ravi_8
Honored Contributor

Re: Editing open files (LTSB)

Hi,
in normal unix (like vi ) there is no such facility to give warning when the file is already open. while in developement to avoid such things we use lockf()( see man lockf)
never give up
James R. Ferguson
Acclaimed Contributor

Re: Editing open files (LTSB)

Hi:

If you want to edit /etc/passwd, for the reasons cited above, use 'vipw'. No arguments to the command are necessary. 'vipw' implements a locking mechanism that prevents concurrent edits for the duration of the session that obtains the lock.

...JRF...