quasi-[OT] Adobe Flash

Suvayu Ali fatkasuvayu+linux at gmail.com
Sun Oct 24 02:41:22 UTC 2010


Hi Patrick and Marko,

On Saturday 23 October 2010 03:51 PM, Patrick O'Callaghan wrote:
> I tried it using inotifywait(1), but it never terminates, i.e. the flash
> file persists even after the video has finished. I suspect it will stay
> there till a new video starts or the flash plugin (i.e. the browser
> process) dies.
>

I think I know what is going on. See my explanation below and please
comment. :)

> tail -f -q --bytes=1G --pid=${pid} $in_file>  $out_file&

Firstly that `--pid=${pid}' needs to be removed otherwise it waits for
the browser to exit. But even that won't help.

When the script executes the above command, another file descriptor is
opened under the pid for tail. This stays linked to the (deleted)
/tmp/FlashXXXX file even after the link under the browser's pid has
been deleted and inotify keeps waiting for the original file to be
deleted!

I think if we can monitor the link itself (which is probably not what
inotify does) then we would have a winner.

> inotifywait -e delete $in_file 2>  /dev/null

Also I think delete_self might be a better event to watch for.

> sleep 5	# Wait for buffer to flush. Is this necessary?

This is probably not necessary. Strangely the answer lies in the man
page for a variation of the tail utility, `man 1 tailf'.

To quote:

... It is similar to tail -f but does not access the file when it is
not growing. This has the side effect of not updating the access time
for the file, so a filesystem flush does not occur periodically when
no log activity is happening.

> poc

This is turning out to be a rather fascinating discussion. :) Learned a 
lot thanks to you all.

-- 
Suvayu

Open source is the future. It sets us free.


More information about the users mailing list