Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All inotify filesystem events are chmod/attribute events #1244

Open
1 of 5 tasks
vansante opened this issue Jan 9, 2025 · 2 comments
Open
1 of 5 tasks

All inotify filesystem events are chmod/attribute events #1244

vansante opened this issue Jan 9, 2025 · 2 comments

Comments

@vansante
Copy link

vansante commented Jan 9, 2025

Description

As reported here by @ploxiln colima only seems to forward ATTRIB events, even when actually modifying files.

See this log:

root@843c34dbbfff:/container# inotifywait -m .
Setting up watches.
Watches established.
./ ATTRIB main.go
./ ATTRIB main.go

I have a file watcher utility that ignores these and only recompiles on modify events, so it would be nice if this could be addressed.

Version

colima version && limactl --version && qemu-img --version
colima version 0.8.1
git commit: 96598cc5b64e5e9e1e64891642b91edc8ac49d16

runtime: docker
arch: aarch64
client: v27.4.1
server: v27.4.0
limactl version 1.0.3
zsh: command not found: qemu-img

(I do not use qemu but vz and rosetta)

Operating System

  • macOS Intel <= 13 (Ventura)
  • macOS Intel >= 14 (Sonoma)
  • Apple Silicon <= 13 (Ventura)
  • Apple Silicon >= 14 (Sonoma)
  • Linux

Output of colima status

colima status
INFO[0000] colima is running using macOS Virtualization.Framework
INFO[0000] arch: aarch64
INFO[0000] runtime: docker
INFO[0000] mountType: virtiofs
INFO[0000] socket: unix:///Users/pvansanten/.colima/default/docker.sock

Reproduction Steps

  1. Start a container with inotify-tools installed and a mount from the host machine
  2. Exec into the container and run inotifywait -m -r .
  3. On the host machine go to the mounted directory and run: touch test && echo hello >> test
  4. Notice the events from the inotifywait command:
inotifywait -m -r .
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.
./ ATTRIB test

Expected behaviour

I expect the container inotifywait command to issue 2 events:

  • A creation event for the file
  • A modification event for the file

I do not expect an attribute event

Additional context

No response

@redecs
Copy link

redecs commented Jan 17, 2025

I'm considering switching to Colima and encountered the same issue with ATTRIB/CHMOD in environment like the one described above.

@vansante
Copy link
Author

After taking a peek at the code, I see that we are replicating the events by doing a chmod call in the VM OS:

https://github.com/abiosoft/colima/blob/main/daemon/process/inotify/events.go#L104

Maybe it would work better if we instead used this command instead?

echo "" >> {filepath}

Which triggers the following events on my local machine:

inotifywait -m .
./ OPEN file.txt
./ MODIFY file.txt
./ CLOSE_WRITE,CLOSE file.txt

Of course it makes sense to do something similar written in native go, like issuing a file.Write() with an empty byte buffer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants