Friday, August 22, 2008

CodeStriker: Inappropriate IOCTL for device

I just had a troubleshooting session with a nifty code review tool called codestriker.

All of a sudden, we're getting an error of: "Inappropriate IOCTL for device" during creation of a new topic. This is maddening. I found lots of references to this, but nothing about what's going on to cause it. I can write to the directory, I can touch files there, everything seems to work, but no joy.

So, I tried putting in a modification to test the return values of the open statements in the code (/var/www/codestriker/codestriker-1.9.4/lib/Codestriker/Repository/Subversion.pm):


push @args, '--revision';
push @args, 'HEAD';
push @args, $self->{repository_url} . '/' . $url;

my $read_stdout_data;
my $read_stdout_fh = new FileHandle;
my $ret = open($read_stdout_fh, '>', \$read_stdout_data);
if (not $ret) { die("Died on open of file stderr",
$read_stdout_fh, ", msg: ", $!); }


my $read_stderr_data;
my $read_stderr_fh = new FileHandle;
my $ret = open($read_stderr_fh, '>', \$read_stderr_data);
if (not $ret) { die("Died on open of file stderr",
$read_stdout_fh, ", msg: ", $!); }


Codestriker::execute_command($read_stdout_fh, read_stderr_fh, $Codestriker::svn, @args);
$file_url = 1;
open($read_stderr_fh, '<', \$read_stderr_data); while(<$read_stderr_fh>) {
if (/^svn:.* refers to a directory/) {
$file_url = 0;
last;
}
}

Adding the 'if not ret...' lines after the opens fixed the problem. Note, I had to restart apache with /etc/init.d/httpd restart and tail /var/www/error_log to fix a minor syntax error first, but it worked out.
Post a Comment