Commit 7d3f17c3c403b8396db8a84d299767965c603820

Thomas de Grivel 2024-07-11T17:52:33

fix warnings

diff --git a/core/defs.lisp b/core/defs.lisp
index 5ae026f..f6f5003 100644
--- a/core/defs.lisp
+++ b/core/defs.lisp
@@ -53,8 +53,6 @@
           :initform nil
           :reader operations-before)))
 
-(declaim (ftype (function (operation) (values function &optional))
-                operation-generic-function))
 (defgeneric operation-generic-function (op))
 
 ;;  Resource metaclass
@@ -121,9 +119,6 @@
 		      :accessor probed-properties))
   (:metaclass resource-class))
 
-(declaim (ftype (function (resource) (values string &optional))
-                resource-id))
-
 (defgeneric resource-additional-specs (resource os))
 (defgeneric resource-probes-properties (resource))
 (defgeneric resource-operations-properties (resource))
@@ -213,6 +208,16 @@
 
 (defvar *host*)
 
+;;  User
+
+(define-resource-class user (resource-container)
+  ()
+  ((probe-user :properties (:ensure :login :uid :gid :realname
+                                    :home :shell))
+   (probe-user-groups :properties (:groups)))
+  ((op-update-user :properties (:ensure :uid :gid :realname :home :shell
+                                :login-class :groups))))
+
 ;;  Probing resources
 
 (defgeneric find-probe (resource property os))
diff --git a/core/resource.lisp b/core/resource.lisp
index 66b2a8b..1fd4dbf 100644
--- a/core/resource.lisp
+++ b/core/resource.lisp
@@ -37,6 +37,7 @@
 	    (/ (length (probed-properties r)) 2))))
 
 (defun make-resource (type id &rest initargs &key &allow-other-keys)
+  (declare (type string id))
   (apply #'make-instance type :id id initargs))
 
 (defun resource-type (resource)
diff --git a/core/spec.lisp b/core/spec.lisp
index c676578..b3f3875 100644
--- a/core/spec.lisp
+++ b/core/spec.lisp
@@ -78,6 +78,7 @@
     (nreverse r)))
 
 (defun resource (type id &rest spec)
+  (declare (type string id))
   (let ((res (or #1=(get-resource type id)
                  (setf #1# (make-resource type id)))))
     (when spec
diff --git a/unix/defs.lisp b/unix/defs.lisp
index 9c79035..7a3f52a 100644
--- a/unix/defs.lisp
+++ b/unix/defs.lisp
@@ -24,14 +24,6 @@
 
 ;;  User
 
-(define-resource-class user (resource-container)
-  ()
-  ((probe-user :properties (:ensure :login :uid :gid :realname
-                                    :home :shell))
-   (probe-user-groups :properties (:groups)))
-  ((op-update-user :properties (:ensure :uid :gid :realname :home :shell
-                                :login-class :groups))))
-
 (defgeneric probe-user-in-/etc/passwd (resource os))
 (defgeneric probe-user-groups-in-/etc/group (resource os))
 (defgeneric op-update-user (resource os &key ensure uid gid realname home shell
diff --git a/unix/operations.lisp b/unix/operations.lisp
index ea27c20..b7a85cd 100644
--- a/unix/operations.lisp
+++ b/unix/operations.lisp
@@ -125,7 +125,8 @@
         (g (if group
                (resource-id group)
                gid)))
-    (declare (type string u g))
+    (declare (type string u)
+             (type (or null string) g))
     (run "chown "
          (sh-quote u)
          (when g `(":" ,(sh-quote g)))