[Git][cmucl/cmucl][issue-158-darwin-pathnames-utf8] 6 commits: Fix #162: Change *filename-encoding* to use :no-encoding

Raymond Toy (@rtoy) gitlab at common-lisp.net
Wed Feb 15 21:43:47 UTC 2023



Raymond Toy pushed to branch issue-158-darwin-pathnames-utf8 at cmucl / cmucl


Commits:
d01f2cf9 by Raymond Toy at 2023-01-18T08:00:32-08:00
Fix #162:  Change *filename-encoding* to use :no-encoding

Instead of using `NIL` to indicate that `*filename-encoding*` is not
to be done, use `:no-encoding` to indicate that.  This makes it a bit
clearer what `*filename-encoding*` means.

- - - - -
7c44d848 by Raymond Toy at 2023-01-19T15:30:06-08:00
Use :null instead of :no-encoding for no filename encoding

The advantage of using `:null` is that it's a recognized external
format (that aliases to `:void`).  So if we inadvertently use `:null`
as a filename encoding somewhere unexpected, it will cause an
error (because the `:void` encoding does).

- - - - -
ce202074 by Raymond Toy at 2023-02-10T08:29:32-08:00
Fix stupid typos

Really stupid typos/thinkos:
* Forgot to change initial value if `*filename-encoding*` from
  `:no-encoding` to `:null`.  (Stupid!)
* Fix typo: `:nul` instead of `:null` in `%name->file`.

Update cmucl-unix.pot too for the change in the docstring for
`*filename-encoding*`.

- - - - -
9eb801f6 by Raymond Toy at 2023-02-15T13:01:43-08:00
Disable issue.41.1 when running CI

This test was previously disabled only for Linux when running the CI.
However, it's now also failing when running the CI for Darwin.  Thus
disable it whenever we're running the CI.

I just manually tested this on my Linux and Mac boxes.  This test
passes without any problem.  Not sure what's going on.

- - - - -
4be1d90c by Raymond Toy at 2023-02-15T21:23:15+00:00
Merge branch 'issue-162-filename-encoding-no-encoding' into 'master'

Fix #162:  Change *filename-encoding* to use :null

Closes #162

See merge request cmucl/cmucl!111
- - - - -
aca1967b by Raymond Toy at 2023-02-15T13:43:20-08:00
Merge branch 'master' into issue-158-darwin-pathnames-utf8

- - - - -


5 changed files:

- src/code/extfmts.lisp
- src/code/lispinit.lisp
- src/code/unix.lisp
- src/i18n/locale/cmucl-unix.pot
- tests/issues.lisp


Changes:

