tags 513183 patch
thanks

Hello,

I spent some time n this bug, first trying to fix hgk itself, then
realising I was fighting someone else's battle and in the end I
settled for a (quite) elegant workaround.

I prepared an NMU, but the functional changes (without changelog
changes) were also extracted in a separate patch, if you prefer to add
yourself the changelog entry.



The functional changes are present in  513183-no-changelog.patch.

The NMU files are also provided (but are not signed). The orig file is
the same from the archive (obviously, from lenny).




Here is the description of the changes.

    workaround for 513183 so hg view works

    tcl/tk is very sensitive about stuff which is printed to stderr
    and considers anything printed to be on stderr to be a sign of
    an error.

    To avoid hgk's crash because of warnings, we print warnings
    only when the quiet option is absent. We suppress
    warnings in hg by calling from "hg view" a wrapper, hg-hgk,
    which requests quiet operation, disabling warnings.

    In order to preserve user's possible preference for another hg
    via HG environment variable, we make sure in the wrapper we
    call that HG, not the system hg, if HG was initally set.





Now all you have to do is to request an unblock request and upload to unstable.


-- 
Regards,
EddyP
=============================================
"Imagination is more important than knowledge" A.Einstein
diff --git a/mercurial-1.0.1/debian/mercurial-common.install b/mercurial-1.0.1/debian/mercurial-common.install
index d8b6493..55cfd85 100644
--- a/mercurial-1.0.1/debian/mercurial-common.install
+++ b/mercurial-1.0.1/debian/mercurial-common.install
@@ -6,3 +6,4 @@ contrib/mq.el usr/share/emacs/site-lisp
 
 contrib/logo-droplets.svg usr/share/mercurial
 contrib/hgk usr/share/mercurial/
+contrib/hg-hgk usr/share/mercurial/
diff --git a/mercurial-1.0.1/debian/patches/hgk-crash-workaround.patch b/mercurial-1.0.1/debian/patches/hgk-crash-workaround.patch
new file mode 100644
index 0000000..73da6c4
--- /dev/null
+++ b/mercurial-1.0.1/debian/patches/hgk-crash-workaround.patch
@@ -0,0 +1,39 @@
+Index: mercurial-1.0.1/hgext/hgk.py
+===================================================================
+--- mercurial-1.0.1.orig/hgext/hgk.py	2009-01-29 02:52:42.000000000 +0200
++++ mercurial-1.0.1/hgext/hgk.py	2009-01-29 02:52:59.000000000 +0200
+@@ -319,6 +319,11 @@
+     optstr = ' '.join(['--%s %s' % (k, v) for k, v in opts.iteritems() if v])
+     cmd = ui.config("hgk", "path", "/usr/share/mercurial/hgk") + " %s %s" % (optstr, " ".join(etc))
+     ui.debug("running %s\n" % cmd)
++    try:
++	os.environ['REALHG']=os.environ['HG']
++    except KeyError:
++	os.environ['REALHG']='/usr/bin/hg'
++    os.environ['HG']='/usr/share/mercurial/hg-hgk'
+     util.system(cmd)
+ 
+ cmdtable = {
+Index: mercurial-1.0.1/mercurial/ui.py
+===================================================================
+--- mercurial-1.0.1.orig/mercurial/ui.py	2009-01-29 02:52:42.000000000 +0200
++++ mercurial-1.0.1/mercurial/ui.py	2009-01-29 02:52:59.000000000 +0200
+@@ -442,7 +442,8 @@
+     def status(self, *msg):
+         if not self.quiet: self.write(*msg)
+     def warn(self, *msg):
+-        self.write_err(*msg)
++	if not self.quiet:
++            self.write_err(*msg)
+     def note(self, *msg):
+         if self.verbose: self.write(*msg)
+     def debug(self, *msg):
+Index: mercurial-1.0.1/contrib/hg-hgk
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ mercurial-1.0.1/contrib/hg-hgk	2009-01-29 02:52:02.000000000 +0200
+@@ -0,0 +1,4 @@
++#!/bin/sh
++
++
++exec "$REALHG" --config ui.quiet=true $@
diff --git a/mercurial-1.0.1/debian/patches/series b/mercurial-1.0.1/debian/patches/series
index c869054..243721c 100644
--- a/mercurial-1.0.1/debian/patches/series
+++ b/mercurial-1.0.1/debian/patches/series
@@ -9,3 +9,4 @@ deb_specific__ElementTree_for_darcs.patch
 convert-darc-doc.patch
 backport__CVE-2008-2942-fix.patch
 backport__svn1.5-fix.patch
+hgk-crash-workaround.patch
diff --git a/mercurial-1.0.1/debian/rules b/mercurial-1.0.1/debian/rules
index 4368de0..dc4ba4e 100755
--- a/mercurial-1.0.1/debian/rules
+++ b/mercurial-1.0.1/debian/rules
@@ -43,6 +43,8 @@ build/mercurial-common::
 	# workaround a bug in asciidoc that generates incorrect manpages
 	sed -i 's,^\([\\]\?[.]hg/hgrc\),\\\&\1,' doc/hg.1
 	sed -i 's,^\([\\]\?[.][*][\\]\?[.]swp\),\\\&\1,' doc/hgignore.5
+	# make sure the hg-hgk wrapper is executable
+	chmod +x contrib/hg-hgk
 
 binary-install/mercurial-common::
 	# web templates are symlinked from python-support to /u/s/mercurial

Attachment: mercurial_1.0.1-5.2.diff.gz
Description: GNU Zip compressed data

Attachment: mercurial_1.0.1-5.2.dsc
Description: Binary data

Attachment: mercurial_1.0.1-5.2_amd64.changes
Description: Binary data

Reply via email to