In order to verify which tempfile it uses, I decided to get an `strace` of the invocation. I ran `strace run-mailcap file.txt` inside the `/home/mik/mailcap-test/spaces in name/` directory. This is the interesting portion of the result. The "no such file or directory" error from the end of this output continues until the end of the strace (until I aborted the command).
openat(AT_FDCWD, "/home/mik/.mime.types", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/local/etc/mime.types", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/etc/mime.types", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/mime.types", O_RDONLY|O_CLOEXEC) = 3
ioctl(3, TCGETS, 0x7ffe260828a0) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=67454, ...}) = 0
read(3, "# This is a comment. I love comm"..., 8192) = 8192
read(3, "ion/pkcs8\t\t\t\tp8\napplication/pkcs"..., 8192) = 8192
read(3, "artisan\napplication/vnd.artsquar"..., 8192) = 8192
read(3, "on/vnd.geogebra.tool\t\t\tggt\nappli"..., 8192) = 8192
brk(0x565269384000) = 0x565269384000
read(3, "e.macroEnabled.12\tdotm\napplicati"..., 8192) = 8192
read(3, "nd.openxmlformats-officedocument"..., 8192) = 8192
read(3, "tion/vnd.uoml+xml\t\t\tuoml uo\nappl"..., 8192) = 8192
read(3, "\t\t\t\tjxs\nimage/jxsc\t\t\t\t\tjxsc\nimag"..., 8192) = 8192
read(3, "lash\t\t\tspl\napplication/x-gtar\t\t\t"..., 8192) = 1918
read(3, "", 8192) = 0
close(3) = 0
openat(AT_FDCWD, "/home/mik/.mailcap", O_RDONLY|O_CLOEXEC) = 3
ioctl(3, TCGETS, 0x7ffe260828a0) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=288, ...}) = 0
read(3, "text/*; nvim '%s'; needsterminal"..., 8192) = 288
read(3, "", 8192) = 0
close(3) = 0
openat(AT_FDCWD, "/etc/mailcap", O_RDONLY|O_CLOEXEC) = 3
ioctl(3, TCGETS, 0x7ffe260828a0) = -1 ENOTTY (Inappropriate ioctl for device)
lseek(3, 0, SEEK_CUR) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=272, ...}) = 0
read(3, "### \n### Begin Red Hat Mailcap\n#"..., 8192) = 272
read(3, "", 8192) = 0
close(3) = 0
openat(AT_FDCWD, "/usr/local/etc/mailcap", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/share/etc/mailcap", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/usr/etc/mailcap", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
stat("./file.txt", {st_mode=S_IFREG|0644, st_size=10, ...}) = 0
stat("./file.txt", {st_mode=S_IFREG|0644, st_size=10, ...}) = 0
geteuid() = 1000
geteuid() = 1000
ioctl(1, TCGETS, 0x7ffe26082b20) = -1 ENOTTY (Inappropriate ioctl for device)
getcwd("/home/mik/mailcap-test/spaces in name", 4095) = 38
pipe2([3, 4], O_CLOEXEC) = 0
fcntl(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
pipe2([5, 6], O_CLOEXEC) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f89e6612a10) = 1045289
close(6) = 0
close(4) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1045289, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
read(5, "\2\0\0\0", 4) = 4
close(5) = 0
close(3) = 0
wait4(1045289, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 1045289
lstat("", 0x7ffe26082b00) = -1 ENOENT (No such file or directory)
symlink("/home/mik/mailcap-test/spaces in name/file.txt", "") = -1 ENOENT (No such file or directory)
pipe2([3, 4], O_CLOEXEC) = 0
pipe2([5, 6], O_CLOEXEC) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f89e6612a10) = 1045290
close(6) = 0
close(4) = 0
read(5, "\2\0\0\0", 4) = 4
close(5) = 0
close(3) = 0
wait4(1045290, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 1045290
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1045290, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
lstat("", 0x7ffe26082b00) = -1 ENOENT (No such file or directory)
symlink("/home/mik/mailcap-test/spaces in name/file.txt", "") = -1 ENOENT (No such file or directory)
pipe2([3, 4], O_CLOEXEC) = 0
pipe2([5, 6], O_CLOEXEC) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f89e6612a10) = 1045291
close(6) = 0
close(4) = 0
read(5, "\2\0\0\0", 4) = 4
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1045291, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---
close(5) = 0
close(3) = 0
wait4(1045291, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 1045291
lstat("", 0x7ffe26082b00) = -1 ENOENT (No such file or directory)
symlink("/home/mik/mailcap-test/spaces in name/file.txt", "") = -1 ENOENT (No such file or directory)
pipe2([3, 4], O_CLOEXEC) = 0
pipe2([5, 6], O_CLOEXEC) = 0
clone(child_stack=NULL, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0x7f89e6612a10) = 1045292
close(6) = 0
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=1045292, si_uid=1000, si_status=1, si_utime=0, si_stime=0} ---