=====================================
src/code/extfmts.lisp
=====================================
@@ -373,7 +373,7 @@
   ;; Set filename encoding to NIL to bypass any encoding; it's not
   ;; needed to open the aliases file.  NIL means the pathname string is passed as is where only the low 8 bits of the 
   (let ((*package* (find-package "KEYWORD"))
-	(unix::*filename-encoding* nil))
+	(unix::*filename-encoding* :null))
     (with-open-file (stm "ext-formats:aliases" :if-does-not-exist nil
 			 :external-format :iso8859-1)
       (when stm
@@ -493,7 +493,7 @@
 	     ;; encoding to NIL because we don't need any special
 	     ;; encoding to open the format files.
 	     (let* ((*print-readably* nil)
-		    (unix::*filename-encoding* nil)
+		    (unix::*filename-encoding* :null)
 		    (*package* (find-package "STREAM"))
 		    (lisp::*enable-package-locked-errors* nil)
 		    (s (open (format nil "ext-formats:~(~A~).lisp" name)
@@ -1157,7 +1157,7 @@ character and illegal outputs are replaced by a question mark.")
     (unless (find-external-format filenames)
       (error (intl:gettext "Can't find external-format ~S.") filenames))
     (setq filenames (ef-name (find-external-format filenames)))
-    (when (and unix::*filename-encoding*
+    (when (and (not (eq unix::*filename-encoding* :null))
 	       (not (eq unix::*filename-encoding* filenames)))
       (cerror (intl:gettext "Change it anyway.")
 	      (intl:gettext "The external-format for encoding filenames is already set.")))


=====================================
src/code/lispinit.lisp
=====================================
@@ -344,7 +344,7 @@
   #-gengc (setf unix::*interrupt-pending* nil)
   (setf *type-system-initialized* nil)
   (setf *break-on-signals* nil)
-  (setf unix::*filename-encoding* nil)
+  (setf unix::*filename-encoding* :null)
   (setf *enable-darwin-path-normalization* nil)
   #+gengc (setf conditions::*handler-clusters* nil)
   (setq intl::*default-domain* "cmucl")


=====================================
src/code/unix.lisp
=====================================
@@ -25,22 +25,22 @@
 ;; it must be set to :iso8859-1 (or left as NIL), making files with
 ;; non-Latin-1 characters "mojibake", but otherwise they'll be inaccessible.
 ;; Must be set to NIL initially to enable building Lisp!
-(defvar *filename-encoding* nil
+(defvar *filename-encoding* :null
   "The encoding to use for converting a namestring to a string that can
   be used by the operations system.  It must be a valid
-  external-format name or NIL.  NIL means the string is passed as is
-  to the operating system.  The operating system will get the low 8
-  bits of each UTF-16 code unit of the string.")
+  external-format name or :NULL.  :NULL means the string
+  is passed as is to the operating system.  The operating system will
+  get the low 8 bits of each UTF-16 code unit of the string.")
 
 (eval-when (:compile-toplevel :load-toplevel :execute)
   (defmacro %name->file (string)
-    `(if *filename-encoding*
-	 (string-encode ,string *filename-encoding*)
-	 ,string))
+    `(if (eql *filename-encoding* :null)
+	 ,string
+	 (string-encode ,string *filename-encoding*)))
   (defmacro %file->name (string)
-    `(if *filename-encoding*
-	 (string-decode ,string *filename-encoding*)
-	 ,string)))
+    `(if (eql *filename-encoding* :null)
+	 ,string
+	 (string-decode ,string *filename-encoding*))))
 
 
 ;;;; Common machine independent structures.


=====================================
src/i18n/locale/cmucl-unix.pot
=====================================
@@ -15,6 +15,15 @@ msgstr ""
 "Content-Type: text/plain; charset=UTF-8\n"
 "Content-Transfer-Encoding: 8bit\n"
 
+#: src/code/unix.lisp
+msgid ""
+"The encoding to use for converting a namestring to a string that can\n"
+"  be used by the operations system.  It must be a valid\n"
+"  external-format name or :NULL.  :NULL means the string\n"
+"  is passed as is to the operating system.  The operating system will\n"
+"  get the low 8 bits of each UTF-16 code unit of the string."
+msgstr ""
+
 #: src/code/unix.lisp
 msgid "Syscall ~A failed: ~A"
 msgstr ""


=====================================
tests/issues.lisp
=====================================
@@ -416,9 +416,12 @@
 ;; running a pipeline with linux, but otherwise enable it.  The
 ;; pipeline defines the envvar GITLAB_CI so check for that.
 ;;
+;; This also fails on Darwin CI now.  Let's just disable the test if
+;; running on CI.
+;;
 ;; It would be better if lisp-unit had a way of marking tests as known
 ;; failures, but it doesn't.
-#+#.(cl:if (cl:and (ext:featurep :linux) (unix:unix-getenv "GITLAB_CI")) '(or) '(and))
+#+#.(cl:if (cl:and (unix:unix-getenv "GITLAB_CI")) '(or) '(and))
 (define-test issue.41.1
     (:tag :issues)
   (issue-41-tester unix:sigstop))



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/34d66158f3f06e2f5cabc90cfe63eb0a6b8c9406...aca1967bf5435426046ee77761ae53399e385e06

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/34d66158f3f06e2f5cabc90cfe63eb0a6b8c9406...aca1967bf5435426046ee77761ae53399e385e06
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/20230215/2d5b68d3/attachment-0001.html>


More information about the cmucl-cvs mailing list