fswatch icon indicating copy to clipboard operation
fswatch copied to clipboard

inotify_rm_watch: Invalid argument

Open JacobAMason opened this issue 6 years ago • 13 comments

I tried to test out fswatch with the following simple command:

fswatch -0 test | xargs -0 -n1 echo "Hello"

After each response

Hello /home/JacobAMason/test

I get the following

inotify_rm_watch: Invalid argument
Hello

This happens on every update to the file. So I have this output:

fswatch -0 test | xargs -0 -n1 echo "Hello"
Hello /home/JacobAMason/test
inotify_rm_watch: Invalid argument
Hello
Hello /home/JacobAMason/test
inotify_rm_watch: Invalid argument
Hello
Hello /home/JacobAMason/test
inotify_rm_watch: Invalid argument
Hello
...

Any idea what could cause this? I'm running fswatch 1.11.2 on Archlinux.

JacobAMason avatar May 17 '18 07:05 JacobAMason

Hi @JacobAMason, thanks for the report. I'll have to investigate it. Could you dump the directory structure of the test directory and all its contents and attach them to this issue?

$ find test -type d > directories.txt
$ find test > contents.txt

emcrisostomo avatar Jun 28 '18 15:06 emcrisostomo

I also just ran into this issue, while using fswatch on a rasPi.

My workaround was to switch the monitor that I was using:

fswatch -m poll_monitor

You can find the list of available monitors by using the -M flag:

pi@raspberrypi:~/csound/hello_world $ fswatch -M
  inotify_monitor
  poll_monitor
pi@raspberrypi:

Here is my output when I do not switch monitors:

pi@raspberrypi:~/csound/hello_world $ fswatch -0 pluck.csd
/home/pi/csound/hello_world/pluck.csdinotify_rm_watch: Invalid argument

Here is my output when I do switch monitors:

pi@raspberrypi:~/csound/hello_world $ fswatch -m poll_monitor -0 pluck.csd
/home/pi/csound/hello_world/pluck.csd

SpaceKatt avatar Jul 05 '18 00:07 SpaceKatt

Closing this because there's no way to replicate this issue and there's no feedback from the issuer.

emcrisostomo avatar Nov 13 '18 08:11 emcrisostomo

Sorry to reopen this, but I can confirm that this is an issue:

I run fswatch with inotify_monitor and then modify index.php:

fswatch -m inotify_monitor -t -x /path/*.php

	Mon 04 Feb 2019 09:56:32 PM UTC /path/index.php Updated
	inotify_rm_watch: Invalid argument
	Mon 04 Feb 2019 09:56:33 PM UTC  AttributeModified

I run fswatch with poll_monitor and then modify index.php and it stops happening:

fswatch -m poll_monitor -t -x /path/*.php

	Mon 04 Feb 2019 09:57:50 PM UTC /path/index.php Updated AttributeModified

To confirm it's not something to do with my command line, I removed everything (so it should default to inotify_monitor) and it happens again:

fswatch /path/*.php

	/path/index.php
	inotify_rm_watch: Invalid argument

As for index.php, it's a regular file. Nothing special about it, or the path:

-rw-rw-r--+ 1 root        root          26 Feb  4 22:02 index.php

Jammmmm avatar Feb 04 '19 22:02 Jammmmm

I'm facing the same issue.

fswatch -0 **/*.php | while read -d "" event; do echo ${event}; done
/home/eddie/Workspace/COMPANY/projects/PROJECT/app/FILEPATH/FILENAME.php
inotify_rm_watch: Invalid argument
$ fswatch --version
fswatch 1.11.2
Copyright (C) 2013-2017 Enrico M. Crisostomo <[email protected]>.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Enrico M. Crisostomo.

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.1 LTS
Release:        18.04
Codename:       bionic

$ uname -r
4.15.0-45-generic

stacyharper avatar Feb 05 '19 10:02 stacyharper

I thought it was something related with file names but according to @Jammmmm that's not the case. Would anyone attach a zipped directory I can use to replicate this problem? I haven't been able to replicate it and until I do there's no way I can fix it.

emcrisostomo avatar Feb 08 '19 15:02 emcrisostomo

Attached: test.zip

There's nothing special about it. Standard directory with standard file.

I've tried running fswatch as a regular user and as root. Both have the problem.

I have just noticed that @Eluminae is using Ubuntu. I am too. Maybe that has something to do with it?

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.5 LTS
Release:        16.04
Codename:       xenial

uname -r 4.4.0-141-generic

fswatch --version

fswatch 1.14.0
Copyright (C) 2013-2018 Enrico M. Crisostomo <[email protected]>.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Enrico M. Crisostomo.

Jammmmm avatar Feb 08 '19 16:02 Jammmmm

I'm also observing this issue on Ubuntu 18.04, fswatch 1.11.2.

sersorrel avatar Feb 24 '19 22:02 sersorrel

Also observing this on Ubuntu 18.10 and fswatch 1.12.0

vrajanap avatar Mar 19 '19 13:03 vrajanap

Checked out sources with version 1.13.0 and locally built it. That seems to work fine.

vrajanap avatar Mar 19 '19 13:03 vrajanap

I got the same thing on archlinux, sadly.

$ fswatch --version

fswatch 1.14.0

Copyright (C) 2013-2018 Enrico M. Crisostomo <[email protected]>.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.



Written by Enrico M. Crisostomo.
$ uname -r

5.0.2-arch1-1-ARCH

stacyharper avatar Mar 19 '19 14:03 stacyharper

Same here, on rpi3b+

yhaiovyi avatar Apr 23 '20 19:04 yhaiovyi

Ditto. Seem to only get the output on renames of the watched file. There's only two calls to inotify_rm_watch in inotify_monitor.cpp so it shouldn't be too hard to figure out what is happening. Will try to make a patch when I have a chance.

Replication:

#!/bin/bash

fswatch -x X &

echo "creating"
touch X
sleep 2

echo "touching"
touch X
sleep 2

echo "moving"
mv X Y
mv Y X
sleep 2

echo "writing"
echo "X" > X
sleep 2

echo "modify write attr"
chmod -w X
sleep 2

echo "modify write attr (revert)"
chmod +w X
sleep 2

echo "deleting"
rm X
sleep 2

kill %1

Output:

creating
touching
/tmp/tmp.nuBGl9PTsZ/X PlatformSpecific
/tmp/tmp.nuBGl9PTsZ/X AttributeModified
/tmp/tmp.nuBGl9PTsZ/X Updated
moving
/tmp/tmp.nuBGl9PTsZ/X Updated
 Updated
inotify_rm_watch: Invalid argument
writing
/tmp/tmp.nuBGl9PTsZ/X Updated
/tmp/tmp.nuBGl9PTsZ/X PlatformSpecific
/tmp/tmp.nuBGl9PTsZ/X Updated
/tmp/tmp.nuBGl9PTsZ/X Updated
modify write attr
/tmp/tmp.nuBGl9PTsZ/X AttributeModified
modify write attr (revert)
/tmp/tmp.nuBGl9PTsZ/X AttributeModified
deleting
/tmp/tmp.nuBGl9PTsZ/X AttributeModified

Archlinux: 5.13.13-arch1-1 fswatch: 1.16.0-develop, built from 6afad282

mxork avatar Sep 28 '21 15:09 mxork