You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Stefan Küng <to...@gmail.com> on 2006/01/05 20:19:49 UTC

[PATCH] fix crash when copying added files with --force

Hi,

The first crashreports for TortoiseSVN 1.3.0RC1 are coming in :)

When copying added (but not committed yet) files with the --force flag, 
Subversion crashes in libsvn_wc/copy.c, line 515.
That's because there are (IMHO) bogus brackets in the check there.

Attached is a patch which fixes this issue.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.tigris.org

Re: [PATCH] fix crash when copying added files with --force

Posted by Jim Blandy <ji...@red-bean.com>.
On 1/5/06, Stefan Küng <to...@gmail.com> wrote:
> When copying added (but not committed yet) files with the --force flag,
> Subversion crashes in libsvn_wc/copy.c, line 515.
> That's because there are (IMHO) bogus brackets in the check there.
>
> Attached is a patch which fixes this issue.
> @@ -511,7 +511,7 @@
>         _("'%s' is not under version control"),
>         svn_path_local_style (src_path, pool));
>
> -  if ((src_entry->repos != NULL && dst_entry->repos != NULL) &&
> +  if (src_entry->repos != NULL && dst_entry->repos != NULL &&
>        strcmp (src_entry->repos, dst_entry->repos) != 0)
>      return svn_error_createf
>        (SVN_ERR_WC_INVALID_SCHEDULE, NULL,

Huh?  How can removing brackets around a sub-portion of an and-chain
have any effect?  The && operator has lower precedence than !=,
function calls, and ->.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: [PATCH] fix crash when copying added files with --force

Posted by Philip Martin <ph...@codematters.co.uk>.
Stefan Küng <to...@gmail.com> writes:

> When copying added (but not committed yet) files with the --force
> flag, Subversion crashes in libsvn_wc/copy.c, line 515.

Which --force flag exactly?

> That's because there are (IMHO) bogus brackets in the check there.
>
> Attached is a patch which fixes this issue.

> -  if ((src_entry->repos != NULL && dst_entry->repos != NULL) &&
> +  if (src_entry->repos != NULL && dst_entry->repos != NULL &&
>        strcmp (src_entry->repos, dst_entry->repos) != 0)

That won't fix a crash, those brackets are redundant.

>      return svn_error_createf
>        (SVN_ERR_WC_INVALID_SCHEDULE, NULL,

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: [PATCH] fix crash when copying added files with --force

Posted by Stefan Küng <to...@gmail.com>.
On 1/5/06, Julian Foad <ju...@btopenworld.com> wrote:
> Stefan Küng wrote:
> >
> > The first crashreports for TortoiseSVN 1.3.0RC1 are coming in :)
> >
> > When copying added (but not committed yet) files with the --force flag,
> > Subversion crashes in libsvn_wc/copy.c, line 515.
> > That's because there are (IMHO) bogus brackets in the check there.
> >
> > Attached is a patch which fixes this issue.
>
> Are you sure?  From my knowledge of C I can't see that removing those brackets
> can make any difference whatsoever.

Autsch.
I think I need some sleep. You're right of course.

But I wonder: the crashreports I received (three so far) indicate that
the strcmp() function was executed even though dst_entry->repos was
NULL.
How could this have happened?

Stefan

--
       ___
  oo  // \\      "De Chelonian Mobile"
 (_,\/ \_/ \     TortoiseSVN
   \ \_/_\_/>    The coolest Interface to (Sub)Version Control
   /_/   \_\     http://tortoisesvn.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: [PATCH] fix crash when copying added files with --force

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 1/6/06, Garrett Rooney <ro...@electricjellyfish.net> wrote:

> I can reproduce this here, although it seems to be fixed in trunk
> (wc-replacements probably changed this codepath).  I'll look at
> getting a fix together and into 1.3.x for the next release.

Actually, this wasn't wc-replacements, it's issue #2436, I'll propose
it for backport once I confirm that the merged version passes the test
it added.

-garrett

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: [PATCH] fix crash when copying added files with --force

Posted by Garrett Rooney <ro...@electricjellyfish.net>.
On 1/6/06, Stefan Küng <to...@gmail.com> wrote:

> Ok, I've got a recipe on how to provoke the crash.
> Using svn version 1.3.0 (my own build, since the official windows
> binaries aren't available yet):
>
> $ cd some_working_copy
> $ echo sometext > file
> $ svn copy file file2
> ==> crash
>
> The problem is that in line 526 of file libsvn_wc/copy.c, the
> 'src_entry' is NULL, so the 'if' check
> if ((src_entry->repos ...
> causes an exception.
>
> I guess a fix would be quite easy, but I'm not sure if you'd rather have
> a check for (src_entry != NULL && dst_entry != NULL) or if you'd like to
> have the call to svn_wc_entry() in the line above to return an error.
>
> May I also say that a fix for this is quite important: the RC1 release
> of TSVN is out only for about a week, and I've already received 9
> crashreports with exactly that crash. And considering it's an RC and the
> first week of the year where many people are still on holiday, that's
> quite a high number.

I can reproduce this here, although it seems to be fixed in trunk
(wc-replacements probably changed this codepath).  I'll look at
getting a fix together and into 1.3.x for the next release.

-garrett

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: [PATCH] fix crash when copying added files with --force

Posted by Stefan Küng <to...@gmail.com>.
Julian Foad wrote:
> Stefan Küng wrote:
>>
>> The first crashreports for TortoiseSVN 1.3.0RC1 are coming in :)
>>
>> When copying added (but not committed yet) files with the --force 
>> flag, Subversion crashes in libsvn_wc/copy.c, line 515.
>> That's because there are (IMHO) bogus brackets in the check there.
>>
>> Attached is a patch which fixes this issue.
> 
> Are you sure?  From my knowledge of C I can't see that removing those 
> brackets can make any difference whatsoever.

Ok, I've got a recipe on how to provoke the crash.
Using svn version 1.3.0 (my own build, since the official windows 
binaries aren't available yet):

$ cd some_working_copy
$ echo sometext > file
$ svn copy file file2
==> crash

The problem is that in line 526 of file libsvn_wc/copy.c, the 
'src_entry' is NULL, so the 'if' check
if ((src_entry->repos ...
causes an exception.

I guess a fix would be quite easy, but I'm not sure if you'd rather have 
a check for (src_entry != NULL && dst_entry != NULL) or if you'd like to 
have the call to svn_wc_entry() in the line above to return an error.

May I also say that a fix for this is quite important: the RC1 release 
of TSVN is out only for about a week, and I've already received 9 
crashreports with exactly that crash. And considering it's an RC and the 
first week of the year where many people are still on holiday, that's 
quite a high number.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] fix crash when copying added files with --force

Posted by Julian Foad <ju...@btopenworld.com>.
Stefan Küng wrote:
> 
> The first crashreports for TortoiseSVN 1.3.0RC1 are coming in :)
> 
> When copying added (but not committed yet) files with the --force flag, 
> Subversion crashes in libsvn_wc/copy.c, line 515.
> That's because there are (IMHO) bogus brackets in the check there.
> 
> Attached is a patch which fixes this issue.

Are you sure?  From my knowledge of C I can't see that removing those brackets 
can make any difference whatsoever.

- Julian


[...]
> [[[
> Fix crash when added files are copied with --force.
> * subversion/libsvn_wc/copy.c:
>   remove bogus brackets.
> ]]]
> Index: subversion/libsvn_wc/copy.c
> ===================================================================
> --- subversion/libsvn_wc/copy.c	(Revision 17990)
> +++ subversion/libsvn_wc/copy.c	(Arbeitskopie)
> @@ -511,7 +511,7 @@
>         _("'%s' is not under version control"),
>         svn_path_local_style (src_path, pool));
>  
> -  if ((src_entry->repos != NULL && dst_entry->repos != NULL) &&
> +  if (src_entry->repos != NULL && dst_entry->repos != NULL &&
>        strcmp (src_entry->repos, dst_entry->repos) != 0)
>      return svn_error_createf


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org