Voelker, Bernhard wrote: > Hi *, > > short question: > is there a particular reason why the signal handlers are installed after > ftruncate() in dd? > > Long story: > I ran dd for a new backup of my 150GB partition to an external USB drive > while I started > while kill -USR1 pid ; do sleep 30 ; done > in a separate terminal. The target file already existed and reflected a > previous backup. > After a while, dd ended with the standard USR1 signal handler. > The only work done so far was to truncate the old output file. > So my guess was that installing the signal handler for SIGUSR1 is done after > the truncation. So I looked into the latest sources (coreutils-7.4) and found > out > that my guess was right: > > if (ftruncate (STDOUT_FILENO, size) != 0) > { > <snipped /> > } > } > #endif > } > install_signal_handlers (); > > So why does ftruncate() before install_signal_handlers()?
What is your exact dd command please, and destination file system. I'm a bit confused as ftruncate is not called unless you specify a non zero seek= but that seems a bit weird from your described usage. Also I'm confused as to why a non zero seek would take "a while". On vfat I suppose, but that only supports 4G files, not 150G. You're right though in that the signal handlers are installed just around the copy. I need to double check if that's by design. cheers, Pádraig.