Bug 182188 - libblkid fails to gather info on systems with clocks set before the epoch
Summary: libblkid fails to gather info on systems with clocks set before the epoch
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: e2fsprogs
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Karel Zak
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-02-20 22:19 UTC by David Cantrell
Modified: 2007-11-30 22:11 UTC (History)
2 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2006-03-07 15:42:48 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
libblkid patch (1.22 KB, patch)
2006-02-20 22:19 UTC, David Cantrell
no flags Details | Diff
Better fix for the bug (2.43 KB, text/plain)
2006-03-12 23:32 UTC, Theodore Tso
no flags Details

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.


Note You need to log in before you can comment on or make changes to this bug.