[cl-debian] Bug#477169: post-sysdef-install.lisp: GET-UID broken on ECL and otherwise inconsistent

Package: common-lisp-controller Version: 6.12 Severity: important Tags: patch I recently found that my ECL fails to ASDF-whatever systems. It fails like this: [metalzone ~]ecl ;;; Loading #P"/usr/lib/ecl/cmp.fas" ;;; Loading #P"/usr/lib/ecl/sysfun.lsp" ECL (Embeddable Common-Lisp) 0.9i Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya Copyright (C) 1993 Giuseppe Attardi Copyright (C) 2000 Juan J. Garcia-Ripoll ECL is free software, and you are welcome to redistribute it under certain conditions; see file 'Copyright' for details. Type :h for Help. Top level.
(asdf:oos 'asdf:load-op :cl-ppcre) ; loading system definition from /usr/share/common-lisp/systems/cl-ppcre.asd ; into #<ASDF0 package> ; registering #<SYSTEM :CL-PPCRE 135932064> as CL-PPCRE 1000 Unable to find out user ID Broken at EVAL.No restarts available. Broken at ASDF:OPERATE.
Tracking down the problem shows that CLC's fallback implementation of GET-UID, in terms of `id', isn't working for whatever reason (presumably ECL doesn't do the right output-redirection stuff). Since ECL has a convenient FFI, it's trivial to implement a working GET-UID which doesn't need to mess with running shell commands and doing redirection. While staring at this code, I've noticed inconsistencies in the behaviour of GET-UID: * SBCL, CMU and Allegro (and now ECL) use the real uid of the process. * CLisp uses the uid of the user named by the USER environment variable. * Other Lisps call `id -u', which returns the effective uid. This is clearly an undesirable state of affairs, so the patch below makes everyone use the ruid. (Using the euid would be better, but I'm not sure that running Lisp systems in a setuid state is clever in the first place; besides, SBCL and CMU don't provide convenient ways of getting hold of the effective uid.) --- /usr/share/common-lisp/source/common-lisp-controller/post-sysdef-install.lisp.aside 2008-04-21 14:53:46.000000000 +0100 +++ /usr/share/common-lisp/source/common-lisp-controller/post-sysdef-install.lisp 2008-04-21 15:28:39.000000000 +0100 @@ -30,20 +30,21 @@ (eval-when (:compile-toplevel :load-toplevel :execute) (require :osi)) -#+clisp (defun get-uid () (posix:user-info-uid (posix:user-info (ext:getenv "USER")))) +#+clisp (defun get-uid () (posix:getuid)) #+sbcl (defun get-uid () (sb-unix:unix-getuid)) #+cmu (defun get-uid () (unix:unix-getuid)) #+allegro (defun get-uid () (excl.osi:getuid)) +#+ecl (defun get-uid () (ffi:c-inline () () :int "getuid()" :one-liner t)) #+clisp (defun world-writable? (mode) (or (member :RWXO mode) (member :WOTH mode))) #+clisp (defun group-writable? (mode) (or (member :RWXG mode) (member :WGRP mode))) #-clisp (defun world-writable? (mode) (/= 0 (logand mode #o002))) #-clisp (defun group-writable? (mode) (/= 0 (logand mode #o020))) -#-(or cmu sbcl clisp allegro) +#-(or cmu sbcl clisp allegro ecl) (defun get-uid () (let ((uid-string (with-output-to-string (asdf::*VERBOSE-OUT*) - (asdf:run-shell-command "id -u")))) + (asdf:run-shell-command "id -ur")))) (with-input-from-string (stream uid-string) (read-line stream) (handler-case (parse-integer (read-line stream)) (I've set the severity to important, not because it breaks CLC, but because it has a major adverse effect on ECL.) -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable') Architecture: i386 (i686) Kernel: Linux 2.6.24.4 (PREEMPT) Locale: LANG=C, LC_CTYPE=en_GB.utf8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages common-lisp-controller depends on: ii bash 3.1dfsg-9 The GNU Bourne Again SHell ii cl-asdf 1.109-2 Another System Definition Facility ii debconf [debconf-2.0] 1.5.20 Debian configuration management sy ii debianutils 2.28.4 Miscellaneous utilities specific t ii perl 5.8.8-12 Larry Wall's Practical Extraction ii realpath 1.11 Return the canonicalized absolute common-lisp-controller recommends no packages. -- debconf information excluded

