Re: [SLUG] Trying to get FuzzyOcr going...
On 12/11/06, Howard Lowndes [EMAIL PROTECTED] wrote: OK, I have put some debugging into the Perl script and I have isolated the problem down to this piece of code (including my debug code): flock( PIPE_IN, LOCK_EX ); my $lannet_err = $?; print PIPE_IN $input; my $lannet_err = $lannet_err.,.$?; flock( PIPE_IN, LOCK_UN ); my $lannet_err = $lannet_err.,.$?; close(PIPE_IN); my $lannet_err = $lannet_err.,.$?; if ($? and not $ignerror) { unless($silent) { handle_error( $err_msges[1], ( $lannet_err.$pipecmd, $? 8, $!, $tmpfile ) ); } unlink($tmpfile); unlink($errfile); return ( $?, [EMAIL PROTECTED], [EMAIL PROTECTED] ); } Now, in order, the $? variable returns: 32512,32512,32512,256 So, can anyone have a go at interpreting what these error code mean in They don't mean anything - both because you probably want to look at $! (mnemonic: What went Bang?) and even then it won't mean anything as long as you don't check flock's return value - quoting the first two sentences in flock's documentation: Calls flock(2), or an emulation of it, on FILEHANDLE. Returns true for success, false on failure. http://perldoc.perl.org/functions/flock.html and $!'s value isn't guaranteed to be anything as long as the system call returned without an error (hence the requirement to check the return value before looking at $!). this context; they appear very odd to me. Also, what does $? 8 do The exit value of a child process is shifted 8 bits to the left to leave space for the signal which killed the child process (if any). Lookup $? (and $!) in http://perldoc.perl.org/perlvar.html in the second array element, is it an 8 bitwise shift of 256, because it's output value is sprintf'd as 1? It means that the chuld process' exit value is 1, probably due to some error. This sits well with that 256 in your comma-separated list of numbers. --P -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Trying to get FuzzyOcr going...
Howard Lowndes wrote: OK, I have put some debugging into the Perl script and I have isolated the problem down to this piece of code (including my debug code): For what it's worth, your debug code is better written as: my $lannet_err = $?; $lannet_err .= ,$?; # repeat this line as needed flock( PIPE_IN, LOCK_EX ); You'd improve the code quality a fair bit by changing the above line to: flock( PIPE_IN, LOCK_EX) or die Failed to get lock: $!; This would then tell you if your lock failed in some awful way, which it shouldn't... my $lannet_err = $?; print PIPE_IN $input; my $lannet_err = $lannet_err.,.$?; flock( PIPE_IN, LOCK_UN ); Since closing a file unlocks it for you, the above line isn't necessary and in fact is generally considered a mistake. my $lannet_err = $lannet_err.,.$?; close(PIPE_IN); This is the first time that $? is going to be meaningful. Closing the piped process ends the process and then the return status (including return code) is packed into $?. Looking at your results below this suggests that the process is returning 1 (rather than 0 which would signal success). What the 1 means depends on the process you're calling. Also, what does $? 8 do in the second array element, is it an 8 bitwise shift of 256, because it's output value is sprintf'd as 1? That's correct. I was tempted to try fuzzyocr myself, but it failed our internal code review. :( If I have too much time on my hands anytime soon, I may send the original author a re-write. J -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Trying to get FuzzyOcr going...
On 11/10/06, Howard Lowndes [EMAIL PROTECTED] wrote: ...I am getting the following log messages: [2006-11-10 16:05:29] Debug mode: Starting FuzzyOcr... [2006-11-10 16:05:29] Debug mode: Attempting to load personal wordlist... [2006-11-10 16:05:29] Debug mode: No personal wordlist found, skipping... [2006-11-10 16:05:29] Debug mode: Analyzing file with content-type image/gif [2006-11-10 16:05:29] Debug mode: Image is single non-interlaced... [2006-11-10 16:05:29] Unexpected error in pipe to external programs. Please check that all helper programs are installed and in the correct path. (Pipe Command /usr/bin/giftopnm -, Pipe exit code 1 (), Temporary file: /tmp/.spamassassin15619xdABuytmp) which are all well and good, except that giftopnm is where it should be: # whereis giftopnm giftopnm: /usr/bin/giftopnm /usr/share/man/man1/giftopnm.1.gz It doesn't look like the command its calling is the problem, it looks as though the switch being used or the way its calling it is the problem. ie. Pipe Command /usr/bin/giftopnm - Notice the - symbol, look around to see if you can remove the offending switch being - -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Trying to get FuzzyOcr going...
On 11/10/06, Howard Lowndes [EMAIL PROTECTED] wrote: That's what is in the config file for FuzzyOcr. I think the image is piped into giftopnm and the - means that the input is on STDIN Maybe so in that case... permissions on the binary in question check out, and ownership to process attempting to kick it off. -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Trying to get FuzzyOcr going...
On Fri, Nov 10, 2006 at 04:12:45PM +1100, Howard Lowndes wrote: ...I am getting the following log messages: [2006-11-10 16:05:29] Debug mode: Starting FuzzyOcr... [2006-11-10 16:05:29] Debug mode: Attempting to load personal wordlist... [2006-11-10 16:05:29] Debug mode: No personal wordlist found, skipping... [2006-11-10 16:05:29] Debug mode: Analyzing file with content-type image/gif [2006-11-10 16:05:29] Debug mode: Image is single non-interlaced... [2006-11-10 16:05:29] Unexpected error in pipe to external programs. Please check that all helper programs are installed and in the correct path. (Pipe Command /usr/bin/giftopnm -, Pipe exit code 1 (), Temporary file: /tmp/.spamassassin15619xdABuytmp) which are all well and good, except that giftopnm is where it should be: # whereis giftopnm giftopnm: /usr/bin/giftopnm /usr/share/man/man1/giftopnm.1.gz Any ideas? Fedora 5 This thread describes a similar issue, but for FC4. http://mail-archives.apache.org/mod_mbox/spamassassin-users/200608.mbox/[EMAIL PROTECTED] Perhaps ensure giflib is installed (libungif replacement/rename) Matt -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
Re: [SLUG] Trying to get FuzzyOcr going...
On Fri, Nov 10, 2006 at 04:47:53PM +1100, Howard Lowndes wrote: root all round and executable But check for selinux denies, assuming you're running selinux. tail -100 /var/log/audit/auditlog | audit2allow -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html