[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

ra_local authentication weirdness

From: Garrett Rooney <rooneg_at_electricjellyfish.net>
Date: 2002-11-30 20:29:49 CET

ok, so today i tried to do an 'svn pedit file:///path/to/repos/file',
and to my surprise it crashed. i mean it shouldn't work anyway, but it
sure as hell shouldn't crash.

here's the backtrace:

(gdb) run pedit svn:eol-style file:///Users/rooneg/tmp/repos/foo
Starting program:
/Users/rooneg/Hacking/svn/subversion/clients/cmdline/svn pedit
svn:eol-style file:///Users/rooneg/tmp/repos/foo
[Switching to process 4412 thread 0xb03]
Reading symbols for shared libraries ......... done

Program received signal EXC_BAD_ACCESS, Could not access memory.
get_username (username=0x470bd8, baton=0x470bb8, force_prompt=0,
pool=0x470698) at subversion/libsvn_client/auth.c:79
79 else if (ab->username)
(gdb) print ab
$1 = (svn_client_auth_baton_t *) 0x0
(gdb) where
#0 get_username (username=0x470bd8, baton=0x470bb8, force_prompt=0,
pool=0x470698) at subversion/libsvn_client/auth.c:79
#1 0x0003a7d8 in svn_ra_local__open (session_baton=0xbffff8ec,
repos_URL=0x470a68 "file:///Users/rooneg/tmp/repos/foo",
callbacks=0x470ba0, callback_baton=0x470bb8, pool=0x470698) at
subversion/libsvn_ra_local/ra_plugin.c:220
#2 0x00013ba0 in svn_client__open_ra_session
(session_baton=0xbffff8ec, ra_lib=0x75d94, base_url=0x470a68
"file:///Users/rooneg/tmp/repos/foo", base_dir=0x0, base_access=0x0,
commit_items=0x0, do_store=1, use_admin=0, read_only_wc=0,
auth_baton=0x0, pool=0x470698) at subversion/libsvn_client/ra.c:259
#3 0x00010174 in svn_client_propget (props=0xbffff98c,
propname=0x4709e8 "svn:eol-style", target=0x470a68
"file:///Users/rooneg/tmp/repos/foo", revision=0xbffffa10,
auth_baton=0x0, recurse=0, pool=0x470698) at
subversion/libsvn_client/prop_commands.c:300
#4 0x000063d4 in svn_cl__propedit (os=0x4707d0, baton=0xbffffa10,
pool=0x470698) at subversion/clients/cmdline/propedit-cmd.c:184
#5 0x00005284 in main (argc=0, argv=0xbffffdcd) at
subversion/clients/cmdline/main.c:856
#6 0x00001c80 in _start (argc=4, argv=0xbffffce4, envp=0xbffffcf8) at
/SourceCache/Csu/Csu-45/crt.c:267
#7 0x00001b00 in start ()
(gdb)

so on further inspection, it turns out that inside get_username we get
an auth_baton from inside the svn_client__callback_baton_t we're
passed, but it looks like it's null here, so we dereference it and
BOOM. if we work our way up the chain, we see in
svn_client__get_authenticator (all this is in libsvn_client/auth.c for
those playing along at home) that that the auth baton and the callback
baton are in fact the same thing at the moment (this seems kind of
sketchy, since they have two separate types, but whatever), and
svn_client__get_authenticator sets the auth_baton pointer it's passed
to point to the callback baton, but it never sets the callback baton's
auth_baton member variable to anything. ok i think to myself, all i've
got to do is set that member variable to the callback baton (since
they're both the same thing anyway according to the comments), and all
is good.

well, it turns out that if i do that, my 'svn pedit' now works (well,
it errors out like it should anyway), but now the regression tests all
break with errors like this:

[rooneg@Zodiac:~/Hacking/svn/subversion/tests/clients/cmdline ]
./basic_tests.py 1
CMD: svnadmin "create" "local_tmp/repos"
CMD: svn "import" "--username" "jrandom" "--password" "rayjandom" "-m"
"Log message for revision 1."
"file:///Users/rooneg/Hacking/svn/subversion/tests/clients/cmdline/
local_tmp/repos" "local_tmp/greekfiles"
CMD: svn "co" "--username" "jrandom" "--password" "rayjandom"
"file:///Users/rooneg/Hacking/svn/subversion/tests/clients/cmdline/
repositories/basic_tests-1" "working_copies/basic_tests-1"
CMD: svn "checkout"
"file:///Users/rooneg/Hacking/svn/subversion/tests/clients/cmdline/
repositories/basic_tests-1/A" "working_copies/basic_tests-1"
CMD: svn "rm" "working_copies/basic_tests-1/A/D/G"
CMD: svn "status" "-v" "-u" "-q" "working_copies/basic_tests-1"
=============================================================
Expected __SVN_ROOT_NODE and actual __SVN_ROOT_NODE are different!
=============================================================
EXPECTED NODE TO BE:
=============================================================
  * Node name: __SVN_ROOT_NODE
     Path: __SVN_ROOT_NODE
     Contents: None
     Properties: {}
     Attributes: {}
     Children: 1
=============================================================
ACTUAL NODE FOUND:
=============================================================
  * Node name: __SVN_ROOT_NODE
     Path: __SVN_ROOT_NODE
     Contents: None
     Properties: {}
     Attributes: {}
     Children: is a file.
Unequal Types: one Node is a file, the other is a directory
caught an SVNTreeUnequal exception, returning error instead
FAIL: basic_tests.py 1: basic checkout of a wc

none of these errors make much sense to me... when i try the commands
here, they all seem to work about as i would expect. does anyone have
any idea what the heck is going on here?

anyway, to reproduce this problem, just apply the following patch to
libsvn_client/auth.c.

-garrett

Index: libsvn_client/auth.c
===================================================================
--- libsvn_client/auth.c (revision 3933)
+++ libsvn_client/auth.c (working copy)
@@ -333,6 +333,7 @@
    /* At the moment, the callback_baton *is* the baton needed by the
       authenticator objects. This may change. */
    *auth_baton = callback_baton;
+ cb->auth_baton = callback_baton;

    /* Return a specific authenticator vtable. */
    switch (method)

-- 
garrett rooney                    Remember, any design flaw you're
rooneg@electricjellyfish.net      sufficiently snide about becomes
http://electricjellyfish.net/     a feature.       -- Dan Sugalski
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Nov 30 20:30:37 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.