Skip to content

FileSystemWatcher does not raise events when target directory is symlink (on linux) #25078

@JustArchi

Description

@JustArchi

Steps to reproduce:

mkdir /tmp/realdir
ln -s /tmp/realdir /tmp/symdir

Launch a program similar to below:

var fsw = new FileSystemWatcher("/tmp/symdir") { NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite };
fsw.Created += (o, i) => Console.WriteLine(i.Name);
fsw.EnableRaisingEvents = true;

Create empty file (or any other one):

touch /tmp/symdir/test.txt # Could be also /tmp/realdir/test.txt, since it's one and the same

No event being raised. Event is raised properly if we listen in /tmp/realdir instead.

Since expected behaviour of linux programs is to handle symlinks transparently, I expected that FileSystemWatcher would properly raise events that happened in real directory. That didn't happen though (no events being raised, I also tested with other event types). I couldn't find similar issue so I consider it a bug, but if this is expected then it should probably be noted somewhere.

Thank you in advance for looking into this.

.NET Command Line Tools (2.1.300-preview2-008210)

Product Information:
 Version:            2.1.300-preview2-008210
 Commit SHA-1 hash:  f6065dcc62

Runtime Environment:
 OS Name:     debian
 OS Version:
 OS Platform: Linux
 RID:         debian-x64
 Base Path:   /opt/dotnet/sdk/2.1.300-preview2-008210/

Microsoft .NET Core Shared Framework Host

  Version  : 2.1.0-preview2-26131-06
  Build    : b13a0d5c331f374afd35ded57b9a4b4ab128864c

Metadata

Metadata

Assignees

Labels

Priority:1Work that is critical for the release, but we could probably ship withoutarea-System.IObugos-linuxLinux OS (any supported distro)

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions