Code review comment for lp:~jamesodhunt/upstart/file-bridge-MP

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

On 14 March 2013 19:13, Steve Langasek <email address hidden> wrote:
> On Thu, Mar 14, 2013 at 06:53:22PM -0000, Dmitrijs Ledkovs wrote:
>> Review: Needs Information
>
>> # stop upstart-file-bridge
>
>> # cat /etc/init/subdir1.conf
>> start on file FPATH=/foo/a/test FEVENT=create
>> exec echo FPATH=$FPATH FEVENT=$FEVENT FMATCH=$FMATCH
>
>> # start upstart-file-bridge
>> # mkdir /foo
>> # mkdir /foo/a
>> # touch /foo/a/test
>
>> In the upstart-file-bridge.log:
>> Job got added /com/ubuntu/Upstart/jobs/subdir1
>> upstart-file-bridge: Could not create watch for path /: No such file or directory
>
>> Is this a limitation or a bug?
>
> Limitation. You're expected to only be able to watch for a) modification of
> a single path in an existing directory, or b) creation/deletion of files in
> an existing directory. Monitoring for recursive directory creation is
> unwieldly via inotify, and out of scope for what we understand the desktop
> requirements to be.
>

Me and steve chatted about this a little on irc on #ubuntu-devel.
In short, we believe we should be supporting the fact that all
/dir/ect/ori/es may not exist at first, but if they got finally
created we stop caring about changes to them (e.g. no support for
tracking removals, re-additions, etc of the dir being watched).
Prototyping here with inotifywait the solution is: if the dir exists
establish the watch & horay emit events as the jobs want.
If that dir does not exist, transverse to the first one that does and
establish a watch which is waiting for "CREATE,ISDIR $subdir", if that
fires establish a new watch on the $subdir, if that's the target we
suppose to watch huray, otherwise wait for "CREATE,ISDIR $nextsubdir",
the old watch can be simply destroyed. It looks like that's what the
code intended to do, but somehow failing.

I did a test for "file FPATH=/foobar.txt FEVENT=create" and that
failed, although that should also be working correctly.

Regards,

Dmitrijs.

« Back to merge proposal