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

Re: swig-py3 str/bytes difference in svn_config_*()

From: Yasuhito FUTATSUKI <futatuki_at_poem.co.jp>
Date: Fri, 13 Dec 2019 17:28:18 +0900

On 2019/12/13 16:24, Daniel Shahaf wrote:
> Thanks for the quick fix. However, it doesn't work on my machine (Debian stretch).
>
> With your latest patch, «svn_config_get_user_config_path(None, None)»
> calls the C function of the name with «path == NULL» and segfaults immediately,
> because the parameter is dereferenced on the first line of the function. As to
> the other case, I get a bogus stack trace:
>
> [[[
> % PYTHONPATH=… lldb -- python3 -c $'from svn.core import *; svn_config_ensure("/tmp/foo")'
> (lldb) r
> Process 19706 launched: '/usr/bin/python3' (x86_64)
> Process 19706 stopped
> * thread #1, name = 'python3', stop reason = signal SIGSEGV: invalid address (fault address: 0x0)
> frame #0: 0x0000000000000000
> error: memory read failed for 0x0
> (lldb)
> ]]]

Thank you for testing. I also tested and same result on FreeBSD
with Python 3.6. It seems "z*" format in PyArg_ParseTuple() doesn't
work I expected.

On the other hand, I can't find good reason to care typemap for
"const char *config_dir" input different from other MAY_BE_NULL types
on Python bindings only, so I removed this special handling.
Then, it works :)

[[[
Index: subversion/bindings/swig/core.i
===================================================================
--- subversion/bindings/swig/core.i (revision 1871319)
+++ subversion/bindings/swig/core.i (working copy)
@@ -362,7 +362,9 @@
      /* svn_config_get */
      const char *default_value,
      /* svn_config_read_auth_data */
- const char *config_dir,
+ const char *config_dir,
+ /* svn_config_get_user_config_path */
+ const char *fname,
      /* svn_diff_file_output_merge */
      const char *conflict_original,
      const char *conflict_modified,
@@ -723,11 +725,6 @@
                    svn_swig_rb_config_section_enumerator)
  #endif
  
-/* Allow None to be passed as config_dir argument */
-#ifdef SWIGPYTHON
-%typemap(in,parse="z") const char *config_dir "";
-#endif
-
  /* -----------------------------------------------------------------------
    thunk the various authentication prompt functions.
    PERL NOTE: store the inputed SV in _global_callback for use in the
]]]

Thanks,

-- 
Yasuhito FUTATSUKI <futatuki_at_yf.bsdclub.org> / <futatuki_at_poem.co.jp>
Received on 2019-12-13 09:30:01 CET

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.