[Mono-bugs] [Bug 428270] New: FileSystemWatcher does not raise Changed() event on MacOSX Tiger 10.4

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Sep 22 04:18:52 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=428270


           Summary: FileSystemWatcher does not raise Changed() event on
                    MacOSX Tiger 10.4
           Product: Mono: Class Libraries
           Version: 1.9
          Platform: Macintosh
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: miguel.debuf at aventiv.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Community User


Installed mono 1.9.1 package on MacOSX 10.4.11 (macbook pro).

Code :

using System;
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            FileSystemWatcher f = new FileSystemWatcher(args[0]);
            f.IncludeSubdirectories = true;
            f.InternalBufferSize = 5000000;
            f.EnableRaisingEvents = true;
            f.Created += new FileSystemEventHandler(f_Created);
            f.Changed += new FileSystemEventHandler(f_Created);
            f.Deleted += new FileSystemEventHandler(f_Created);
            while (true)
            {
                f.WaitForChanged(WatcherChangeTypes.All);
            }
        }

        static void f_Created(object sender, FileSystemEventArgs e)
        {
            Console.WriteLine(e.ChangeType + " : " + e.FullPath);
        }
    }
}


Test script :

#!/bin/bash

TESTDIR=/tmp/fswatcher.dir

function watch() {
    install -d $1
    (
        mono fswatcher.exe $1 | while read LINE
        do
            echo "[`date`] $LINE" 
        done
    ) &
}

function at() {
    sleep $1
    echo "[`date`] $2" 
    eval $2
}

watch $TESTDIR

at 1 "touch $TESTDIR/bla.txt"
at 1 "echo a >> $TESTDIR/bla.txt"
at 5 "touch $TESTDIR/bla2.txt"

sleep 1
killall mono
rm -rf $TESTDIR



Output :

mdebuf at pc-192-168-2-232:~/Projects/mono-fswatcher $ make test
bash test.sh
[Mon Sep 22 09:48:40 CEST 2008] touch /tmp/fswatcher.dir/bla.txt
[Mon Sep 22 09:48:40 CEST 2008] Created : /tmp/fswatcher.dir/bla.txt
[Mon Sep 22 09:48:41 CEST 2008] echo a >> /tmp/fswatcher.dir/bla.txt
[Mon Sep 22 09:48:46 CEST 2008] touch /tmp/fswatcher.dir/bla2.txt
[Mon Sep 22 09:48:46 CEST 2008] Changed : /tmp/fswatcher.dir/bla.txt
[Mon Sep 22 09:48:46 CEST 2008] Created : /tmp/fswatcher.dir/bla2.txt
mdebuf at pc-192-168-2-232:~/Projects/mono-fswatcher $

Expected result : the changed() event for 'echo a >> ...' should have fired
after the call, not after the creation of a second file.  In other words, the
output should look like :

mdebuf at pc-192-168-2-232:~/Projects/mono-fswatcher $ make test
bash test.sh
[Mon Sep 22 09:48:40 CEST 2008] touch /tmp/fswatcher.dir/bla.txt
[Mon Sep 22 09:48:40 CEST 2008] Created : /tmp/fswatcher.dir/bla.txt
[Mon Sep 22 09:48:41 CEST 2008] echo a >> /tmp/fswatcher.dir/bla.txt
[Mon Sep 22 09:48:41 CEST 2008] Changed : /tmp/fswatcher.dir/bla.txt
[Mon Sep 22 09:48:46 CEST 2008] touch /tmp/fswatcher.dir/bla2.txt
[Mon Sep 22 09:48:46 CEST 2008] Created : /tmp/fswatcher.dir/bla2.txt
mdebuf at pc-192-168-2-232:~/Projects/mono-fswatcher $


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list