Content interface rebuilding folder structure on each connect/disconnect

Hi,
we are using the content interface in spool-mode to share folders from multiple snaps in another snap. The folder is structured like this $SNAP_DATA/assets/{snapA,snapB,snapC…snapN}. Our application is using a file watcher to monitor changes in $SNAP_DATA/assets/.

We noticed that when a new snapD is connecting to this content interface we get fs “remove events” for snapA, snapB, snapC and afterwards “create events” for snapA,snapB, snapC and snapD. We expected to only get one create event for snapD.

When disconnecting snapD we get again events for all other snaps.

Why is the folder rebuild on each connect/disconnect? Is this by design?

Thanks.

1 Like

Hi snapd team,

any update on this. We have a different use case where we have to workaround this behavior. Would be nice to understand why this happens.

Thanks.

1 Like

The reason for this is how snap-update-ns is implemented. We are exploring a refactor for this cycle which may change how this works, but I think it is unlikely that the behavior you see about everything being removed and re-added before the new events are also added will be changed