[Orca-users] Web page logos corrupt under Linux

Blair Zajac blair at orcaware.com
Fri Jun 27 18:03:17 PDT 2003


"Charles R. Dennett" wrote:
> 
> Hi,
> 
> I had used Orca for several years at work so when I got my new home
> Linux system this spring, I installed it there and used the contributed
> procallator for the data collector.  The only thing that does not work
> are the logos for orca, RRDtool and The Rothschildimage.  Everything
> else is fine.  The logos are corrupt.  I copied the image files from my
> source area to the web area and that seemed to fix it...until orca
> updated the web pages.  The images were corrupt once more.
> 
> So, I took a look at the orca perl script to figure out what it was
> doing. The images are hex encoded and included at the very end of the
> orca perl script.  The script locates them and uses the perl pack
> routine to convert them back to the raw image format and puts them in
> the orca web page area.
> 
> If I right click on one of the logos and view the image in a separate
> browser window, it says the image contains errors.   I also checked my
> web server logs and the logo files are being fed to my browser just
> fine.  It's that they are corrupt and so the browser has no idea what to
> do with them.  I've tried this with Netscape 7, Mozilla 1.3 and IE5 and
> IE6 from a different machine.
> 
> I'm running RedHat 9 with perl 5.8.0, which is what came with RH9.
> 
> Any other Linux users seen this?  Anyone have any idea what's happening?

Hi Charlie,

Yes, it's a problem with Perl modifying the output when it's creating
the output PNG and GIF files.  I think it has to do with UTF8 and it
modifying the output.

The solution is to apply this patch to orca.pl.in which writes the file
in binmode.

Index: orca.pl.in
===================================================================
--- orca.pl.in     (revision 219)
+++ orca.pl.in     (revision 230)
@@ -277,7 +277,11 @@
     } elsif (/OPEN (.*)/) {
       $image_filename = "$config_global{html_dir}/$1";
       print "Creating $1.\n" if $opt_verbose;
-      unless (open(ORCA_WRITE, ">$image_filename")) {
+      if (open(ORCA_WRITE, ">$image_filename")) {
+        # Some of these generated files are images, so always open in
+        # binary mode.
+        binmode ORCA_WRITE;
+      } else {
         warn "$0: cannot open `$image_filename' for writing: $!\n";
         $image_filename = '';
       }


> You can see the Orca graphs at http://www.dennett.org/orca/procallator/
> and scroll to the bottom of any page to see the missing logos.

Do you mind me adding a link from orcaware.com to your site?

Best,
Blair

-- 
Blair Zajac <blair at orcaware.com>
Plots of your system's performance - http://www.orcaware.com/orca/



More information about the Orca-users mailing list