Your message dated Tue, 15 Oct 2024 23:41:51 +0200
with message-id 
<ca+6xhwrvfzszr4qhtcc0e4vjodprpmn+tsy0xh+idm1yudl...@mail.gmail.com>
and subject line Re: strace: -e write=fd doesn't dump data after error return
has caused the Debian Bug report #436284,
regarding strace: -e write=fd doesn't dump data after error return
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
436284: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=436284
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: strace
Version: 4.5.15-1
Severity: normal
Tags: patch


-e write=fd doesn't dump data after error return

When you provide the commandline option "-e write=fd", strace still
doesn't dump the full write data in the case where the write system call
returns an error.

Of course, the write that fails is sometimes exactly the one I wanted to
see....

So, reorganize the cases in dumpio() so that all the write-like cases
(where the io is input to the system call) are before all the read-like
cases, and only exit early in the second case.

(You could even wonder whether it makes sense to skip dumping in the
read case.  I tend to suspect the likelihood of there being interesting
data in the read buffer is small in that case, and that it's likely to
confuse the reader into thinking that the dumped data was actually
returned from the read.)

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.19 (PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.utf8)
Shell: /bin/sh linked to /bin/bash

Versions of packages strace depends on:
ii  libc6                         2.6-5      GNU C Library: Shared libraries

strace recommends no packages.

-- no debconf information

diff --git a/syscall.c b/syscall.c
index 06b10e8..781ead0 100644
--- a/syscall.c
+++ b/syscall.c
@@ -505,31 +505,10 @@ static void
 dumpio(tcp)
 struct tcb *tcp;
 {
-       if (syserror(tcp))
-               return;
        if (tcp->u_arg[0] < 0 || tcp->u_arg[0] >= MAX_QUALS)
                return;
+
        switch (known_scno(tcp)) {
-       case SYS_read:
-#ifdef SYS_pread64
-       case SYS_pread64:
-#endif
-#if defined SYS_pread && SYS_pread64 != SYS_pread
-       case SYS_pread:
-#endif
-#ifdef SYS_recv
-       case SYS_recv:
-#elif defined SYS_sub_recv
-       case SYS_sub_recv:
-#endif
-#ifdef SYS_recvfrom
-       case SYS_recvfrom:
-#elif defined SYS_sub_recvfrom
-       case SYS_sub_recvfrom:
-#endif
-               if (qual_flags[tcp->u_arg[0]] & QUAL_READ)
-                       dumpstr(tcp, tcp->u_arg[1], tcp->u_rval);
-               break;
        case SYS_write:
 #ifdef SYS_pwrite64
        case SYS_pwrite64:
@@ -550,12 +529,6 @@ struct tcb *tcp;
                if (qual_flags[tcp->u_arg[0]] & QUAL_WRITE)
                        dumpstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
                break;
-#ifdef SYS_readv
-        case SYS_readv:
-                if (qual_flags[tcp->u_arg[0]] & QUAL_READ)
-                        dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]);
-                break;
-#endif
 #ifdef SYS_writev
         case SYS_writev:
 
@@ -564,6 +537,39 @@ struct tcb *tcp;
                 break;
 #endif
        }
+
+       /* Don't bother dumping output if the sycall returned an error */
+       if (syserror(tcp))
+               return;
+
+       switch (known_scno(tcp)) {
+       case SYS_read:
+#ifdef SYS_pread64
+       case SYS_pread64:
+#endif
+#if defined SYS_pread && SYS_pread64 != SYS_pread
+       case SYS_pread:
+#endif
+#ifdef SYS_recv
+       case SYS_recv:
+#elif defined SYS_sub_recv
+       case SYS_sub_recv:
+#endif
+#ifdef SYS_recvfrom
+       case SYS_recvfrom:
+#elif defined SYS_sub_recvfrom
+       case SYS_sub_recvfrom:
+#endif
+               if (qual_flags[tcp->u_arg[0]] & QUAL_READ)
+                       dumpstr(tcp, tcp->u_arg[1], tcp->u_rval);
+               break;
+#ifdef SYS_readv
+        case SYS_readv:
+                if (qual_flags[tcp->u_arg[0]] & QUAL_READ)
+                        dumpiov(tcp, tcp->u_arg[2], tcp->u_arg[1]);
+                break;
+#endif
+       }
 }
 
 #ifndef FREEBSD


--- End Message ---
--- Begin Message ---
Version: 4.26-0.1

On Sat, 21 Mar 2020 02:38:28 +0100 Eugene Syromiatnikov <[email protected]> wrote:
> Control: tags -1 +upstream
>
> This has been fixed in strace 4.22 (commit bed7622d4980).

--- End Message ---

Reply via email to