27/9/2007

dotline dotlinedot dot linedot line linedotlinedot dotlinedotdot dot dotline dotlinedot linedotlinedot dotline dotdotdot dot line dotlinedot dotdot linelinedot linelinedot dot dotlinedot dotdotdot linedotline dotdot linedot linedotdot linelineline dotdotlinedot linedotdotdot dotlinedot linelineline linedotline dot linedot

Aren’t ClearCase triggers kind of broken???

Filed under: — Mikolaj at analog clock showing 10:17

ClearCase triggers are supposed to force the users to follow the policy. They need to be laying at some tamper-proof location, so that nobody tries to short-circuit them. Right? Sort of…

A small exercise.

Let’s first make an unfriendly trigger.

print "Sorry, this trigger is always false!n";
exit 1;

We’ll make it a pre-checkout trigger.
Try it:

always-false trigger

Works as expected.
Now, I can’t modify the trigger (tamper-proof, remember :-D), why not wrap around ccperl.exe? Sorry for not doing things elegantly, it’s just an example:

/*******************************************************************************
 *                                                                             *
 * This thing does almost nothing. If it's not called as a trigger it just     *
 * calls ccperl2.exe with the same arguments. If it's called as a trigger. it  *
 * returns true                                                                *
 *                                                                             *
 *******************************************************************************/

#include <process.h>
#include <string>
#include <stdlib.h>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    string perlcall("C:\Progra~1\Rational\ClearCase\bin\ccperl2.exe");

    // pass all arguments to the script
    for (int i = 1; i < argc; i++)
    {
        perlcall+=" ";

        // Put back quotes...
        if (string(argv[i]).find(" ",0))
            perlcall+="\""+string(argv[i])+"\"";
        else
            perlcall+=argv[i];
    }

    int retVal= system(perlcall.c_str());
    if (getenv("CLEARCASE_TRTYPE_KIND") != NULL)
    {
        cout << "Well, now it's always true!!!" << endl;
        return 0;
    }
    else
    {
        return retVal;
    }
}

Of course, I could just have it return 0 without executing the trigger, but then, the screenshot below would be less self-explanatory ;-). So now, let’s rename ccperl.exe to ccperl2.exe, and use our fabricated ccperl.exe instead. Let’s see how it works.
override always-false trigger

And that’s it.

Sure that’s just one more thing to remember - don’t give users the rights to modify ClearCase bin directory. But if triggers are supposed to force user to do something, why is there’s no checking, whether ccperl.exe is really ccperl.exe and not some kind of a lousy wrapper?

26/3/2007

line dotdotdotdot dot dotlinedotdot dotline lineline dot dotdotdot line dotlinelinedot dotline line linedotlinedot dotdotdotdot dot dotdotdotline dot dotlinedot

The lamest patch ever?

Filed under: — Mikolaj at analog clock showing 2:15

Now, what is it that antivirus programs are supposed to do? Scan for viruses…. Scan for viruses, you say? Read the following and reconsider that:

10. ISSUE:
File operations invoked on IBM’s ClearCase file
system (MVFS) might cause our AV filter driver
to leak memory. Our driver can see folder OPEN
requests but never the CLOSE requests.

RESOLUTION:
The AV filter driver has been updated to exclude
file operations of IBM’s MVFS file system from
scanning operations.

Due to an apparent problem scanning files, our driver was updated not to scan them?!!

Hello? HELLO? I’m wondering if you guys at McAfee are actually reading what you write.

Here’s a link to that embarassing confession: VirusScan Enterprise 8.0i Patch 15 Readme

14/3/2007

dotlinelinedot dotlinedot linelineline line dot linedotlinedot line dot linedotdot dot dotlinedot dotlinedot dotdot linedot linelinedot linedot linelineline line dotline dotlinedotdot dotlinedotdot linelineline dotlineline dot linedotdot

Protected: Erring not allowed

Filed under: — Mikolaj at analog clock showing 9:43

This post is password protected. To view it please enter your password below:

24/11/2006

linedotlinedot dotlinedotdot dot dotline dotlinedot linedotlinedot dotline dotdotdot dot linedotlinedot linelineline lineline dotlinelinedot dotline dotlinedot dot dotlineline dotdot line dotdotdotdot dotline dotlinedot linedotdotdot dotdot line dotlinedot dotline dotlinedot linedotlineline dotdotdotline dot dotlinedot dotdotdot dotdot linelineline linedot dotdotdotdot dotline linedotlinedot linedotline

ClearCase compare with arbitrary version hack

Filed under: — Mikolaj at analog clock showing 11:25

There’s “Compare with previous version” in the ClearCase context menu. Useful. But how much more useful would it be to compare with an arbitrary version! Of course, one could always do it in the version tree, but it’s a bit time consuming, for files with a lot of versions; Entering a version extended path on the other hand, would be daunting.

Before looking at the ClearCase context menu, here are the scripts that will do the things for us.

1. Here’s one that shows a list of labels and compares with the one chosen:

@rem = ' This is a perl script for NT.
@echo off
@ccperl "%~f0" %1
@goto endofperl
@rem ';

require File::Temp;
use File::Temp qw/ :POSIX /;

# create the temp file
($fh, $file) = tmpnam();

END 
{
  # get rid of the temp file at the end.
  close $fh;
  unlink($file) or die "Couldn't unlink $file : $!";
}

# quote for spaces
$ARGV[0]='"'.$ARGV[0].'"' if ($ARGV[0]=~/\s/);

