Bugs item #2959335, was opened at 2010-02-26 01:56
Message generated for change (Comment added) made by sf-robot
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=101355&aid=2959335&group_id=1355
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: clisp
Group: None
>Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: ander-skirnir (ander-skirnir)
Assigned to: Arseny Slobodyuk (ampy)
Summary: no posix:uid on windows (required by asdf)
Initial Comment:
asdf package requires uid symbol from posix, but its not exporting on win32 at all.
so, to load asdf on clisp from win32 now u have to do that:
(in-package #:posix)
(export '(uid))
(in-package #:cl-user)
(load "asdf\\asdf.lisp")
to fix it, u can just add #+win32 (export '(uid)) to the syscalls\\posix.lisp
----------------------------------------------------------------------
>Comment By: SourceForge Robot (sf-robot)
Date: 2010-05-28 02:20
Message:
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
----------------------------------------------------------------------
Comment By: Sam Steingold (sds)
Date: 2010-05-13 19:24
Message:
we consider the problem fixed since GET-USER-SID is now available.
if you disagree, reply within 2 weeks.
----------------------------------------------------------------------
Comment By: Sam Steingold (sds)
Date: 2010-05-13 19:24
Message:
This bug report is now marked as "pending"/"works for me".
This means that we think that we cannot reproduce the problem
and cannot do anything about it.
Unless you - the reporter - act within 2 weeks
(e.g., by submitting a self-contained test case
or answering our other recent requests),
the bug will be permanently closed.
Sorry about the inconvenience -
we hope your silence means that
you are no longer observing the problem either.
----------------------------------------------------------------------
Comment By: Sam Steingold (sds)
Date: 2010-04-28 13:48
Message:
I confirm Arseny's observations about 400 & -1.
however, getting back to the original issue:
first of all, my understanding of asdf.lisp is that get-uid will not be
defined on a windows machine without cygwin.
this should take care of the original issue because on unix or cygwin
clisp does define posix:uid.
however, if it is desirable to implement get-uid on windows, one can use
#+clisp (defun get-uid () #+win32 (os:get-user-sid) #-win32
(princ-to-string (posix:uid)))
----------------------------------------------------------------------
Comment By: Arseny Slobodyuk (ampy)
Date: 2010-04-28 10:31
Message:
BTW, uid will return 400 (on cygwin) if the current user not listed in
passwd.
And (finally a bug!) - we should handle uid of -1 returned by getpwent - I
have one such record on all machines I tried. Such a record is returnned
for any user not listed in passwd and which is not current user. I couldn't
guess who is it. It looks weird in lisp:
[1]> (user-info)
( ...
#<USER-INFO :LOGIN-ID "????????" :PASSWD "*" :UID 4294967295 :GID
4294967295 :FULL-NAME "" :HOME-DIR "" :SHELL "">)
I'm afraid it leads us too far...
----------------------------------------------------------------------
Comment By: Arseny Slobodyuk (ampy)
Date: 2010-04-28 07:58
Message:
Found at http://www.cygwin.com/cygwin-ug-net/ntsec.html :
To use Windows security correctly, Cygwin depends on the files /etc/passwd
and /etc/group. These files define the translation between the Cygwin
uid/gid and the Windows SID. The SID is stored in the pw_gecos field in
/etc/passwd, and in the gr_passwd field in /etc/group. Since the pw_gecos
field can contain more information than just a SID, there are some rules
for the layout. It's required that the SID is the last entry of the
pw_gecos field, assuming that the entries in pw_gecos are comma-separated.
The commands mkpasswd and mkgroup usually do this for you.
Another interesting entry in the pw_gecos field (which is also usually
created by running mkpasswd) is the Windows user name entry. It takes the
form "U-domain\username" and is sometimes used by services to authenticate
a user. Logging in through telnet is a common scenario.
----------------------------------------------------------------------
Comment By: Arseny Slobodyuk (ampy)
Date: 2010-04-28 02:37
Message:
user-info is based on getpwent and gets info from /etc/passwd and I believe
:FULL-NAME is constructed from various fields and results of system calls.
It is like that it's treated as commenting field. The drawback of getpwent
on cygwin is that /etc/passwd may be out of sync with system security state
- for example, user can change his name in system and forget to update
/etc/passwd, so (get-user-sid (user-info-login-id u)) will not succeed.
----------------------------------------------------------------------
Comment By: Sam Steingold (sds)
Date: 2010-04-27 15:48
Message:
erm... this is not always the case, however, this holds:
(dolist (u (user-info))
(let* ((fn (user-info-full-name u))
(sid (and (string/= "" fn) (get-user-sid (user-info-login-id
u)))))
(unless (or (null sid)
(string= sid (subseq fn (1+ (position #\, fn :from-end
t)))))
(print (list u sid fn)))))
can others comment on this observation?
----------------------------------------------------------------------
Comment By: Sam Steingold (sds)
Date: 2010-04-27 15:27
Message:
Arseny, thanks for adding GET-USER-SID.
interestingly, on cygwin I see this:
(string= (user-info-full-name (user-info :default)) (concatenate 'string
"," (GET-USER-SID)))
==> T
is this the officially documented cygwin behavior?
----------------------------------------------------------------------
Comment By: Arseny Slobodyuk (ampy)
Date: 2010-04-14 01:55
Message:
Don't know why you can't open the link - I'm opening it with no problem.
Try search "SID Components" at msdn.microsoft.com or Google - the first
result is the article.
I don't want to create the structure because, although it's good for
training in writing of CLISP modules:
- I don't think its useful to have separate fields in the structure - for
UUID there is no documentation on their meaning, for SID although there is
an API to extract the (variable number of) fields - GetSidSubAuthority, but
besides converting SID to a string it has only rather exotic applications
AFAIK.
- SID is like pathname or array not the structure (explained in the MSDN
link).
- This is intended way of its use, I believe. For example: to store user
information in the registry, string representations of SIDs are used.
----------------------------------------------------------------------
Comment By: Sam Steingold (sds)
Date: 2010-04-13 13:39
Message:
the link you gave results in "Unable to Service Request".
why don't you want to return a structure which will print as the right
string?
----------------------------------------------------------------------
Comment By: Arseny Slobodyuk (ampy)
Date: 2010-04-13 09:26
Message:
Sorry, I was wrong. User ID on Windows is not UUID but SID which is a
variable-length structure (see
http://msdn.microsoft.com/en-us/library/aa379597(VS.85).aspx). We only can
portably convert it to a sequence of bytes (integer) or to a string (like
S-1-5-21-1645522239-1606980848-123456789-1234). The latter seems to me to
have more use (can be used to do some registry hacking for example). I'm
going to implement POSIX:GET-USER-SID -> string in syscalls.
----------------------------------------------------------------------
Comment By: Sam Steingold (sds)
Date: 2010-03-02 17:29
Message:
the syscalls module is supposed to help in "systems programming".
it should export all posix functions which do not have a better CL
analogue.
since there is no clear win32 analogue for unix uid, we are free to use
uuids instead.
I do not want to map the uuid struct to a bignum because this would
prevent us from defining a print-object method.
I still think that my suggestion in "2010-03-01 10:35" is correct: return
a struct and define a print-object method.
----------------------------------------------------------------------
Comment By: Arseny Slobodyuk (ampy)
Date: 2010-03-02 09:26
Message:
I have investigated a little futher. Although Windows has posix
compatibility layer (posix subsystem), there's seems no way to get integer
userid, so, in fact the layer is incomplete. I dealt with, for example,
Microsoft SFU (Services For Unix) - the mapping between users and uids,
groups and uids (for NFS) is defined by administrator in the dedicated
table. Same with Hummingbird NFS server. Is it a global trend to make
Lisp C-posix-conforming? There will be difficulties, but I believe there's
freedom in such a mapping and it could be done automatically.
----------------------------------------------------------------------
Comment By: Arseny Slobodyuk (ampy)
Date: 2010-03-02 00:18
Message:
Correcting myself: clisp/win32 is already depends on advapi32.
----------------------------------------------------------------------
Comment By: Arseny Slobodyuk (ampy)
Date: 2010-03-02 00:07
Message:
Not that I like the idea, but, having conforming CL we could translate UUID
to the large integer. Or (for the goal described here) get a hash from
string of UUID or username. Using GetTokenInformation (thanks for the hint,
Sam) will make CLISP dependent on yet another dll (its in the Advapi32.lib,
getting USERNAME is much simpler), affecting load time and memory demands -
is it acceptable? Which could be another uses of such a functions?
----------------------------------------------------------------------
Comment By: Sam Steingold (sds)
Date: 2010-03-01 19:09
Message:
even worse -- "" is not a valid pathname component.
win32 _does_ support multiple users, so the issue _is_ relevant (and if it
is not, asdf maintainers should handle that).
----------------------------------------------------------------------
Comment By: Reini Urban (rurban)
Date: 2010-03-01 19:04
Message:
I remember: The uid is used in asdf for site-location to discriminate the
.fas cache for different users, which is not relevent for win32.
If you are concerned about a deleted USERNAME env submit a uid patch to
asdf, like
#+win32 (defun uid () (or (getenv "USERNAME") ""))
----------------------------------------------------------------------
Comment By: Sam Steingold (sds)
Date: 2010-03-01 18:56
Message:
asdf uses getuid in resolve-relative-location-component as a pathname
component.
getenv is no good - it may return NIL which may screw sharing up.
I think returning a struct based on
OpenProcessToken+GetTokenInformation->UUID
and defining a print-object method on it is the best approach.
----------------------------------------------------------------------
Comment By: Reini Urban (rurban)
Date: 2010-03-01 17:55
Message:
I would prefer a simple
#+win32 (defun uid () (getenv "USERNAME"))
#+win32 (defun euid () (getenv "USERNAME"))
and not using the GUID as arseny suggested.
I don't know if the asdf uid is used as number, e.g. format, or used for
numerical sorting.
But asdf should add this patch, as one cannot force windows to return such
a number,
only a string. Windows is no posix, as everyone knows.
----------------------------------------------------------------------
Comment By: Sam Steingold (sds)
Date: 2010-03-01 15:35
Message:
ander-skirnir: what is the original use case for this function? what is the
expected contract?
I don't think getenv is the right way here. I think
OpenProcessToken+GetTokenInformation is the way to go.
Arseny, I don't think string return value is a good idea - we should
return a structure of 3 integers and a byte vector or maybe 5 integers.
you can also provide a printer function which would produce the string you
describe. Would you like to handle this issue? Thanks!
----------------------------------------------------------------------
Comment By: Arseny Slobodyuk (ampy)
Date: 2010-02-28 00:40
Message:
I believe on Windows, user's and group's UUID corresponds userid and
groupid in UNIX. But UUID is a structure
typedef struct _GUID
{
DWORD Data1;
WORD Data2;
WORD Data3;
BYTE Data4[8];
} GUID;
which can be represented as string like
{4208fb66-e22a-11d1-a7d7-00a0c982c00d}. This UUIDS however are unique -
different on different computers.
I dont know how it could help. Possibly "int getuid() {return 0;}" will
do?
----------------------------------------------------------------------
Comment By: ander-skirnir (ander-skirnir)
Date: 2010-02-27 23:41
Message:
quote from some forum: "You can access the Windows environment variable
%USERNAME%. You didn't mention how you want to access it though. Batch
file? Command Prompt? C/C++? With C/C++ you can use the getenv() function
to retrieve specific environment variable values."
useful discuss:
http://stackoverflow.com/questions/1594746/win32-equivalent-of-getuid
----------------------------------------------------------------------
Comment By: Sam Steingold (sds)
Date: 2010-02-26 16:16
Message:
how do we implement uid on windows?
what's the windows analogue of getuid/geteuid/getgid &c?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=101355&aid=2959335&group_id=1355

Feature Requests item #3007443, was opened at 2010-05-26 12:07
Message generated for change (Tracker Item Submitted) made by sds
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=351355&aid=3007443&group_id=1355
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: UI
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Sam Steingold (sds)
Assigned to: Bruno Haible (haible)
Summary: REQUIRE modules from the command line
Initial Comment:
Now that the default build uses dynamic modules, the users of non-base modules are likely to use the base linking set and use REQUIRE to load the modules they need (because the full linking set may contain a zillion modules they do not need and might actually not run because one of those zillion modules may require a missing external library).
This may make them want to be able to REQUIRE a module from the command line.
What we can do:
1. Do nothing. People can already do
$ clisp -x '(require "rawsock")' -repl
2. Make "-i" work as REQUIRE instead of LOAD, i.e., temporarily prepend libdir/dynmod to *LOAD-PATHS*:
$ clisp -i rawsock
this way the dynamic modules will override user files with the same name which may not necessarily always be what the user wants.
3. Add a new "-r" option to require the module, binding *load-paths* to NIL around the call to REQUIRE to ensure that no non-module files are considered:
$ clisp -r rawsock
will start clisp+rawsock and
$ clisp -r foo
will fail even if there is a file foo.lisp in *load-paths*.
Whatever course we take, the right way to write a script remains
==========
#!/usr/bin/clisp
(require "rawsock")
...
==========
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=351355&aid=3007443&group_id=1355

Feature Requests item #3001956, was opened at 2010-05-14 22:32
Message generated for change (Comment added) made by sds
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=351355&aid=3001956&group_id=1355
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Extend ANSI CL
Group: None
Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Krzysztof Drewniak (krzysz00)
>Assigned to: Sam Steingold (sds)
Summary: Make closures/functions printable
Initial Comment:
This would be a great feature. Basically make it so that given
(setf foo #'(lambda (x) x))
(setf bar (read-from-string (format nil "~s" foo)))
then (= (funcall foo 3) (cuncall bar 3)) would be true.
This would be great and let you do many good things.
----------------------------------------------------------------------
Comment By: Sam Steingold (sds)
Date: 2010-05-21 13:52
Message:
Thanks for the suggestion - it has been just implemented and
checked into the CVS repository, and will be available in the next
release.
If you cannot wait for the next release, you can get the latest
development sources from the CVS and compile them yourself.
Please be aware that the development sources are not stable and
might not even compile on your machine.
You should report any problems you encounter with the CVS sources
to the <clisp-devel> mailing list, not to the <clisp-list>.
If you use the CVS sources, you should read <clisp-devel>
since the CVS log goes there.
----------------------------------------------------------------------
Comment By: Bruno Haible (haible)
Date: 2010-05-16 05:23
Message:
1) Why is it bad to have features that work for some functions (namely,
functions that don't
refer to closed-up variables, functions, tags, blocks) and don't work
for functions that do
refer to closed-up variables, functions, tags, blocks?
Because the very concept of "function" is that one function is
substitutable for another function,
provided it has the same argument list and the same semantics. The way the
function is
implemented - with references to special variables or with references to
lexical variables -
MUST not have any effect on what you can do with the function.
2) The fact that (with-standard-io-syntax (prin1-to-string func)) allows a
compiled function
to be printed readably is a misfeature, because it violates principle 1):
It offers some feature
that does not work reliably for functions that refer to closed-over
lexical variables. It would be
good to introduce a new, undocumented special variable
SYSTEM::*PRINT-CLOSURE-READABLY*
that triggers the readable printout of closures in clisp. This variable
should be bound to NIL by
WITH-STANDARD-IO-SYNTAX.
3) Why are interpreted functions not printed readably when
*print-readably* is true?
Because they refer to the global environment.
> (setf foo #'(lambda (x) x))
> (sys::%record-ref foo 8)
((DECLARATION OPTIMIZE DECLARATION))
This is necessary and even desired: A interpreted function may not have
processed all
its source code after it is created (this is what distinguishes it from a
compiled function).
Therefore it needs to refer to the global environment.
And even if there was not the reference to the declaration environment, it
is not
desirable to print them readably because it would violate principle 1).
4) Requests like this are understandable from the point of new Lisp
users.
But these users have to learn that there are different programming styles
possible withing CL: The function and closed-up-variable oriented style,
where your data resides in closed-up variables. The function and
structure
style, where your data resides in objects of DEFSTRUCT type. The
CLOS style, where your data resides in objects of DEFCLASS type and
your code is in methods of generic functions. You can use all three
styles
on Common Lisp, but you have to be aware of the limitations. One of
these limitations is that you get the best support for *PRINT-READABLY*
by using the third style.
----------------------------------------------------------------------
Comment By: Sam Steingold (sds)
Date: 2010-05-16 00:16
Message:
compiler closures already can be printed readably:
[4]> (setf foo #'(lambda (x) (declare (compile)) x))
#<COMPILED-FUNCTION :LAMBDA>
[5]> (setf bar (read-from-string (with-standard-io-syntax (prin1-to-string
foo))))
#<COMPILED-FUNCTION :LAMBDA>
[6]> (= (funcall foo 1) (funcall bar 1))
T
we do not print interpreted closures readably for historical reasons.
I see no reason not to print them readably as lambda expressions (when the
original lambda is still available).
Of course, when the lambda is closed over a variable, you will not get
what you expect:
(let (a) (setq f1 (lambda (x) (push x a)) f2 (lambda () (pop a))))
F1 and F2 modify the same variable A.
now, if you do
(setq g1 (read-from-string (with-standard-io-syntax (prin1-to-string
f1))))
(setq g2 (read-from-string (with-standard-io-syntax (prin1-to-string
f2))))
there is no way to make g1 and g2 modify the same variable.
(this argument did not prevent us from printing compiled closured
readably, even though it applies equally there too).
So, Bruno, why can't we print interpreted closured "readably" as lambda
expressions?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=351355&aid=3001956&group_id=1355