`organize:{ /: another-dir/ }` causes the items under host root directory to be copied in another-dir

Consider the following parts recipe:

  patches:
    source: snap/patches
    plugin: dump

    organize:
      /: patches/
    override-prime: 'true'

Here’s the content under snap/patches:

snap/patches
└── enchant-fix-build.patch

0 directories, 1 file

One may expect that the organize stanza will make snapcraft move enchant-fix-build.patch to $SNAPCRAFT_STAGE/patches/enchant-fix-build.patch, but when running the build step of patches part, the content of $SNAPCRAFT_PART_INSTALL becomes:

parts/patches/install/
├── enchant-fix-build.patch
└── patches
    ├── bin
    │   ├── bash
    │   ├── btrfs
    │   ├── btrfs-calc-size
    │   ├── btrfsck -> btrfs
    │   ├── btrfs-convert
    │   ├── btrfs-debug-tree
    │   ├── btrfs-find-root
    │   ├── btrfs-image
    │   ├── btrfs-map-logical
    │   ├── btrfs-select-super
    │   ├── btrfs-show-super
    │   ├── btrfstune
    │   ├── btrfs-zero-log
    │   ├── bunzip2
    │   ├── busybox
    │   ├── bzcat
    │   ├── bzcmp -> bzdiff
    │   ├── bzdiff
    │   ├── bzegrep -> bzgrep
    │   ├── bzexe
    │   ├── bzfgrep -> bzgrep
    │   ├── bzgrep
    │   ├── bzip2
    │   ├── bzip2recover
    │   ├── bzless -> bzmore
    │   ├── bzmore
    │   ├── cat
    │   ├── chacl
    │   ├── chgrp
    │   ├── chmod
    │   ├── chown
    │   ├── chvt
    │   ├── cp
    │   ├── cpio
    │   ├── dash
    │   ├── date
    │   ├── dd
    │   ├── df
    │   ├── dir
    │   ├── dmesg
    │   ├── dnsdomainname -> hostname
    │   ├── domainname -> hostname
    │   ├── dumpkeys
    │   ├── echo
    │   ├── ed
    │   ├── egrep
    │   ├── false
    │   ├── fgconsole
    │   ├── fgrep
    │   ├── findmnt
    │   ├── fsck.btrfs
    │   ├── fuser
    │   ├── fusermount
    │   ├── getfacl
    │   ├── grep
    │   ├── gunzip
    │   ├── gzexe
    │   ├── gzip
    │   ├── hostname
    │   ├── ip
    │   ├── journalctl
    │   ├── kbd_mode
    │   ├── kill
    │   ├── kmod
    │   ├── less
    │   ├── lessecho
    │   ├── lessfile -> lesspipe
    │   ├── lesskey
    │   ├── lesspipe
    │   ├── ln
    │   ├── loadkeys
    │   ├── login
    │   ├── loginctl
    │   ├── lowntfs-3g
    │   ├── ls
    │   ├── lsblk
    │   ├── lsmod -> kmod
    │   ├── mkdir
    │   ├── mkfs.btrfs
    │   ├── mknod
    │   ├── mktemp
    │   ├── more
    │   ├── mount
    │   ├── mountpoint
    │   ├── mt -> /etc/alternatives/mt
    │   ├── mt-gnu
    │   ├── mv
    │   ├── nano
    │   ├── nc -> /etc/alternatives/nc
    │   ├── nc.openbsd
    │   ├── netcat -> /etc/alternatives/netcat
    │   ├── netstat
    │   ├── networkctl
    │   ├── nisdomainname -> hostname
    │   ├── ntfs-3g
    │   ├── ntfs-3g.probe
    │   ├── ntfs-3g.secaudit
    │   ├── ntfs-3g.usermap
    │   ├── ntfscat
    │   ├── ntfscluster
    │   ├── ntfscmp
    │   ├── ntfsfallocate
    │   ├── ntfsfix
    │   ├── ntfsinfo
    │   ├── ntfsls
    │   ├── ntfsmove
    │   ├── ntfstruncate
    │   ├── ntfswipe
    │   ├── open -> openvt
    │   ├── openvt
    │   ├── pidof -> /sbin/killall5
    │   ├── ping
    │   ├── ping6
    │   ├── plymouth
    │   ├── ps
    │   ├── pwd
    │   ├── rbash -> bash
    │   ├── readlink
    │   ├── red
    │   ├── rm
    │   ├── rmdir
    │   ├── rnano -> nano
    │   ├── run-parts
    │   ├── sed
    │   ├── setfacl
    │   ├── setfont
    │   ├── setupcon
    │   ├── sh -> dash
    │   ├── sh.distrib -> dash
    │   ├── sleep
    │   ├── ss
    │   ├── static-sh -> busybox
    │   ├── stty
    │   ├── su
    │   ├── sync
    │   ├── systemctl
    │   ├── systemd -> /lib/systemd/systemd
    │   ├── systemd-ask-password
    │   ├── systemd-escape
    │   ├── systemd-hwdb
    │   ├── systemd-inhibit
    │   ├── systemd-machine-id-setup
    │   ├── systemd-notify
    │   ├── systemd-tmpfiles
    │   ├── systemd-tty-ask-password-agent
    │   ├── tailf
    │   ├── tar
    │   ├── tempfile
    │   ├── touch
    │   ├── true
    │   ├── udevadm
    │   ├── ulockmgr_server
    │   ├── umount
    │   ├── uname
    │   ├── uncompress
    │   ├── unicode_start
    │   ├── vdir
    │   ├── wdctl
    │   ├── which
    │   ├── whiptail
    │   ├── ypdomainname -> hostname
    │   ├── zcat
    │   ├── zcmp
    │   ├── zdiff
    │   ├── zegrep
    │   ├── zfgrep
    │   ├── zforce
    │   ├── zgrep
    │   ├── zless
    │   ├── zmore
    │   └── znew
    ├── boot
    │   └── grub
    │       ├── default
    │       ├── grub.cfg
    │       ├── menu.lst
    │       ├── menu.lst~
    │       ├── menu.lst_backup_by_grub2_prerm
    │       └── unicode.pf2
    ├── dev
    │   ├── core -> /proc/kcore
    │   ├── hugepages
    │   ├── lxd
    │   ├── mqueue
    │   ├── net
    │   ├── null
    │   ├── pts
    │   ├── shm
    │   ├── stderr -> /proc/self/fd/2
    │   ├── stdout -> /proc/self/fd/1
    │   ├── tty
    │   └── urandom
    ├── etc
    ├── home
    ├── lib
    ├── lib64
    ├── media
    ├── mnt
    ├── opt
    ├── proc
    ├── root
    ├── run
    ├── sbin
    ├── srv
    ├── sys
    ├── tmp
    ├── usr
    └── var

27 directories, 184 files

It seems that the content from the build host’s root directory is somehow copied to $SNAPCRAFT_PART_INSTALL, which seems to conflict with the description of organize stanza:

Note that the path is relative (even though it is "usr/local") because
it refers to content underneath parts/<part-name>/install which is going
to be mapped into the stage and prime areas.

I suspect that this behavior is either a bug in snapcraft or my misunderstanding of organize, any ideas?

I filed a bug regarding this issue:
Bug #1775582 “organize:{ /: another-dir/ } causes the items un…” : Bugs : Snapcraft

I found the following snippet works, but don’t exactly know why:

    organize:
      '*': another-dir/