[PATCH] add user:has-account-with-uid
David Bremner
david at tethera.net
Mon Sep 13 13:00:09 BST 2021
Sean Whitton <spwhitton at spwhitton.name> writes:
>> + (let* ((gid-str (write-to-string gid))
>> + (uid-str (write-to-string uid))
>> + (uid+gid (format nil "~d:~d" uid gid))
>> + (home (passwd-entry 5 username)))
>> + (mrun "groupmod" "--gid" gid-str username)
>> + (mrun "usermod" "--uid" uid-str username)
>> + (mrun "chown" "-R" uid+gid home))))
>
> I've realised a potential problem with your approach here, sorry I
> didn't think of it earlier -- what happens if the caller specifies a gid
> of a group that doesn't exist? I guess the chown will still succeed,
> but is that okay? Should we also ensure the group exists?
groupmod will fail in that case. Do I need to do something more to abort
the application?
> Also just while we're here, do you mind if I switch $HOME for HOME? I
> believe that is the standard way to refer to environment variables
> outside of shell scripts.
I was trying to distinguish between lisp variables and environment
variables, since common-lisp writes the lisp variable 'home' as HOME in
docstrings. Maybe there is a better way to do that? Or maybe I should
not try to fit everything on the first line of the docstrings.
d
More information about the sgo-software-discuss
mailing list