Non-snapcraft-generated files are pulled when nil plugin is used

Consider this snapcraft parts recipe:

  ccache:
    plugin: nil
    build-packages:
      - ccache
    override-build: 'true'
    override-stage: 'true'
    override-prime: 'true'

And according to the description of snapcraft help nil:

The nil plugin is useful for parts with no source.

However after running snapcraft pull ccache, non-snapcraft-generated files in the source tree are pulled into the part’s sourcedir:

parts/ccache/src
├── guvcview-brlin_source.tar.bz2
├── guvcview.strace.log
├── icons
│   ├── guvcview256.png
│   └── guvcview.png
├── LICENSE
├── nohup.out
├── README.md
└── screenshots
    └── view-image-control.png

2 directories, 8 files

IMO the behavior is unexpected and should be a snapcraft bug.

Workaround

Override the entire pull step using scriptlets.

This bug has been filed to Bug #1776807 “nil plugin shouldn’t pull anything to the srctre…” : Bugs : Snapcraft.