Bug 182188

Summary: libblkid fails to gather info on systems with clocks set before the epoch
Product: [Fedora] Fedora Reporter: David Cantrell <dcantrell>
Component: e2fsprogsAssignee: Karel Zak <kzak>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: kzak, sct
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-03-07 15:42:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
libblkid patch
none
Better fix for the bug none

Description David Cantrell 2006-02-20 22:19:43 UTC
I did an install of FC5t3 on an iMac and noticed that blkid(8) showed nothing. 
The /etc/blkid.tab file was empty.  Digging deeper I discovered that since
libblkid uses a cache file, time stamps are compared to determine if anything
needs to be reread.  The iMac had a dead battery and it's date was set to the
Mac epoch, which is in 1904.  The negative time was throwing off the test and
libblkid just failed to see anything.

I created a patch for libblkid to let it gather info if time(0) is less than
zero.  Correct info is returned when the clock is set before or after the epoch.

The major problem this caused on the iMac was an unbootable system after a fresh
install.  /etc/fstab contained a LABEL=/boot line to mount the /boot filesystem,
but since libblkid gathered nothing, mounting /boot failed.

The patch I created is attached.

Comment 1 David Cantrell 2006-02-20 22:19:44 UTC
Created attachment 124914 [details]
libblkid patch

Comment 2 David Cantrell 2006-02-20 22:31:44 UTC
Also, other users have noticed this behavior in the past.  Bugzilla #158499
shows it happening.

Comment 3 Stephen Tweedie 2006-02-21 20:09:42 UTC
Isn't this basically goin to disable blkid caching in that case, forcing probing
each time?


Comment 4 David Cantrell 2006-02-21 20:17:39 UTC
Yes.

Comment 5 Karel Zak 2006-02-21 20:53:14 UTC
Probe each time is probably less problem than failed fsck/mount when the system
boots. IMHO the patch (or some other way how ignore blk.tab on system where
time() ==(time_t)-1) has sense.

Comment 6 David Cantrell 2006-02-21 21:00:59 UTC
That was my reasoning too.  If the clock is useless, blkid should just probe
each time.

Comment 7 David Cantrell 2006-03-07 15:42:48 UTC
I've added this patch to e2fsprogs-1.38-10.

Comment 8 Theodore Tso 2006-03-12 23:32:53 UTC
Created attachment 126011 [details]
Better fix for the bug

Here is a more elegant fix to the problem which was reported.  There was a bug
in blkid's test to see whether or not a device needs to be verified.  The
device should always be checked if current time is less than the last
verification time recorded for the device.  Your proposed patch works around
the problem, but doesn't fix the root cause of the problem.  (For example, if
the system clock gets set backwards, there are lossage cases that don't get
fixed with your proposed patch, which is fixed with mine.)

Comment 9 Karel Zak 2006-03-13 12:50:02 UTC
Ted's patch has been added to devel/ CVS.