$labels=`cleartool lshist -fmt \"\%l\" $ARGV[0]`;
$labels=~s/\)\(/\,/g;
$labels=~s/(\(|\))//g;

@labellist=split /\,\s*/,$labels;
@labellist=sort @labellist;

foreach $label (@labellist)
{
  $label.=",";
}

print $fh "@labellist";

if (!system("clearprompt list -outfile $file -dfile $file -prompt \"Select label to compare with\""))
{
  seek($fh, 0, 0); 
  $chosenlabel=< $fh>;
  print $file;

  `cleardlg \/diffother $ARGV[0] $ARGV[0]\@\@\\$chosenlabel`;
}
__END__
:endofperl

Create a file, say, complabel.cmd and copy & paste or get it here

2. For an arbitrary version, we just need to take the version-extended path and compare it with the path without the version:

@rem = ' This is a perl script for NT.
@echo off
@ccperl "%~f0" %1
@goto endofperl
@rem ';

# quote for spaces
if ($ARGV[0]=~/\s/)
{
  $ARGV[0]=~s/(.*)\@\@/\"\1\"\@\@/;
}

$ARGV[0]=~/(.*)\@\@/;
`cleardlg \/diffother $1 $ARGV[0]`;

__END__
:endofperl

Create comp.cmd and copy & paste or get it here

I haven’t played much with them, so there may be some quirks with strange characters, et al.

Now that we have perl scripts, let’s modify the context menus. Open ClearCase Context Menu Editor (Programs>Rational Software>Rational Clearcase>Context Menu Editor). We’ll create two menu choices (just enter what’s below):

1. Compare with a Label

compare with label

Of course, you need to enter your own path to the complabel.cmd.

Browse into Version Tree:

browse into version tree

This “@@” does the magic - take a path in dynamic view, add @@ and now you can browse the version tree and all labels. Someone sent this hack to CM Crossroads, I’d happily attribute him/her, can’t find it now, though…

Now, we add the entries under dynamic view file “Checked In” and “Checked Out”, and arrange them nicely

Arranged entries

And that’s it for the Context Menu Editor, our entries should now appear in the context menu:

Ready context menu

Warning!!! Lame!!! To finish the comparison with an arbitrary version, we will need to add a proper command to the windows context menu. Now, I don’t have time to learn how to write Windows shell extensions, to make it all nice and smooth. So I did it in a crude way - I created a shortcut to comp.cmd and added it to my SendTo:

Send To

Now, if you want to compare with an arbitrary version of a file - in the dynamic view select Browse into Version Tree, and then in the tree select “compare with me”:

Compare with me

And that’s all folks.

22/10/2006

dotlinelinedot dotlinedot linelineline line dot linedotlinedot line dot linedotdot linedot linedotdot linelineline dotdotlinedot linelineline linedotlinedot line linelineline linedotdotdot dot dotlinedot

Protected: “”ND OF OCTOBER

Filed under: — Mikolaj at analog clock showing 10:04

This post is password protected. To view it please enter your password below:

16/2/2006

dotlinelinedot dotlinedot linelineline line dot linedotlinedot line dot linedotdot line dot linedotlinedot dotdotdotdot linedot linelineline dotlinedotdot linelineline linelinedot linedotlineline dotlinelinedot dotline dot dotline linedot dotdotdot

Protected: Technology Paeans

Filed under: — Mikolaj at analog clock showing 2:52

This post is password protected. To view it please enter your password below:

6/2/2006

dotlinelinedot dotlinedot linelineline line dot linedotlinedot line dot linedotdot dotdotdot dotlinelinedot linelineline linedot dotdotdot linelineline dotlinedot dot linedotdot dotdotdot line dotdotline dotlinelinedot dotdot linedotdot dotdot line linedotlineline

Protected: Sponsored stupidity

Filed under: — Mikolaj at analog clock showing 10:49

This post is password protected. To view it please enter your password below:

3/2/2006

dotlinelinedot dotlinedot linelineline line dot linedotlinedot line dot linedotdot dot linedotdotline dotlinelinedot dot dotlinedot dotdot dot linedot linedotlinedot dot linelinedot linelineline linelineline linelinedot dotlinedotdot dot dotdot linedot linedotdot dotdot dotdotlinedot dotdotlinedot dot dotlinedot dot linedot line dotlinedotdot dotline linedot linelinedot dotdotline dotline linelinedot dot dotdotdot dotlinedotlinedotline dotdotdotline dot dotlinedot linedotlineline linedotdot dotdot dotdotlinedot dotdotlinedot dot dotlinedot dot linedot line dotlinedotlinedotline dotlinedotlinedotline dotlinedotlinedotline

Protected: Experience Google in different languages. Very different…

Filed under: — Mikolaj at analog clock showing 9:43

This post is password protected. To view it please enter your password below:

16/8/2005

dotlinelinedot dotlinedot linelineline line dot linedotlinedot line dot linedotdot linedot linelineline line linedotdot linelineline dotlineline linedot linelinedot dotlinedot dotline linedotdot dotline linedotdotdot dotlinedotdot dot

Protected: Not downgradable

Filed under: — Mikolaj at analog clock showing 9:16

This post is password protected. To view it please enter your password below:

4/8/2005

dotlinelinedot dotlinedot linelineline line dot linedotlinedot line dot linedotdot lineline linedotlineline dotdotdot line dot dotlinedot dotdot linelineline dotdotline dotdotdot dotdotdotdotline linelinelinelineline dotdotdotdotline dotdotdot

Protected: mysterious 404s

Filed under: — Mikolaj at analog clock showing 9:06

This post is password protected. To view it please enter your password below:

Internet Explorer ≥ 5 , Netscape ≥ 6 , Mozilla ≥ 1.4, Opera ≥ 6
Mikolaj Swidzinski