Issue 66155 - ~/.cwsrc parsing broken ...
Summary: ~/.cwsrc parsing broken ...
Status: CLOSED FIXED
Alias: None
Product: Build Tools
Classification: Code
Component: solenv (show other issues)
Version: 680m172
Hardware: All All
: P3 Trivial (vote)
Target Milestone: OOo 2.0.4
Assignee: jens-heiner.rechtien
QA Contact: issues@tools
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-06 11:11 UTC by mmeeks
Modified: 2006-09-05 14:05 UTC (History)
4 users (show)

See Also:
Issue Type: PATCH
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
patch (881 bytes, patch)
2006-06-06 11:13 UTC, mmeeks
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description mmeeks 2006-06-06 11:11:59 UTC
Unfortunately if your CVS password has a space in it - you're thoroughly screwed
by the simple ~/.cwsrc parsing I wrote ;-)

Jody has a nice patch to fix this - allowing the following:

  - leading spaces    :  foo=bar
    - trailing spaces   :  foo=bar # asda
    - quoting           :  foo='bar'
    - escaped quotes    :  foo='b\'ar'

any chance of slipping it into a CWS soon ? :-)
Comment 1 mmeeks 2006-06-06 11:13:41 UTC
Created attachment 36943 [details]
patch
Comment 2 jens-heiner.rechtien 2006-06-06 14:35:39 UTC
Hi Michael,

no problem, I'll attach it to the next upcoming CWS.
Comment 3 jodygoldberg 2006-06-06 16:28:54 UTC
Thank you.  I'd also suggest a warning that failure to connect to server is
likely related to an invalid password.
Comment 4 jens-heiner.rechtien 2006-06-06 18:30:51 UTC
Ause - the old nitpicker - found a small glitch in one of the REs (we spend 20
min to understand it :-) ... and I found another one :-)

First (the line with the first + sign in the patch): The square backets in the
RE are exchanged for round ones. This isn't right, is it? This either doesn't
match (most of the cases) or match in funny ways. See attached snippet.

Secondly and here we are nitpicking :-): 
Please exchange the mentioned round brackets to square brackets in the "if" line
of the snippet . Now, if there is a whitespace before the quote sign on both
ends of the value string ie,
foo= "bar " 
then the RE which kills the surrounding quotes of the value will also kill the
last space inside the quote which still belongs to the value.

my $str = 'BAR1= "foo "';
print "$str\n";
if ( $str =~ m/(\w(\w\d)+)=(.*)$/ ) {
    my $var = $1;
    my $val = $2;
    print "$var\n";
    print "$val\n";
    $val =~ s/(\s*['"])?(.*)\1\s*$/\2/;
    print "x${val}x\n";
}

I told you we are nitpicking ... :-)
Comment 5 mmeeks 2006-06-07 10:04:42 UTC
> Ause - the old nitpicker - found a small glitch in one of the REs (we spend 20
> min to understand it :-) ... and I found another one :-)

    Perl - a lovely write-only language :-)

> I told you we are nitpicking ... :-)

    Nah these are good nits; any chance you can fix as you commit ? :-)
Comment 6 jens-heiner.rechtien 2006-06-07 13:55:43 UTC
Fixed in ause056
Comment 7 hjs 2006-06-07 15:37:09 UTC
looks fine for me now

->mmeeks:  you might want to have a look anyhow...
Comment 8 jodygoldberg 2006-06-07 16:19:44 UTC
1) You're correct.  That was a last minute change that I did not review properly
sorry about that.

2) blah.  This brings back unpleasant memories of why I haven't used perl in a
while.

Thanks for the review.
Comment 9 jens-heiner.rechtien 2006-09-05 14:05:20 UTC
Close issue.