In this example, report[path] would point to /usr/bin/foo. get_file_package() will return the first package name that it finds. So it might either return foo1 or foo2 which might be the wrong one. get_file_package() should take into account which package is installed instead.
Assume that you have two packages foo1 and foo2 which provide the binary /usr/bin/foo.
make_sandbox() calls
pkg = apport. packaging. get_file_ package( report[ path], True, pkgmap_cache_dir,
release= report[ 'DistroRelease' ],
arch= report. get('Architectu re'))
In this example, report[path] would point to /usr/bin/foo. get_file_package() will return the first package name that it finds. So it might either return foo1 or foo2 which might be the wrong one. get_file_package() should take into account which package is installed instead.