From: andy@jhunix2.hcf.jhu.edu (Andy Poling)
Newsgroups: comp.sys.sgi.bugs
Subject: Unbelievable bug that didn't happen
Followup-To: comp.sys.sgi.bugs
Date: 21 Jan 1993 19:21:02 -0500
Organization: Homewood Academic Computing, Johns Hopkins University, Baltimore, Md, USA
Distribution: world
NNTP-Posting-Host: jhunix2.hcf.jhu.edu
Summary: file modified without mtime changing?!
Keywords: oh boy...


I can't believe what I just witnessed.  I've been chasing down a bug where
some process (I don't know which one - I'll get to why) is scribbling pieces
of /etc/utmp into /etc/mtab.  This I can deal with -- I just look at the
modification time on mtab and check out our process-accounting file for
which processes were running at the time, right?  Wrong.

While I was tracking this bug down, it happened -- I may have even made it
happen - I dunno.  The problem is this: even though the mtab file had been
scribbled in since I had last fixed it, the modification time of the file
had not changed!!!

I've called this in to the TAC, but I figure an article is worth a thousand
words over the phone as far as demonstrating the problem (which has occurred
three times while I was writing this article).  Plus maybe it'll ring a bell
with someone else and we can nail it down faster...

Below is included an undoctored transcript of me witnessing it.  I should
add that /etc/mtab is rally a symlink to a symlink to /loc/mtab (don't ask
why).  "age" is a simple 50 line C program that stat()s a file and prints
out it's ages with second precision.

Here's the sequence of events... 
	1) I do a "mount" and find the mtab screwed
	2) I "age" it: mod time = Jan 21 18:26:56 1993
	3) I zero it, and mount -f it back to life
	4) I do a "mount" to verify it is OK
	5) I "age" it: mod time = Jan 21 18:33:47 1993
	6) I wait awhile for the scribbling to occur
	7) I do a "mount" and voila: screwed again
	8) I "age" it: mod time = Jan 21 18:33:47 1993 (STILL!!!!!)

# mount
# age -ams /loc/mtab
/loc/mtab: access: 12 secs ago - Thu Jan 21 18:33:22 1993
modify: 398 secs ago - Thu Jan 21 18:26:56 1993
change: 398 secs ago - Thu Jan 21 18:26:56 1993
# > /loc/mtab; mount -fv /; mount -fav
/dev/root mounted on /
/dev/dsk/lv6 mounted on /src
/debug mounted on /debug
/dev/dsk/lv0 mounted on /diskless
/dev/dsk/lv3 mounted on /users
/dev/dsk/lv4 mounted on /tmp
/dev/dsk/lv1 mounted on /usr
/dev/dsk/lv5 mounted on /usr/spool/news
/dev/dsk/lv2 mounted on /usr/local
# mount
/dev/root on / type efs (rw,raw=/dev/rroot)
/dev/dsk/lv6 on /src type efs (rw,noquota,raw=/dev/rdsk/lv6)
/debug on /debug type dbg (rw,noquota)
/dev/dsk/lv0 on /diskless type efs (rw,noquota,raw=/dev/rdsk/lv0)
/dev/dsk/lv3 on /users type efs (rw,quota,raw=/dev/rdsk/lv3)
/dev/dsk/lv4 on /tmp type efs (rw,noquota,raw=/dev/rdsk/lv4)
/dev/dsk/lv1 on /usr type efs (rw,noquota,raw=/dev/rdsk/lv1)
/dev/dsk/lv5 on /usr/spool/news type efs (rw,noquota,raw=/dev/rdsk/lv5)
/dev/dsk/lv2 on /usr/local type efs (rw,noquota,raw=/dev/rdsk/lv2)
# age -ams /loc/mtab
/loc/mtab: access: 2 secs ago - Thu Jan 21 18:33:49 1993
modify: 4 secs ago - Thu Jan 21 18:33:47 1993
change: 4 secs ago - Thu Jan 21 18:33:47 1993
# mount
# age -ams /loc/mtab
/loc/mtab: access: 2 secs ago - Thu Jan 21 18:35:26 1993
modify: 101 secs ago - Thu Jan 21 18:33:47 1993
change: 101 secs ago - Thu Jan 21 18:33:47 1993

In case anybody's intersted, here is the sort of scribbling that I'm talking
about:

# strings /loc/mtab.hosed
ttyq10
elmo
ttyq11
tockgae_q12
ttyq12
yooyoungq13
ttyq13
+_("yam_ls
ttyq14
kroot
ttyq15
oherb
ttyq16
telnet
ttyq17
+_0gsheppardq18
ttyq18
hosemug
ttyq19
telnet
ttyq20
+_/'gwenlynsq21
ttyq21
telnet
ttyq22
latha
ttyq23
+_!Ocheckersq24
ttyq24
+_+]telnet
ttyq25
stephen
ttyq26
+_+atelnet
ttyq27
+_*Htelnet
ttyq28
telnet
ttyq29
telnet
ttyq30
telnet
ttyq31
+_*5rlogin
ttyq32
deat
ttyq33
telnet
ttyq34
telnet
ttyq35
kroot
ttyq36
isinger
ttyq37

-Andy

Andy Poling                              Internet: andy@jhunix.hcf.jhu.edu
UNIX Systems Programmer                  Bitnet: ANDY@JHUNIX
Homewood Academic Computing              Voice: (410)516-8096    
Johns Hopkins University                 UUCP: uunet!mimsy!aplcen!jhunix!andy
Newsgroups: comp.sys.sgi.bugs