1

I have output captured by following command:

strace -f -e trace=process,socketpair,open,close,dup,dup2,read,write -o rsync.log rsync -avcz --progress src/ dst/

it is a bit long so I've uploaded it here. I understand basic format of strace output, for example following line:

1399 open("/lib/x86_64-linux-gnu/libpopt.so.0", O_RDONLY|O_CLOEXEC) = 3

Means that:

  1. 1399 is PID of process
  2. open(const char *pathname, int flags); is system call with particular arguments (taken from man 2 open)
  3. 3 is the return value, a file descriptor in this particular case (taken from man 2 open)

According to this thread:

rsync spawns two processes/threads to do the copy, and there's one stream data between the processes, and another from the receiving process to the target file.

Using something like strace -e trace=process,socketpair,open,read,write would show some threads spawned off, the socket pair being created between them, and different threads opening the input and output files.

Can I somehow parse strace output to being able confirm statements from mentioned thread and see what happens under the hood, even if I'm not very familiar with inter process communication? I'm especially interested in data passing between processes/threads (how much data were passed from process1 to process2? where does the process2 wrote the received data?)

I've also seen lines like this one in log but I do not know how to correctly interpret them:

1399  <... close resumed> )             = 0
1400  <... dup2 resumed> )              = 0
1
  • 1
    It's going to be tricky since rsync uses SSH by default so the text itself is probably going to be encrypted. A description of "resumed" can be found on the man page: linux.die.net/man/1/strace
    – rogerdpack
    Aug 21, 2018 at 19:56

1 Answer 1

0
  • I recommend to use -y flag for strace, it will print paths associated with file descriptor arguments.

  • -e is qualifier for trace, it may be miss syscalls that you want.

I think it is better to output all system calls and signals without qualifying, then you can use grep to filter the information you want, example below:

grep -E 'dup2\(|clone\(|execve\(|\(open|write|close|openat|F_DUPFD|exit_group' trace.log

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .