Bug#528488: Should open output file with O_APPEND

2020-03-20 Thread Eugene Syromiatnikov
Control: tags -1 +upstream

This has been fixed in strace 4.22 by addition of the -A option
(commit be55c1c61aec).



Bug#528488: Should open output file with O_APPEND

2009-05-13 Thread Philipp Marek
X-Reportbug-Version: 4.2
X-Debbugs-Cc: philipp.ma...@emerion.com
Package: strace
Version: 4.5.18-1
Severity: normal


I'm sometimes using strace to debug long-running processes, by looking into 
the log files from time to time.
When they grow, I'd like to truncate them, so that effectively a new logfile 
(for the same process) is started.

But that doesn't really work, because strace opens the output file without 
O_APPEND:

# strace -e open strace -o /tmp/log true
open(/etc/ld.so.cache, O_RDONLY)  = 3
open(/lib/libc.so.6, O_RDONLY)= 3
open(/dev/urandom, O_RDONLY)  = 3
open(/tmp/log, O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3

So when I truncate the logfile, the file position is the same, and everything 
before the next write is filled with \0.

As for all log files the correct way would be to use O_APPEND (at least IMO).



-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.29-1-amd64 (SMP w/1 CPU core)
Locale: LANG=de_AT.UTF-8, LC_CTYPE=de_AT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages strace depends on:
ii  libc6 2.9-12 GNU C Library: Shared libraries

strace recommends no packages.

strace suggests no packages.

-- no debconf information




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org