flint / Lurker

Resource Tracking
http://lurker.rtfd.org
MIT License
179 stars 24 forks source link

inotify conversion error #32

Open macintoshplus opened 6 years ago

macintoshplus commented 6 years ago

The test Lurker\Tests\Tracker\InotifyTrackerTest::testMoveResource fail because the events read from inotify is wrong converted in object.

This is the inotify raw data from the php ext:

array(5) {
  [0]=>
  array(4) {
    ["wd"]=>
    int(1)
    ["mask"]=>
    int(64)
    ["cookie"]=>
    int(538122)
    ["name"]=>
    string(4) "file"
  }
  [1]=>
  array(4) {
    ["wd"]=>
    int(1)
    ["mask"]=>
    int(128)
    ["cookie"]=>
    int(538122)
    ["name"]=>
    string(8) "file_new"
  }
  [2]=>
  array(4) {
    ["wd"]=>
    int(1)
    ["mask"]=>
    int(1073741888)
    ["cookie"]=>
    int(538123)
    ["name"]=>
    string(6) "subdir"
  }
  [3]=>
  array(4) {
    ["wd"]=>
    int(1)
    ["mask"]=>
    int(1073741952)
    ["cookie"]=>
    int(538123)
    ["name"]=>
    string(10) "subdir_new"
  }
  [4]=>
  array(4) {
    ["wd"]=>
    int(2)
    ["mask"]=>
    int(2048)
    ["cookie"]=>
    int(0)
    ["name"]=>
    string(0) ""
  }
}

This is the result from this library:

Path /tmp/sf2_resource_watcher_tests/dir/file => event DELETE
Path /tmp/sf2_resource_watcher_tests/dir/file_new => event CREATE
Path /tmp/sf2_resource_watcher_tests/dir/subdir_new => event CREATE
Path /tmp/sf2_resource_watcher_tests/dir/subdir_new/subfile => event CREATE

The DELETE event for subdir and subdir/subfile have been lost...

Environment:

PHP version:

$ php -v
PHP 7.2.5-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: May  5 2018 05:00:15) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.5-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

PHP ext:

$ php --ri inotify

inotify

Version => 2.0.0

Kernel:

$ uname -srvpio
Linux 4.15.0-22-generic #24-Ubuntu SMP Wed May 16 12:15:17 UTC 2018 x86_64 x86_64 GNU/Linux