[Git][cmucl/cmucl][rtoy-fix-49-clm-crash] Make sure spawn is called with a string

Raymond Toy rtoy at common-lisp.net
Sun Jan 28 02:20:17 UTC 2018


Raymond Toy pushed to branch rtoy-fix-49-clm-crash at cmucl / cmucl


Commits:
87c07e5d by Raymond Toy at 2018-01-27T18:19:56-08:00
Make sure spawn is called with a string

The previous commit worked for search lists, but the program could be
a string.  Take care to convert pathnames to strings so that spawn is
always called with a string.

- - - - -


1 changed file:

- src/code/run-program.lisp


Changes:

=====================================
src/code/run-program.lisp
=====================================
--- a/src/code/run-program.lisp
+++ b/src/code/run-program.lisp
@@ -522,8 +522,18 @@
   ;; Make sure all the args are okay.
   (unless (every #'simple-string-p args)
     (error (intl:gettext "All args to program must be simple strings -- ~S.") args))
+
+  ;; Make sure program is a string that we can use with spawn.
+  (setf program
+	(if (pathnamep program)
+	    (lisp::with-pathname (p program)
+	      (or (unix::unix-namestring p)
+		  (namestring p)))
+	    (namestring program)))
+  (check-type program string)
+
   ;; Prepend the program to the argument list.
-  (push (namestring program) args)
+  (push program args)
   ;; Clear random specials used by GET-DESCRIPTOR-FOR to communicate cleanup
   ;; info.  Also, establish proc at this level so we can return it.
   (let (*close-on-error* *close-in-parent* *handlers-installed* proc)
@@ -566,10 +576,10 @@
 					     (cdr entry)))
 					env))
 			(let ((child-pid
-			       (without-gcing
-				(spawn (unix::unix-namestring program)
-				       argv envp pty-name
-				       stdin stdout stderr))))
+				(without-gcing
+				    (spawn program
+					   argv envp pty-name
+					   stdin stdout stderr))))
 			  (when (< child-pid 0)
 			    (error (intl:gettext "Could not fork child process: ~A")
 				   (unix:get-unix-error-msg)))



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/commit/87c07e5d7b5c882422bf3089d71284635731eb5a

---
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/commit/87c07e5d7b5c882422bf3089d71284635731eb5a
You're receiving this email because of your account on gitlab.common-lisp.net.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20180128/11ea82b8/attachment-0001.html>


More information about the cmucl-cvs mailing list