darcs

Issue 257 push => incorrect return code when couldn't get lock (Darcs2)

Title push => incorrect return code when couldn't get lock (Darcs2)
Priority bug Status resolved
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, kowey, markstos, thorkilnaur, tommy, vmiklos
Assigned To markstos
Topics Confirmed, Darcs2

Created on 2006-09-01.13:57:40 by vmiklos, last changed 2009-08-27.14:05:07 by admin.

Messages
msg951 (view) Author: vmiklos Date: 2006-09-01.13:57:35
hi

$ dr push ../../pacman

Fri Sep  1 15:51:51 CEST 2006  .
  * .
Shall I push this patch? (1/1)  [ynWvpxqadjk], or ? for help: y
Waiting for lock /home/vmiklos/darcs/pacman/_darcs/lock
(...)
Waiting for lock /home/vmiklos/darcs/pacman/_darcs/lock
Couldn't get lock /home/vmiklos/darcs/pacman/_darcs/lock

$ echo $?
0

this way from scripts you can't handle the "could not get lock" error :/

$ dr --version
1.0.8 (release)

udv / greetings,
VMiklos
msg1517 (view) Author: kowey Date: 2007-03-08.11:36:43
That's odd.  Lock.getlock does an exitWith $ ExitFailure 1 when it can't get the
lock.  Ideas?
msg1518 (view) Author: droundy Date: 2007-03-08.15:12:56
On Thu, Mar 08, 2007 at 11:36:55AM +0000, Eric Kow wrote:
> That's odd.  Lock.getlock does an exitWith $ ExitFailure 1 when it can't get the
> lock.  Ideas?

Maybe it's when the apply fails to get the lock? We could look at whether
we check the exit code of the remote "darcs apply".
-- 
David Roundy
http://www.darcs.net
msg1525 (view) Author: kowey Date: 2007-03-08.20:18:04
On Thu, Mar 08, 2007 at 15:13:10 +0000, David Roundy wrote:
> Maybe it's when the apply fails to get the lock? We could look at whether
> we check the exit code of the remote "darcs apply".

But if I understand correctly, this applying to a local repository
(../../something).  In that case we don't invoke a new darcs, do we?
msg1526 (view) Author: droundy Date: 2007-03-08.21:18:43
On Thu, Mar 08, 2007 at 09:17:07PM +0100, Eric Y. Kow wrote:
> On Thu, Mar 08, 2007 at 15:13:10 +0000, David Roundy wrote:
> > Maybe it's when the apply fails to get the lock? We could look at whether
> > we check the exit code of the remote "darcs apply".
> 
> But if I understand correctly, this applying to a local repository
> (../../something).  In that case we don't invoke a new darcs, do we?

We still invoke a new darcs, which does have the advantage of keeping the
code path close to the same in the two cases (local and remote push).  But
it might make sense to code a local push differently.  Actually, for a
local push, the most efficient approach would be to implement it as a cd
and pull, which wouldn't involve creating an intermediate patch bundle.
But then we'd have totally different code paths, which is a little scary,
and the remote push code path wouldn't be tested by the test suite at all.
-- 
David Roundy
Department of Physics
Oregon State University
msg1527 (view) Author: vmiklos Date: 2007-03-08.21:37:14
Na Thu, Mar 08, 2007 at 09:17:07PM +0100, "Eric Y. Kow" <eric.kow@gmail.com> pisal(a):
> On Thu, Mar 08, 2007 at 15:13:10 +0000, David Roundy wrote:
> > Maybe it's when the apply fails to get the lock? We could look at whether
> > we check the exit code of the remote "darcs apply".
> 
> But if I understand correctly, this applying to a local repository
> (../../something).  In that case we don't invoke a new darcs, do we?

this is on darcs push, so we do invoke one imho

VMiklos
msg1543 (view) Author: kowey Date: 2007-03-19.21:05:19
On Thu, Mar 08, 2007 at 21:18:48 +0000, David Roundy wrote:
> > > Maybe it's when the apply fails to get the lock? We could look at whether
> > > we check the exit code of the remote "darcs apply".
> > 
> > But if I understand correctly, this applying to a local repository
> > (../../something).  In that case we don't invoke a new darcs, do we?
> 
> We still invoke a new darcs, which does have the advantage of keeping the
> code path close to the same in the two cases (local and remote push).

Yep, RemoteApply.apply_via_local uses execPipeIgnoreError It would be
good for somebody to look into this, figure out why we do that and see
if we can just use exec.
msg2945 (view) Author: markstos Date: 2008-01-31.03:12:12
I confirmed this bug with Darcs 2. The issue is that darcs calls a remote darcs
and doesn't propagate the return code back. 

Solutions could involve properly passing the return code back through from the
remote darcs call, or re-implementing a local darcs push so that a second
process is not involved. 

I could possibly create an automated test for this, but it would be annoying to
run in the test suite, because we'd have to wait for it to time out each time. 

  Mark
msg2964 (view) Author: vmiklos Date: 2008-01-31.10:10:31
> I could possibly create an automated test for this, but it would be annoying to
> run in the test suite, because we'd have to wait for it to time out each time. 

hmm, why a conflict results in a timeout? there could be different error
codes for locking failure and conflicts.

