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

Re: Branch 'invoke-diff-cmd-feature' is ready for half-way review

From: <roderich.schupp_at_gmail.com>
Date: Wed, 16 Oct 2013 05:18:46 -0700 (PDT)

Looking over __create_custom_diff_cmd() in ./subversion/libsvn_subr/io.c:

(1) The function doesn't strip double quotes, e.g.

_create_custom_diff_cmd(..., /* cmd= */ "duff \"quoted\"", pool)

will return the array { "duff", "\"quoted\"", NULL }
You probably need to split cmd into tokens yourself (instead of using

svn_cstring_split and then trying to fix up the result).

(2)

  result = apr_palloc(pool,
                      (words->nelts+1) * words->elt_size * sizeof(char *) )

Why is words->elt_size needed here - result is an array of char*?

(3) Lifetime issue:

      result[argv] = word->data;

word (and hence word->data) has been allocated in scratch_pool (which will be destroyed
prior to return from __create_custom_diff_cmd), while result has been allocated in pool.

Cheers, Roderich
Received on 2013-10-16 14:19:26 CEST

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