Raymond Toy pushed to branch issue-393-os-common-getpwuid at cmucl / cmucl

Commits:

2 changed files:

Changes:

  • src/code/unix.lisp
    ... ... @@ -2553,8 +2553,11 @@
    2553 2553
     		    :password (string (cast (slot passwd 'pw-passwd) c-call:c-string))
    
    2554 2554
     		    :uid (slot passwd 'pw-uid)
    
    2555 2555
     		    :gid (slot passwd 'pw-gid)
    
    2556
    -		    :gecos (string (cast (slot passwd 'pw-gecos) c-call:c-string))
    
    2557
    -		    :dir (string (cast (slot passwd 'pw-dir) c-call:c-string))
    
    2556
    +		    ;; The GECOS field could be unicode
    
    2557
    +		    :gecos (string-decode (cast (slot passwd 'pw-gecos) c-call:c-string)
    
    2558
    +					  :default)
    
    2559
    +		    ;; The home directory could be unicode 
    
    2560
    +		    :dir (%file->name (cast (slot passwd 'pw-dir) c-call:c-string))
    
    2558 2561
     		    :shell (string (cast (slot passwd 'pw-shell) c-call:c-string))))))
    
    2559 2562
     	(unless (null-alien result)
    
    2560 2563
     	  (let ((passwd (deref result)))
    

  • tests/unix.lisp
    ... ... @@ -89,3 +89,10 @@
    89 89
         (assert-true (and (integerp errno) (plusp errno)))))
    
    90 90
     
    
    91 91
     
    
    92
    +(define-test getpwuid
    
    93
    +  (:tag :issues)
    
    94
    +  ;; Check that we get something sensible from unix-getpwuid.
    
    95
    +  (let ((info (unix:unix-getpwuid 0)))
    
    96
    +    (assert-true info)
    
    97
    +    (assert-equal (unix:user-info-name info)
    
    98
    +		  "root")))