Skip Menu |

This queue is for tickets about the ClearCase-Argv CPAN distribution.

Report information
The Basics
Id: 80191
Status: open
Priority: 0/
Queue: ClearCase-Argv

People
Owner: Nobody in particular
Requestors: Kai.Tetzlaff [...] rohde-schwarz.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Fallback from ctcmd to plain cleartool mode does not add cleartool prefix to executed commands
Date: Mon, 15 Oct 2012 14:04:27 +0200
To: bug-ClearCase-Argv [...] rt.cpan.org
From: Kai.Tetzlaff [...] rohde-schwarz.com
Hi, i'm using ClearCase::Argv 1.51 with ctcmd(1) on windows (ActivePerl 5.16.1, 32-bit). When using the pipe() command, ClearCase::Argv automatically tries to fall back to using plain cleartool mode (as can be seen when using dbglevel > 0). But it seems to fail to add cleartool to the executed command. Here's some example output: a:\TestVob\test>perl -E "use ClearCase::Argv; $ct=ClearCase::Argv->new(); $ct->dbglevel(1)->ctcmd(1)->mklabel(['-nc', '-config', 'some.do', 'LBL_TEST'])->pipe" Warning: mklabel: CtCmd usage incompatible with pipe - temporarily reverting to plain cleartool at -e line 1. + mklabel -nc -config some.do LBL_TEST | 'mklabel' is not recognized as an internal or external command, operable program or batch file. /Kai
Hello, Thanks for the report. I can reproduce on my Strawberry Perl installation on which CtCmd is not (and cannot be) installed. However, I cannot reproduce if I switch to ipc (see below). My question to you is: did you install CtCmd? ClearCase::Argv requires it but falls back silently to using CAL if it doesn't find it... W:\atcctest\ClearCase-Argv>perl -E "use ClearCase::Argv; $ct=ClearCase::Argv->new(); $ct->dbglevel(1)->ctcmd(1)->mklabel(['-nc', '-config', 'some.do', 'LBL_TEST'])->pipe" Warning: mklabel: CtCmd usage incompatible with pipe - temporarily reverting to plain cleartool at -e line 1 + mklabel -nc -config some.do LBL_TEST | 'mklabel' is not recognized as an internal or external command, operable program or batch file. W:\atcctest\ClearCase-Argv>perl -E "use ClearCase::Argv; $ct=ClearCase::Argv->new(); $ct->dbglevel(1)->ipc(1)->mklabel(['-nc', '-config', 'some.do', 'LBL_TEST'])->pipe" Warning: mklabel: IPC usage incompatible with pipe - temporarily reverting to plain cleartool at -e line 1 + cleartool mklabel -nc -config some.do LBL_TEST | cleartool: Error: Pathname not found: "some.do". Attempted to apply labels to 0 versions. 0 newly applied 0 moved 0 already in place 0 failed Marc
CC: Marc Girod <marc.girod [...] gmail.com>, Kai.Tetzlaff [...] rohde-schwarz.com
Subject: Re: [rt.cpan.org #80191] Fallback from ctcmd to plain cleartool mode does not add cleartool prefix to executed commands
Date: Wed, 17 Oct 2012 06:41:49 -0400
To: bug-ClearCase-Argv [...] rt.cpan.org
From: David Boyce <dsb [...] boyski.com>
On Wed, Oct 17, 2012 at 6:33 AM, Marc Girod via RT <bug-ClearCase-Argv@rt.cpan.org> wrote: Show quoted text
> My question to you is: did you install CtCmd? > ClearCase::Argv requires it but falls back silently to using CAL if it doesn't find it...
More precisely, the OP requested this fallback behavior with the ->ctcmd(1) method. Use of (2) would print a warning and (3) would fail, as detailed at: http://search.cpan.org/~dsb/ClearCase-Argv-1.51/Argv.pm#ALTERNATE_EXECUTION_INTERFACES David
Subject: Re: [rt.cpan.org #80191] Fallback from ctcmd to plain cleartool mode does not add cleartool prefix to executed commands
Date: Wed, 17 Oct 2012 13:20:25 +0200
To: bug-ClearCase-Argv [...] rt.cpan.org
From: Kai.Tetzlaff [...] rohde-schwarz.com
Hello, yes, i have installed CtCmd and it is working for me (i checked with ->ctcmd(2) and also the output of dbglevel(1) shows that it gets used). I would also have tried ->ipc(..) but failed to install it. There's also another thing which caused some confusion on my side: without ctcmd, the value of $? is as documented: a combination of signal ID and exit code of the cleartool process (shiftet 1 octet to the left). However, when using ctcmd() mode, it just contains the exit code (without the shift). So if you do $?>>8 to get the exit code, the result will always just be 0. /Kai From: "Marc Girod via RT" <bug-ClearCase-Argv@rt.cpan.org> To: Kai.Tetzlaff@rohde-schwarz.com Date: 17.10.2012 12:33 Subject: [rt.cpan.org #80191] Fallback from ctcmd to plain cleartool mode does not add cleartool prefix to executed commands <URL: https://rt.cpan.org/Ticket/Display.html?id=80191 > Hello, Thanks for the report. I can reproduce on my Strawberry Perl installation on which CtCmd is not (and cannot be) installed. However, I cannot reproduce if I switch to ipc (see below). My question to you is: did you install CtCmd? ClearCase::Argv requires it but falls back silently to using CAL if it doesn't find it... W:\atcctest\ClearCase-Argv>perl -E "use ClearCase::Argv; $ct=ClearCase::Argv->new(); $ct->dbglevel(1)->ctcmd(1)->mklabel(['-nc', '-config', 'some.do', 'LBL_TEST'])->pipe" Warning: mklabel: CtCmd usage incompatible with pipe - temporarily reverting to plain cleartool at -e line 1 + mklabel -nc -config some.do LBL_TEST | 'mklabel' is not recognized as an internal or external command, operable program or batch file. W:\atcctest\ClearCase-Argv>perl -E "use ClearCase::Argv; $ct=ClearCase::Argv->new(); $ct->dbglevel(1)->ipc(1)->mklabel(['-nc', '-config', 'some.do', 'LBL_TEST'])->pipe" Warning: mklabel: IPC usage incompatible with pipe - temporarily reverting to plain cleartool at -e line 1 + cleartool mklabel -nc -config some.do LBL_TEST | cleartool: Error: Pathname not found: "some.do". Attempted to apply labels to 0 versions. 0 newly applied 0 moved 0 already in place 0 failed Marc
Based on my understanding of our being in the CAL emulation mode of ClearCase::CtCmd, I would propose the following patch: W:\atcctest\ClearCase-Argv>ct diff -diff Argv.pm 344a345,346 Show quoted text
> $otherSelf->prog(@ct, $otherSelf->prog) > if $mode eq 'CtCmd' and !$INC{'ClearCase/CtCmd.pm'};
Now, if you tell me that you do have the real CtCmd, this shouldn't work for you (it does for me). Note that the dbglevel prompt does not differentiate CtCmd from CAL... This obviously doesn't address your other remark. Marc
Sorry, my own transcript (using ctcmd(2) to display the warning and the prompt) showing that my patch fixes at least one issue: W:\atcctest\ClearCase-Argv>perl -Mblib -E "use ClearCase::Argv; $ct=ClearCase::Argv->new({ctcmd=>2, dbglevel=>1});$ct->pwv(['-s'])->system;$ct->mklabel(['-nc', '-config', 'foo', 'FF'])->pipe" Warning: Can't locate ClearCase/CtCmd.pm, using CAL instead +> pwv -s emagiro_w2 Warning: mklabel: CtCmd usage incompatible with pipe - temporarily reverting to plain cleartool at -e line 1 + cleartool mklabel -nc -config foo FF | cleartool: Error: Pathname not found: "foo". Attempted to apply labels to 0 versions. 0 newly applied 0 moved 0 already in place 0 failed W:\atcctest\ClearCase-Argv>
Subject: Re: [rt.cpan.org #80191] Fallback from ctcmd to plain cleartool mode does not add cleartool prefix to executed commands
Date: Wed, 17 Oct 2012 15:30:21 +0200
To: bug-ClearCase-Argv [...] rt.cpan.org
From: Kai.Tetzlaff [...] rohde-schwarz.com
Show quoted text
> Now, if you tell me that you do have the real CtCmd, this shouldn't work > for you (it does for me). > Note that the dbglevel prompt does not differentiate CtCmd from CAL...
I'm quite sure that i'm using the real CtCmd. And at least for me, i also see a difference in the debug output: ** pwv->system with ctcmd (prefixes echoed cleartool command with '+>') (perl -E "use ClearCase::Argv; $ct=ClearCase::Argv->new(); $ct->dbglevel(1)->ctcmd(3)->pwv()->system") +> pwv Working directory view: tetzlaff_mu710858_tools Set view: ** NONE ** ** pwv->system without ctcmd (prefixes echoed cleartool command with '+') (perl -E "use ClearCase::Argv; $ct=ClearCase::Argv->new(); $ct->dbglevel(1)->pwv()->system") + cleartool pwv Working directory view: tetzlaff_mu710858_tools Set view: ** NONE ** ** pwv->pipe with ctcmd (falls back to CAL, uses '+' prefix) (perl -E "use ClearCase::Argv; $ct=ClearCase::Argv->new(); $ct->dbglevel(1)->ctcmd(3)->pwv()->pipe") Warning: pwv: CtCmd usage incompatible with pipe - temporarily reverting to plain cleartool at -e line 1. + pwv | 'pwv' is not recognized as an internal or external command, operable program or batch file. ** pwv->pipe after applying patch -> same as above (as already expected from your comment that it won't work with reall CtCmd) perl -E "use ClearCase::Argv; $ct=ClearCase::Argv->new(); $ct->dbglevel(1)->ctcmd(3)->pwv()->pipe" Warning: pwv: CtCmd usage incompatible with pipe - temporarily reverting to plain cleartool at -e line 1. + pwv | 'pwv' is not recognized as an internal or external command, operable program or batch file.
On Wed Oct 17 09:30:31 2012, Kai.Tetzlaff@rohde-schwarz.com wrote: Show quoted text
> ** pwv->system with ctcmd (prefixes echoed cleartool command with '+>')
As I told, this is not enough to discriminate... Show quoted text
> $ct->dbglevel(1)->ctcmd(3)->pwv()->system")
This (3) however is: if CtCmd is not found, Argv dies... Now, I am surprised, so I'll ask you for one more confirmation. But before, I simplify the patch, so that it would support the assumption: ClearCase-Argv> ct diff -diff Argv.pm 344a345 Show quoted text
> $otherSelf->prog(@ct, $otherSelf->prog) if $mode eq 'CtCmd';
Now, the confirmation, please, as a oneliner: W:>perl -MClearCase::Argv -e "$ct=new ClearCase::Argv->pwv({ctcmd=>1});print qq($_\n) for @{$ct->{q(AV_PROG)}}" I.e. I now understand that cleartool is not added within prog in the ctcmd case (line 89), whether or not the real CtCmd is found...
Subject: Re: [rt.cpan.org #80191] Fallback from ctcmd to plain cleartool mode does not add cleartool prefix to executed commands
Date: Thu, 18 Oct 2012 18:32:40 +0200
To: bug-ClearCase-Argv [...] rt.cpan.org
From: Kai.Tetzlaff [...] rohde-schwarz.com
Results after applying the new patch perl -MClearCase::Argv -e "$ct=new ClearCase::Argv->pwv({ctcmd=>1});print qq($_\n) for @{$ct->{q(AV_PROG)}}" cleartool pwv looks good?! Also the pipe command which previously failed is now working: perl -E "use ClearCase::Argv; $ct=ClearCase::Argv->new(); $ct->dbglevel(1)->ctcmd(3)->pwv()->pipe" Warning: pwv: CtCmd usage incompatible with pipe - temporarily reverting to plain cleartool at -e line 1. + cleartool pwv | Working directory view: tetzlaff_mu710858_tools Set view: ** NONE ** Thanks!
Show quoted text
> looks good?!
In fact, no... Show quoted text
> Also the pipe command which previously failed is now working
Well, I am happy of that, but my understanding was thus flawed. I guess I have to reinstall ActivePerl and CtCmd... Thanks!
On Thu Oct 18 13:14:05 2012, MGI wrote: Show quoted text
> I guess I have to reinstall ActivePerl and CtCmd...
Only, I fail... I installed Microsoft Visual Studio Express 11.0, ran vcvars32, extracted CtCmd 1.09, ran perl Makefile.PL, but nmake will choke on: C:\Perl\lib\CORE\perl.h(610) : fatal error C1083: Cannot open include file: 'sys/types.h': No such file or directory Marc
OK. I got it after installing Visual Studio Express 10.0 instead. It seems that 11.0 only supports Windows 8... Anyway... Now comparing (with pre-patch 1.51): $ct=new ClearCase::Argv->pwv({ctcmd=>3});$ct->pwv([q(-s)])->pipe and $ct=new ClearCase::Argv->pwv({ctcmd=>3});$ct->args([q(-s)])->pipe The latter, would work... The problem would thus happen in the generated 'pwv' function!?
Show quoted text
> The latter, would work...
But fail with my patch. Show quoted text
> The problem would thus happen in the generated 'pwv' function!?
Here is what happens: The function is generated in the parent Argv.pm, and this one resets the internal AV_PROG, by invoking (337) prog. This is overloaded and prepends 'cleartool' unless in ctcmd mode. But if one builds a function object, and use it with the 'args' method, AV_PROG is not reset, hence the naive patch prepends a second copy. Hence my next patch (wrt 1.51): W:\atcctest\ClearCase-Argv>ct diff -diff -3 Argv.pm 344c344,350 < ($mode eq 'CtCmd') ? $otherSelf->ctcmd(0) : $otherSelf->ipc(0); --- Show quoted text
> if ($mode eq 'CtCmd') { > $otherSelf->ctcmd(0); > my @prg = $otherSelf->prog; #Depends on the invocation path > $otherSelf->prog(@ct, @prg) unless $prg[0] =~ /cleartool/; > } else { > $otherSelf->ipc(0); > }
Show quoted text
> Hence my next patch (wrt 1.51):
... Show quoted text
> $otherSelf->prog(@ct, @prg) unless $prg[0] =~ /cleartool/;
I can see a flaw with this in retrospect: @ct, hence @prg too, might contain things such as: qw(sudo cleartool). I probably need to test instead: grep /cleartool/, @prg
On Sun Oct 21 14:19:45 2012, MGI wrote: Show quoted text
> I can see a flaw with this in retrospect: @ct, hence @prg too, might > contain things such as: qw(sudo cleartool).
Although not in ctcmd mode...