SHA256
1
0
forked from pool/strace
strace/0011-Fix-stat64-st_-acm-time-decoding-for-personalities-w.patch
Martin Pluskal 0b44e76647 Accepting request 292570 from home:Andreas_Schwab:Factory
- 0001-aarch64-fix-rt_sigreturn-decoding.patch,
  0002-m68k-define-HAVE_SA_RESTORER.patch,
  0003-Fix-decoding-of-mmap2-for-arm.patch,
  0005-tests-select.test-handle-architectures-using-pselect.patch,
  0006-aarch64-fix-ioctl-decoding.patch,
  0007-m68k-fix-sigreturn-decoding.patch,
  0008-Fix-crash-in-ipc_sem-test.patch,
  0009-tests-ipc_-match-IPC_64-flag.patch,
  0010-semctl-fix-indirect-syscall-decoding.patch,
  0011-Fix-stat64-st_-acm-time-decoding-for-personalities-w.patch,
  0012-tests-verify-that-all-patterns-match.patch,
  0013-aarch64-properly-decode-generic-syscalls.patch,
  0014-stat64-v.test-add-newfstatat-syscall-support.patch,
  0015-tests-uid-use-fchown-instead-of-chown.patch: Patches from upstream
  to fix testsuite failure.
- Enable libunwind support (strace -k).

OBS-URL: https://build.opensuse.org/request/show/292570
OBS-URL: https://build.opensuse.org/package/show/devel:tools/strace?expand=0&rev=44
2015-03-24 18:25:03 +00:00

62 lines
2.0 KiB
Diff

From bce1ff5f881c3fe7b921637af2ee06dd0cdceef4 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Thu, 12 Mar 2015 16:59:01 +0000
Subject: [PATCH 11/15] Fix stat64 st_[acm]time decoding for personalities with
32-bit time_t
STRUCT_STAT.st_[acm]time are declared as unsigned int for some
personalities, while time_t is signed.
* printstat.h (DO_PRINTSTAT): If st_[acm]time have the same size as int,
explicitly cast them to int.
* tests/stat64-v.test: Test that negative time_t is decoded properly.
Reported-by: Andreas Schwab <schwab@suse.de>
---
printstat.h | 14 +++++++++++---
tests/stat64-v.test | 3 +--
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/printstat.h b/printstat.h
index dd0b02e..53112fe 100644
--- 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
diff --git a/tests/stat64-v.test b/tests/stat64-v.test
index 4915386..f03254a 100755
--- 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"
--
2.3.3