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

Re: Problems in 1.8 with Hook Scripts

From: Alexander Haley <ahaley_at_meditech.com>
Date: Tue, 18 Jun 2013 16:17:11 -0400

On Tue, Jun 18, 2013 at 3:27 PM, Alexander Haley <ahaley_at_meditech.com>wrote:

> I am encountering two problems (which I believe to be opposite sides of
> the same coin) with client defined hook scripts as of the 1.8.0 release.
>
[...]

> Notice the new 'enforce' option - and notice that the post_update_hook is
> entirely removed. I suspect an investigation into the registry
> import/export code for the client hooks would turn up this bug readily
> enough.
>

Seems to me that the problem is in the *src\Utils\Hooks.cpp *code,
in bool CHooks::Save() , where the defined hooks are stored back into the
registry key , the code that glues together the string to store looks like:

for (hookiterator it = begin(); it != end(); ++it)
{
    strhooks += GetHookTypeString(it->first.htype);
    strhooks += '\n';
    strhooks += it->first.path.GetWinPathString();
    strhooks += '\n';
    strhooks += it->second.commandline;
    strhooks += '\n';
    strhooks += (it->second.bWait ? _T("true") : _T("false"));
    strhooks += '\n';
    strhooks += (it->second.bShow ? _T("show") : _T("hide"));
    strhooks += '\n';
    if (it->second.bEnforce)
      strhooks += _T("enforce\n");
}

Those last two lines, that tack on the 'enforce\n' bit ... well, if
bEnforce isn't true, then no '\n' delimiter will be tacked on, and then
later during the read in, if there are more than one hooks stored in the
registry string, they'll be fouled up via an off-by-one style error.
 Perhaps something like:

    strhooks += (it->second.bEnforce ? _T("enforce") : _T("disregard"));
    strhooks += '\n';

would fix this ... Hope that is useful...

Alex

------------------------------------------------------
http://tortoisesvn.tigris.org/ds/viewMessage.do?dsForumId=4061&dsMessageId=3058448

To unsubscribe from this discussion, e-mail: [users-unsubscribe_at_tortoisesvn.tigris.org].
Received on 2013-06-18 22:18:27 CEST

This is an archived mail posted to the TortoiseSVN Users mailing list.

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