thanks,
- VMiklos
msg2967 (view) Author: vmiklos Date: 2008-01-31.10:48:54
On Thu, Jan 31, 2008 at 10:10:33AM -0000, VMiklos <bugs@darcs.net> wrote:
> hmm, why a conflict results in a timeout? there could be different error
> codes for locking failure and conflicts.

ah, i'm stupid. so here the idea: this issue is both about

1) conflicts
2) locking failure

does not result in exit code 1

fixing both and creating a test for conflicts could be fine.

thanks,
- VMiklos
msg2985 (view) Author: droundy Date: 2008-01-31.16:38:36
On Thu, Jan 31, 2008 at 10:48:56AM -0000, VMiklos wrote:
> ah, i'm stupid. so here the idea: this issue is both about
> 
> 1) conflicts
> 2) locking failure
> 
> does not result in exit code 1
> 
> fixing both and creating a test for conflicts could be fine.

A test for this would be great!

David
msg2995 (view) Author: vmiklos Date: 2008-01-31.18:20:39
On Thu, Jan 31, 2008 at 04:38:37PM -0000, David Roundy <bugs@darcs.net> wrote:
> A test for this would be great!

here is one:

----
#!/bin/sh
set -ev

test $DARCS || DARCS=$PWD/../darcs

rm -rf tempc
mkdir tempc
cd tempc
$DARCS init
echo foo > foo.c
$DARCS rec -Ax -alm init
cd ..
rm -rf temps
$DARCS get tempc temps
cd temps
echo server >> foo.c
$DARCS rec -Ax -alm server
cd ../tempc
echo client >> foo.c
$DARCS rec -Ax -alm client
if $DARCS push -a ../temps; then
        false
fi
cd ..
rm -rf tempc temps
----

basically it creates a conflict and if darcs push says everything went
fine then it bails out with an error since it should _not_ say
everything is ok.

- VMiklos
msg3060 (view) Author: markstos Date: 2008-02-03.01:16:00
Thanks for the test vmiklos. I have added it to tests/ and send the patch to the
darcs-devel list. It already passed, because David Roundy had already submitted
a fix, based on your report. 

   Mark
History
Date User Action Args
2006-09-01 13:57:40vmikloscreate
2007-03-08 11:36:55koweysetstatus: unread -> unknown
nosy: + kowey, beschmi
messages: + msg1517
title: incorrect return code when couldn't get lock on push -> incorrect return code when couldn't get lock on push (1.0.8)
2007-03-08 15:13:10droundysetnosy: droundy, tommy, beschmi, kowey, vmiklos
messages: + msg1518
2007-03-08 20:18:44koweysetnosy: droundy, tommy, beschmi, kowey, vmiklos
messages: + msg1525
2007-03-08 21:18:48droundysetnosy: droundy, tommy, beschmi, kowey, vmiklos
messages: + msg1526
2007-03-08 21:37:48vmiklossetnosy: droundy, tommy, beschmi, kowey, vmiklos
messages: + msg1527
2007-03-19 21:05:31koweysetnosy: droundy, tommy, beschmi, kowey, vmiklos
messages: + msg1543
2008-01-31 03:12:18markstossettopic: + Confirmed, Darcs2
nosy: + markstos
messages: + msg2945
title: incorrect return code when couldn't get lock on push (1.0.8) -> push => incorrect return code when couldn't get lock (Darcs2)
2008-01-31 10:10:33vmiklossetnosy: droundy, tommy, beschmi, kowey, markstos, vmiklos
messages: + msg2964
2008-01-31 10:48:56vmiklossetnosy: droundy, tommy, beschmi, kowey, markstos, vmiklos
messages: + msg2967
2008-01-31 16:38:37droundysetnosy: droundy, tommy, beschmi, kowey, markstos, vmiklos
messages: + msg2985
title: push => incorrect return code when couldn't get lock (Darcs2) -> push => incorrect return code when couldn't get lock (Darcs2)
2008-01-31 18:20:40vmiklossetnosy: droundy, tommy, beschmi, kowey, markstos, vmiklos
messages: + msg2995
2008-02-02 23:59:12markstossetnosy: droundy, tommy, beschmi, kowey, markstos, vmiklos
assignedto: markstos
2008-02-03 01:16:03markstossetstatus: unknown -> resolved-in-unstable
nosy: droundy, tommy, beschmi, kowey, markstos, vmiklos
messages: + msg3060
2008-09-04 21:29:14adminsetstatus: resolved-in-unstable -> resolved
nosy: + dagit
2009-08-06 17:36:14adminsetnosy: + jast, Serware, dmitry.kurochkin, darcs-devel, zooko, mornfall, simon, thorkilnaur, - droundy, vmiklos
2009-08-06 20:33:18adminsetnosy: - beschmi
2009-08-10 21:55:09adminsetnosy: + vmiklos, - darcs-devel, zooko, jast, Serware, mornfall
2009-08-10 23:55:59adminsetnosy: - dagit
2009-08-25 17:50:16adminsetnosy: + darcs-devel, - simon
2009-08-27 14:05:07adminsetnosy: tommy, kowey, markstos, vmiklos, darcs-devel, thorkilnaur, dmitry.kurochkin