Raymond Toy pushed to branch issue-139-add-alias-local-external-format at cmucl / cmucl
Commits:
4a7207b6 by Raymond Toy at 2022-10-17T18:58:45+00:00
Fix #130: Implement file_author in C
- - - - -
ba5c5d2a by Raymond Toy at 2022-10-17T18:58:45+00:00
Merge branch 'issue-130-file-author-in-c' into 'master'
Fix #130: Implement file_author in C
Closes #130
See merge request cmucl/cmucl!88
- - - - -
e8a0cc6c by Raymond Toy at 2022-10-30T15:03:27+00:00
Fix #147: Add method for stream-line-column
- - - - -
0dad5a1a by Raymond Toy at 2022-10-30T15:03:28+00:00
Merge branch 'issue-147-stream-line-column-impl' into 'master'
Fix #147: Add method for stream-line-column
Closes #147
See merge request cmucl/cmucl!104
- - - - -
1300830b by Raymond Toy at 2022-10-31T17:12:48+00:00
Address #139: *default-external-format* is :utf-8
- - - - -
649a4f1e by Raymond Toy at 2022-10-31T17:12:49+00:00
Merge branch 'issue-139-default-external-format-utf8' into 'master'
Address #139: *default-external-format* is :utf-8
See merge request cmucl/cmucl!103
- - - - -
69f2a990 by Raymond Toy at 2022-10-31T10:14:48-07:00
Merge branch 'master' into issue-139-add-alias-local-external-format
- - - - -
9 changed files:
- src/code/extfmts.lisp
- src/code/filesys.lisp
- src/general-info/release-21e.md
- src/lisp/os-common.c
- src/pcl/gray-streams.lisp
- + tests/.gitignore
- tests/issues.lisp
- + tests/utf8.txt
- + tests/안녕하십니까.txt
Changes:
=====================================
src/code/extfmts.lisp
=====================================
@@ -22,7 +22,7 @@
describe-external-format))
(defvar *default-external-format*
- :iso8859-1
+ :utf-8
"The default external format to use if no other external format is
specified")
=====================================
src/code/filesys.lisp
=====================================
@@ -1079,13 +1079,21 @@ optionally keeping some of the most recent old versions."
:pathname file
:format-control (intl:gettext "~S doesn't exist.")
:format-arguments (list file)))
- (multiple-value-bind (winp dev ino mode nlink uid)
- (unix:unix-stat name)
- (declare (ignore dev ino mode nlink))
- (when winp
- (let ((user-info (unix:unix-getpwuid uid)))
- (when user-info
- (unix:user-info-name user-info))))))))
+ ;; unix-namestring converts "." to "". Convert it back to
+ ;; "." so we can stat the current directory. (Perhaps
+ ;; that's a bug in unix-namestring?)
+ (when (zerop (length name))
+ (setf name "."))
+ (let (author)
+ (unwind-protect
+ (progn
+ (setf author (alien:alien-funcall
+ (alien:extern-alien "os_file_author"
+ (function (alien:* c-call:c-string) c-call:c-string))
+ (unix::%name->file name)))
+ (unless (alien:null-alien author)
+ (alien:cast author c-call:c-string)))
+ (alien:free-alien author))))))
;;;; DIRECTORY.
=====================================
src/general-info/release-21e.md
=====================================
@@ -22,6 +22,7 @@ public domain.
* Feature enhancements
* Changes
* Update to ASDF 3.3.6
+ * The default external format is `:utf-8` instead of `:iso8859-1`
* ANSI compliance fixes:
* Bug fixes:
* ~~#97~~ Fixes stepping through the source forms in the debugger. This has been broken for quite some time, but it works now.
@@ -56,6 +57,7 @@ public domain.
* ~~#132~~ Ansi test `RENAME-FILE.1` no fails
* ~~#134~~ Handle the case of `(expt complex complex-rational)`
* ~~#136~~ `ensure-directories-exist` should return the given pathspec
+ * #139 `*default-external-format*` defaults to `:utf-8`
* ~~#142~~ `(random 0)` signals incorrect error
* Other changes:
* Improvements to the PCL implementation of CLOS:
=====================================
src/lisp/os-common.c
=====================================
@@ -5,12 +5,16 @@
*/
+#include <assert.h>
#include <errno.h>
#include <math.h>
#include <netdb.h>
+#include <pwd.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
+#include <unistd.h>
#include <time.h>
#include "os.h"
@@ -715,3 +719,57 @@ os_lstat(const char* path, u_int64_t *dev, u_int64_t *ino, unsigned int *mode, u
return rc;
}
+
+/*
+ * Interface for file-author. Given a pathname, returns a new string
+ * holding the author of the file or NULL if some error occurred. The
+ * caller is responsible for freeing the memory used by the string.
+ */
+char *
+os_file_author(const char *path)
+{
+ struct stat sb;
+ char initial[1024];
+ char *buffer, *obuffer;
+ size_t size;
+ struct passwd pwd;
+ struct passwd *ppwd;
+ char *result;
+
+ if (stat(path, &sb) != 0) {
+ return NULL;
+ }
+
+ result = NULL;
+ buffer = initial;
+ obuffer = NULL;
+ size = sizeof(initial) / sizeof(initial[0]);
+
+ /*
+ * Keep trying with larger buffers until a maximum is reached. We
+ * assume (1 << 20) is large enough for any OS.
+ */
+ while (size <= (1 << 20)) {
+ switch (getpwuid_r(sb.st_uid, &pwd, buffer, size, &ppwd)) {
+ case 0:
+ /* Success, though we might not have a matching entry */
+ result = (ppwd == NULL) ? NULL : strdup(pwd.pw_name);
+ goto exit;
+ case ERANGE:
+ /* Buffer is too small, double its size and try again */
+ size *= 2;
+ obuffer = (buffer == initial) ? NULL : buffer;
+ if ((buffer = realloc(obuffer, size)) == NULL) {
+ goto exit;
+ }
+ continue;
+ default:
+ /* All other errors */
+ goto exit;
+ }
+ }
+exit:
+ free(obuffer);
+
+ return result;
+}
=====================================
src/pcl/gray-streams.lisp
=====================================
@@ -235,6 +235,9 @@
defined for this function, although it is permissible for it to
always return NIL."))
+(defmethod stream-line-column ((stream fundamental-character-output-stream))
+ nil)
+
;;; Stream-line-length is a CMUCL extension to Gray streams.
(defgeneric stream-line-length (stream)
(:documentation _N"Return the stream line length or Nil."))
=====================================
tests/.gitignore
=====================================
@@ -0,0 +1 @@
+/out-utf8.txt
=====================================
tests/issues.lisp
=====================================
@@ -5,6 +5,12 @@
(in-package "ISSUES-TESTS")
+(defparameter *test-path*
+ (merge-pathnames (make-pathname :name :unspecific :type :unspecific
+ :version :unspecific)
+ *load-truename*)
+ "Path to where this file is.")
+
(defun square (x)
(expt x 2))
@@ -670,3 +676,72 @@
(err (relerr value answer)))
(assert-true (<= err eps) base err eps)))))))
+(define-test issue.130
+ (:tag :issues)
+ ;; Just verify that file-author works. In particular "." should
+ ;; work and not return NIL.
+ (assert-true (file-author "."))
+ (assert-true (file-author "bin/build.sh"))
+ (let ((unix::*filename-encoding* :utf-8))
+ ;; Set filename encoding to utf-8 so that we can encode the
+ ;; filename properly.
+ (assert-true
+ (file-author
+ (merge-pathnames
+ (concatenate 'string
+ ;; Write the test file name this way so
+ ;; that it's independent of the encoding
+ ;; used to load this file. The name is
+ ;; "안녕하십니까".
+ '(#\Hangul_Syllable_An #\Hangul_Syllable_Nyeong #\Hangul_Syllable_Ha
+ #\Hangul_Syllable_Sib #\Hangul_Syllable_Ni #\Hangul_Syllable_Gga)
+ ".txt")
+ *test-path*)))))
+
+(define-test issue.139-default-external-format
+ (:tag :issues)
+ (assert-eq :utf-8 stream:*default-external-format*))
+
+(define-test issue.139-default-external-format-read-file
+ (:tag :issues)
+ (let ((string (concatenate 'string
+ ;; This is "hello" in Korean
+ '(#\Hangul_syllable_an
+ #\Hangul_Syllable_Nyeong
+ #\Hangul_Syllable_Ha
+ #\Hangul_Syllable_Se
+ #\Hangul_Syllable_Yo))))
+ ;; Test that opening a file for reading uses the the default :utf8
+ ;; encoding.
+ (with-open-file (s (merge-pathnames "utf8.txt"
+ *test-path*)
+ :direction :input)
+ ;; The first line should be "hello" in Hangul.
+ (assert-equal (map 'list #'char-name string)
+ (map 'list #'char-name (read-line s))))))
+
+(define-test issue.139-default-external-format-write-file
+ (:tag :issues)
+ ;; Test that opening a file for writing uses the default :utf8.
+ ;; First write something out to the file. Then read it back in
+ ;; using an explicit format of utf8 and verifying that we got the
+ ;; right contents.
+ (let ((string (concatenate 'string
+ ;; This is "hello" in Korean
+ '(#\Hangul_syllable_an
+ #\Hangul_Syllable_Nyeong
+ #\Hangul_Syllable_Ha
+ #\Hangul_Syllable_Se
+ #\Hangul_Syllable_Yo))))
+ (with-open-file (s (merge-pathnames "out-utf8.txt"
+ *test-path*)
+ :direction :output
+ :if-exists :supersede)
+ (write-line string s))
+ (with-open-file (s (merge-pathnames "out-utf8.txt"
+ *test-path*)
+ :direction :input
+ :external-format :utf-8)
+ (assert-equal (map 'list #'char-name string)
+ (map 'list #'char-name (read-line s))))))
+
=====================================
tests/utf8.txt
=====================================
@@ -0,0 +1,2 @@
+안녕하세요
+UTF8 test. The above line is "Hello" in Hangul.
=====================================
tests/안녕하십니까.txt
=====================================
@@ -0,0 +1,3 @@
+The file name of this file is "안녕하십니까.txt" ("Hello" in Korean.)
+
+
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/b627c1e36a02140adc6264…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/b627c1e36a02140adc6264…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
1300830b by Raymond Toy at 2022-10-31T17:12:48+00:00
Address #139: *default-external-format* is :utf-8
- - - - -
649a4f1e by Raymond Toy at 2022-10-31T17:12:49+00:00
Merge branch 'issue-139-default-external-format-utf8' into 'master'
Address #139: *default-external-format* is :utf-8
See merge request cmucl/cmucl!103
- - - - -
5 changed files:
- src/code/extfmts.lisp
- src/general-info/release-21e.md
- + tests/.gitignore
- tests/issues.lisp
- + tests/utf8.txt
Changes:
=====================================
src/code/extfmts.lisp
=====================================
@@ -22,7 +22,7 @@
describe-external-format))
(defvar *default-external-format*
- :iso8859-1
+ :utf-8
"The default external format to use if no other external format is
specified")
=====================================
src/general-info/release-21e.md
=====================================
@@ -22,6 +22,7 @@ public domain.
* Feature enhancements
* Changes
* Update to ASDF 3.3.6
+ * The default external format is `:utf-8` instead of `:iso8859-1`
* ANSI compliance fixes:
* Bug fixes:
* ~~#97~~ Fixes stepping through the source forms in the debugger. This has been broken for quite some time, but it works now.
@@ -56,6 +57,7 @@ public domain.
* ~~#132~~ Ansi test `RENAME-FILE.1` no fails
* ~~#134~~ Handle the case of `(expt complex complex-rational)`
* ~~#136~~ `ensure-directories-exist` should return the given pathspec
+ * #139 `*default-external-format*` defaults to `:utf-8`
* ~~#142~~ `(random 0)` signals incorrect error
* Other changes:
* Improvements to the PCL implementation of CLOS:
=====================================
tests/.gitignore
=====================================
@@ -0,0 +1 @@
+/out-utf8.txt
=====================================
tests/issues.lisp
=====================================
@@ -5,6 +5,12 @@
(in-package "ISSUES-TESTS")
+(defparameter *test-path*
+ (merge-pathnames (make-pathname :name :unspecific :type :unspecific
+ :version :unspecific)
+ *load-truename*)
+ "Path to where this file is.")
+
(defun square (x)
(expt x 2))
@@ -676,4 +682,66 @@
;; work and not return NIL.
(assert-true (file-author "."))
(assert-true (file-author "bin/build.sh"))
- (assert-true (file-author "tests/안녕하십니까.txt")))
+ (let ((unix::*filename-encoding* :utf-8))
+ ;; Set filename encoding to utf-8 so that we can encode the
+ ;; filename properly.
+ (assert-true
+ (file-author
+ (merge-pathnames
+ (concatenate 'string
+ ;; Write the test file name this way so
+ ;; that it's independent of the encoding
+ ;; used to load this file. The name is
+ ;; "안녕하십니까".
+ '(#\Hangul_Syllable_An #\Hangul_Syllable_Nyeong #\Hangul_Syllable_Ha
+ #\Hangul_Syllable_Sib #\Hangul_Syllable_Ni #\Hangul_Syllable_Gga)
+ ".txt")
+ *test-path*)))))
+
+(define-test issue.139-default-external-format
+ (:tag :issues)
+ (assert-eq :utf-8 stream:*default-external-format*))
+
+(define-test issue.139-default-external-format-read-file
+ (:tag :issues)
+ (let ((string (concatenate 'string
+ ;; This is "hello" in Korean
+ '(#\Hangul_syllable_an
+ #\Hangul_Syllable_Nyeong
+ #\Hangul_Syllable_Ha
+ #\Hangul_Syllable_Se
+ #\Hangul_Syllable_Yo))))
+ ;; Test that opening a file for reading uses the the default :utf8
+ ;; encoding.
+ (with-open-file (s (merge-pathnames "utf8.txt"
+ *test-path*)
+ :direction :input)
+ ;; The first line should be "hello" in Hangul.
+ (assert-equal (map 'list #'char-name string)
+ (map 'list #'char-name (read-line s))))))
+
+(define-test issue.139-default-external-format-write-file
+ (:tag :issues)
+ ;; Test that opening a file for writing uses the default :utf8.
+ ;; First write something out to the file. Then read it back in
+ ;; using an explicit format of utf8 and verifying that we got the
+ ;; right contents.
+ (let ((string (concatenate 'string
+ ;; This is "hello" in Korean
+ '(#\Hangul_syllable_an
+ #\Hangul_Syllable_Nyeong
+ #\Hangul_Syllable_Ha
+ #\Hangul_Syllable_Se
+ #\Hangul_Syllable_Yo))))
+ (with-open-file (s (merge-pathnames "out-utf8.txt"
+ *test-path*)
+ :direction :output
+ :if-exists :supersede)
+ (write-line string s))
+ (with-open-file (s (merge-pathnames "out-utf8.txt"
+ *test-path*)
+ :direction :input
+ :external-format :utf-8)
+ (assert-equal (map 'list #'char-name string)
+ (map 'list #'char-name (read-line s))))))
+
=====================================
tests/utf8.txt
=====================================
@@ -0,0 +1,2 @@
+안녕하세요
+UTF8 test. The above line is "Hello" in Hangul.
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/0dad5a1a767748e6c4fafb…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/0dad5a1a767748e6c4fafb…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-139-default-external-format-utf8 at cmucl / cmucl
Commits:
2fed09ce by Raymond Toy at 2022-10-30T17:41:37-07:00
Adjust issue.130 test encoding
* Create the test file name using the character names so that the
name is independent of the encoding used to read/compile the file.
* Set `unix::*filename-encoding*` to `:utf-8` so that we can encode
the file name properly before handing to `file-author`
Not sure why this was working in merge !88, but it's not working
locally and not working in CI. With this change, it's working locally
now.
- - - - -
1 changed file:
- tests/issues.lisp
Changes:
=====================================
tests/issues.lisp
=====================================
@@ -682,7 +682,21 @@
;; work and not return NIL.
(assert-true (file-author "."))
(assert-true (file-author "bin/build.sh"))
- (assert-true (file-author "tests/안녕하십니까.txt")))
+ (let ((unix::*filename-encoding* :utf-8))
+ ;; Set filename encoding to utf-8 so that we can encode the
+ ;; filename properly.
+ (assert-true
+ (file-author
+ (merge-pathnames
+ (concatenate 'string
+ ;; Write the test file name this way so
+ ;; that it's independent of the encoding
+ ;; used to load this file. The name is
+ ;; "안녕하십니까".
+ '(#\Hangul_Syllable_An #\Hangul_Syllable_Nyeong #\Hangul_Syllable_Ha
+ #\Hangul_Syllable_Sib #\Hangul_Syllable_Ni #\Hangul_Syllable_Gga)
+ ".txt")
+ *test-path*)))))
(define-test issue.139-default-external-format
(:tag :issues)
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/2fed09ce4c3f8c60b077ffe…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/2fed09ce4c3f8c60b077ffe…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-141-locale at cmucl / cmucl
Commits:
cdd7d328 by Raymond Toy at 2022-10-15T14:39:32+00:00
Fix #132: Ansi test RENAME-FILE.1 fails
- - - - -
e0e9f62d by Raymond Toy at 2022-10-15T14:39:35+00:00
Merge branch 'issue-132-ansi-test-rename-files' into 'master'
Fix #132: Ansi test RENAME-FILE.1 fails
Closes #132
See merge request cmucl/cmucl!90
- - - - -
a05277c7 by Raymond Toy at 2022-10-15T20:53:20+00:00
Fix #134: Handle the case of (expt complex complex-rational)
- - - - -
4dacd5ac by Raymond Toy at 2022-10-15T20:53:20+00:00
Merge branch 'issue-134-expt-bug' into 'master'
Fix #134: Handle the case of (expt complex complex-rational)
Closes #134
See merge request cmucl/cmucl!91
- - - - -
8719b21c by Raymond Toy at 2022-10-15T23:27:33+00:00
Fix #146: CI passes incorrectly
- - - - -
9c0f63ff by Raymond Toy at 2022-10-15T23:27:34+00:00
Merge branch 'issue-146-ci-passes-incorrectly' into 'master'
Fix #146: CI passes incorrectly
Closes #146
See merge request cmucl/cmucl!100
- - - - -
cde14045 by Raymond Toy at 2022-10-16T14:26:39+00:00
Fix #142: (random 0) signals incorrect error
- - - - -
4c9cbf43 by Raymond Toy at 2022-10-16T14:26:41+00:00
Merge branch 'issue-142-random-0-wrong-error' into 'master'
Fix #142: (random 0) signals incorrect error
Closes #142
See merge request cmucl/cmucl!99
- - - - -
b59185fc by Raymond Toy at 2022-10-16T14:27:39+00:00
Fix #136: ensure-directories-exist should return the given pathspec
- - - - -
49ecc858 by Raymond Toy at 2022-10-16T14:27:39+00:00
Merge branch 'issue-136-ansi-test-ensure-directories-exist.8' into 'master'
Fix #136: ensure-directories-exist should return the given pathspec
Closes #136
See merge request cmucl/cmucl!92
- - - - -
08e5370a by Raymond Toy at 2022-10-16T07:33:23-07:00
Update release notes based on recent merges
Forgot to update the release notes with recent merges that fixed a few
issues. Hence update the notes now.
Also testing see if we need to add a strikeout for closed issues, so
didn't add strikeout for these.
- - - - -
556b1a5b by Raymond Toy at 2022-10-16T07:35:57-07:00
Add strikeout for closed issues
Nope, gitlab doesn't mark closed issues in anyway, unlike Trac that
would automatically strikeout references to closed issues. We have to
do it ourselves.
- - - - -
95b4fc5c by Raymond Toy at 2022-10-16T13:05:09-07:00
Fix #146: CI passes incorrectly
We forgot to update the script for macos to use separate `grep`
commands like we did for linux.
- - - - -
4a7207b6 by Raymond Toy at 2022-10-17T18:58:45+00:00
Fix #130: Implement file_author in C
- - - - -
ba5c5d2a by Raymond Toy at 2022-10-17T18:58:45+00:00
Merge branch 'issue-130-file-author-in-c' into 'master'
Fix #130: Implement file_author in C
Closes #130
See merge request cmucl/cmucl!88
- - - - -
6e975c79 by Raymond Toy at 2022-10-30T11:55:47-07:00
Merge branch 'master' into issue-141-locale
- - - - -
5 changed files:
- .gitlab-ci.yml
- src/code/filesys.lisp
- src/lisp/os-common.c
- tests/issues.lisp
- + tests/안녕하십니까.txt
Changes:
=====================================
.gitlab-ci.yml
=====================================
@@ -167,7 +167,8 @@ osx:ansi-test:
script:
- cd ansi-test
- make LISP="../dist/bin/lisp -batch -noinit -nositeinit"
- - grep 'No unexpected \(successes\|failures\)' test.out
+ # There should be no unexpected successes or failures; check these separately.
+ - grep -a 'No unexpected successes' test.out && grep -a 'No unexpected failures' test.out
osx:benchmark:
stage: benchmark
=====================================
src/code/filesys.lisp
=====================================
@@ -1079,13 +1079,21 @@ optionally keeping some of the most recent old versions."
:pathname file
:format-control (intl:gettext "~S doesn't exist.")
:format-arguments (list file)))
- (multiple-value-bind (winp dev ino mode nlink uid)
- (unix:unix-stat name)
- (declare (ignore dev ino mode nlink))
- (when winp
- (let ((user-info (unix:unix-getpwuid uid)))
- (when user-info
- (unix:user-info-name user-info))))))))
+ ;; unix-namestring converts "." to "". Convert it back to
+ ;; "." so we can stat the current directory. (Perhaps
+ ;; that's a bug in unix-namestring?)
+ (when (zerop (length name))
+ (setf name "."))
+ (let (author)
+ (unwind-protect
+ (progn
+ (setf author (alien:alien-funcall
+ (alien:extern-alien "os_file_author"
+ (function (alien:* c-call:c-string) c-call:c-string))
+ (unix::%name->file name)))
+ (unless (alien:null-alien author)
+ (alien:cast author c-call:c-string)))
+ (alien:free-alien author))))))
;;;; DIRECTORY.
=====================================
src/lisp/os-common.c
=====================================
@@ -5,12 +5,16 @@
*/
+#include <assert.h>
#include <errno.h>
#include <math.h>
#include <netdb.h>
+#include <pwd.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
+#include <unistd.h>
#include <time.h>
#include "os.h"
@@ -715,3 +719,57 @@ os_lstat(const char* path, u_int64_t *dev, u_int64_t *ino, unsigned int *mode, u
return rc;
}
+
+/*
+ * Interface for file-author. Given a pathname, returns a new string
+ * holding the author of the file or NULL if some error occurred. The
+ * caller is responsible for freeing the memory used by the string.
+ */
+char *
+os_file_author(const char *path)
+{
+ struct stat sb;
+ char initial[1024];
+ char *buffer, *obuffer;
+ size_t size;
+ struct passwd pwd;
+ struct passwd *ppwd;
+ char *result;
+
+ if (stat(path, &sb) != 0) {
+ return NULL;
+ }
+
+ result = NULL;
+ buffer = initial;
+ obuffer = NULL;
+ size = sizeof(initial) / sizeof(initial[0]);
+
+ /*
+ * Keep trying with larger buffers until a maximum is reached. We
+ * assume (1 << 20) is large enough for any OS.
+ */
+ while (size <= (1 << 20)) {
+ switch (getpwuid_r(sb.st_uid, &pwd, buffer, size, &ppwd)) {
+ case 0:
+ /* Success, though we might not have a matching entry */
+ result = (ppwd == NULL) ? NULL : strdup(pwd.pw_name);
+ goto exit;
+ case ERANGE:
+ /* Buffer is too small, double its size and try again */
+ size *= 2;
+ obuffer = (buffer == initial) ? NULL : buffer;
+ if ((buffer = realloc(obuffer, size)) == NULL) {
+ goto exit;
+ }
+ continue;
+ default:
+ /* All other errors */
+ goto exit;
+ }
+ }
+exit:
+ free(obuffer);
+
+ return result;
+}
=====================================
tests/issues.lisp
=====================================
@@ -670,3 +670,10 @@
(err (relerr value answer)))
(assert-true (<= err eps) base err eps)))))))
+(define-test issue.130
+ (:tag :issues)
+ ;; Just verify that file-author works. In particular "." should
+ ;; work and not return NIL.
+ (assert-true (file-author "."))
+ (assert-true (file-author "bin/build.sh"))
+ (assert-true (file-author "tests/안녕하십니까.txt")))
=====================================
tests/안녕하십니까.txt
=====================================
@@ -0,0 +1,3 @@
+The file name of this file is "안녕하십니까.txt" ("Hello" in Korean.)
+
+
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/82ac3a68ea524768d60096…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/82ac3a68ea524768d60096…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-139-default-external-format-utf8 at cmucl / cmucl
Commits:
3717f165 by Raymond Toy at 2022-10-30T09:33:54-07:00
Add test file and git ignore output file
Forgot to add the test file used for testing opening files with the
default external format.
Ignore the output file.
- - - - -
2 changed files:
- + tests/.gitignore
- + tests/utf8.txt
Changes:
=====================================
tests/.gitignore
=====================================
@@ -0,0 +1 @@
+/out-utf8.txt
=====================================
tests/utf8.txt
=====================================
@@ -0,0 +1,2 @@
+안녕하세요
+UTF8 test. The above line is "Hello" in Hangul.
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/3717f16569510d166630f00…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/3717f16569510d166630f00…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-139-default-external-format-utf8 at cmucl / cmucl
Commits:
a130c526 by Raymond Toy at 2022-10-30T09:14:18-07:00
Update release notes and add tests
Update the release notes to say `*default-external-format*` is now
`:utf-8`.
Add tests for the default external format by opening files for reading
and writing and verifying that we get the right things with the
default format of :utf8.
Manually verified that these tests fail with version snapshot-2021-07.
- - - - -
2 changed files:
- src/general-info/release-21e.md
- tests/issues.lisp
Changes:
=====================================
src/general-info/release-21e.md
=====================================
@@ -22,6 +22,7 @@ public domain.
* Feature enhancements
* Changes
* Update to ASDF 3.3.6
+ * The default external format is `:utf-8` instead of `:iso8859-1`
* ANSI compliance fixes:
* Bug fixes:
* ~~#97~~ Fixes stepping through the source forms in the debugger. This has been broken for quite some time, but it works now.
@@ -56,6 +57,7 @@ public domain.
* ~~#132~~ Ansi test `RENAME-FILE.1` no fails
* ~~#134~~ Handle the case of `(expt complex complex-rational)`
* ~~#136~~ `ensure-directories-exist` should return the given pathspec
+ * #139 `*default-external-format*` defaults to `:utf-8`
* ~~#142~~ `(random 0)` signals incorrect error
* Other changes:
* Improvements to the PCL implementation of CLOS:
=====================================
tests/issues.lisp
=====================================
@@ -5,6 +5,12 @@
(in-package "ISSUES-TESTS")
+(defparameter *test-path*
+ (merge-pathnames (make-pathname :name :unspecific :type :unspecific
+ :version :unspecific)
+ *load-truename*)
+ "Path to where this file is.")
+
(defun square (x)
(expt x 2))
@@ -670,3 +676,50 @@
(err (relerr value answer)))
(assert-true (<= err eps) base err eps)))))))
+(define-test issue.139-default-external-format
+ (:tag :issues)
+ (assert-eq :utf-8 stream:*default-external-format*))
+
+(define-test issue.139-default-external-format-read-file
+ (:tag :issues)
+ (let ((string (concatenate 'string
+ ;; This is "hello" in Korean
+ '(#\Hangul_syllable_an
+ #\Hangul_Syllable_Nyeong
+ #\Hangul_Syllable_Ha
+ #\Hangul_Syllable_Se
+ #\Hangul_Syllable_Yo))))
+ ;; Test that opening a file for reading uses the the default :utf8
+ ;; encoding.
+ (with-open-file (s (merge-pathnames "utf8.txt"
+ *test-path*)
+ :direction :input)
+ ;; The first line should be "hello" in Hangul.
+ (assert-equal (map 'list #'char-name string)
+ (map 'list #'char-name (read-line s))))))
+
+(define-test issue.139-default-external-format-write-file
+ (:tag :issues)
+ ;; Test that opening a file for writing uses the default :utf8.
+ ;; First write something out to the file. Then read it back in
+ ;; using an explicit format of utf8 and verifying that we got the
+ ;; right contents.
+ (let ((string (concatenate 'string
+ ;; This is "hello" in Korean
+ '(#\Hangul_syllable_an
+ #\Hangul_Syllable_Nyeong
+ #\Hangul_Syllable_Ha
+ #\Hangul_Syllable_Se
+ #\Hangul_Syllable_Yo))))
+ (with-open-file (s (merge-pathnames "out-utf8.txt"
+ *test-path*)
+ :direction :output
+ :if-exists :supersede)
+ (write-line string s))
+ (with-open-file (s (merge-pathnames "out-utf8.txt"
+ *test-path*)
+ :direction :input
+ :external-format :utf-8)
+ (assert-equal (map 'list #'char-name string)
+ (map 'list #'char-name (read-line s))))))
+
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/a130c52629119ed282263fc…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/a130c52629119ed282263fc…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
e8a0cc6c by Raymond Toy at 2022-10-30T15:03:27+00:00
Fix #147: Add method for stream-line-column
- - - - -
0dad5a1a by Raymond Toy at 2022-10-30T15:03:28+00:00
Merge branch 'issue-147-stream-line-column-impl' into 'master'
Fix #147: Add method for stream-line-column
Closes #147
See merge request cmucl/cmucl!104
- - - - -
1 changed file:
- src/pcl/gray-streams.lisp
Changes:
=====================================
src/pcl/gray-streams.lisp
=====================================
@@ -235,6 +235,9 @@
defined for this function, although it is permissible for it to
always return NIL."))
+(defmethod stream-line-column ((stream fundamental-character-output-stream))
+ nil)
+
;;; Stream-line-length is a CMUCL extension to Gray streams.
(defgeneric stream-line-length (stream)
(:documentation _N"Return the stream line length or Nil."))
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/ba5c5d2a6813c3c1504d9f…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/ba5c5d2a6813c3c1504d9f…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-135-unix-namestring-dot at cmucl / cmucl
Commits:
ef2a1fc3 by Raymond Toy at 2022-10-19T13:44:15-07:00
Remove special case from file-author
file-author had a special case when `(unix-namestring ".")` returned
"". This doesn't happen anymore, so remove the special case.
`(file-author ".")` returns the expected author.
- - - - -
1 changed file:
- src/code/filesys.lisp
Changes:
=====================================
src/code/filesys.lisp
=====================================
@@ -1079,11 +1079,6 @@ optionally keeping some of the most recent old versions."
:pathname file
:format-control (intl:gettext "~S doesn't exist.")
:format-arguments (list file)))
- ;; unix-namestring converts "." to "". Convert it back to
- ;; "." so we can stat the current directory. (Perhaps
- ;; that's a bug in unix-namestring?)
- (when (zerop (length name))
- (setf name "."))
(let (author)
(unwind-protect
(progn
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/ef2a1fc306f966f78c8663b…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/ef2a1fc306f966f78c8663b…
You're receiving this email because of your account on gitlab.common-lisp.net.
Raymond Toy pushed to branch issue-135-unix-namestring-dot at cmucl / cmucl
Commits:
9c006ed9 by Raymond Toy at 2022-10-19T13:00:07-07:00
Remove debugging print
- - - - -
1 changed file:
- src/code/filesys.lisp
Changes:
=====================================
src/code/filesys.lisp
=====================================
@@ -883,7 +883,6 @@
(when (or (not executable-only)
(and (eq (unix:unix-file-kind name) :file)
(unix:unix-access name unix:x_ok)))
- (format t "unix-namestring: name = ~A~%" name)
(names name)))
(let ((names (names)))
(when names
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/9c006ed9c316b444ab95970…
--
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/9c006ed9c316b444ab95970…
You're receiving this email because of your account on gitlab.common-lisp.net.