[Git][cmucl/cmucl][issue-130-file-author-in-c] 10 commits: Fix #142: (random 0) signals incorrect error

Raymond Toy (@rtoy) gitlab at common-lisp.net
Mon Oct 17 18:26:47 UTC 2022



Raymond Toy pushed to branch issue-130-file-author-in-c at cmucl / cmucl


Commits:
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.

- - - - -
66cb86f6 by Raymond Toy at 2022-10-17T10:53:42-07:00
Merge branch 'master' into issue-130-file-author-in-c

- - - - -
e3f73659 by Raymond Toy at 2022-10-17T11:07:05-07:00
Address review comments

Remove the assert and change the loop limit from 16384 to 1<<20.

- - - - -
9e208e62 by Raymond Toy at 2022-10-17T11:26:32-07:00
Change so we only free in one place.

- - - - -


6 changed files:

- .gitlab-ci.yml
- src/code/filesys.lisp
- src/code/rand-xoroshiro.lisp
- src/general-info/release-21e.md
- src/lisp/os-common.c
- tests/filesys.lisp


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
=====================================
@@ -1486,4 +1486,4 @@ optionally keeping some of the most recent old versions."
 			 (retry () :report "Try to create the directory again"
 				(go retry))))))
 	 ;; Only the first path in a search-list is considered.
-	 (return (values pathname created-p))))))
+	 (return (values pathspec created-p))))))


=====================================
src/code/rand-xoroshiro.lisp
=====================================
@@ -491,8 +491,8 @@
     (t
      (error 'simple-type-error
 	    :expected-type '(or (integer 1) (float (0.0))) :datum arg
-	    :format-control _"Argument is not a positive integer or a positive float: ~S")
-	    :format-arguments (list arg))))
+	    :format-control _"Argument is not a positive integer or a positive float: ~S"
+	    :format-arguments (list arg)))))
 
 ;; Jump function for the generator.  See the jump function in
 ;; http://xoroshiro.di.unimi.it/xoroshiro128plus.c


=====================================
src/general-info/release-21e.md
=====================================
@@ -50,8 +50,13 @@ public domain.
     * ~~#113~~ REQUIRE on contribs can pull in the wrong things via ASDF.
     * ~~#121~~ Wrong column index in FILL-POINTER-OUTPUT-STREAM
     * ~~#122~~ gcc 11 can't build cmucl
+    * ~~#125~~ Linux `unix-stat` returning incorrect values
     * ~~#127~~ Linux unix-getpwuid segfaults when given non-existent uid.
     * ~~#128~~ `QUIT` accepts an exit code
+    * ~~#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
+    * ~~#142~~ `(random 0)` signals incorrect error
   * Other changes:
   * Improvements to the PCL implementation of CLOS:
   * Changes to building procedure:


=====================================
src/lisp/os-common.c
=====================================
@@ -730,7 +730,7 @@ os_file_author(const char *path)
 {
     struct stat sb;
     char initial[1024];
-    char *buffer, *obuffer;
+    char *buffer, *newbuffer;
     size_t size;
     struct passwd pwd;
     struct passwd *ppwd;
@@ -745,15 +745,10 @@ os_file_author(const char *path)
     size = sizeof(initial) / sizeof(initial[0]);
 
     /*
-     * Assume a buffer of size 16384 is enough to for getpwuid_r to do
-     * it's thing.
+     * Keep trying with larger buffers until a maximum is reached.  We
+     * assume (1 << 20) is large enough for any OS.
      */
-    assert(sysconf(_SC_GETPW_R_SIZE_MAX) <= 16384);
-
-    /*
-     * Keep trying with larger buffers until a maximum is reached.
-     */
-    while (size <= 16384) {
+    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 */
@@ -762,11 +757,11 @@ os_file_author(const char *path)
           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) {
-                  free(obuffer); 
+              if ((newbuffer = realloc((buffer == initial) ? NULL : buffer,
+                                       size)) == NULL) {
                   goto exit;
               }
+              buffer = newbuffer;
               continue;
           default:
               /* All other errors */


=====================================
tests/filesys.lisp
=====================================
@@ -10,7 +10,7 @@
 
 (define-test unix-namestring.1.exists
   ;; Make sure the desired directories exist.
-  (assert-equal #P"/tmp/foo/bar/hello.txt"
+  (assert-equal "/tmp/foo/bar/hello.txt"
 		(ensure-directories-exist "/tmp/foo/bar/hello.txt"))
   (dolist (path '("/tmp/hello.txt"
 		  "/tmp/foo/"
@@ -27,7 +27,7 @@
 
 (define-test unix-namestring.1.non-existent
   ;; Make sure the desired directories exist.
-  (assert-equal #P"/tmp/foo/bar/hello.txt"
+  (assert-equal "/tmp/foo/bar/hello.txt"
 		(ensure-directories-exist "/tmp/foo/bar/hello.txt"))
   ;; These paths contain directories that don't exist.
   (dolist (path '("/tmp/oops/"
@@ -42,7 +42,7 @@
 
 (define-test unix-namestring.2
   ;; Make sure the desired directories exist.
-  (assert-equal #P"/tmp/foo/bar/hello.txt"
+  (assert-equal "/tmp/foo/bar/hello.txt"
 		(ensure-directories-exist "/tmp/foo/bar/hello.txt"))
   (unwind-protect
        (progn



View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/3d81bc22fae31018c2fd978b2288fe1ad05c80f0...9e208e62c48aefe33b060cebaf08ec725cdf0e9d

-- 
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/3d81bc22fae31018c2fd978b2288fe1ad05c80f0...9e208e62c48aefe33b060cebaf08ec725cdf0e9d
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/20221017/bc673503/attachment-0001.html>


More information about the cmucl-cvs mailing list