`ninja install` fails as non-root trying to write to an incorrect directory
If I configure gnome-shell with a local install prefix for testing:
meson --prefix /home/dan/tmp.gs . build.master
Building works fine. But installation fails trying to write to the wrong directory /usr/share/gnome-control-center/keybindings
:
ninja install
...
Installing /home/dan/git/gnome-shell/build.master/data/perf-background.xml to /home/dan/tmp.gs/share/gnome-shell
Installing /home/dan/git/gnome-shell/data/gnome-shell.portal to /home/dan/tmp.gs/share/xdg-desktop-portal/portals
Installing /home/dan/git/gnome-shell/data/50-gnome-shell-system.xml to /usr/share/gnome-control-center/keybindings
Traceback (most recent call last):
File "/usr/bin/meson", line 26, in <module>
sys.exit(main())
File "/usr/bin/meson", line 23, in main
return mesonmain.run(sys.argv[1:], launcher)
File "/usr/share/meson/mesonbuild/mesonmain.py", line 308, in run
sys.exit(run_script_command(args[1:]))
File "/usr/share/meson/mesonbuild/mesonmain.py", line 257, in run_script_command
return cmdfunc(cmdargs)
File "/usr/share/meson/mesonbuild/scripts/meson_install.py", line 390, in run
do_install(datafilename)
File "/usr/share/meson/mesonbuild/scripts/meson_install.py", line 219, in do_install
install_data(d)
File "/usr/share/meson/mesonbuild/scripts/meson_install.py", line 239, in install_data
do_copyfile(fullfilename, outfilename)
File "/usr/share/meson/mesonbuild/scripts/meson_install.py", line 129, in do_copyfile
os.unlink(to_file)
PermissionError: [Errno 13] Permission denied: '/usr/share/gnome-control-center/keybindings/50-gnome-shell-system.xml'
FAILED: meson-install
/usr/bin/python3 /usr/bin/meson --internal install /home/dan/git/gnome-shell/build.master/meson-private/install.dat
ninja: build stopped: subcommand failed.