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

Following symlinks does not work when matched against sth* pattern #419

Closed
Reinmar opened this issue Dec 17, 2015 · 7 comments
Closed

Following symlinks does not work when matched against sth* pattern #419

Reinmar opened this issue Dec 17, 2015 · 7 comments

Comments

@Reinmar
Copy link

Reinmar commented Dec 17, 2015

I've got the following setup:

In /www/ckeditor5/node_modules/ I've got two symlinks:

lrwxr-xr-x    1 p  staff     29 15 Dec 17:14 ckeditor5-foo -> /www/ckeditor5-foo
lrwxr-xr-x    1 p  staff     39 15 Dec 17:16 ckeditor5-bar -> /www/ckeditor5-bar

When using chokidar as follows, changes made in ckeditor5-core are not discovered. However, the changes made in ckeditor5-bar are.

const chokidar = require( 'chokidar' );

chokidar.watch(
    [
        '/www/ckeditor5/node_modules/ckeditor5-f*/**/*.js',
        '/www/ckeditor5/node_modules/ckeditor5-bar/**/*.js',
    ],
    {
        ignoreInitial: true
    }
).on( 'all', ( event, path ) => {
    console.log( event, path );
} );

When I change the first pattern to '/www/ckeditor5/node_modules/ckeditor5-foo/**/*.js' everything works fine.

I'm on MacOS 10.11.2, Node v5.2.0.

@es128
Copy link
Contributor

es128 commented Dec 17, 2015

A version of this issue was fixed with #406, but that wasn't with the glob pattern on the symlink's path itself.

@jfbibeau
Copy link

I believe I'm also run into this issue. I'm watching a path that has a glob pattern in it containing a symlink (via browsersync), and chokidar is not watching files under a symlink.

Any idea if there's a workaround I could use?

@jfbibeau
Copy link

Found a workaround by watching the parent then using ignored to filter the files, but my directory was gigantic and "ignored" doesn't seem to be as efficient as matching with glob pattern itself (my cpu almost melted).

Found a second workaround by iterating through my directory and adding individual watches against each folder in the parent folder, and glob after that. That seems to work fine without any performance penalty. Hope this helps someone!

Still would be nice to have this working :) Cheers.

@paulmillr paulmillr added the bug label Mar 2, 2016
@trainerbill
Copy link

trainerbill commented Apr 26, 2016

+1. My issue is a little different. It doesn't work when watching a folder with symlinks. I have a modules/ folder with symlinks in it and watching ./modules/*/.js. Using Gulp 4 with latest chokidar. It does not work with matching a pattern in folder/symlink/pattern. If I watch the direct file path without a pattern it works with symlink and if I remove the symlink and copy the directory in /modules folder it works. So the issue is watching a folder with symlinks as subdirectories.

Linux OS, gulp 4, chokidar 1.4.3

works:

gulp.watch(['/folder/symlink/server/whatever/testfile.js']);
gulp.watch(['/folder/symlink/server/**/*.js']);

doesn't work:

gulp.watch(['/folder/*/server/**/*.js']);

Seems to be when you place a pattern on the symlink directory

@ThomasBrierley
Copy link

+1. I'm experiencing this in the same way @trainerbill is: where the symlink is a subdirectory matched by the glob, the watch does not recurse through that symlink regardless of glob.

In-case it's of any use, I had a similar problem with vinyl-fs not srcing files when symlinked subdirectories are present and matching with something like foo/**/*.* (where foo is not a symlink), purely by instinct I found that foo/**/**/*.* will inspect symlinked subdirectories under foo and deeper. However this does not work with chokidar.

@ThomasBrierley
Copy link

One workaround if you don't mind it watching an entire directory without filtering: Specify only the top level directory without any globbing... symlinked subdirectories are recursed normally.

@lkraav
Copy link

lkraav commented Dec 6, 2017

As far as I can tell on Linux, this is still a problem today.

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

7 participants