After switch to a new path, bind-file becomes empty


I am going to move a configuration file into a subdir of $SNAP_DATA. Previously, it was in $SNAP_DATA. The file is also the source file of a layout/bind-file declaration.
What I have done is:

  1. update the source file of bind-file declaration in snapcraft.yaml
  2. in my service script, move the source file into the subdir
  3. build and install the new snap

The service moved the config file first. When checking the configuration file, it couldn’t find the expected string. and I found the file is empty.

If I reboot the system, then the service won’t complaint the string is missing. I’m wondering if this behavior is expected?

The changes are at here.

ah, I just aware that I should use cp + rm instead of mv.