Bug 182188 - libblkid fails to gather info on systems with clocks set before the epoch
libblkid fails to gather info on systems with clocks set before the epoch
Product: Fedora
Classification: Fedora
Component: e2fsprogs (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Karel Zak
Depends On:
  Show dependency treegraph
Reported: 2006-02-20 17:19 EST by David Cantrell
Modified: 2007-11-30 17:11 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-03-07 10:42:48 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description David Cantrell 2006-02-20 17:19:43 EST
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 17:19:44 EST
Created attachment 124914 [details]
libblkid patch
Comment 2 David Cantrell 2006-02-20 17:31:44 EST
Also, other users have noticed this behavior in the past.  Bugzilla #158499
shows it happening.
Comment 3 Stephen Tweedie 2006-02-21 15:09:42 EST
Isn't this basically goin to disable blkid caching in that case, forcing probing
each time?
Comment 4 David Cantrell 2006-02-21 15:17:39 EST
Comment 5 Karel Zak 2006-02-21 15:53:14 EST
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 16:00:59 EST
That was my reasoning too.  If the clock is useless, blkid should just probe
each time.
Comment 7 David Cantrell 2006-03-07 10:42:48 EST
I've added this patch to e2fsprogs-1.38-10.
Comment 8 Theodore Tso 2006-03-12 18:32:53 EST
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 07:50:02 EST
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.