Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: strace completion (Re: grouping/joining _values)

On Jun 14,  9:49am, Stephane Chazelas wrote:
} Or to let zsh remove the temp file:
} zmodload zsh/mapfile
} eval 'tmp=(' =(
}   print -rn -- ${mapfile[/usr/bin/strace]//strcmp/printf}) ')
}   chmod u+x $tmp
}   $tmp -e $'"'%s\n'"' 2> /dev/null | sort -u'
} Assuming the temp file name generated by zsh won't have special
} characters in it.

Clever as that seems to be, though, it doesn't work on my CentOS 4 system.
Using "ltrace -e printf $tmp ..." without the 2> shows a bunch of printf
calls, but none of the output ever appears.

[... lots omitted ...]
printf("%s\n", "shmdt")                          = -1
printf("%s\n", "shmget")                         = -1
printf("%s\n", "shmctl")                         = -1
strace: invalid system call `%s
+++ exited (status 1) +++

If I pass a valid system call name instead of $'%s\n' then I get the
usage message, so I think changing the label from strcmp to printf is
not replacing the underlying function that is actually called.

Incidentally for a shorter eval-less way to get the same non-result:

x() { chmod u+x $1; $1 -e $'%s\n' 2> /dev/null | sort -u }
x =(zmodload zsh/mapfile;
    print -rn -- ${mapfile[/usr/bin/strace]//strcmp/printf})

Messages sorted by: Reverse Date, Date, Thread, Author