On Thu, Mar 12, 2015 at 11:25:47AM +0100, Andreas Schwab wrote:
> stat64-v.test fails for tests-m32 on x86_64, because stat64 has unsigned
> int st_?time, but time_t is signed.

I'm inclined to think that the test is right and the parser is wrong.
Does this fix look OK?

--- a/printstat.h
+++ b/printstat.h
@@ -57,9 +57,17 @@ DO_PRINTSTAT(struct tcb *tcp, const STRUCT_STAT *statbuf)
        }
 
        if (!abbrev(tcp)) {
-               tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
-               tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
-               tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
+               const bool cast = sizeof(statbuf->st_atime) == sizeof(int);
+
+               tprintf("st_atime=%s, ",
+                       sprinttime(cast ? (time_t) (int) statbuf->st_atime:
+                                         (time_t) statbuf->st_atime));
+               tprintf("st_mtime=%s, ",
+                       sprinttime(cast ? (time_t) (int) statbuf->st_mtime:
+                                         (time_t) statbuf->st_mtime));
+               tprintf("st_ctime=%s",
+                       sprinttime(cast ? (time_t) (int) statbuf->st_ctime:
+                                         (time_t) statbuf->st_ctime));
 #if HAVE_STRUCT_STAT_ST_FLAGS
                tprintf(", st_flags=%u", (unsigned int) statbuf->st_flags);
 #endif
--- a/tests/stat64-v.test
+++ b/tests/stat64-v.test
@@ -22,8 +22,7 @@ $truncate_cmd > "$OUT" 2>&1 || {
 ./stat $sample > /dev/null ||
        fail_ 'stat failed'
 
-touch -d '1970-01-01 36028797018963968 seconds' $sample ||
-touch -t 0102030405 $sample
+touch -d '1970-01-01 -42 seconds' $sample
 
 for f in $sample . /dev/null; do
        args="-v -efile ./stat $f"

-- 
ldv

Attachment: pgpPFYfHOtLhD.pgp
Description: PGP signature

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Strace-devel mailing list
Strace-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to