[coreutils] [PATCH] Cater for extra strace output when building 32-on-64.

Pádraig Brady P at draigBrady.com
Mon Nov 1 14:53:29 UTC 2010


On 30/10/10 14:20, Nix wrote:
> When building 32-bit coreutils on a 64-bit Linux platform, the
> stat-free-symlinks test fails because the strace output it diffs
> against contains an extra informative line emitted by strace
> of the general form
> 
> [ Process PID=28429 runs in 32 bit mode. ]
> 
> So dike that line out, if it exists, before running the comparison.
> ---
>  tests/ls/stat-free-symlinks |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/tests/ls/stat-free-symlinks b/tests/ls/stat-free-symlinks
> index 6843b97..3f1e732 100755
> --- a/tests/ls/stat-free-symlinks
> +++ b/tests/ls/stat-free-symlinks
> @@ -42,6 +42,10 @@ LS_COLORS='or=0:mi=0:ex=01;32:ln=01;35' \
>  # line showing ls had called stat on "x".
>  grep '^stat("x"' err && fail=1
>  
> +# Eliminate warnings from 'out' relating to 32-bit mode on 64-bit platforms.
> +grep -v 'Process PID=[1-9][0-9]* runs in 32 bit mode.' < out > out-destrace
> +mv -f out-destrace out
> +
>  # Check that output is colorized, as requested, too.
>  {
>    printf '\033[0m\033[01;35mlink-to-x\033[0m@\n'

That looks like a buglet in strace, patch below.
There doesn't look to be any more cases of
incorrectly outputting to stdout:

I'll apply your workaround. but by directly
filtering through | grep -v "Process PID"

thanks!
Pádraig.

$ cd /rpmbuild/BUILD/strace-4.5.19
$ find -name "*.[ch]" | xargs grep -E "[^ftsn]printf[ (]"
./ioctlsort.c:          printf("{\"%s\", \"%s\", %#lx},\n",
./linux/ioctlsort.c:                    printf("\t{\"%s\",\t\"%s\",\t%#lx},\n",
./strace.c:                     printf("%s -- version %s\n", PACKAGE_NAME, VERSION);
./syscall.c:                    printf("ptrace_peektext failed: %s\n",
./syscall.c:                    printf("[ Process PID=%d runs in %s mode. ]\n",

--- syscall.c.orig      2010-11-01 14:46:41.292576453 +0000
+++ syscall.c   2010-11-01 14:47:10.164576378 +0000
@@ -953,7 +953,7 @@

                call = ptrace(PTRACE_PEEKTEXT, pid, (char *)rip, (char *)0);
                if (errno)
-                       printf("ptrace_peektext failed: %s\n",
+                       fprintf(stderr, "ptrace_peektext failed: %s\n",
                                        strerror(errno));
                switch (call & 0xffff) {
                        /* x86-64: syscall = 0x0f 0x05 */
@@ -972,7 +972,7 @@
                if (currpers != current_personality) {
                        static const char *const names[] = {"64 bit", "32 bit"};
                        set_personality(currpers);
-                       printf("[ Process PID=%d runs in %s mode. ]\n",
+                       fprintf(stderr, "[ Process PID=%d runs in %s mode. ]\n",
                                        pid, names[current_personality]);
                }
        }




More information about the Strace-devel mailing list