You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Tor Hovland <to...@nidaros.homedns.org> on 2003/06/06 20:32:42 UTC

Cancellable auth prompts

I use the simple prompt provider in a GUI client. However, there seems to be
no real way for the user to cancel the authentication dialog (i.e. the
prompt_func), thereby cancelling the operation that is about to run as well.

I have tried doing

return svn_error_create(SVN_ERR_CANCELLED, NULL, "Authentication prompt
cancelled by user.");

but instead of catching this error, it gets propagated all the way up to
neon, upon which the pending operation fails instead of just stopping.

My immediate guess was that the problem could be rectified in get_creds(),
by checking explicitly for SVN_ERR_CANCELLED and keeping got_creds == 0
before returning, but it might not be quite that easy, as
svn_auth_first_credentials() will then just keep looking for another
provider that is able to succeed.

A better approach would probably be to handle the error in request_auth(),
but then the next question is whether it is possible to return a meaningful
cancellation signal to neon. It seems that it isn't. Neon will return
NE_AUTH regardless of how authentication is interrupted.

So now I'm stuck. I'm thinking that others must have been wondering about
this before, and the Subversion API suffers because of lacking cancellation
support in Neon. Or am I missing something?


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Cancellable auth prompts

Posted by Ben Collins-Sussman <su...@collab.net>.
Greg Stein <gs...@lyra.org> writes:

> "Hey, let's just set this global over *there*, so when (if) I get called
>  back over *here*, then I can cancel the operation. yah yah!"
> 
> Not.

Man, you've got to stop making me laugh!

Fine, fine.  Somebody please file an "enhancement" request to add
a cancellation API to our authorization API.  :-)


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Cancellable auth prompts

Posted by Greg Stein <gs...@lyra.org>.
On Fri, Jun 06, 2003 at 03:35:13PM -0500, Ben Collins-Sussman wrote:
> "Tor Hovland" <to...@nidaros.homedns.org> writes:
> 
> > So now I'm stuck. I'm thinking that others must have been wondering about
> > this before, and the Subversion API suffers because of lacking cancellation
> > support in Neon. Or am I missing something?
> 
> You are correct;  the svn authentication API has no way of noticing a
> cancellation event.
> 
> But is it necssary to be able to cancel immediately within an
> auth-prompt?

As Brane said: yes, this makes great sense.

> Your svn_client_ctx *does* have a cancellation callback/ctx that
> you've defined.  If the user hits 'cancel' on your auth-prompt dialog
> box, you can set a flag in your cancellation-ctx and return an empty
> string to the auth system.  When actual work is about to begin (some
> svn_client_*() routine), your cancellation callback will be called,
> which will exit at that point.  I think... am I wrong about that?

eeewwww... Don't make me hurt you, man.

"Hey, let's just set this global over *there*, so when (if) I get called
 back over *here*, then I can cancel the operation. yah yah!"

Not.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Cancellable auth prompts

Posted by Tor Hovland <to...@nidaros.homedns.org>.
----- Original Message ----- 
From: "Branko Čibej" <br...@xbc.nu>
To: "Ben Collins-Sussman" <su...@collab.net>
Cc: "Tor Hovland" <to...@nidaros.homedns.org>; <de...@subversion.tigris.org>
Sent: Saturday, June 07, 2003 12:19 AM


> That means you could generate network requests (that would probably
> fail) before the first cancellation point was hit; so the command would
> fail, not stop, like he said.

Yes, and some actions seem to be without cancellation points altogether,
like log. I noticed that RapidSVN couldn't cancel the prompt properly, and
took that to be a bug in RapidSVN, but I see now that RapidSVN is probably
doing as much as it can towards cancelling an action.

To see how this works, open RapidSVN, right-click on a file under revision
control, select 'log', select 'cancel' in the auth dialog, and notice the
following report in the status pane:

Error while preparing action: PROPFIND request failed on '/svn/repos/file'
PROPFIND of '/svn/repos/file': authorization failed (http://www.server.org)

The error is caused by Neon trying to complete the request with missing
authorization, despite the cancel.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Cancellable auth prompts

Posted by Branko Čibej <br...@xbc.nu>.
Ben Collins-Sussman wrote:

>"Tor Hovland" <to...@nidaros.homedns.org> writes:
>
>  
>
>>So now I'm stuck. I'm thinking that others must have been wondering about
>>this before, and the Subversion API suffers because of lacking cancellation
>>support in Neon. Or am I missing something?
>>    
>>
>
>You are correct;  the svn authentication API has no way of noticing a
>cancellation event.
>
>But is it necssary to be able to cancel immediately within an
>auth-prompt?
>
For a GUI, this makes perfect sense from a usability standpoint.


>Your svn_client_ctx *does* have a cancellation callback/ctx that
>you've defined.  If the user hits 'cancel' on your auth-prompt dialog
>box, you can set a flag in your cancellation-ctx and return an empty
>string to the auth system.  When actual work is about to begin (some
>svn_client_*() routine), your cancellation callback will be called,
>which will exit at that point.  I think... am I wrong about that?
>  
>
That means you could generate network requests (that would probably
fail) before the first cancellation point was hit; so the command would
fail, not stop, like he said.


-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Cancellable auth prompts

Posted by Ben Collins-Sussman <su...@collab.net>.
"Tor Hovland" <to...@nidaros.homedns.org> writes:

> So now I'm stuck. I'm thinking that others must have been wondering about
> this before, and the Subversion API suffers because of lacking cancellation
> support in Neon. Or am I missing something?

You are correct;  the svn authentication API has no way of noticing a
cancellation event.

But is it necssary to be able to cancel immediately within an
auth-prompt?

Your svn_client_ctx *does* have a cancellation callback/ctx that
you've defined.  If the user hits 'cancel' on your auth-prompt dialog
box, you can set a flag in your cancellation-ctx and return an empty
string to the auth system.  When actual work is about to begin (some
svn_client_*() routine), your cancellation callback will be called,
which will exit at that point.  I think... am I wrong about that?




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org