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

dune keeps no longer existing files from data_only_dirs in _build #2499

Closed
Khady opened this issue Aug 2, 2019 · 1 comment · Fixed by ocaml/opam-repository#14654
Closed
Labels

Comments

@Khady
Copy link
Contributor

Khady commented Aug 2, 2019

I have an rule with a dep to a source_tree (let's say it's named spec). The alias generates a dune file based on the content of spec. It mostly does what I expect. Except when I run this alias after removing a file from spec. Because the content of spec in _build will still contain the file which was removed in the real spec. It seems to be because I marked the spec directory with data_only_dirs.

I created a small project to reproduce https://github.com/Khady/dune-data-only-dirs-cleanup

$ dune clean
$ cat from_spec_a.sexp 
6
$ ls -l spec_a/**/*.txt
-rw-r--r-- 1 louis louis 0 Aug  2 10:16 spec_a/d1/1.txt
-rw-r--r-- 1 louis louis 0 Aug  2 10:16 spec_a/d1/2.txt
-rw-r--r-- 1 louis louis 0 Aug  2 10:16 spec_a/d1/3.txt
-rw-r--r-- 1 louis louis 0 Aug  2 10:32 spec_a/d2/1.txt
-rw-r--r-- 1 louis louis 0 Aug  2 10:32 spec_a/d2/2.txt
-rw-r--r-- 1 louis louis 0 Aug  2 10:32 spec_a/d2/3.txt
$ dune build @gen_spec_a
$ tree _build/default/spec_a
_build/default/spec_a
├── d1
│   ├── 1.txt
│   ├── 2.txt
│   └── 3.txt
└── d2
    ├── 1.txt
    ├── 2.txt
    └── 3.txt

2 directories, 6 files
$ rm -rf spec_a/d2
$ dune build @gen_spec_a
$ ls -l spec_a/**/*.txt
-rw-r--r-- 1 louis louis 0 Aug  2 10:16 spec_a/d1/1.txt
-rw-r--r-- 1 louis louis 0 Aug  2 10:16 spec_a/d1/2.txt
-rw-r--r-- 1 louis louis 0 Aug  2 10:16 spec_a/d1/3.txt
$ tree _build/default/spec_a
_build/default/spec_a
├── d1
│   ├── 1.txt
│   ├── 2.txt
│   └── 3.txt
└── d2
    ├── 1.txt
    ├── 2.txt
    └── 3.txt

2 directories, 6 files
$ cat from_spec_a.sexp 
6
@ghost ghost added the bug label Aug 6, 2019
@ghost
Copy link

ghost commented Aug 6, 2019

Thanks for the report, this is indeed a bug

ghost pushed a commit that referenced this issue Aug 7, 2019
Signed-off-by: Jeremie Dimino <[email protected]>
@ghost ghost closed this as completed in a7c9bdf Aug 7, 2019
ghost pushed a commit that referenced this issue Aug 8, 2019
Signed-off-by: Jeremie Dimino <[email protected]>
ghost pushed a commit that referenced this issue Aug 8, 2019
Signed-off-by: Jeremie Dimino <[email protected]>
rgrinberg added a commit to rgrinberg/opam-repository that referenced this issue Aug 9, 2019
CHANGES:

- Fix config file dependencies of ocamlformat (ocaml/dune#2471, fixes ocaml/dune#2646,
  @nojb)

- Cleanup stale directories when using `(source_tree ...)` in the
  presence of directories with only sub-directories and no files
  (ocaml/dune#2514, fixes ocaml/dune#2499, @diml)
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant