* quit with modified files
@ 1993-05-24 18:48 Scott Schwartz
1993-05-25 23:07 ` Chris Siebenmann
0 siblings, 1 reply; 4+ messages in thread
From: Scott Schwartz @ 1993-05-24 18:48 UTC (permalink / raw)
To: Sam Fans
Is this a bug?
; sam -d
B /etc/fstab
-. /etc/fstab
i
a
b
c
.
B /etc/motd
-. /etc/motd
n
-
'- /etc/fstab
-. /etc/motd
q
;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: quit with modified files
1993-05-24 18:48 quit with modified files Scott Schwartz
@ 1993-05-25 23:07 ` Chris Siebenmann
1993-05-27 0:21 ` Scott Schwartz
0 siblings, 1 reply; 4+ messages in thread
From: Chris Siebenmann @ 1993-05-25 23:07 UTC (permalink / raw)
To: Sam Fans
It's a bug. It happens if you call in a clean file and immediately
try to quit; edit() in sam/sam.c doesn't set the global dirty file state
quite right. I've attached a patch.
- cks
*** /tmp/,RCSt1a04954 Tue May 25 19:05:06 1993
--- sam/sam.c Tue May 25 18:47:16 1993
***************
*** 331,337 ****
f->ndot.r.p1 = addr.r.p2, f->ndot.r.p2 = addr.r.p2+p;
else
f->ndot.r.p1 = f->ndot.r.p2 = 0;
! quitok = f->closeok = empty;
state(f, empty && !nulls? Clean : Dirty);
if(cmd == 'e')
filename(f);
--- 331,337 ----
f->ndot.r.p1 = addr.r.p2, f->ndot.r.p2 = addr.r.p2+p;
else
f->ndot.r.p1 = f->ndot.r.p2 = 0;
! quitok = quitok ? (f->closeok = empty) : FALSE;
state(f, empty && !nulls? Clean : Dirty);
if(cmd == 'e')
filename(f);
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: quit with modified files
1993-05-25 23:07 ` Chris Siebenmann
@ 1993-05-27 0:21 ` Scott Schwartz
0 siblings, 0 replies; 4+ messages in thread
From: Scott Schwartz @ 1993-05-27 0:21 UTC (permalink / raw)
To: Sam Fans
Thanks for the patch Chris. But now I have a second question. :-)
Consider this:
; sam/sam -d
B /etc/fstab
-. /etc/fstab
i
foo
.
D /etc/fstab
?changes to "/etc/fstab"
B /etc/svdtab
-. /etc/svdtab
D /etc/fstab
q
In other words, the second close attempt on a file will always succeed,
even if other operations have taken place in the meantime. That seems
rather aggressive to me; when the man page talks about a ``subsequent
D'', I expected that it meant an immediately subsequent one.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: quit with modified files
@ 1993-05-26 4:30 Chris Siebenmann
0 siblings, 0 replies; 4+ messages in thread
From: Chris Siebenmann @ 1993-05-26 4:30 UTC (permalink / raw)
To: sam-fans
Scott Schwartz kindly pointed out that my patch had a small bug. Please
discard it and use this one instead:
*** /tmp/,RCSt1a13201 Wed May 26 00:22:53 1993
--- sam/sam.c Wed May 26 00:10:47 1993
***************
*** 331,337 ****
f->ndot.r.p1 = addr.r.p2, f->ndot.r.p2 = addr.r.p2+p;
else
f->ndot.r.p1 = f->ndot.r.p2 = 0;
! quitok = f->closeok = empty;
state(f, empty && !nulls? Clean : Dirty);
if(cmd == 'e')
filename(f);
--- 331,338 ----
f->ndot.r.p1 = addr.r.p2, f->ndot.r.p2 = addr.r.p2+p;
else
f->ndot.r.p1 = f->ndot.r.p2 = 0;
! f->closeok = empty;
! quitok = quitok ? f->closeok : FALSE;
state(f, empty && !nulls? Clean : Dirty);
if(cmd == 'e')
filename(f);
- cks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1993-05-27 0:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1993-05-24 18:48 quit with modified files Scott Schwartz
1993-05-25 23:07 ` Chris Siebenmann
1993-05-27 0:21 ` Scott Schwartz
1993-05-26 4:30 Chris Siebenmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).