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

Commits:

6 changed files:

Changes:

  • .gitlab-ci.yml
    ... ... @@ -167,7 +167,8 @@ osx:ansi-test:
    167 167
       script:
    
    168 168
         - cd ansi-test
    
    169 169
         - make LISP="../dist/bin/lisp -batch -noinit -nositeinit"
    
    170
    -    - grep 'No unexpected \(successes\|failures\)' test.out 
    
    170
    +    # There should be no unexpected successes or failures; check these separately.
    
    171
    +    - grep -a 'No unexpected successes' test.out && grep -a 'No unexpected failures' test.out
    
    171 172
       
    
    172 173
     osx:benchmark:
    
    173 174
       stage: benchmark
    

  • src/code/filesys.lisp
    ... ... @@ -1486,4 +1486,4 @@ optionally keeping some of the most recent old versions."
    1486 1486
     			 (retry () :report "Try to create the directory again"
    
    1487 1487
     				(go retry))))))
    
    1488 1488
     	 ;; Only the first path in a search-list is considered.
    
    1489
    -	 (return (values pathname created-p))))))
    1489
    +	 (return (values pathspec created-p))))))

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

  • src/general-info/release-21e.md
    ... ... @@ -50,8 +50,13 @@ public domain.
    50 50
         * ~~#113~~ REQUIRE on contribs can pull in the wrong things via ASDF.
    
    51 51
         * ~~#121~~ Wrong column index in FILL-POINTER-OUTPUT-STREAM
    
    52 52
         * ~~#122~~ gcc 11 can't build cmucl
    
    53
    +    * ~~#125~~ Linux `unix-stat` returning incorrect values
    
    53 54
         * ~~#127~~ Linux unix-getpwuid segfaults when given non-existent uid.
    
    54 55
         * ~~#128~~ `QUIT` accepts an exit code
    
    56
    +    * ~~#132~~ Ansi test `RENAME-FILE.1` no fails
    
    57
    +    * ~~#134~~ Handle the case of `(expt complex complex-rational)`
    
    58
    +    * ~~#136~~ `ensure-directories-exist` should return the given pathspec
    
    59
    +    * ~~#142~~ `(random 0)` signals incorrect error
    
    55 60
       * Other changes:
    
    56 61
       * Improvements to the PCL implementation of CLOS:
    
    57 62
       * Changes to building procedure:
    

  • src/lisp/os-common.c
    ... ... @@ -730,7 +730,7 @@ os_file_author(const char *path)
    730 730
     {
    
    731 731
         struct stat sb;
    
    732 732
         char initial[1024];
    
    733
    -    char *buffer, *obuffer;
    
    733
    +    char *buffer, *newbuffer;
    
    734 734
         size_t size;
    
    735 735
         struct passwd pwd;
    
    736 736
         struct passwd *ppwd;
    
    ... ... @@ -745,15 +745,10 @@ os_file_author(const char *path)
    745 745
         size = sizeof(initial) / sizeof(initial[0]);
    
    746 746
     
    
    747 747
         /*
    
    748
    -     * Assume a buffer of size 16384 is enough to for getpwuid_r to do
    
    749
    -     * it's thing.
    
    748
    +     * Keep trying with larger buffers until a maximum is reached.  We
    
    749
    +     * assume (1 << 20) is large enough for any OS.
    
    750 750
          */
    
    751
    -    assert(sysconf(_SC_GETPW_R_SIZE_MAX) <= 16384);
    
    752
    -
    
    753
    -    /*
    
    754
    -     * Keep trying with larger buffers until a maximum is reached.
    
    755
    -     */
    
    756
    -    while (size <= 16384) {
    
    751
    +    while (size <= (1 << 20)) {
    
    757 752
             switch (getpwuid_r(sb.st_uid, &pwd, buffer, size, &ppwd)) {
    
    758 753
               case 0:
    
    759 754
                   /* Success, though we might not have a matching entry */
    
    ... ... @@ -762,11 +757,11 @@ os_file_author(const char *path)
    762 757
               case ERANGE:
    
    763 758
                   /* Buffer is too small, double its size and try again */
    
    764 759
                   size *= 2;
    
    765
    -              obuffer = (buffer == initial) ? NULL : buffer;
    
    766
    -              if ((buffer = realloc(obuffer, size)) == NULL) {
    
    767
    -                  free(obuffer); 
    
    760
    +              if ((newbuffer = realloc((buffer == initial) ? NULL : buffer,
    
    761
    +                                       size)) == NULL) {
    
    768 762
                       goto exit;
    
    769 763
                   }
    
    764
    +              buffer = newbuffer;
    
    770 765
                   continue;
    
    771 766
               default:
    
    772 767
                   /* All other errors */
    

  • tests/filesys.lisp
    ... ... @@ -10,7 +10,7 @@
    10 10
     
    
    11 11
     (define-test unix-namestring.1.exists
    
    12 12
       ;; Make sure the desired directories exist.
    
    13
    -  (assert-equal #P"/tmp/foo/bar/hello.txt"
    
    13
    +  (assert-equal "/tmp/foo/bar/hello.txt"
    
    14 14
     		(ensure-directories-exist "/tmp/foo/bar/hello.txt"))
    
    15 15
       (dolist (path '("/tmp/hello.txt"
    
    16 16
     		  "/tmp/foo/"
    
    ... ... @@ -27,7 +27,7 @@
    27 27
     
    
    28 28
     (define-test unix-namestring.1.non-existent
    
    29 29
       ;; Make sure the desired directories exist.
    
    30
    -  (assert-equal #P"/tmp/foo/bar/hello.txt"
    
    30
    +  (assert-equal "/tmp/foo/bar/hello.txt"
    
    31 31
     		(ensure-directories-exist "/tmp/foo/bar/hello.txt"))
    
    32 32
       ;; These paths contain directories that don't exist.
    
    33 33
       (dolist (path '("/tmp/oops/"
    
    ... ... @@ -42,7 +42,7 @@
    42 42
     
    
    43 43
     (define-test unix-namestring.2
    
    44 44
       ;; Make sure the desired directories exist.
    
    45
    -  (assert-equal #P"/tmp/foo/bar/hello.txt"
    
    45
    +  (assert-equal "/tmp/foo/bar/hello.txt"
    
    46 46
     		(ensure-directories-exist "/tmp/foo/bar/hello.txt"))
    
    47 47
       (unwind-protect
    
    48 48
            (progn