why not make a temporary copy of the files with appropriate permission, send a message the application the user originally opened to diff the files, then apply the user modified file and cleanup the $tmpdir?
This would leave the user the possibility to choose whatever application she want to do the merge, which is a big plus. 2010/5/30 Christopher Harvey <[email protected]> > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hello gentoo-dev, > > I'm working on an app for GSoC that needs to show a diff of two files > to the user. Right now I've just been calling meld from the python > os.system call. I tried running my application as root to show diffs > of system files that belong to root. I got this error: > > Traceback (most recent call last): > File "/usr/bin/meld", line 90, in <module> > meldapp.main() > File "/usr/lib/meld/meldapp.py", line 982, in main > app = MeldApp() > File "/usr/lib/meld/meldapp.py", line 562, in __init__ > self.prefs = MeldPreferences() > File "/usr/lib/meld/meldapp.py", line 435, in __init__ > super(MeldPreferences, self).__init__("/apps/meld", self.defaults) > File "/usr/lib/meld/prefs.py", line 92, in __init__ > self._gconf.add_dir(rootkey, gconf.CLIENT_PRELOAD_NONE) > glib.GError: Failed to contact configuration server; some possible > causes are that you need to enable TCP/IP networking for ORBit, or you > have stale NFS locks due to a system crash. See > http://projects.gnome.org/gconf/ for information. (Details - 1: > Failed to get connection to session: Did not receive a reply. Possible > causes include: the remote application did not send a reply, the > message bus security policy blocked the reply, the reply timeout > expired, or the network connection was broken.) > > I haven't looked into why this is happening very much because calling > os.system("meld file1 file2 &") in python is putting up so many red > flags in my head it's not funny. If anybody could tell me the proper > gentoo/linux/python way to present a root level diff to a user running > a program through su or sudo I'd really appreciate the help. > > thanks, > Chris > > - -- > My GnuPGP key at: > www.basementcode.com/public_key.txt > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.14 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQEcBAEBAgAGBQJMAn1RAAoJEDqfZIFeqFH7brQH/RqeUmCHuopa+SufkzNNT4Ys > 7IJArQCik3vBLJLpeTM3gf3NL3KMWjyzlxxQ8L74KAhItPuA3cVUQKQrSnOCBiDa > y6yfDttBbOptOtcUYn7WkXQDm+BYEdpviMfjtym5ZF2nlGOMzZMxknP4ywXnhLZN > q2169haoG0p1g0D11q2H9B4Vk++PUil7VLgzOfAOcLQ9YpFDkXIdxy5FRaRkx8K4 > lcPfmzFha8OkdBpsXPJdhtY5pmzOEf+ziprDlyD7eCkE1xAkRNhjsNtEz9CTXeLh > l46/tUCZTx+aX9ABW0m13Ache8jGN36+TvsRzRKfzqaMJ0z/wEOeESooPFYHnl0= > =FxxJ > -----END PGP SIGNATURE----- > > >
