[cl-debian] Bug#384697: cl-launch: need to modify script variables without touching the script

Package: cl-launch Version: 1.85-1 Severity: wishlist Hello, the background of this wishlist can be found on bug #384071 [1], I created a new bug because I think the discussion was becoming specific to CL-Launch and no more to StumpWM. BTW, Xavier, I Cc:ed you because you were deeply involved in the discussion, I hope you don't mind :-) On Thu, 24 Aug 2006 00:53:17 +0200, Xavier Maillard wrote:
Moreover, I think we need to find a common way to specify cl-launch files. For example, stumpwm can be loaded through CMUCL or SBCL, thus the script in /usr/bin/stumpwm cannot have the SBCL option hardcoded (because files in /usr should not be edited by the administrator).
You can normally pass --lisp "sbcl cmucl clisp" as an argument thus you can easily set LISPS="list of CL implentations separated by spaces".
I'm aware of this, but the main problem here is the following. At package building time, I create the /usr/bin/stumpwm script with cl-launch --output ./stumpwm --lisp "sbcl clisp" \ --system stumpwm --init '(stumpwm:stumpwm ":0")' But with this solution, as the StumpWM maintainer I'm giving a preference to SBCL (because it's the first in the list). As by the Debian Policy not the administrator neither the end-user have the rights to modify files in /usr, but only in /etc (because only modifications done in the latter are preserved during package upgrades), if someone wants to start StumpWM through CMUCL needs to copy /usr/bin/stumpwm somewhere and modify the $LISPS variable. Thus, I think we need to find a general and user-specific solution: something like a /etc/cl-launchrc and ~/.cl-launchrc files, where for every CL-Launch binary script (e.g. /usr/bin/stumpwm) one can override variables (especially $LISPS). Thus, any maintainer that wants to provide CL-Launch binary scripts could specify every supported Common Lisp implementation, then the administrator or the end-user can adjust to his needs. Obviously, someone may prefer to copy /usr/bin/stumpwm into ~/bin, but I'm not for "polluting" $HOME with multiple copies of /usr/bin/ files which differ only for a line (yes, I'm a bit paranoid). Thx, bye, Gismo / Luca -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (990, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.18-rc4 Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Versions of packages cl-launch depends on: ii common-lisp-controller 6.2 This is a Common Lisp source and c cl-launch recommends no packages. -- no debconf information Footnotes: [1] http://bugs.debian.org/384071

On 25/08/06, Luca Capello <luca@pca.it> wrote:
Package: cl-launch Version: 1.85-1 Severity: wishlist
I'm not sure we either need or want a /etc/cl-launchrc or a ~/.cl-launchrc. After all, the user (or root) may already export the variable $LISP to override things at runtime (or at dump time), whatever the --lisp or $LISPS variable be, unless explicitly prevented with a --wrap argument (or a resetting of $LISP), and I think that's all we need. As for stumpwm, note that I prefer the more versatile --init argument: '(stumpwm:stumpwm (cl-launch:getenv "DISPLAY"))' to a hardcoded :0. If multiple dumped versions are wanted, they should each have a different name, and the main script would select amongst them. Finally, there are embarassing bugs in cl-launch 1.85, and I'd appreciate it if one of my sponsors would have the time upload 1.86 to unstable. [ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ] You're currently going through a difficult transition period called "Life."

tags 384697 + patch thanks Hello Faré! On Sat, 26 Aug 2006 06:08:39 +0200, Faré wrote:
I'm not sure we either need or want a /etc/cl-launchrc or a ~/.cl-launchrc.
I still think that's the way to go, but obviously we need more feedbacks from the other CL-Debian developers/users (especially Peter and René). Xavier, this is the reason I explicitly cc:ed you again, I hope you don't mind :-) The attached patch is a very simple support for ~/.cl-launchrc, based on the CL-Launch available in Debian, thus 1.85-1. To apply it: $ [save the patch somewhere] $ cp /usr/share/common-lisp/source/cl-launch/wrapper.sh ~/ $ patch wrapper.sh < /path/to/the/patch $ [modify your CL-Launch script to call include ~/wrapper.sh instead of the /usr/share/common-lisp/source/cl-launch/wrapper.sh] ~/.cl-launchrc is a shell file, with the following structure: [value of $SOFTWARE_SYSTEM in the CL-Launch script] = \ [Common Lisp implementation to be used] I assume that the value of $SOFTWARE_SYSTEM will always be the name of the script, i.e. /usr/bin/$SOFTWARE_SYSTEM. Thus, for StumpWM would be something like the following: stumpwm=sbcl ATM the patch is quite dirty, because it uses grep and the BASH parameter substitution to assign the value, while the same function should be very simple as: check_lisp_variable () { test -r /etc/cl-launchrc && . /etc/cl-launchrc test -r "$HOME/.cl-launchrc" && . "$HOME/.cl-launchrc" test -n ${SOFTWARE_SYSTEM} && LISP=${SOFTWARE_SYSTEM} } The last line is obviously fault, what I'd like to do is: if the variable called with the name of the value of $SOFTWARE_SYSTEM is not-empty set the LISP variable to that value Unfortunately, I don't know how to do it in shell language, I quickly and unsuccessfully read `man bash`, so I post here in case someone with more shell skills would help.
After all, the user (or root) may already export the variable $LISP to override things at runtime (or at dump time), whatever the --lisp or $LISPS variable be, unless explicitly prevented with a --wrap argument (or a resetting of $LISP), and I think that's all we need.
If we ship a CL-Launch script I'd like to avoid special forms like: $ LISP=sbcl /usr/bin/stumpwm $ /usr/bin/stumpwm --lisp sbcl
As for stumpwm, note that I prefer the more versatile --init argument: '(stumpwm:stumpwm (cl-launch:getenv "DISPLAY"))' to a hardcoded :0.
OK, I noticed it and I completely agree, as this is The Right Thing™, because we can't assume $DISPLAY always :0.0.
If multiple dumped versions are wanted, they should each have a different name, and the main script would select amongst them.
Well, for sure I'm not going to support multiple versions (would be them dumped images or not). IMHO, if a Debian package ships a CL-Launch script at /usr/bin/$SOFTWARE_SYSTEM, this should be the more generic possible, i.e. $LISPS should contains all the Common Lisp implementation that the _Debian package_ support. Thx, bye, Gismo / Luca

Processing commands for control@bugs.debian.org:
tags 384697 + patch Bug#384697: cl-launch: need to modify script variables without touching the script There were no tags set. Tags added: patch
thanks Stopping processing here.
Please contact me if you need assistance. Debian bug tracking system administrator (administrator, Debian Bugs database)

Hello! On Sat, 26 Aug 2006 18:50:40 +0200, Luca Capello wrote:
ATM the patch is quite dirty, because it uses grep and the BASH parameter substitution to assign the value, while the same function should be very simple as:
check_lisp_variable () { test -r /etc/cl-launchrc && . /etc/cl-launchrc test -r "$HOME/.cl-launchrc" && . "$HOME/.cl-launchrc" test -n ${SOFTWARE_SYSTEM} && LISP=${SOFTWARE_SYSTEM} }
The last line is obviously fault, what I'd like to do is:
It was quite simple, just putting two ! (and I'd like to thanks __dave@irc.freenode.net for his support). The attached patch is tested on cl-launch_1.85-1, but it's generated against cl-launch_1.86 as at [1]. Comments? Thx, bye, Gismo / Luca Footnotes: [1] http://fare.tunes.org/files/cl-launch/

On 29/08/06, Luca Capello <luca@pca.it> wrote:
check_lisp_variable () { test -r /etc/cl-launchrc && . /etc/cl-launchrc test -r "$HOME/.cl-launchrc" && . "$HOME/.cl-launchrc" test -n ${SOFTWARE_SYSTEM} && LISP=${SOFTWARE_SYSTEM} } I have several issues with such a patch:
(1) I took enough pain to get cl-launch running on a wide variety of shells (bash, zsh, posh, dash...) and I won't accept any bash-ism. Eval is OK. (2) since we're using eval I'd rather the variable be named LISP_stumpwm or something like that. (3) this patch just won't work when we're in --dump mode, since it very wrongly overrides the $LISP from the dumped image. A script generated with --dump should NOT read any kind of cl-launchrc. (4) If you hack cl-launch, you might want to run cl-launch -l "clisp sbcl cmucl gcl" -B tests from a temporary directory (complete with all installed and supported implementations). This will run the self-test. [ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ] Amateurs talk strategy. Professionals talk logistics. - old military saying

Due to popular request, I am working on an optional /etc/cl-launchrc feature for cl-launch. Because I allow a --no-rc option (that is enabled by default for me, you can use --rc by default), the contents of these file will be read *after* the option processing. A cl-launchrc file may contain statements such as: system_preferred_lisps stumpwm cmucl sbcl clisp system_preferred_lisps exscribe clisp cmucl Then remains the question of whether or not the statements should override a user-specified --lisps option. My current feeling is "yes, but issue a warning on stderr". Also, the preferrence happens at script-creation time. At runtime, the variable $LISP is still all that matters -- should it not? [ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ] Clairvoyant, n.: A person, commonly a woman, who has the power of seeing that which is invisible to her patron -- namely, that he is a blockhead. -- Ambrose Bierce

I put on my site a cl-launch 1.87 deb that I believe fixes 384697. Testers: Please test. Uploaders: please upload. [ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ] If Java had true garbage collection, most programs would delete themselves upon execution. -- Robert Sewell On 29/08/06, Faré <fahree@gmail.com> wrote:
Due to popular request, I am working on an optional /etc/cl-launchrc feature for cl-launch. Because I allow a --no-rc option (that is enabled by default for me, you can use --rc by default), the contents of these file will be read *after* the option processing.
A cl-launchrc file may contain statements such as: system_preferred_lisps stumpwm cmucl sbcl clisp system_preferred_lisps exscribe clisp cmucl
Then remains the question of whether or not the statements should override a user-specified --lisps option. My current feeling is "yes, but issue a warning on stderr".
Also, the preferrence happens at script-creation time. At runtime, the variable $LISP is still all that matters -- should it not?
[ François-René ÐVB Rideau | Reflection&Cybernethics | http://fare.tunes.org ] Clairvoyant, n.: A person, commonly a woman, who has the power of seeing that which is invisible to her patron -- namely, that he is a blockhead. -- Ambrose Bierce

Hello! On Wed, 30 Aug 2006 01:38:30 +0200, Faré wrote:
Due to popular request, I am working on an optional /etc/cl-launchrc feature for cl-launch. [...] Also, the preferrence happens at script-creation time. At runtime, the variable $LISP is still all that matters -- should it not?
I tested your cl-launchrc feature and indeed it works as expected, but, as you wrote, at script-creation time. I think you and I are trying to solve a different problem: IMHO it's not worth supporting cl-launchrc at script-creation time, as per the following example. I, as the StumpWM maintainer, provide a general /usr/bin/stumpwm (which is a CL-Launch script, with LISPS="sbcl clisp"). Then, Joe User launches StumpWM and discovers that instead of his preferred Common Lisp (which turns out to be CLisp), the script uses SBCL (because it's the first option and it's available). So, Joe reads the StumpWM README.Debian where he finds that he can creates his own ~/bin/stumpwm via a /usr/share/doc/stumpwm/create-stumpwm-binary (provided by the StumpWM Debian package, calling `cl-launch --rc` and creating binaries in ~/bin/), specifying CLisp in his ~/.cl-launchrc. This situation is very similar to copying /usr/bin/stumpwm and modifying the LISPS variable. If a lot of CL-Launch depending packages acts like the above example, Joe User will have a crowded ~/bin/, which is something that I don't really like. And which is the "problem" I'm trying to solve. In my scenario, in fact, different CL-Launch scripts end to have only one configuration file, well, two (one general and one user-specific), instead of filling ~/bin. I'll investigate with the problem you arose in your previous posts (e.g. the --dump behavior), but I hope I have better explained my point :-) Thx, bye, Gismo / Luca

Hello! Sorry for the long delay, real life took recently quite all my free time. On Wed, 30 Aug 2006 00:13:47 +0200, Faré wrote:
On 29/08/06, Luca Capello <luca@pca.it> wrote:
check_lisp_variable () { test -r /etc/cl-launchrc && . /etc/cl-launchrc test -r "$HOME/.cl-launchrc" && . "$HOME/.cl-launchrc" test -n ${SOFTWARE_SYSTEM} && LISP=${SOFTWARE_SYSTEM} } I have several issues with such a patch:
(1) I took enough pain to get cl-launch running on a wide variety of shells (bash, zsh, posh, dash...) and I won't accept any bash-ism. Eval is OK.
I agree and I forgot to wrote that I tested my patch with dash (which AFAIK is POSIX-compliant only), without any problem. Other common tools I use for shell scripts are checkbash [1] and checkbashism [2].
(2) since we're using eval I'd rather the variable be named LISP_stumpwm or something like that.
I thought about that, too, but I found that as ATM cl-launchrc should only contains $LISP for a specific script, I preferred to use the general $LISP.
(3) this patch just won't work when we're in --dump mode, since it very wrongly overrides the $LISP from the dumped image. A script generated with --dump should NOT read any kind of cl-launchrc.
I never tested the --dump mode, so I cannot say anything. I'll investigate to find a better solution.
(4) If you hack cl-launch, you might want to run cl-launch -l "clisp sbcl cmucl gcl" -B tests from a temporary directory (complete with all installed and supported implementations). This will run the self-test.
Thank you for the hint! Thx, bye, Gismo / Luca Footnotes: [1] `apt-cache show debmake` [2] `apt-cache show devscripts`

I'm not sure we either need or want a /etc/cl-launchrc or a ~/.cl-launchrc. After all, the user (or root) may already export the variable $LISP to override things at runtime (or at dump time), whatever the --lisp or $LISPS variable be, unless explicitly prevented with a --wrap argument (or a resetting of $LISP), and I think that's all we need. I second this. As for stumpwm, note that I prefer the more versatile --init argument: '(stumpwm:stumpwm (cl-launch:getenv "DISPLAY"))' to a hardcoded :0. Oh nice enhancement ! I did not know I could do this. Thank you. -- Xavier

Your message dated Tue, 10 Oct 2006 12:14:01 -0400 with message-id <653bea160610100914x33012ee9lae2ec22eda7c7cd2@mail.gmail.com> and subject line bug closed but not automatically detected has caused the attached Bug report 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 I am talking about this indicates a serious mail system misconfiguration somewhere. Please contact me immediately.) Debian bug tracking system administrator (administrator, Debian Bugs database)

Your message dated Thu, 19 Oct 2006 19:04:31 -0400 with message-id <653bea160610191604t18d84f15qb7eec6c5c564523e@mail.gmail.com> and subject line cl-launch already offers the required configurability has caused the attached Bug report 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 I am talking about this indicates a serious mail system misconfiguration somewhere. Please contact me immediately.) Debian bug tracking system administrator (administrator, Debian Bugs database)
participants (4)
-
"Faré"
-
Luca Capello
-
owner@bugs.debian.org
-
Xavier Maillard