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

jbuild-ignore not respected when there's a nested symlink #228

Closed
jaredly opened this issue Aug 22, 2017 · 5 comments
Closed

jbuild-ignore not respected when there's a nested symlink #228

jaredly opened this issue Aug 22, 2017 · 5 comments

Comments

@jaredly
Copy link

jaredly commented Aug 22, 2017

Directory structure

jbuild (empty)
jbuild-ignore (contents: node_modules)
node_modules/
  bs-platform (is a symlink to ~/.nvm/versions/node/v7.6.0/lib/node_modules/bs-platform

in this case, jbuilder clearly does a ton of traversing, because it takes 15s to complete

$ time jbuilder build                                                                                                                                                                                                                                  Error: exception Stack overflow
Backtrace:
Raised at file "src/import.ml", line 414, characters 36-37
Called from file "src/future.ml", line 657, characters 6-29
Called from file "vendor/cmdliner/src/cmdliner_term.ml", line 27, characters 19-24
Called from file "vendor/cmdliner/src/cmdliner.ml", line 106, characters 32-39
Called from file "vendor/cmdliner/src/cmdliner.ml", line 136, characters 18-36
Called from file "vendor/cmdliner/src/cmdliner.ml", line 251, characters 22-48
Called from file "bin/main.ml", line 909, characters 10-51
jbuilder build  1.37s user 13.44s system 98% cpu 15.095 tota

If instead of a symlink, bs-plaftorm is copied into the node_modules directory, then there's no problem.

$ time jbuilder build
jbuilder build  0.02s user 0.03s system 20% cpu 0.267 total

It's weird to me that jbuilder would be looking inside of an ignored folder, and behavior would differ based on the contents

@ghost
Copy link

ghost commented Aug 31, 2017

Hmm, so the jbuild-ignore files are interpreted after scanning the file system, so it is a bit mysterious to me why we observe this difference in behaviour.

The reason jbuilder looks inside ignored folders is that it is sometimes the case that one ignores a folder but still depends on files inside it, so jbuilder must still setup copy rules for all files inside ignored folders. This is used for instance to sandbox an external build system, and this is used in jbuilder itself for blackbox testing.

We should probably not follow symlinks when scanning the build system, it just seems simpler.

@copy
Copy link

copy commented Nov 21, 2017

I'm running into a related issue: In my case the node_modules is itself a symlink, and it's so large (300k files) that it causes a stackoverflow:

jbuilder build jsoo_hashtbl.bc.js
Error: exception Stack overflow
Backtrace:
Raised by primitive operation at file "pervasives.ml", line 200, characters 10-32
Called from file "src/path.ml", line 183, characters 15-22
Called from file "list.ml", line 67, characters 20-23
Called from file "list.ml", line 67, characters 32-39
Called from file "list.ml", line 67, characters 32-39
Called from file "list.ml", line 67, characters 32-39
…

The reason jbuilder looks inside ignored folders is that it is sometimes the case that one ignores a folder but still depends on files inside it

I'd say ignoring a folder should imply not looking into it.

In my case I the workaround is to simply build in the source directory.

@rgrinberg
Copy link
Member

We should probably not follow symlinks when scanning the build system, it just seems simpler.

Some people rely on symlinking to replace pinning as part of their workflow. Seems like this would break things for them.

@ttamttam
Copy link
Contributor

ttamttam commented Apr 1, 2018

The reason jbuilder looks inside ignored folders is that it is sometimes the case that one ignores a folder but still depends on files inside it, so jbuilder must still setup copy rules for all files inside ignored folders. This is used for instance to sandbox an external build system, and this is used in jbuilder itself for blackbox testing.

We should probably not follow symlinks when scanning the build system, it just seems simpler.

I was beaten by this, because for some tests, I had a huge remote (over ADSL link) shared folder mounted as a jbuild-ignored sub-directory. I would find ridiculous/overkill to add a jbuild-really-ignore file.

The fact that jbuilder looks inside ignored folders is really not intuitive: I suggest that a warning about this is added into the documentation (I'll have a look at this)?

ttamttam added a commit to ttamttam/dune that referenced this issue Apr 1, 2018
ttamttam added a commit to ttamttam/dune that referenced this issue Apr 1, 2018
@ghost
Copy link

ghost commented Apr 10, 2018

Now that we setup rules lazily, we can scan the file system lazily as well. This way jbuilder will only look inside ignored directories if it needs to.

@ghost ghost mentioned this issue Apr 30, 2018
@ghost ghost closed this as completed in #732 May 1, 2018
ghost pushed a commit that referenced this issue May 1, 2018
This issue was closed.
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

4 participants