Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-45866

QFileSystemWatcher doesn't notify of symbolic link deletions on Linux

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.3.0
    • None
    • Win7 x64 and Linux 3.2.0-49-generic-pae #75-Ubuntu SMP Tue Jun 18 18:00:21 UTC 2013 i686 i686 i386 GNU/Linux

      If I create symbolic link and watch that link, then delete the link (the link's target exists and remains unchanged the entire time), I get a notification on deletion on Windows (Win7 x64), but not on Linux.

      Here's some code that uses the Qt Test framework:

      // Note: must create a symlink called "symlink" on disk in the current folder before running
      
      QFileSystemWatcher watcher;
      QStringList changedList;
      QFileSystemWatcher::connect( &watcher, &QFileSystemWatcher::fileChanged, [&]( const QString& filename ) { changedList.push_back( filename ); } );
      watcher.addPath( "symlink" );
      QTest::qWait( 100 ); // Let events flow through
      
      // Remove a link
      std::remove( "symlink" );
      QTest::qWait( 100 ); // Let events flow through
      
      // Check the result
      QCOMPARE( 0, watcher.files().size() );
      QCOMPARE( 1, changedList.size() );
      QCOMPARE( "symlink", changedList[0] );
      
      

      This passes on Win7 but fails on Linux.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            thiago Thiago Macieira
            mlimber mlimber
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes