为什么不设置DBUS_SESSION_BUS_ADDRESS时不支持g_file_copy操作

以下代码正常用户会话正常工作:

#include <gio/gio.h> int main() { const gchar *uri = "https://stackoverflow.com/questions/5758770/"; GFile *in; GFile *out; GError *error = NULL; gboolean ret; g_type_init(); in = g_file_new_for_uri(uri); out = g_file_new_for_path("/tmp/a"); ret = g_file_copy(in, out, G_FILE_COPY_OVERWRITE, NULL, NULL, NULL, &error); if (!ret) g_message("%s", error->message); return 0; } 

(从glib-network-connection-example取得 )

但是,当“su – ”给另一个用户并执行相同的二进制文件时,我得到以下错误:

****信息:不支持的操作**

strace dump下面:

 execve("./uri_copy", ["./uri_copy"], [/* 24 vars */]) = 0 brk(0) = 0x2318000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc8757f3000 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=113424, ...}) = 0 mmap(NULL, 113424, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc8757d7000 close(3) = 0 open("/usr/lib/libgio-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\21\3\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=7332859, ...}) = 0 mmap(NULL, 3481536, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc875281000 mprotect(0x7fc8753cd000, 2093056, PROT_NONE) = 0 mmap(0x7fc8755cc000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x14b000) = 0x7fc8755cc000 mmap(0x7fc8755d2000, 4032, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc8755d2000 close(3) = 0 open("/usr/lib/libgobject-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\256\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1571328, ...}) = 0 mmap(NULL, 2416416, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc875033000 mprotect(0x7fc87507f000, 2097152, PROT_NONE) = 0 mmap(0x7fc87527f000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x4c000) = 0x7fc87527f000 close(3) = 0 open("/usr/lib/libglib-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220\230\1\0\0\0\0\0"..., 832) = 832 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc8757d6000 fstat(3, {st_mode=S_IFREG|0755, st_size=4565491, ...}) = 0 mmap(NULL, 3279624, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc874d12000 mprotect(0x7fc874e31000, 2097152, PROT_NONE) = 0 mmap(0x7fc875031000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x11f000) = 0x7fc875031000 close(3) = 0 open("/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340l\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=776444, ...}) = 0 mmap(NULL, 2212768, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc874af5000 mprotect(0x7fc874b0c000, 2097152, PROT_NONE) = 0 mmap(0x7fc874d0c000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x7fc874d0c000 mmap(0x7fc874d0e000, 13216, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc874d0e000 close(3) = 0 open("/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \30\2\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=10464009, ...}) = 0 mmap(NULL, 3820672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc874750000 mprotect(0x7fc8748eb000, 2097152, PROT_NONE) = 0 mmap(0x7fc874aeb000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19b000) = 0x7fc874aeb000 mmap(0x7fc874af1000, 15488, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc874af1000 close(3) = 0 open("/usr/lib/libgthread-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0000\6\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=10190, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc8757d5000 mmap(NULL, 2100144, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc87454f000 mprotect(0x7fc874550000, 2093056, PROT_NONE) = 0 mmap(0x7fc87474f000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0x7fc87474f000 close(3) = 0 open("/usr/lib/libffi.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\30\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=160444, ...}) = 0 mmap(NULL, 2128152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc874347000 mprotect(0x7fc87434e000, 2097152, PROT_NONE) = 0 mmap(0x7fc87454e000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7fc87454e000 close(3) = 0 open("/usr/lib/libgmodule-2.0.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\21\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=48372, ...}) = 0 mmap(NULL, 2107576, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc874144000 mprotect(0x7fc874147000, 2093056, PROT_NONE) = 0 mmap(0x7fc874346000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fc874346000 close(3) = 0 open("/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260\16\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=110348, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc8757d4000 mmap(NULL, 2109720, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc873f40000 mprotect(0x7fc873f42000, 2097152, PROT_NONE) = 0 mmap(0x7fc874142000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fc874142000 close(3) = 0 open("/lib/librt.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\"\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=197331, ...}) = 0 mmap(NULL, 2128888, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc873d38000 mprotect(0x7fc873d3f000, 2093056, PROT_NONE) = 0 mmap(0x7fc873f3e000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x7fc873f3e000 close(3) = 0 open("/lib/libz.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360 \0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=102874, ...}) = 0 mmap(NULL, 2188616, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc873b21000 mprotect(0x7fc873b37000, 2097152, PROT_NONE) = 0 mmap(0x7fc873d37000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7fc873d37000 close(3) = 0 open("/lib/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260:\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=397849, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc8757d3000 mmap(NULL, 2189936, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc87390a000 mprotect(0x7fc87391e000, 2093056, PROT_NONE) = 0 mmap(0x7fc873b1d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x13000) = 0x7fc873b1d000 mmap(0x7fc873b1f000, 6768, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fc873b1f000 close(3) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc873909000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc873908000 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc873907000 arch_prctl(ARCH_SET_FS, 0x7fc873908700) = 0 mprotect(0x7fc874aeb000, 16384, PROT_READ) = 0 mprotect(0x7fc873b1d000, 4096, PROT_READ) = 0 mprotect(0x7fc874d0c000, 4096, PROT_READ) = 0 mprotect(0x7fc873f3e000, 4096, PROT_READ) = 0 mprotect(0x7fc874142000, 4096, PROT_READ) = 0 mprotect(0x7fc8757f4000, 4096, PROT_READ) = 0 munmap(0x7fc8757d7000, 113424) = 0 set_tid_address(0x7fc8739089d0) = 3023 set_robust_list(0x7fc8739089e0, 24) = 0 futex(0x7fff6deb5014, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 7fc873908700) = -1 EAGAIN (Resource temporarily unavailable) rt_sigaction(SIGRTMIN, {0x7fc874afb7d0, [], SA_RESTORER|SA_SIGINFO, 0x7fc874b047b0}, NULL, 8) = 0 rt_sigaction(SIGRT_1, {0x7fc874afb850, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7fc874b047b0}, NULL, 8) = 0 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0 getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 brk(0) = 0x2318000 brk(0x2339000) = 0x2339000 getresuid([0], [0], [0]) = 0 getresgid([0], [0], [0]) = 0 openat(AT_FDCWD, "/usr/lib/gio/modules", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 stat("/usr/lib/gio/modules/giomodule.cache", {st_mode=S_IFREG|0644, st_size=317, ...}) = 0 open("/usr/lib/charset.alias", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/lib/gio/modules/giomodule.cache", O_RDONLY) = 4 fstat(4, {st_mode=S_IFREG|0644, st_size=317, ...}) = 0 read(4, "libgvfsdbus.so: gio-vfs,gio-volu"..., 317) = 317 close(4) = 0 getdents(3, /* 17 entries */, 32768) = 704 stat("/usr/lib/gio/modules/libgvfsdbus.so", {st_mode=S_IFREG|0755, st_size=1008539, ...}) = 0 stat("/usr/lib/gio/modules/libgiognutls.so", {st_mode=S_IFREG|0755, st_size=528214, ...}) = 0 stat("/usr/lib/gio/modules/libgiolibproxy.so", {st_mode=S_IFREG|0755, st_size=38152, ...}) = 0 stat("/usr/lib/gio/modules/libgiognomeproxy.so", {st_mode=S_IFREG|0755, st_size=61385, ...}) = 0 stat("/usr/lib/gio/modules/libgsettingsgconfbackend.so", {st_mode=S_IFREG|0755, st_size=80091, ...}) = 0 stat("/usr/lib/gio/modules/libgioremote-volume-monitor.so", {st_mode=S_IFREG|0755, st_size=520847, ...}) = 0 stat("/usr/lib/gio/modules/libdconfsettings.so", {st_mode=S_IFREG|0755, st_size=197917, ...}) = 0 getdents(3, /* 0 entries */, 32768) = 0 close(3) = 0 stat("/usr/lib/gio/modules/libgvfsdbus.so", {st_mode=S_IFREG|0755, st_size=1008539, ...}) = 0 futex(0x7fc8741430c8, FUTEX_WAKE_PRIVATE, 2147483647) = 0 open("/usr/lib/gio/modules/libgvfsdbus.so", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0`\311\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1008539, ...}) = 0 mmap(NULL, 2296960, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc8736d6000 mprotect(0x7fc873705000, 2097152, PROT_NONE) = 0 mmap(0x7fc873905000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2f000) = 0x7fc873905000 close(3) = 0 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=113424, ...}) = 0 mmap(NULL, 113424, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc8736ba000 close(3) = 0 open("/usr/lib/libgvfscommon.so.0", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 .\1\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=935965, ...}) = 0 mmap(NULL, 2338440, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc87347f000 mprotect(0x7fc8734b5000, 2093056, PROT_NONE) = 0 mmap(0x7fc8736b4000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x35000) = 0x7fc8736b4000 close(3) = 0 open("/lib/libpcre.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\23\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=270107, ...}) = 0 mmap(NULL, 2356392, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc87323f000 mprotect(0x7fc87327e000, 2097152, PROT_NONE) = 0 mmap(0x7fc87347e000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x3f000) = 0x7fc87347e000 close(3) = 0 open("/lib/libudev.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@L\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=1088628, ...}) = 0 mmap(NULL, 2173032, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc87302c000 mprotect(0x7fc87303d000, 2097152, PROT_NONE) = 0 mmap(0x7fc87323d000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x11000) = 0x7fc87323d000 close(3) = 0 open("/lib/libutil.so.1", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360\16\0\0\0\0\0\0"..., 832) = 832 fstat(3, {st_mode=S_IFREG|0755, st_size=33117, ...}) = 0 mmap(NULL, 2105600, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fc872e29000 mprotect(0x7fc872e2b000, 2093056, PROT_NONE) = 0 mmap(0x7fc87302a000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7fc87302a000 close(3) = 0 mprotect(0x7fc87302a000, 4096, PROT_READ) = 0 mprotect(0x7fc87323d000, 4096, PROT_READ) = 0 munmap(0x7fc8736ba000, 113424) = 0 munmap(0x7fc8736d6000, 2296960) = 0 munmap(0x7fc87347f000, 2338440) = 0 munmap(0x7fc87323f000, 2356392) = 0 munmap(0x7fc87302c000, 2173032) = 0 munmap(0x7fc872e29000, 2105600) = 0 open("/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = -1 ENOENT (No such file or directory) open("/usr/lib64/gconv/gconv-modules", O_RDONLY|O_CLOEXEC) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=56302, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc8757f2000 read(3, "# GNU libc iconv configuration.\n"..., 4096) = 4096 read(3, "lias\tCSISO141JUSIB1002//\tJUS_I.B"..., 4096) = 4096 read(3, "odule\t\tcost\nalias\tISO-IR-110//\t\t"..., 4096) = 4096 read(3, "9-14//\nalias\tL8//\t\t\tISO-8859-14/"..., 4096) = 4096 read(3, "CSEBCDICES//\t\tEBCDIC-ES//\nalias\t"..., 4096) = 4096 read(3, "IBM284//\nalias\tEBCDIC-CP-ES//\t\tI"..., 4096) = 4096 brk(0x235a000) = 0x235a000 read(3, "ias\t864//\t\t\tIBM864//\nalias\tCSIBM"..., 4096) = 4096 read(3, "lias\tCSIBM939//\t\tIBM939//\nmodule"..., 4096) = 4096 read(3, "alias\tcsGB2312//\t\tEUC-CN//\nalias"..., 4096) = 4096 read(3, "//\t\tISO-2022-CN-EXT//\nmodule\tISO"..., 4096) = 4096 read(3, "st\nalias\tISO-IR-55//\t\tISO_5428//"..., 4096) = 4096 read(3, "\tARMSCII-8//\t\tARMSCII-8\t1\n\n#\tfro"..., 4096) = 4096 read(3, "2//\t\tIBM1112\t\t1\n\n#\tfrom\t\t\tto\t\t\tm"..., 4096) = 4096 read(3, "module\tIBM9448//\t\tINTERNAL\t\tIBM9"..., 4096) = 3054 read(3, "", 4096) = 0 close(3) = 0 munmap(0x7fc8757f2000, 4096) = 0 futex(0x7fc874af08f8, FUTEX_WAKE_PRIVATE, 2147483647) = 0 write(2, "** Message: Operation not suppor"..., 36** Message: Operation not supported ) = 36 exit_group(0) = ? +++ exited with 0 +++ 

我已经将问题缩小到未设置DBUS_SESSION_BUS_ADDRESSvariables。

我想知道为什么上面的解决scheme需要dbus,因为在glib / gio文档中没有提到这一点,是否有一个不需要dbus的下载文件解决scheme,或者,我可以设置DBUS_SESSION_BUS_ADDRESS为什么会使它无论我如何切换到另一个用户的会话,都可以工作。

通过GIO进行本地文件访问不需要DBus,但通过gvfsd进行网络文件访问,DBus用于在程序和守护进程之间进行通信。 更多的技术细节可以在GNOME 2.22发行说明中找到 。

在这个问题中给出的答案访问另一个用户的D-Bus会话应该解决您的问题。