tags 477169 + pending thanks Hi Mark! Cc:ing Kevin M. Rosenberg (the other c-l-c maintainer) since I'm not sure he reads the pkg-common-lisp-devel. And always because of that I'm sorry for having quoted most of your mail. On Mon, 21 Apr 2008 16:47:52 +0200, Mark Wooding wrote:
I recently found that my ECL fails to ASDF-whatever systems. It fails like this:
[metalzone ~]ecl [...]
(asdf:oos 'asdf:load-op :cl-ppcre) ; loading system definition from /usr/share/common-lisp/systems/cl-ppcre.asd ; into #<ASDF0 package> ; registering #<SYSTEM :CL-PPCRE 135932064> as CL-PPCRE 1000 Unable to find out user ID Broken at EVAL.No restarts available. Broken at ASDF:OPERATE.
Tracking down the problem shows that CLC's fallback implementation of GET-UID, in terms of `id', isn't working for whatever reason (presumably ECL doesn't do the right output-redirection stuff).
Since ECL has a convenient FFI, it's trivial to implement a working GET-UID which doesn't need to mess with running shell commands and doing redirection.
While staring at this code, I've noticed inconsistencies in the behaviour of GET-UID:
* SBCL, CMU and Allegro (and now ECL) use the real uid of the process.
* CLisp uses the uid of the user named by the USER environment variable.
* Other Lisps call `id -u', which returns the effective uid.
This is clearly an undesirable state of affairs, so the patch below makes everyone use the ruid.
Thank you for having tracked down the problem and for the patch as well. Instead of simply applied it, I splitted into three pieces. 1) fix the ECL error commit e23cc4609fae905243441c8107653c4ffb012745 [1] ECL must depend at least on the first version of c-l-c that includes this fix 2) use (posix:getuid) for CLISP commit 2c2bbc99707d8769c7433532ada7723ac47aac0a [2] `posix:getuid' is present in CLISP since version 2.36: it was added to clisp/modules/syscalls/posix.lisp with CVS revision 1.46 [3] (2005-12-04). Since c-l-c already conflicts with CLISP versions less than 2.36, we're OK. However, CVS revision 1.79 [4] removed the GET prefix, so we need to remember this when packaging newer CLISP versions. 3) use the real uid of the process for other Lisps commit 1f3e7d0487df08c5746180c059774c85fbcf40cb [5] I don't think these changes value a new major version (i.e. 7.0). Kevin, what do you think about it? Since I need to fix also some lintian warnings about c-l-c, I'll upload it in the next days as version 6.15 if no one argues. Thx, bye, Gismo / Luca Footnotes: [1] http://git.debian.org/?p=pkg-common-lisp/common-lisp-controller.git;a=commit... [2] http://git.debian.org/?p=pkg-common-lisp/common-lisp-controller.git;a=commit... [3] 2005-09-25 Sam Steingold <sds@gnu.org> * modules/syscalls/calls.c (GETUID, %SETUID, GETGID, %SETGID) (GETEUID, %SETEUID, GETEGID, %SETEGID): implemented * modules/syscalls/posix.lisp (getuid, getgid, geteuid, getegid): exported and DEFSETFed * modules/syscalls/configure.in (gid_t, uid_t): AC_CHECK_SIZEOF (getegid, geteuid, getgid, getuid, setegid, seteuid, setgid, setuid): AC_CHECK_FUNCS http://clisp.cvs.sourceforge.net/clisp/clisp/modules/syscalls/posix.lisp?r1=1.45&r2=1.46 [4] 2008-06-05 Sam Steingold <sds@gnu.org> * modules/syscalls/calls.c, modules/syscalls/posix.lisp: remove the GET prefix from SETFable functions PGID, UID, GID, EUID, EGID, GROUPS http://clisp.cvs.sourceforge.net/clisp/clisp/modules/syscalls/posix.lisp?r1=1.78&r2=1.79 [5] http://git.debian.org/?p=pkg-common-lisp/common-lisp-controller.git;a=commit...

Processing commands for control@bugs.debian.org:
tags 477169 + pending Bug#477169: post-sysdef-install.lisp: GET-UID broken on ECL and otherwise inconsistent Tags were: patch Tags added: pending
thanks Stopping processing here.
Please contact me if you need assistance. Debian bug tracking system administrator (administrator, Debian Bugs database)

Your message dated Fri, 13 Jun 2008 08:47:08 +0000 with message-id <E1K74w8-00009I-GW@ries.debian.org> and subject line Bug#477169: fixed in common-lisp-controller 6.15 has caused the Debian Bug report #477169, regarding post-sysdef-install.lisp: GET-UID broken on ECL and otherwise inconsistent to be marked as done. This means that you claim that the problem has been dealt with. If this is not the case it is now your responsibility to reopen the Bug report if necessary, and/or fix the problem forthwith. (NB: If you are a system administrator and have no idea what this message is talking about, this may indicate a serious mail system misconfiguration somewhere. Please contact owner@bugs.debian.org immediately.) -- 477169: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=477169 Debian Bug Tracking System Contact owner@bugs.debian.org with problems
participants (3)
-
Luca Capello
-
Mark Wooding
-
owner@bugs.debian.org