common-workflow-language / common-workflow-language/cwltool
`shallow_listing` data loss issue
- Dominant language
- Python
- Stars
- 376
- Forks
- 255
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 12
Description
Found via https://github.com/DataBiosphere/toil/issues/5099#issuecomment-2401780214
Setup
``` shell
mkdir 5099-test
mkdir 5099-test/subdir
touch 5099-test/a 5099-test/b 5099-test/c 5099-test/subdir/d
find 5099-test/
# 5099-test/
# 5099-test/a
# 5099-test/c
# 5099-test/subdir
# 5099-test/subdir/d
# 5099-test/b
```
> 5099-minimal-example.cwl
``` cwl
class: Workflow
cwlVersion: v1.2
id: minimal_example
label: minimal_example
inputs:
- id: msin
type: Directory[]
outputs:
- id: msout
outputSource:
- second_pass/msout
type: Directory[]
steps:
- id: pass
in:
- id: msin
source: msin
out:
- id: msout
run: 5099-pass.cwl
- id: second_pass
in:
- id: msin
source: pass/msout
out:
- id: msout
run: 5099-pass.cwl
```
> 5099-pass.cwl
``` cwl
class: CommandLineTool
cwlVersion: v1.2
id: pass
baseCommand: echo
# arguments:
# - $(inputs.msin[0].listing)
inputs:
- id: msin
type:
- Directory[]
outputs:
- id: msout
type:
- Directory[]
outputBinding:
outputEval: $(inputs.msin)
requirements:
- class: LoadListingRequirement
#loadListing: no_listing
loadListing: shallow_listing
```
> 5099-debug.json
``` json
{
"msin": [ {"class": "Directory", "path": "5099-test"}]
}
```
## Expected Behavior
`cwltool 5099-minimal-example.cwl 5099-debug.json` without `--outdir` does not delete any files from the input directory `5099-test`
## Actual Behavior
The directory `5099-test/subdir` and its contents are deleted
``` shell
$ find 5099-test/
5099-test/
5099-test/a
5099-test/c
5099-test/b
```
## Your Environment
* cwltool version: 3.1.20241112140731.dev10+g[f1d192dd](https://github.com/common-workflow-language/cwltool/commit/f1d192dd2b28902fd0098e133c2ef241557d27a8).d202412
Check using ``cwltool --version``
Contributor guide
Assessment
This issue has not been assessed yet.