Cygwin Errors with Git SVN

When venturing out into Windows Land, I mostly use Cygwin as command line interface. Unfortunately the Win7 64 bit version has the habit of throwing rather cryptic errors from time to time:

[code lang=”bash”]
$ git svn rebase
0 [main] perl 5248 C:\cygwin\bin\perl.exe: *** fatal error
– cygheap base mismatch detected – 0x61242860/0xD72860.
[/code]

This, and what appears to be its slight variations, can usually be resolved by:

  1. Closing all Cygwin windows
  2. Running C:\cygwin\bin\ash.exe as Administrator
  3. Executing
    [code lang=”bash”]
    PATH=.
    rebaseall -v
    exit
    [/code]

Not overly pretty, but fixes the problem for a while.

I Will Do It By Hand One More Time

If you catch yourself saying this about a task for the third time, it is time to write a script for it. My contribution for today: when I want to process a large amount of photos my workflow usually starts with sorting through the contents of my SD cards and deleting the pictures with which I am not happy. If you are working on a rather dated computer as mine, having the corresponding RAW files in the same folder will cause you a headache with most picture viewers, especially when you try to flip through the files quickly. Moving them to a separate folder, however, will make you do the work twice. The following PurgeRaw script fixes this problem:

[code lang=”perl”]
#!/usr/bin/perl -w
use strict;

print “Searching for RAW files without matching JPG preview…\n”;

my @jpgs = glob(“*.jpg *.JPG”);
@jpgs or die “There are no preview JPGs in this directory.”;

my @raws = glob(“NEF/*.NEF RAW/*.NEF”);
@raws or die “There are no RAWs we could purge.”;

foreach (@jpgs) {
$_ =~ s/\..*//;
}

my @toDelete;
my $raw;
foreach (@raws) {
$raw = $_;
$_ =~ s/\..*//;
$_ =~ s/^.*\///;
if(!($_ ~~ @jpgs)){
push(@toDelete, $raw);
}
}

if(@toDelete){
print “Looks like we should delte the following RAW files:\n”;
foreach(@toDelete){print $_ . “\n”;}

print “Proceed with deleting? (Y/N): “;
my $answer = ;
chomp($answer);

if($answer eq “Y”){
print “Deleting…”;
foreach my $file ( @toDelete ) {
unlink $file or warn “Could not delete $file: $!”;
}
}
elsif($answer eq “N”){
print “Aborting without deleting anything.”;
}
else{
print “Wrong input – aborting without deleting anything.”;
}
}
else{
print “Did not find any RAW files eligible to be deleted.”
}
[/code]

This is obviously far from being anything sophisticated, but it does the job. If needed, you can grab the code from my github repository, that is also where I will add the next scripts when I catch myself counting to three again.