On 12/01/2026 09:17, Dmitry V. Levin wrote:
On Sun, Jan 11, 2026 at 06:32:31PM +0000, Pádraig Brady wrote:
FYI we've just pushed a new test in the attached that uses
strace to inject errors for testing, like:

    $ strace -o /dev/null -P /dev/null -e fault=read:error=EIO \
      cat /dev/null
    cat: /dev/null: Input/output error

Since it's not guaranteed that the syscall issued by libc would
necessarily be read (it could be a syscall from readv family instead),
I'd recommend using a wide regexp like /read instead, e.g.

   $ strace -o /dev/null -P /dev/null -e trace=/read -e fault=all:error=EIO \
     cat /dev/null

Also note that since you're not interested in tracing non-read syscalls,
you can explicitly limit the set of syscalls being traced to those you're
going to tamper with, and inject errors into all syscalls being traced,
like in this example, all /read syscalls dealing with /dev/null.

That is better yes, as it caters for pread64, readv, readahead, preadv, preadv2 
...
I've pushed an adjustment to the test along those lines, in your name.

In the edge case where readlink was also in play one could use -e '/read[^l]?'
BTW it might be nice to support ANDing negatives like -e '/read,!readlink'

cheers,
Padraig

Reply via email to