unarchive 23539 close 23539 stop On 20/05/16 05:08, Pádraig Brady wrote: > On 15/05/16 00:06, Janne Snabb wrote: >> The attached patch fixes this bug for me. >> >> The patch moves the write_header() call in the inotify case to >> dump_remainder() where write_header() is called only if some file >> content is going to be output. >> >> I am not sure if this is the best approach. Another approach would be to >> change the inotify event handling so that all queued events are read at >> once and duplicates are eliminated before acting on them. Now it reads >> and acts on them one. > > I'd prefer to handle this much like you've done in the patch. > I.E. avoid more complications with inotify. > However consider the case where a file is truncated, > with your patch subsequent writes will not get a header. I.E. > > echo file1 > file1 > echo file2 > file2 > tail -f file1 file2 > > Then in parallel: > > > file1 > echo file1 > file1 > > You'll get output like: > > ==> file1 <== > file1 > > ==> file2 <== > file2 > tail: file1: file truncated > file1 The attached variant also handles the case above, and includes a test. I'll push in your name tomorrow. sorry for the delay on this. Pádraig