Re: Fix for: Re: Why is dump-scsh-program failing here?

Martin Gasbichler <[email protected]> Wed, 24 May 2006 15:14:19 +0200
Newsgroups gmane.lisp.scheme.scsh
Message-ID <[email protected]>
Eric Hanchrow <[email protected]> writes:

> I haven't been able to test this, since I wasn't able to rebuild scsh
> (not having scheme48 0.53), but Taylor Campbell suggests this fix:
>
> diff -bu /usr/local/src/langs/scheme/scsh-0.6.7/scsh/startup.scm\~ /usr/local/src/langs/scheme/scsh-0.6.7/scsh/startup.scm
> --- /usr/local/src/langs/scheme/scsh-0.6.7/scsh/startup.scm~	2006-04-05 00:54:00.000000000 -0700
> +++ /usr/local/src/langs/scheme/scsh-0.6.7/scsh/startup.scm	2006-05-19 12:43:06.000000000 -0700
> @@ -27,9 +27,12 @@
>      (newline (command-output))
>      ;JMG: it is set to #f in the vm, so I omit it now
>  ;;;(flush-the-symbol-table!)	;Gets restored at next use of string->symbol
> +    (with-resources-aligned
> +     (list cwd-resource)
> +     (lambda ()
>      (write-image filename
>  		 (scsh-stand-alone-resumer start)
> -		 "Scsh 0.6")
> +                    "Scsh 0.6")))
>      #t))

Unfortunately, this patch will leave a lock obtained in the dumped
image and will thus break all CWD related procedures after
resuming. Here is a better patch that still has its problems but will
at least fix your problem:

Index: startup.scm
===================================================================
RCS file: /cvsroot/scsh/scsh/scsh/startup.scm,v
retrieving revision 1.16.2.1
diff -u -c -r1.16.2.1 startup.scm
*** startup.scm	5 Apr 2006 08:06:16 -0000	1.16.2.1
--- startup.scm	24 May 2006 13:09:05 -0000
***************
*** 22,36 ****
  ;;; error handler. MAKE-SCSH-STARTER shadows it in the interactive case.
  
  (define (really-dump-scsh-program start filename)
!   (let ((filename (translate filename)))
      (display (string-append "Writing " filename) (command-output))
      (newline (command-output))
      ;JMG: it is set to #f in the vm, so I omit it now
  ;;;(flush-the-symbol-table!)	;Gets restored at next use of string->symbol
!     (write-image filename
! 		 (scsh-stand-alone-resumer start)
! 		 "Scsh 0.6")
!     #t))
  
  
  ;;; This one relies on the scsh top-level command-line switch parser
--- 22,39 ----
  ;;; error handler. MAKE-SCSH-STARTER shadows it in the interactive case.
  
  (define (really-dump-scsh-program start filename)
!   (let ((filename (absolute-file-name (translate filename))))
      (display (string-append "Writing " filename) (command-output))
      (newline (command-output))
      ;JMG: it is set to #f in the vm, so I omit it now
  ;;;(flush-the-symbol-table!)	;Gets restored at next use of string->symbol
! 
!     ;; we cannot align umask-resource, euid-resource, and egid-resource here
!     ;; as the corresponding locks would then be obtained in the dumped image
!      (write-image filename
!                   (scsh-stand-alone-resumer start)
!                   "Scsh 0.6")
!      #t))

BTW: You don't need Scheme 48 to incorporate this fix. A simple "make
install" after patching is sufficient.

-- 
Martin