Bug#608249: if mercurial extension listed in config and unavailable, etckeeper reports spurious error

2010-12-29 Thread faheem
Package: etckeeper
Version: 0.50
Severity: normal


Hi Joey,

Using current unstable etckeeper on lenny.

Suppose my /root/.hgrc lists a extension which is not available. In my
case it was

hg-prompt.prompt =

Then hg complains when it runs, of course. However, this doesn't
actually affect anything. However, etckeeper seems to see this as a
problem, and pops up a screen saying the commit failed to happen, when
in fact there is no problem. I assume it is looking at some exit
status to determine whether there is a problem? I think this is a bug.
You may disagree, in which case, feel free to close it. Thanks for
your work on etckeeper, and Happy Christmas and New Year!

   Regards, Faheem
   

-- System Information:
Debian Release: 5.0.7
  APT prefers stable
  APT policy: (500, 'stable'), (50, 'unstable'), (50, 'testing'), (1, 
'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.26-2-686-bigmem (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages etckeeper depends on:
ii  debconf [debconf-2. 1.5.24   Debian configuration management sy
ii  git-core1:1.5.6.5-3+lenny3.2 fast, scalable, distributed revisi
ii  mercurial   1.7.2-1  scalable distributed version contr

Versions of packages etckeeper recommends:
ii  cron  3.0pl1-105 management of regular background p

Versions of packages etckeeper suggests:
ii  sudo  1.6.9p17-3 Provide limited super user privile

-- debconf information:
* etckeeper/commit_failed:
  etckeeper/purge: true



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#608249: if mercurial extension listed in config and unavailable, etckeeper reports spurious error

2010-12-29 Thread Faheem Mitha


On Wed, 29 Dec 2010, Joey Hess wrote:


faheem wrote:

Using current unstable etckeeper on lenny.

Suppose my /root/.hgrc lists a extension which is not available. In my
case it was

hg-prompt.prompt =

Then hg complains when it runs, of course. However, this doesn't
actually affect anything. However, etckeeper seems to see this as a
problem, and pops up a screen saying the commit failed to happen, when
in fact there is no problem. I assume it is looking at some exit
status to determine whether there is a problem? I think this is a bug.
You may disagree, in which case, feel free to close it. Thanks for
your work on etckeeper, and Happy Christmas and New Year!


etckeeper assumes that when $VCS commit returns a nonzero exit status,
the commit has failed. Of course that is not necessarily true, maybe
$VCS has been misconfigured such that it successfully commits and then
indicates failure. But etckeeper can't possibly tell. I don't see a bug
here.


Ok. I did some testing.

As was pointed out by Lasse V. Karlsen la...@vkarlsen.no, the error mercurial 
gives for a missing extn is not reflected in its exit code, which is still 0, 
as you can easily verify. I tested using Python


subprocess.call(some mercurial stuff)

I also verified again that the etckeeper error appears with the missing extn, 
and goes away if it is removed. I didn't directly check that the error status 
was 0 in this case (not sure how to), but I've no idea why it would not be.


For the record, the etckeeper error message is

Commit failed An attempt to commit /etc changes to hg failed.  You may 
manually resolve the issues with the uncommitted changes before continuing.


I removed, reinstalled, and removed w3m. The first two times with the missing 
extn, which produced the etckeeper error message. In all cases, the commit 
succeeded.


Assuming hg's error codes when called by etckeeper are the same as when called 
normally from the shell, I can only conclude that etckeeper is using some 
criterion other than a non-zero hg exit code to decide that the commit failed.


Irc snippet from Matt Mackall, quoted with permission, in case it is helpful.

13:34  mpm Unavailable extensions don't affect Mercurial's exit code.
13:49  * mpm browses the etckeeper source.
13:55  mpm The only place I can spot any error handling is here:
http://git.kitenet.net/?p=etckeeper.git;a=blob;f=pre-install.d/50uncommitted-changes;h=d03d0e81cb3545e57c878fa050333eb98e440b7d;hb=HEAD
13:56  mpm The commit itself is here:
http://git.kitenet.net/?p=etckeeper.git;a=blob;f=commit.d/50vcs-commit;h=6e509e6285df0755025b21dc5c601644cc971bee;hb=HEAD
13:57  mpm Line 53, since anchors don't seem to work.
13:58  mpm I have no idea where the message Commit failed is coming from.
13:58  mpm It's not from hg.
13:59  faheem mpm: can i quote this?
13:59  mpm http://paste.pocoo.org/show/311570/
13:59  mpm Sure.
13:59  faheem mpm: ok. thanks
13:59  mpm hg --config extensions.bogus= help debugdate ; echo $?
13:59  mpm Quick test of extensions and exit codes.

Regards, Faheem



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#608249: if mercurial extension listed in config and unavailable, etckeeper reports spurious error

2010-12-29 Thread Joey Hess
Faheem Mitha wrote:
 Commit failed An attempt to commit /etc changes to hg failed.  You
 may manually resolve the issues with the uncommitted changes before
 continuing.
 
 Assuming hg's error codes when called by etckeeper are the same as
 when called normally from the shell, I can only conclude that
 etckeeper is using some criterion other than a non-zero hg exit code
 to decide that the commit failed.

No, etckeeper only looks at the exit status. You should be able to reproduce
the nonzero exit status by running `etckeeper commit` (passing it some,
possibly multiline commit message). It is impossible to see that message unless
`etckeeper commit` returns nonzero, and that in turn is impossible unless one
of the commands it runs, like `hg commit $HG_COMMIT_OPTIONS -l $logfile`
returns nonzero.

-- 
see shy jo


signature.asc
Description: Digital signature