mirror of https://github.com/vitalif/e2fsprogs
Fix up workarounds for dietlibc breakage
The dietlibc doesn't support the TZ environment variable, which is required by the standard. Work around this so that we can run the regression test suite when building with dietlibc. (This is useful for finding problems.) With this change, the only thing which doesn't work as far as dietlibc is concerned is the posix_memalign test, and the MMP support tests (because posix_memalign isn't provided by dietlibc, sigh.) Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>maint-test
parent
1fc70c168c
commit
5a1d25a7b2
|
@ -201,7 +201,7 @@ char *time_to_string(__u32 cl)
|
||||||
tz = ss_safe_getenv("TZ");
|
tz = ss_safe_getenv("TZ");
|
||||||
if (!tz)
|
if (!tz)
|
||||||
tz = "";
|
tz = "";
|
||||||
do_gmt = !strcmp(tz, "GMT");
|
do_gmt = !strcmp(tz, "GMT") | !strcmp(tz, "GMT0");
|
||||||
}
|
}
|
||||||
|
|
||||||
return asctime((do_gmt) ? gmtime(&t) : localtime(&t));
|
return asctime((do_gmt) ? gmtime(&t) : localtime(&t));
|
||||||
|
@ -222,14 +222,18 @@ time_t string_to_time(const char *arg)
|
||||||
}
|
}
|
||||||
if (arg[0] == '@') {
|
if (arg[0] == '@') {
|
||||||
/* interpret it as an integer */
|
/* interpret it as an integer */
|
||||||
ret = strtoul(arg+1, &tmp, 0);
|
arg++;
|
||||||
|
fallback:
|
||||||
|
ret = strtoul(arg, &tmp, 0);
|
||||||
if (*tmp)
|
if (*tmp)
|
||||||
return ((time_t) -1);
|
return ((time_t) -1);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
memset(&ts, 0, sizeof(ts));
|
memset(&ts, 0, sizeof(ts));
|
||||||
#ifdef HAVE_STRPTIME
|
#ifdef HAVE_STRPTIME
|
||||||
strptime(arg, "%Y%m%d%H%M%S", &ts);
|
ret = strptime(arg, "%Y%m%d%H%M%S", &ts);
|
||||||
|
if (ret == NULL)
|
||||||
|
goto fallback;
|
||||||
#else
|
#else
|
||||||
sscanf(arg, "%4d%2d%2d%2d%2d%2d", &ts.tm_year, &ts.tm_mon,
|
sscanf(arg, "%4d%2d%2d%2d%2d%2d", &ts.tm_year, &ts.tm_mon,
|
||||||
&ts.tm_mday, &ts.tm_hour, &ts.tm_min, &ts.tm_sec);
|
&ts.tm_mday, &ts.tm_hour, &ts.tm_min, &ts.tm_sec);
|
||||||
|
@ -241,13 +245,9 @@ time_t string_to_time(const char *arg)
|
||||||
ts.tm_mday = 0;
|
ts.tm_mday = 0;
|
||||||
#endif
|
#endif
|
||||||
ts.tm_isdst = -1;
|
ts.tm_isdst = -1;
|
||||||
ret = mktime(&ts);
|
ret = ts.tm_sec + ts.tm_min*60 + ts.tm_hour*3600 + ts.tm_yday*86400 +
|
||||||
if (ts.tm_mday == 0 || ret == ((time_t) -1)) {
|
(ts.tm_year-70)*31536000 + ((ts.tm_year-69)/4)*86400 -
|
||||||
/* Try it as an integer... */
|
((ts.tm_year-1)/100)*86400 + ((ts.tm_year+299)/400)*86400;
|
||||||
ret = strtoul(arg, &tmp, 0);
|
|
||||||
if (*tmp)
|
|
||||||
return ((time_t) -1);
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,8 @@ static void print_time(FILE *f, time_t t)
|
||||||
time_str = getenv("TZ");
|
time_str = getenv("TZ");
|
||||||
if (!time_str)
|
if (!time_str)
|
||||||
time_str = "";
|
time_str = "";
|
||||||
do_gmt = !strcmp(time_str, "GMT0");
|
do_gmt = !strcmp(time_str, "GMT") ||
|
||||||
|
!strcmp(time_str, "GMT0");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
time_str = asctime((do_gmt > 0) ? gmtime(&t) : localtime(&t));
|
time_str = asctime((do_gmt > 0) ? gmtime(&t) : localtime(&t));
|
||||||
|
|
|
@ -18,7 +18,7 @@ status=$?
|
||||||
echo Exit status is $status >> $OUT
|
echo Exit status is $status >> $OUT
|
||||||
|
|
||||||
$DEBUGFS -w $TMPFILE << EOF > /dev/null 2>&1
|
$DEBUGFS -w $TMPFILE << EOF > /dev/null 2>&1
|
||||||
set_current_time 201301151400
|
set_current_time 20130115140000
|
||||||
set_super_value lastcheck 0
|
set_super_value lastcheck 0
|
||||||
set_super_value hash_seed null
|
set_super_value hash_seed null
|
||||||
set_super_value mkfs_time 0
|
set_super_value mkfs_time 0
|
||||||
|
|
|
@ -8,7 +8,7 @@ echo "/ Murphy Magic. The SeCrEt of the UnIvErSe is 43, NOT 42" > $TEST_DATA
|
||||||
touch $TMPFILE
|
touch $TMPFILE
|
||||||
$MKE2FS -N 32 -F -o Linux -b 1024 $TMPFILE 100 > /dev/null 2>&1
|
$MKE2FS -N 32 -F -o Linux -b 1024 $TMPFILE 100 > /dev/null 2>&1
|
||||||
$DEBUGFS -w $TMPFILE << EOF > /dev/null 2>&1
|
$DEBUGFS -w $TMPFILE << EOF > /dev/null 2>&1
|
||||||
set_current_time 200704102100
|
set_current_time 20070410210000
|
||||||
set_super_value lastcheck 0
|
set_super_value lastcheck 0
|
||||||
set_super_value hash_seed null
|
set_super_value hash_seed null
|
||||||
set_super_value mkfs_time 0
|
set_super_value mkfs_time 0
|
||||||
|
|
|
@ -11,8 +11,8 @@ $DEBUGFS -w $TMPFILE << EOF > /dev/null 2>&1
|
||||||
freeb 4 4
|
freeb 4 4
|
||||||
freeb 8195 4
|
freeb 8195 4
|
||||||
write $TEST_DATA debugfs
|
write $TEST_DATA debugfs
|
||||||
set_current_time 200504110000
|
set_current_time 20050411000000
|
||||||
set_inode_field debugfs mtime 200504110000
|
set_inode_field debugfs mtime 2005041100000000
|
||||||
q
|
q
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue