RSS/Atom feed Twitter
Site is read-only, email is disabled

Script-fu gimp 2.4.1 causes seg fault on linux but not on win

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

1 of 1 message available
Toggle history

Please log in to manage your subscriptions.

Script-fu gimp 2.4.1 causes seg fault on linux but not on win david 18 Nov 23:01
david
2007-11-18 23:01:59 UTC (about 17 years ago)

Script-fu gimp 2.4.1 causes seg fault on linux but not on win

Dear gimp-developers,

the following Script-fu written to test some of the new features of the TinyScheme version of Script-fu seems to work perfectly on Windows 2000 pro (Gimp 2.4.1) but fails on Ubuntu 7.10 standard amd64 and on Ubuntu 7.10 i386.
It runs for a variable time and fails on different directories/files sometimes up to 300,000 files into a run. I am happy to directly help you as much as I can and will furnish any data that you may need.

regards David Martin

;;; originated by Jim Blandy --- July 1998 ;;; modified by David M. W. Martin to work with Gimp 2.4 Script-fu 18/11/07
;;; works on win2000 32bit gimp 2.4.1 as far as I can see faultlessly ;;; causes segmentation fault on ubuntu 7.10 amd64 and i386 after variable
;;; numbers of files sometimes 250,000 into run at similar places, ;;; nothing strange about files it fails on, usually on changing to a new dir.
;;; /usr/lib/gimp/2.0/plug-ins/script-fu: fatal error: Segmentation fault
;;; gimp still runs but "Refresh Scripts" is missing and all Script-fu entries
;;; gimp must be restarted!

(define (test-for-each-file outputdevice dirname regex) (let* ((count 0) ;initialise count (seconds (car(gettimeofday)))) ;initialise time of day in seconds

(case outputdevice
((0) (gimp-message-set-handler ERROR-CONSOLE)) ((1) (gimp-message-set-handler CONSOLE)) ((2) (gimp-message-set-handler MESSAGE-BOX)))
(define (for-each-file perform-func-on root) (let visit ((root root));reset root (let ((should-recurse (perform-func-on root))) (if (and should-recurse (if (= (file-type root) FILE-TYPE-DIR)#t #f));dir?
(let ((dir (dir-open-stream root))) (let loop ()
(let ((entry (dir-read-entry dir))) (cond
((eof-object? entry) #f) ;if eof signal false and drop through
(( or (string=? entry ".") ;current directory or (string=? entry "..")) ;parent directory (loop));recurse loop (else(visit (string-append root DIR-SEPARATOR entry)) ;recurse visit
(loop)) ;recurse loop ) ;end cond
) ;end let dir-read-entry ) ;end let loop
) ;end let dir-open-stream
) ;end if a dir
) ;end let should-recurse
) ;end of let visit
) ;end of for-each-file function

(define (perform-func-on file) (set! count (+ count 1)) ;count files visited (if (re-match regex file) ;check regex (gimp-message (string-append "found "file " number "(number->string count)))
) ;end if
(gimp-message (string-append file " number "(number->string count))) ) ;end perform-func-on

(for-each-file perform-func-on dirname);main routine called from here (gimp-message (string-append "elapsed seconds " (number->string (- (car(gettimeofday)) seconds))" count " (number->string count))) ; print elapsed time and number of files
) ;end test-for-each-file let* ) ;end test-for-each-file

(script-fu-register "test-for-each-file"
_"_test-for-each-file..."
"Chose output media, select directory to recurse from, optional regular expression to be applied to each filename " "David(dot)Martin(at)sixtyfive(dot)plus(dot)com" "David Martin, 2007. Public Domain GPL." "18/11/07 "
""
SF-OPTION _"Message output device" '("ERROR-CONSOLE" "CONSOLE" "MESSAGE-BOX" )
SF-DIRNAME _"Directory" "/home/david/test_images" SF-STRING "File or Directory contains (regex)" ".jpg$" )
(script-fu-menu-register "test-for-each-file" "/Xtns/")