Skip to content

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

@Khady

Description

@Khady

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions