* [gentoo-dev] showing file diffs as root
@ 2010-05-30 14:59 Christopher Harvey
2010-05-30 15:21 ` Domen Kožar
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Christopher Harvey @ 2010-05-30 14:59 UTC (permalink / raw
To: gentoo-dev
-----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-----
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-dev] showing file diffs as root
2010-05-30 14:59 [gentoo-dev] showing file diffs as root Christopher Harvey
@ 2010-05-30 15:21 ` Domen Kožar
2010-05-30 15:27 ` Christopher Harvey
2010-05-30 20:34 ` Sebastian Pipping
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Domen Kožar @ 2010-05-30 15:21 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 2650 bytes --]
Hey!
Maybe I am missing something, but why not use difflib and pygments on
top of that?
Cheers, Domen
On Sun, 2010-05-30 at 10:59 -0400, Christopher Harvey wrote:
> -----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-----
>
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-dev] showing file diffs as root
2010-05-30 15:21 ` Domen Kožar
@ 2010-05-30 15:27 ` Christopher Harvey
2010-05-30 15:34 ` Domen Kožar
2010-05-30 16:08 ` Michał Górny
0 siblings, 2 replies; 8+ messages in thread
From: Christopher Harvey @ 2010-05-30 15:27 UTC (permalink / raw
To: gentoo-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On 05/30/10 11:21, Domen Kožar wrote:
> Hey!
>
> Maybe I am missing something, but why not use difflib and pygments on
> top of that?
>
> Cheers, Domen
>
That's a good option.
Pros:
Can easily integrate the diff viewer into my application.
Cons:
Doesn't seem to be a way to interactively merge files (not a big deal
for me)
As for generating the diff is it ok to use difflib to generate the diff
text? I hear there is a diff environment variable..(but I can't seem to
find it now) should I use that instead?
- --
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/
iQEcBAEBAgAGBQJMAoPtAAoJEDqfZIFeqFH7+NYH/3J6IS4woiS5KI3KIDdPA5eU
9VBaC8xRJEJ/fwYXoxaRqkWft2hAd/FahbPMzZI9RiA3tEu8Cv8NE6nvtXTJoe6U
zJ/8gIszJVEG3QnADvzdSr03kCWCsom5iZBuEYP0eK/VT9cgsjiTsc71p0h7zcIK
TosCrKMkya3IJ3svBXLnJhgtcekfmP2Qk8gQt4o/UMW1D7abP5kI2zxidgsGEL1V
YBu4HOirte9RFzEIZBClFW0LpUZ0Ix2Rpf614GvAEW+5HK34hfQHMxdmPCVVLv7W
KNMspLUOaOEVnufhz8i5UvKvbMCjj5PItTvEQlsJ/xzrB2bZqIWK1iYZp07PdmI=
=CWy/
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-dev] showing file diffs as root
2010-05-30 15:27 ` Christopher Harvey
@ 2010-05-30 15:34 ` Domen Kožar
2010-05-30 16:08 ` Michał Górny
1 sibling, 0 replies; 8+ messages in thread
From: Domen Kožar @ 2010-05-30 15:34 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1553 bytes --]
difflib is one of the best Python libraries out there. It does it's job
perfectly.
difflib can generate diff in text, any it's very pluggable (go through
documentation, you will see)
On Sun, 2010-05-30 at 11:27 -0400, Christopher Harvey wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 05/30/10 11:21, Domen Kožar wrote:
> > Hey!
> >
> > Maybe I am missing something, but why not use difflib and pygments on
> > top of that?
> >
> > Cheers, Domen
> >
>
> That's a good option.
> Pros:
> Can easily integrate the diff viewer into my application.
>
> Cons:
> Doesn't seem to be a way to interactively merge files (not a big deal
> for me)
>
> As for generating the diff is it ok to use difflib to generate the diff
> text? I hear there is a diff environment variable..(but I can't seem to
> find it now) should I use that instead?
>
> - --
> 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/
>
> iQEcBAEBAgAGBQJMAoPtAAoJEDqfZIFeqFH7+NYH/3J6IS4woiS5KI3KIDdPA5eU
> 9VBaC8xRJEJ/fwYXoxaRqkWft2hAd/FahbPMzZI9RiA3tEu8Cv8NE6nvtXTJoe6U
> zJ/8gIszJVEG3QnADvzdSr03kCWCsom5iZBuEYP0eK/VT9cgsjiTsc71p0h7zcIK
> TosCrKMkya3IJ3svBXLnJhgtcekfmP2Qk8gQt4o/UMW1D7abP5kI2zxidgsGEL1V
> YBu4HOirte9RFzEIZBClFW0LpUZ0Ix2Rpf614GvAEW+5HK34hfQHMxdmPCVVLv7W
> KNMspLUOaOEVnufhz8i5UvKvbMCjj5PItTvEQlsJ/xzrB2bZqIWK1iYZp07PdmI=
> =CWy/
> -----END PGP SIGNATURE-----
>
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-dev] showing file diffs as root
2010-05-30 15:27 ` Christopher Harvey
2010-05-30 15:34 ` Domen Kožar
@ 2010-05-30 16:08 ` Michał Górny
1 sibling, 0 replies; 8+ messages in thread
From: Michał Górny @ 2010-05-30 16:08 UTC (permalink / raw
To: gentoo-dev
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Sun, 30 May 2010 11:27:41 -0400
Christopher Harvey <chris@basementcode.com> wrote:
> As for generating the diff is it ok to use difflib to generate the
> diff text? I hear there is a diff environment variable..(but I can't
> seem to find it now) should I use that instead?
If I correctly understand what you're referring to, that variable is
useful if you just need to present the diff to the user in the format
preferred by him -- he could then choose an alternate diffing program,
offering another output format.
If you need to parse the differences, that's not an option for you as
the diffing program chosen by user might use any freeform output
format, making it unparseable. Thus, in that case difflib is the solu-
tion you're looking for -- it is prepared to provide the differences
in a way suitable for program use.
- --
Best regards,
Michał Górny
<http://mgorny.alt.pl>
<xmpp:mgorny@jabber.ru>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
iEYEARECAAYFAkwCjW0ACgkQnGSe5QXeB7uojwCg5bXcUVGR487tyuU+wnNDG5fA
JMkAoKiqCHJXsmQz7aYGU+J+BzTPwQsn
=lRtw
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-dev] showing file diffs as root
2010-05-30 14:59 [gentoo-dev] showing file diffs as root Christopher Harvey
2010-05-30 15:21 ` Domen Kožar
@ 2010-05-30 20:34 ` Sebastian Pipping
2010-05-31 12:21 ` Francesco R
2010-05-31 12:57 ` Gilles Dartiguelongue
3 siblings, 0 replies; 8+ messages in thread
From: Sebastian Pipping @ 2010-05-30 20:34 UTC (permalink / raw
To: gentoo-dev
On 05/30/10 16:59, Christopher Harvey wrote:
> [..] because calling
> os.system("meld file1 file2 &") in python is putting up so many red
> flags in my head it's not funny. [..]
On a sidenote: the subprocess module offers better alternatives to
calling os.system:
http://docs.python.org/library/subprocess.html
Best,
Sebastian
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-dev] showing file diffs as root
2010-05-30 14:59 [gentoo-dev] showing file diffs as root Christopher Harvey
2010-05-30 15:21 ` Domen Kožar
2010-05-30 20:34 ` Sebastian Pipping
@ 2010-05-31 12:21 ` Francesco R
2010-05-31 12:57 ` Gilles Dartiguelongue
3 siblings, 0 replies; 8+ messages in thread
From: Francesco R @ 2010-05-31 12:21 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 2785 bytes --]
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 <chris@basementcode.com>
> -----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-----
>
>
>
[-- Attachment #2: Type: text/html, Size: 3554 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [gentoo-dev] showing file diffs as root
2010-05-30 14:59 [gentoo-dev] showing file diffs as root Christopher Harvey
` (2 preceding siblings ...)
2010-05-31 12:21 ` Francesco R
@ 2010-05-31 12:57 ` Gilles Dartiguelongue
3 siblings, 0 replies; 8+ messages in thread
From: Gilles Dartiguelongue @ 2010-05-31 12:57 UTC (permalink / raw
To: gentoo-dev
Le dimanche 30 mai 2010 à 10:59 -0400, Christopher Harvey a écrit :
> -----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
https://bugs.gentoo.org/show_bug.cgi?id=286577
https://bugs.gentoo.org/show_bug.cgi?id=302597
and probably a couple more duplicates.
--
Gilles Dartiguelongue <eva@gentoo.org>
Gentoo
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-05-31 12:58 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-30 14:59 [gentoo-dev] showing file diffs as root Christopher Harvey
2010-05-30 15:21 ` Domen Kožar
2010-05-30 15:27 ` Christopher Harvey
2010-05-30 15:34 ` Domen Kožar
2010-05-30 16:08 ` Michał Górny
2010-05-30 20:34 ` Sebastian Pipping
2010-05-31 12:21 ` Francesco R
2010-05-31 12:57 ` Gilles Dartiguelongue
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox