Hello, when passing a revision string in the form of "{DATE}" to the Perl bindings, the passed string is unexpectedly modified during parsing and the closing brace will be removed. Here is a Perl script reproducing the issue with an example:
---8<--- use SVN::Client; my $ctx = SVN::Client->new(); my $repo = "http://svn.apache.org/repos/asf/subversion/trunk"; my $rev = "{2016-11-02 12:34:56}"; print "Before: $rev\n"; $ctx->info($repo, "HEAD", $rev, sub { print $_[1]->rev . "\n"; }, 0); print "After: $rev\n"; --->8--- Running this script will give the following output, note the missing close brace at the end of the third line: Before: {2016-11-02 12:34:56} 1767638 After: {2016-11-02 12:34:56 I experienced and reproduced this problem with perl 5.20 and 5.24. Due to different internal memory handling, perl <= 5.18 might not be affected by this. This problem originates in the function svn_swig_pl_set_revision in subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c. I am attaching a patch that solves this problem by undoing the null byte insertion, after the modified string was passed to svn_parse_date. [[ * subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c: (svn_swig_pl_set_revision): Undo revision variable modifications when using "{DATE}" syntax. ]] Rainer
Index: subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c =================================================================== --- subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c (revision 1767623) +++ subversion/bindings/swig/perl/libsvn_swig_perl/swigutil_pl.c (working copy) @@ -470,9 +470,11 @@ svn_opt_revision_t *svn_swig_pl_set_revision(svn_o if (!end) maybe_croak(("unknown opt_revision_t string \"%s\": " "missing closing brace for \"{DATE}\"", input)); + char saved = *end; *end = '\0'; err = svn_parse_date (&matched, &tm, input + 1, apr_time_now(), pool); + *end = saved; if (err) { svn_error_clear (err); maybe_croak(("unknown opt_revision_t string \"{%s}\": "