Bug 35291 - commit-log-editor can call itself in an infinite loop
Summary: commit-log-editor can call itself in an infinite loop
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P3 Minor
Assignee: Julien Chaffraix
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-23 06:45 PST by Julien Chaffraix
Modified: 2010-03-25 07:18 PDT (History)
1 user (show)

See Also:


Attachments
Proposed fix: add a isCommitLogEditor routine and check the $editor variable against it (2.65 KB, patch)
2010-02-23 06:49 PST, Julien Chaffraix
kenneth: review+
jchaffraix: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Julien Chaffraix 2010-02-23 06:45:04 PST
if $editor ends up being commit-log-editor, it will be called in an infinite loop. I managed to get this situation by swapping SVN_EDITOR and SVN_LOG_EDITOR - by mistake - in my .bashrc file.
Comment 1 Julien Chaffraix 2010-02-23 06:49:35 PST
Created attachment 49287 [details]
Proposed fix: add a isCommitLogEditor routine and check the $editor variable against it
Comment 2 Kenneth Rohde Christiansen 2010-02-26 05:18:46 PST
Comment on attachment 49287 [details]
Proposed fix: add a isCommitLogEditor routine and check the $editor variable against it


> +sub isCommitLogEditor($)
> +{
> +    my $editor = shift;
> +    printf $editor . "\n";
> +    return $editor =~ m/commit-log-editor/;
> +}

Wouldn't it be enough to just do this check once and not for each time you call the subroutine?
Comment 3 Julien Chaffraix 2010-02-26 07:17:22 PST
(In reply to comment #2)
> (From update of attachment 49287 [details])
> 
> > +sub isCommitLogEditor($)
> > +{
> > +    my $editor = shift;
> > +    printf $editor . "\n";
> > +    return $editor =~ m/commit-log-editor/;
> > +}
> 
> Wouldn't it be enough to just do this check once and not for each time you call
> the subroutine?

No, as you can't predict whether $editor is the same each time you are called.

The use case for that would be setting $SVN_LOG_EDITOR to commit-log-editor. If you cache the result, then you will fall all the way down to "/usr/bin/vi" when you could have used $EDITOR.
Comment 4 Julien Chaffraix 2010-03-17 18:18:00 PDT
Kenneth, are you satisfied with my comment or would you prefer another approach?
Comment 5 Kenneth Rohde Christiansen 2010-03-17 18:22:23 PDT
Yes! r=me
Comment 6 Julien Chaffraix 2010-03-25 07:18:26 PDT
Landed in r56540. Thanks!