Commit Diff


commit - 2d4acaab999748e817fe139f43ea6956713b1388
commit + 2532a0877753c148bda7560ddeccb2918a6da84c
blob - 61d048c23d756b489814cacfbe69b7db66c86002
blob + f3a74c5b9584739a21dcc29ece278e52cfdd76aa
--- client.c
+++ client.c
@@ -1051,7 +1051,7 @@ twalk(struct np_msg_header *hdr, const uint8_t *data, 
 			return;
 		}
 
-		if (*wnam == '\0' || 
+		if (*wnam == '\0' ||
 		    strchr(wnam, '/') != NULL ||
 		    !strcmp(wnam, ".")) {
 			errno = EINVAL;
blob - 540db5d7a21ca5a23ec67093317dcfacdd2a3f7e
blob + 61e3c0a71cdb362e49a8cc3a79dc8979a6bb6080
--- regress/lisp/9p-test/client.lisp
+++ regress/lisp/9p-test/client.lisp
@@ -583,7 +583,9 @@
 
 (defun create-path (stream parent-fid path &key (file-permissions #o640))
   (let ((fs:*directory-sep-regexp* "\\/")
-        (path-elements             (fs:split-path-elements path))
+        (path-elements             (remove "/"
+                                           (fs:split-path-elements path)
+                                           :test #'string=))
         (last-is-dir-p             (cl-ppcre:scan "\\/$" path)))
     (labels ((%create-dirs (path-elements)
                (when path-elements
blob - f6253e8d717fdc51084b682250af55c9513bd69f
blob + 2567c304db2d3acb379913fbf9d262b23624b258
--- regress/lisp/9p-test/tests/kami-tests.lisp
+++ regress/lisp/9p-test/tests/kami-tests.lisp
@@ -222,3 +222,37 @@
       (stat-entry-type (example-stat "/")))
   (assert-eq   :file
       (stat-entry-type (example-stat *remote-test-path*))))
+
+(defun example-create-file (path &optional (root "/"))
+  (with-open-ssl-stream (stream
+                         socket
+                         *host*
+                         *port*
+                         *client-certificate*
+                         *certificate-key*)
+    (let* ((*messages-sent* ())
+           (root-fid        (mount stream root)))
+      (with-new-fid (fid)
+        (9p-create stream root-fid path)
+        (read-all-pending-message stream)
+        t))))
+
+(alexandria:define-constant +create-file+ "test-file-create" :test #'string=)
+
+(defun example-create-directory (path &optional (root "/"))
+  (with-open-ssl-stream (stream
+                         socket
+                         *host*
+                         *port*
+                         *client-certificate*
+                         *certificate-key*)
+    (let* ((*messages-sent* ())
+           (root-fid        (mount stream root)))
+      (create-directory stream root-fid path)
+      t)))
+
+(alexandria:define-constant +create-directory+ "test-dir-create" :test #'string=)
+
+(deftest test-create ((kami-suite) (test-open-path))
+  (assert-true (ignore-errors (example-create-file +create-file+)))
+  (assert-true (ignore-errors (example-create-directory +create-directory+))))