" /> Status for Andrew DeFaria: November 20, 2005 - November 26, 2005 Archives

« November 13, 2005 - November 19, 2005 | Main | November 27, 2005 - December 3, 2005 »

November 23, 2005

Forking in PerlTk

  • Continued to help several users with connecting to the new Controller Clearquest Database for Vinh's users
  • Added Version Tree button to the bin_merge prompt dialog box.
  • Resolved problem with forking from PerlTk

Forking in PerlTk

The issue here is that calling fork(2) in general on Windows just doesn't work well. Clearcase's Perl is based on ActiveState Perl and ActiveState Perl is not the best implementation of Perl. Cygwin's Perl is by far a much better implementation but Cygwin's Perl works from a true Posix environment which is specifically what Cygwin is all about. However Cygwin's Perl does not support PerlTk (I posted on Cygwin's mailing list about this - it would be great if Cygwin would finally support PerlTk) and Cygwin would need to be present on all Windows systems.

In general, while fork(2) does work under ActiveState is does not work if you have Tk objects created. Chris had suggested to use "start <program>" which is fine - for Windows - but would fail in Unix. I like to wrote my code such that it works on both Windows and Unix. So I tried in vain to get fork to work. However, ActiveState's fork(2) call is horribly broken so I had to code around it like this:

sub VersionTree {
  my $file = shift;

  my $cmd =  "cleartool lsvtree -graphical $file";

  if ($^O =~ /mswin|cygwin/i) {
    system "start /b $cmd";
  } else {
    my $pid = fork;

    return if $pid;

    system $cmd;
    exit;
  } # if
} # VersionTree

November 21, 2005

Remaining PQA Issues/GNATS stripmime

  • Worked with Vinh's group and adjusting to life with the new Controller CQ Database. Wrote instructions for how to unsubscribe to some Broadcom email distribution lists
  • Documented how to install the new Clearquest Client Software
  • Coded stripmime filter for GNATS.

Stripmime

The script described above basically takes as input an email message. It then extracts the header portion and the body portion. It uses some CPAN modules (MIME::Base64 and MIME::Tools as well as MIME::Parser) to analyze the message and obtain the message "parts". Some transformations are performed on the header information and then it is written to stdout. For the plaintext part (if present) it will again write out the message to stdout Other, non-textual parts (AKA attachments) are written to a subdirectory based on the message name/number and a note is included to stdout indicating were to find the attachment.

The stripemime script placed in /tools/gnats/4.0/bin does the same thing except that attachments are disregarded and no mention of them are written to stdout. However there is an implicit assumption above that there does exist at least one plaintext version of the mail message. This need not be the case. I know, for example, when using Thunderbird I have the option of sending email as HTML, plain text or both. I tend to send both, which are epresented in the raw email as MIME multipart with the first part being a plaintext version of the HTML, which is sent as the second multipart as HTML. However, if I were to select HTML Only I would not get the plaintext part. Stripemime, as currently coded would generate a blank email message.

Also, on gnats-irva-3, could my shell be set to bash? I've tried to set it but I get permission denied. Also, I don't appear to have a home directory set to /home/adefaria for the gadefaria user?

Finally, MIME::Parser is not installed on gnats-irva-3:

gnats4@gnats-irva-3[+1035] bin/stripmime
Can't locate MIME/Parser.pm in @INC (@INC contains:
/tools/perl/5.004_04/SunOS/lib/sun4-solaris/5.00404
/tools/perl/5.004_04/SunOS/lib
/tools/perl/5.004_04/SunOS/lib/site_perl/sun4-solaris
/tools/perl/5.004_04/SunOS/lib/site_perl .) at bin/stripmime line 47.
BEGIN failed--compilation aborted at bin/stripmime line 47.

I had managed to install MIME::Parser on my Cygwin system using "perl -MCPAN -e 'install MIME::Parser'"