Bug 149397

Summary: [patch] x11-wm/stumpwm: install stumpish and other contrib
Product: Ports & Packages Reporter: swell.k <swell.k>
Component: Individual Port(s)Assignee: Ashish SHUKLA <ashish>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
a.diff none

Description swell.k 2010-08-07 14:30:07 UTC
while here reformat OPTS and add --no-sysinit
Comment 1 swell.k 2010-08-07 14:32:32 UTC
Oops, forgot about example for ~/.stumpwmrc.

--- b.diff begins here ---
diff --git x11-wm/stumpwm/Makefile x11-wm/stumpwm/Makefile
index 7fe334c..7a929a1 100644
--- x11-wm/stumpwm/Makefile
+++ x11-wm/stumpwm/Makefile
@@ -20,6 +20,7 @@ MAKE_JOBS_UNSAFE=yes
 PLIST_FILES=	bin/stumpish \
 		bin/${PORTNAME}
 INFO=		${PORTNAME}
+PORTEXAMPLES=	sample-stumpwmrc.lisp
 PORTDATA=	*
 
 OPTIONS=	SBCL "Build with lang/sbcl (otherwise with lang/clisp)" on
@@ -64,6 +65,10 @@ post-patch:	.SILENT
 
 post-install:
 	${INSTALL_SCRIPT} ${WRKSRC}/contrib/stumpish ${PREFIX}/bin
+.if !defined(NOPORTEXAMPLES)
+	${MKDIR} ${EXAMPLESDIR}
+	${INSTALL_DATA} ${WRKSRC}/${PORTEXAMPLES} ${EXAMPLESDIR}
+.endif
 .if !defined(NOPORTDATA)
 	${MKDIR} ${DATADIR}
 	${TAR} cf - -C${WRKSRC}/contrib --exclude stumpish\* . \
--- b.diff ends here ---
Comment 2 swell.k 2010-08-07 14:44:47 UTC
Damn, typo. On FreeBSD we use TMPDIR according to environ(7).

--- c.diff begins here ---
diff --git x11-wm/stumpwm/files/patch-contrib-stumpish x11-wm/stumpwm/files/patch-contrib-stumpish
index 5e65b2b..fa82173 100644
--- x11-wm/stumpwm/files/patch-contrib-stumpish
+++ x11-wm/stumpwm/files/patch-contrib-stumpish
@@ -58,7 +58,7 @@ index 1d48bb4..59c783e 100755
  	    # for backwards compatibility.
 -	    COMMANDS="${TEMP:-${TEMPDIR:-/var/tmp}}/stumpish.commands.$$"
 -	    echo `send_cmd "commands"` | sed 's/[[:space:]]\+/\n/g' | sort > "$COMMANDS"
-+	    COMMANDS="${TEMPDIR:-/tmp}/stumpish.commands.$$"
++	    COMMANDS="${TMPDIR:-/tmp}/stumpish.commands.$$"
 +	    echo `send_cmd "commands"` |
 +	    sed -E 's/[[:space:]]+/\
 +/g' |
--- c.diff ends here ---
Comment 3 Gabor Pali freebsd_committer freebsd_triage 2010-08-07 23:56:57 UTC
Responsible Changed
From-To: freebsd-ports-bugs->jacula

Over to jacula.
Comment 4 swell.k 2010-08-08 01:54:38 UTC
A few more tweaks for stumpish to make it more usable.

Note, I couldn't figure out what 's/\n\+$//' tries to accomplish.
The closest guess is for removing consecutive empty lines but it doesn't
work with textproc/gsed.

Tested on /bin/sh, bash, /usr/bin/sed, gsed.

--- d.diff begins here ---
diff --git a/files/patch-contrib-stumpish b/files/patch-contrib-stumpish
index fa82173..8098b8e 100644
--- a/files/patch-contrib-stumpish
+++ b/files/patch-contrib-stumpish
@@ -2,6 +2,9 @@
   - try to guess whether sleep(1) supports fractions
   - remove GNUisms from sed(1) lines without breaking GNU sed usage
   - use termcap names, they have higher chance to work on FreeBSD
+  - correct example line in usage
+  - prevent word splitting when reading command list
+  - remove command list on SIGINT and SIGTERM, too
 
 diff --git contrib/stumpish~ contrib/stumpish
 index 1d48bb4..59c783e 100755
@@ -30,16 +33,34 @@ index 1d48bb4..59c783e 100755
 +    echo $RESULT |
 +    sed -E 's/[^"]*"//
 +            s/"$//
-+            s/([^\])\\n/\1\
++            s/([^\\])\\n/\1\
 +/g
 +            s/\\\\n/\\n/g
 +            s/\\"/"/g
-+            s/\\n[[:space:]]+$//
++            /^$/d
 +            s/\^[*[:digit:]]{2}//g
 +            s/\^[Bbn]//g'
  }
  
  send_cmd ()
+@@ -73,7 +81,7 @@ send_cmd ()
+ usage ()
+ {
+     cat <<EOF
+-Usage: "$0" [[-e] command [args...]]
++Usage: ${0##*/} [[-e] command [args...]]
+ 
+ StumpIsh is the StumpWM shell. Use it to interact a running StumpWM
+ instance.  When run from a terminal with no arguments, stumpish
+@@ -87,7 +95,7 @@ the first is considered the name of the command to execute and the
+ remainder is concatenated to form the argument.
+ 
+ Example:
+-	echo '(group-windows (current-group))' | "$0" eval
++	echo '(group-windows (current-group))' | ${0##*/} -e eval
+ EOF
+     exit 0;
+ }
 @@ -121,24 +129,34 @@ then
  else
      if [ -t 0 ]
@@ -58,13 +79,15 @@ index 1d48bb4..59c783e 100755
  	    # for backwards compatibility.
 -	    COMMANDS="${TEMP:-${TEMPDIR:-/var/tmp}}/stumpish.commands.$$"
 -	    echo `send_cmd "commands"` | sed 's/[[:space:]]\+/\n/g' | sort > "$COMMANDS"
+-	    rlwrap -f "$COMMANDS" "$0" -r
+-	    rm -f "$COMMANDS"
 +	    COMMANDS="${TMPDIR:-/tmp}/stumpish.commands.$$"
 +	    echo `send_cmd "commands"` |
 +	    sed -E 's/[[:space:]]+/\
 +/g' |
 +	    sort > "$COMMANDS"
- 	    rlwrap -f "$COMMANDS" "$0" -r
- 	    rm -f "$COMMANDS"
++	    trap 'rm -f "$COMMANDS"' exit int term
++	    rlwrap -b '' -f "$COMMANDS" "$0" -r
  	    exit
  	fi
  
--- d.diff ends here ---
Comment 5 swell.k 2010-08-08 09:11:04 UTC
Example of how stumpish output looks like.

  $ echo '(in-package :stumpwm)' | stumpish -e eval
  #<PACKAGE "STUMPWM">

  $ echo '(group-windows (current-group))' | stumpish -e eval
  (#S(TILE-WINDOW "xterm" #x60000D)
   #S(TILE-WINDOW "ports/149397: [patch] x11-wm/stumpwm: install stumpish and other contrib - Conkeror" #x800081))

  $ stumpish
  Welcome to the STUMPwm Interactive SHell.
  Type commands for a list of commands.
  >
  Display all 148 possibilities? (y or n)
  ...
  describe-command                gnew                            number
  describe-function               gnew-float                      only
  describe-key                    gnewbg                          other
  describe-variable               gnewbg-float                    other-in-frame
  ...
  > describe-function info
  #<FUNCTION INFO>
    [compiled function]
  Lambda-list: (&OPTIONAL (FMT *WINDOW-INFO-FORMAT*))
  Derived type: (FUNCTION (&OPTIONAL T) *)
  Documentation:
    Display information about the current window.
  Source file: /usr/ports/x11-wm/stumpwm/work/stumpwm-0.9.7/window.lisp

And line editing commands still separate words by breakchars, e.g. by `-'.

BTW, I forgot to change *contrib-dir* for load-module when moved it to DATADIR.

--- e.diff begins here ---
diff --git x11-wm/stumpwm/Makefile x11-wm/stumpwm/Makefile
index 7a929a1..f832848 100644
--- x11-wm/stumpwm/Makefile
+++ x11-wm/stumpwm/Makefile
@@ -15,6 +15,7 @@ MAINTAINER=	ports@FreeBSD.org
 COMMENT=	A tiling, keyboard driven Window Manager written in Common Lisp
 
 GNU_CONFIGURE=	yes
+CONFIGURE_ARGS=	--with-contrib-dir=${DATADIR}
 MAKE_JOBS_UNSAFE=yes
 
 PLIST_FILES=	bin/stumpish \
@@ -33,10 +34,10 @@ DISTFILES+=	clx-0.7.4.tgz:clx
 .endif
 
 .if defined(WITH_SBCL)
-CONFIGURE_ARGS=	--with-lisp=sbcl
+CONFIGURE_ARGS+=	--with-lisp=sbcl
 BUILD_DEPENDS+=	sbcl:${PORTSDIR}/lang/sbcl
 .else
-CONFIGURE_ARGS=	--with-lisp=clisp
+CONFIGURE_ARGS+=	--with-lisp=clisp
 BUILD_DEPENDS+=	clisp:${PORTSDIR}/lang/clisp
 .endif
 
--- e.diff begins here ---
Comment 6 swell.k 2010-08-08 12:17:28 UTC
BTW, comments in stumpish patch are important. Do not reroll the patch[1]
for the sake of useless timestamps.

[1] e.g. by using `makepatch' target
Comment 7 swell.k 2010-08-09 11:44:51 UTC
Actually strip empty lines
--- f.diff begins here ---
diff --git x11-wm/stumpwm/files/patch-contrib-stumpish x11-wm/stumpwm/files/patch-contrib-stumpish
index 8098b8e..3c3b62c 100644
--- x11-wm/stumpwm/files/patch-contrib-stumpish
+++ x11-wm/stumpwm/files/patch-contrib-stumpish
@@ -37,9 +37,9 @@ index 1d48bb4..59c783e 100755
 +/g
 +            s/\\\\n/\\n/g
 +            s/\\"/"/g
-+            /^$/d
 +            s/\^[*[:digit:]]{2}//g
-+            s/\^[Bbn]//g'
++            s/\^[Bbn]//g' |
++    sed '/^[[:space:]]*$/d'
  }
  
  send_cmd ()
--- f.diff ends here ---
Comment 8 swell.k 2010-08-09 13:22:32 UTC
I've made a few more changes and put cumulative diff for convenience here
  ftp://ftp.lissyara.su/users/Guest/stumpwm.diff

Sorry, for the noise before.
Comment 9 swell.k 2010-08-10 18:00:19 UTC
So, the stumpish patch works even on Linux
  http://www.mail-archive.com/stumpwm-devel@nongnu.org/msg02133.html
Comment 10 swell.k 2010-09-04 18:33:13 UTC
Anonymous <swell.k@gmail.com> writes:

> I've made a few more changes and put cumulative diff for convenience here
>   ftp://ftp.lissyara.su/users/Guest/stumpwm.diff

Attaching current patch since ftp.lissyara.su is down. There were no
changes since then, I got bored very quickly.

--- stumpwm.diff begins here ---
Index: x11-wm/stumpwm/Makefile
===================================================================
RCS file: /a/.cvsup/ports/x11-wm/stumpwm/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- x11-wm/stumpwm/Makefile	14 Jun 2010 12:28:10 -0000	1.8
+++ x11-wm/stumpwm/Makefile	8 Aug 2010 09:47:25 -0000
@@ -15,10 +15,14 @@ MAINTAINER=	ports@FreeBSD.org
 COMMENT=	A tiling, keyboard driven Window Manager written in Common Lisp
 
 GNU_CONFIGURE=	yes
+CONFIGURE_ARGS=	--with-contrib-dir=${DATADIR}
 MAKE_JOBS_UNSAFE=yes
 
-PLIST_FILES=	bin/${PORTNAME}
+PLIST_FILES=	bin/stumpish \
+		bin/${PORTNAME}
 INFO=		${PORTNAME}
+PORTEXAMPLES=	sample-stumpwmrc.lisp
+PORTDATA=	*
 
 OPTIONS=	SBCL "Build with lang/sbcl (otherwise with lang/clisp)" on
 
@@ -30,10 +34,10 @@ DISTFILES+=	clx-0.7.4.tgz:clx
 .endif
 
 .if defined(WITH_SBCL)
-CONFIGURE_ARGS=	--with-lisp=sbcl
+CONFIGURE_ARGS+=	--with-lisp=sbcl
 BUILD_DEPENDS+=	sbcl:${PORTSDIR}/lang/sbcl
 .else
-CONFIGURE_ARGS=	--with-lisp=clisp
+CONFIGURE_ARGS+=	--with-lisp=clisp
 BUILD_DEPENDS+=	clisp:${PORTSDIR}/lang/clisp
 .endif
 
@@ -49,12 +53,27 @@ post-extract:	.SILENT
 	${LN} -sf ${WRKDIR}/clx*/*.asd ${WRKSRC}/cl-ppcre/*.asd ${WRKSRC}
 
 post-patch:	.SILENT
-	${REINPLACE_CMD} 's|sbcl_.*OPTS=|&--disable-debugger --no-userinit \
+	${REINPLACE_CMD} 's|sbcl_.*OPTS=|& \
+		--disable-debugger \
+		--no-userinit \
+		--no-sysinit \
 		--eval "(require :asdf)" \
-		--eval "(pop asdf:*central-registry*)" |' \
-		${WRKSRC}/Makefile.in
+		--eval "(pop asdf:*central-registry*)" \
+		|' ${WRKSRC}/Makefile.in
 	${REINPLACE_CMD} 's/\(sb-introspect:function-\)arglist/\1lambda-list/' \
 		${WRKSRC}/manual.lisp
 .endif
 
+post-install:
+	${INSTALL_SCRIPT} ${WRKSRC}/contrib/stumpish ${PREFIX}/bin
+.if !defined(NOPORTEXAMPLES)
+	${MKDIR} ${EXAMPLESDIR}
+	${INSTALL_DATA} ${WRKSRC}/${PORTEXAMPLES} ${EXAMPLESDIR}
+.endif
+.if !defined(NOPORTDATA)
+	${MKDIR} ${DATADIR}
+	${TAR} cf - -C${WRKSRC}/contrib --exclude stumpish\* . \
+		| ${TAR} xovf - -C${DATADIR}
+.endif
+
 .include <bsd.port.mk>
Index: x11-wm/stumpwm/files/patch-contrib-stumpish
===================================================================
RCS file: x11-wm/stumpwm/files/patch-contrib-stumpish
diff -N x11-wm/stumpwm/files/patch-contrib-stumpish
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ x11-wm/stumpwm/files/patch-contrib-stumpish	10 Aug 2010 16:49:41 -0000
@@ -0,0 +1,175 @@
+ - try to guess whether sleep(1) supports fractions
+ - remove GNUisms from sed(1) lines without breaking GNU sed usage
+ - try termcap(5) capabilities first
+ - correct example line in usage
+ - prevent word splitting when reading command list
+ - remove command list on SIGINT and SIGTERM, too
+ - don't use backquotes, they have side effect of removing one layer of quoting
+ - prevent glob expansion when stripping output
+
+---
+ contrib/stumpish |   93 ++++++++++++++++++++++++++++++++++++-----------------
+ 1 files changed, 63 insertions(+), 30 deletions(-)
+
+diff --git contrib/stumpish~ contrib/stumpish
+index 1d48bb4..2b0fca1 100755
+--- contrib/stumpish~
++++ contrib/stumpish
+@@ -21,19 +21,25 @@
+ 
+ ### STUMPwm Interactive SHell.
+ 
+-if sleep --version 2>/dev/null | grep -q GNU
++DELAY=0.01
++
++if ! sleep $DELAY 2>/dev/null >&2
+ then
+-    DELAY=0.1
+-else
+     DELAY=1
+ fi
+ 
++# parse C-style backslash sequences by default
++if [ "$(echo -e foo)" = foo ]; then
++    echo() { builtin echo -e "$@"; }
++fi
++
+ wait_result ()
+ {
+     while true
+     do
+-	RESULT=`xprop -root -f STUMPWM_COMMAND_RESULT 8s STUMPWM_COMMAND_RESULT 2>/dev/null`
+-
++	RESULT=$(xprop -root -f STUMPWM_COMMAND_RESULT 8s \
++	    STUMPWM_COMMAND_RESULT 2>/dev/null |
++	    sed -E 's/\\([[:digit:]]+)/\\0\1/g')
+ 	if echo "$RESULT" | grep -v -q 'not found.$'
+ 	then
+ 	    break
+@@ -49,8 +55,14 @@ wait_result ()
+ 	return 1
+     fi
+ 
+-    echo $RESULT | sed 's/[^"]*"//;s/"$//;s/\\n/\n/g;s/\\"/"/g;s/\n\+$//;
+-			s/\^[*[:digit:]]\{2\}//g;s/\^[Bbn]//g;'
++    echo "$RESULT" |
++    sed -E 's/[^"\\n]+"//
++            s/"[[:space:]]*$//
++            s/([^\\])\\n/\1\
++/g
++            s/\\(["\\n])/\1/g
++            s/\^([*[:digit:]]+|[Bbn])//g' |
++    sed '/^[[:space:]]*$/d'
+ }
+ 
+ send_cmd ()
+@@ -73,7 +85,7 @@ send_cmd ()
+ usage ()
+ {
+     cat <<EOF
+-Usage: "$0" [[-e] command [args...]]
++Usage: ${0##*/} [[-e|-r] command [args...]]
+ 
+ StumpIsh is the StumpWM shell. Use it to interact a running StumpWM
+ instance.  When run from a terminal with no arguments, stumpish
+@@ -87,11 +99,31 @@ the first is considered the name of the command to execute and the
+ remainder is concatenated to form the argument.
+ 
+ Example:
+-	echo '(group-windows (current-group))' | "$0" eval
++	echo '(group-windows (current-group))' | ${0##*/} -e eval
+ EOF
+     exit 0;
+ }
+ 
++warn ()
++{
++  {
++    tput md bold
++    tput AF setaf 1
++    echo 'WARN:\c'
++    tput me sgr0
++    echo " $*"
++  } >&2
++}
++
++tput ()
++{
++    local cap1=$1 cap2=$2
++    shift 2
++
++    command tput $cap1 $@ ||
++    command tput $cap2 $@
++}
++
+ READLINE=yes
+ 
+ if [ "x$1" = "x-r" ]
+@@ -112,7 +144,7 @@ then
+ 	fi
+ 	shift 1
+ 	IFS=''
+-	ARGS=`cat /dev/stdin`
++	ARGS=$(cat /dev/stdin)
+ 	send_cmd "$1 $ARGS"
+     else
+ 	IFS=' '
+@@ -121,37 +153,36 @@ then
+ else
+     if [ -t 0 ]
+     then
+-	if [ $READLINE = yes ] && type rlwrap >/dev/null 2>&1
++	if ! type rlwrap 2>/dev/null >&2
+ 	then
+-	    # Note: $TEMP is not conventional; it is left here purely
+-	    # for backwards compatibility.
+-	    COMMANDS="${TEMP:-${TEMPDIR:-/var/tmp}}/stumpish.commands.$$"
+-	    echo `send_cmd "commands"` | sed 's/[[:space:]]\+/\n/g' | sort > "$COMMANDS"
+-	    rlwrap -f "$COMMANDS" "$0" -r
+-	    rm -f "$COMMANDS"
++	    warn rlwrap not found, command completion won\'t work
++	elif [ $READLINE = yes ]
++	then
++	    COMMANDS="${TMPDIR:-/tmp}/stumpish.commands.$$"
++	    echo $(send_cmd "commands") |
++	    sed -E 's/[[:space:]]+/\
++/g' |
++	    sort > "$COMMANDS"
++	    trap 'rm -f "$COMMANDS"' exit int term
++	    rlwrap -b '' -f "$COMMANDS" "$0" -r
+ 	    exit
+ 	fi
+ 
+-	tput setaf 5
++	tput AF setaf 5
+         echo Welcome to the STUMPwm Interactive SHell.
+-        tput sgr0
+-        echo -n 'Type '
+-        tput setaf 2
+-        echo -n commands
+-        tput sgr0
++        tput me sgr0
++        echo 'Type \c'
++        tput AF setaf 2
++        echo 'commands\c'
++        tput me sgr0
+         echo \ for a list of commands.
+ 
+-        IFS='
+-'
+-	echo -n "> "
+-	while read REPLY
++	while read -p '> ' REPLY
+ 	do
+-	    tput bold
+-	    tput setaf 2
++	    tput md bold
++	    tput AF setaf 2
+ 	    send_cmd "$REPLY"
+-	    tput sgr0
+-
+-	    echo -n "> "
++	    tput me sgr0
+ 	done
+     else
+ 	while read REPLY
--- stumpwm.diff ends here ---
Comment 11 Gabor Pali freebsd_committer freebsd_triage 2010-09-04 21:12:13 UTC
Responsible Changed
From-To: jacula->ashish

Ashish, could you please review and commit this PR?
Comment 12 Ashish SHUKLA freebsd_committer freebsd_triage 2010-09-05 07:02:33 UTC
Hi,

I tried your diff on my 8.1-RELEASE (amd64) box and got error about exhaustion
of SBCL's control stack[1]. Could you look at the issue and send an
appropriate fix ?

References:
[1]  http://people.freebsd.org/~ashish/logs/stumpwm-0.9.7.log

Thanks
-- 
Ashish SHUKLA      | GPG: F682 CDCC 39DC 0FEA E116  20B6 C746 CFA9 E74F A4B0
freebsd.org!ashish | http://people.freebsd.org/~ashish/

Avoid Success At All Costs !!
Comment 13 swell.k 2010-09-05 09:45:48 UTC
ashish@FreeBSD.org (Ashish SHUKLA) writes:

> Hi,
>
> I tried your diff on my 8.1-RELEASE (amd64) box and got error about exhaustion
> of SBCL's control stack[1]. Could you look at the issue and send an
> appropriate fix ?

I think it's a transient error, i.e. it occurred for me but only once.
Besides, the error is not related to this PR because my patch doesn't
affect compilation nor touches the lisp code. So, it should've posed an
issue earlier, when makc@ changed default of this port to use SBCL or
even when I introduced the option.

Anyway, can you reproduce it reliably? I've tried on my old i386 box and
still can't reproduce it.

> References:
> [1]  http://people.freebsd.org/~ashish/logs/stumpwm-0.9.7.log
Comment 14 Ashish SHUKLA freebsd_committer freebsd_triage 2010-09-05 10:29:39 UTC
Anonymous  writes:
> ashish@FreeBSD.org (Ashish SHUKLA) writes:


>> Hi,
>> 
>> I tried your diff on my 8.1-RELEASE (amd64) box and got error about exhaustion
>> of SBCL's control stack[1]. Could you look at the issue and send an
>> appropriate fix ?


> I think it's a transient error, i.e. it occurred for me but only once.
> Besides, the error is not related to this PR because my patch doesn't
> affect compilation nor touches the lisp code. So, it should've posed an
> issue earlier, when makc@ changed default of this port to use SBCL or
> even when I introduced the option.


> Anyway, can you reproduce it reliably? I've tried on my old i386 box and
> still can't reproduce it.


Well yes, which is why I mentioned about that. And it occured with AMD64, do
you think we need '--dynamic-space-size' to get around this ?

Thanks
-- 
Ashish SHUKLA      | GPG: F682 CDCC 39DC 0FEA E116  20B6 C746 CFA9 E74F A4B0
freebsd.org!ashish | http://people.freebsd.org/~ashish/

Avoid Success At All Costs !!
Comment 15 swell.k 2010-09-05 12:22:32 UTC
ashish@FreeBSD.org (Ashish SHUKLA) writes:

> Anonymous  writes:
>> ashish@FreeBSD.org (Ashish SHUKLA) writes:
>
>>> Hi,
>>> 
>>> I tried your diff on my 8.1-RELEASE (amd64) box and got error about exhaustion
>>> of SBCL's control stack[1]. Could you look at the issue and send an
>>> appropriate fix ?
>
>> I think it's a transient error, i.e. it occurred for me but only once.
>> Besides, the error is not related to this PR because my patch doesn't
>> affect compilation nor touches the lisp code. So, it should've posed an
>> issue earlier, when makc@ changed default of this port to use SBCL or
>> even when I introduced the option.
>
>> Anyway, can you reproduce it reliably? I've tried on my old i386 box and
>> still can't reproduce it.
>
> Well yes, which is why I mentioned about that.

I guess should ask directly. Does it fail to build because of the patch
in *this* PR or regardless? If the latter then it requires a separate PR.

> And it occured with AMD64,

I'm using amd64, too. (see Release field in PR description)

> do you think we need '--dynamic-space-size' to get around this ?

Without a way to confirm I'm not sure. But here is how the piece from
lang/sbcl can be added to this port.

--- a.diff begins here ---
--- x11-wm/stumpwm/Makefile~
+++ x11-wm/stumpwm/Makefile
@@ -7,7 +7,7 @@
 
 PORTNAME=	stumpwm
 PORTVERSION=	0.9.7
-CATEGORIES=	x11-wm
+CATEGORIES=	x11-wm lisp
 MASTER_SITES=	SAVANNAH
 DISTFILES=	${DISTNAME}.tgz
 
@@ -36,6 +36,9 @@ DISTFILES+=	clx-0.7.4.tgz:clx
 .if defined(WITH_SBCL)
 CONFIGURE_ARGS+=	--with-lisp=sbcl
 BUILD_DEPENDS+=	sbcl:${PORTSDIR}/lang/sbcl
+. if defined(DYNAMIC_SPACE_SIZE)
+LISP_EXTRA_ARG+=--dynamic-space-size ${DYNAMIC_SPACE_SIZE}
+. endif
 .else
 CONFIGURE_ARGS+=	--with-lisp=clisp
 BUILD_DEPENDS+=	clisp:${PORTSDIR}/lang/clisp
@@ -54,6 +57,7 @@ post-extract:	.SILENT
 
 post-patch:	.SILENT
 	${REINPLACE_CMD} 's|sbcl_.*OPTS=|& \
+		${LISP_EXTRA_ARG} \
 		--disable-debugger \
 		--no-userinit \
 		--no-sysinit \
--- a.diff ends here ---
Comment 16 swell.k 2010-09-05 12:29:28 UTC
Anonymous <swell.k@gmail.com> writes:

>> do you think we need '--dynamic-space-size' to get around this ?
>
> Without a way to confirm I'm not sure. But here is how the piece from
> lang/sbcl can be added to this port.
[...]
> +. if defined(DYNAMIC_SPACE_SIZE)
> +LISP_EXTRA_ARG+=--dynamic-space-size ${DYNAMIC_SPACE_SIZE}
> +. endif

Don't define DYNAMIC_SPACE_SIZE by default in the Makefile unless
pointyhat fails to build, too.
Comment 17 Ashish SHUKLA freebsd_committer freebsd_triage 2010-09-05 18:15:20 UTC
Anonymous  writes:
> ashish@FreeBSD.org (Ashish SHUKLA) writes:


>> Anonymous  writes:
>>> ashish@FreeBSD.org (Ashish SHUKLA) writes:
>> 
>>>> Hi,
>>>> 
>>>> I tried your diff on my 8.1-RELEASE (amd64) box and got error about exhaustion
>>>> of SBCL's control stack[1]. Could you look at the issue and send an
>>>> appropriate fix ?
>> 
>>> I think it's a transient error, i.e. it occurred for me but only once.
>>> Besides, the error is not related to this PR because my patch doesn't
>>> affect compilation nor touches the lisp code. So, it should've posed an
>>> issue earlier, when makc@ changed default of this port to use SBCL or
>>> even when I introduced the option.
>> 
>>> Anyway, can you reproduce it reliably? I've tried on my old i386 box and
>>> still can't reproduce it.
>> 
>> Well yes, which is why I mentioned about that.


> I guess should ask directly. Does it fail to build because of the patch
> in *this* PR or regardless? If the latter then it requires a separate PR.


It fails even without this diff.

>> And it occured with AMD64,


> I'm using amd64, too. (see Release field in PR description)


>> do you think we need '--dynamic-space-size' to get around this ?


Okay, it's not --dynamic-space-size but --control-stack-size, after doing that
it now fails with a new error[1].

> Without a way to confirm I'm not sure. But here is how the piece from
> lang/sbcl can be added to this port.


> --- a.diff begins here ---
> --- x11-wm/stumpwm/Makefile~
> +++ x11-wm/stumpwm/Makefile
> @@ -7,7 +7,7 @@

 
>  PORTNAME=	stumpwm
>  PORTVERSION=	0.9.7
> -CATEGORIES=	x11-wm
> +CATEGORIES=	x11-wm lisp
>  MASTER_SITES=	SAVANNAH
>  DISTFILES=	${DISTNAME}.tgz

 
> @@ -36,6 +36,9 @@ DISTFILES+=	clx-0.7.4.tgz:clx
>  .if defined(WITH_SBCL)
>  CONFIGURE_ARGS+=	--with-lisp=sbcl
>  BUILD_DEPENDS+=	sbcl:${PORTSDIR}/lang/sbcl
> +. if defined(DYNAMIC_SPACE_SIZE)
> +LISP_EXTRA_ARG+=--dynamic-space-size ${DYNAMIC_SPACE_SIZE}
> +. endif
>  .else
>  CONFIGURE_ARGS+=	--with-lisp=clisp
>  BUILD_DEPENDS+=	clisp:${PORTSDIR}/lang/clisp
> @@ -54,6 +57,7 @@ post-extract:	.SILENT

 
>  post-patch:	.SILENT
>  	${REINPLACE_CMD} 's|sbcl_.*OPTS=|& \
> +		${LISP_EXTRA_ARG} \
>  		--disable-debugger \
>  		--no-userinit \
>  		--no-sysinit \
> --- a.diff ends here ---



The change is same as mentioned above with s/dynamic-space/control-stack/ .

References:
[1]  http://people.freebsd.org/~ashish/logs/stumpwm-0.9.7-2.log

HTH
-- 
Ashish SHUKLA      | GPG: F682 CDCC 39DC 0FEA E116  20B6 C746 CFA9 E74F A4B0
freebsd.org!ashish | http://people.freebsd.org/~ashish/

Avoid Success At All Costs !!
Comment 18 swell.k 2010-09-05 22:22:17 UTC
ashish@FreeBSD.org (Ashish SHUKLA) writes:

>> I guess should ask directly. Does it fail to build because of the patch
>> in *this* PR or regardless? If the latter then it requires a separate PR.
>
> It fails even without this diff.
>
>>> And it occured with AMD64,
>
>> I'm using amd64, too. (see Release field in PR description)
>
>>> do you think we need '--dynamic-space-size' to get around this ?
>
> Okay, it's not --dynamic-space-size but --control-stack-size, after doing that
> it now fails with a new error[1].
>
> The change is same as mentioned above with s/dynamic-space/control-stack/ .
>
> References:
> [1]  http://people.freebsd.org/~ashish/logs/stumpwm-0.9.7-2.log

> ; compiling (DEFUN ALLOCATE-GCONTEXT-STATE ...)
> unhandled SB-INT:SIMPLE-PROGRAM-ERROR: invalid number of arguments: 4194306

Sorry, I have no idea how to fix that. More, I consider anything that
isn't reproducable on pointyhat as weird behavior of your tinderbox
(it includes emacs-devel plist issue).

If you're gonna file a PR about it describe your environment more
accurately instead of a blanket called "tinderbox".

BTW, don't commit LISP_EXTRA_ARG patch, except for adding "lisp" category.
Perhaps, we can convert the port and the tunable to bsd.cl-asdf.mk
so that other asdf ports can benefit from it, too.
Comment 19 Ashish SHUKLA freebsd_committer freebsd_triage 2010-09-05 22:45:43 UTC
On Mon, Sep 6, 2010 at 2:52 AM, Anonymous <swell.k@gmail.com> wrote:
> ashish@FreeBSD.org (Ashish SHUKLA) writes:
>
>>> I guess should ask directly. Does it fail to build because of the patch
>>> in *this* PR or regardless? If the latter then it requires a separate P=
R.
>>
>> It fails even without this diff.
>>
>>>> And it occured with AMD64,
>>
>>> I'm using amd64, too. (see Release field in PR description)
>>
>>>> do you think we need '--dynamic-space-size' to get around this ?
>>
>> Okay, it's not --dynamic-space-size but --control-stack-size, after doin=
g that
>> it now fails with a new error[1].
>>
>> The change is same as mentioned above with s/dynamic-space/control-stack=
/ .
>>
>> References:
>> [1] =C2=A0http://people.freebsd.org/~ashish/logs/stumpwm-0.9.7-2.log
>
>> ; compiling (DEFUN ALLOCATE-GCONTEXT-STATE ...)
>> unhandled SB-INT:SIMPLE-PROGRAM-ERROR: invalid number of arguments: 4194=
306
>
> Sorry, I have no idea how to fix that. More, I consider anything that
> isn't reproducable on pointyhat as weird behavior of your tinderbox
> (it includes emacs-devel plist issue).

I try building ports on my desktop (8.1-AMD64, before building on
tinderbox. And this port is failing on my desktop. And the box which
runs Tinderbox is not my desktop.

> If you're gonna file a PR about it describe your environment more
> accurately instead of a blanket called "tinderbox".
>
> BTW, don't commit LISP_EXTRA_ARG patch, except for adding "lisp" category=
.
> Perhaps, we can convert the port and the tunable to bsd.cl-asdf.mk
> so that other asdf ports can benefit from it, too.

Whatever you decide let me know.
--=20
Ashish SHUKLA

India will always have just enough bandwidth so we can check email. -
Gautam Renjen
Comment 20 swell.k 2010-09-05 23:11:28 UTC
Ashish SHUKLA <ashish@freebsd.org> writes:

> Whatever you decide let me know.

I've already decided to forget about the compilation problem in this PR.
If you're still gonna haunt me please do so for the sh script. I haven't
received any comments regarding my attempt to port stumpish. It may as
well be a garbage since no one complained. ;) For testing you can
install stumpwm from package and trick the port to think it successfully
completed "build" step.
Comment 21 swell.k 2010-09-13 23:16:24 UTC
Not sure why this PR is stalled for an issue that's not even
reproduceable on pointyhat.

A few more changes in cumulative diff below.

- add "lisp" virtual category
- silence warnings from tput/ncurses, reported on stumpwm-devel@
- reorder comments a bit and add missing ones

--- stumpwm.diff begins here ---
Index: x11-wm/stumpwm/Makefile
===================================================================
RCS file: /a/.cvsup/ports/x11-wm/stumpwm/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- x11-wm/stumpwm/Makefile	14 Jun 2010 12:28:10 -0000	1.8
+++ x11-wm/stumpwm/Makefile	13 Sep 2010 21:17:20 -0000
@@ -7,7 +7,7 @@
 
 PORTNAME=	stumpwm
 PORTVERSION=	0.9.7
-CATEGORIES=	x11-wm
+CATEGORIES=	x11-wm lisp
 MASTER_SITES=	SAVANNAH
 DISTFILES=	${DISTNAME}.tgz
 
@@ -15,10 +15,14 @@ MAINTAINER=	ports@FreeBSD.org
 COMMENT=	A tiling, keyboard driven Window Manager written in Common Lisp
 
 GNU_CONFIGURE=	yes
+CONFIGURE_ARGS=	--with-contrib-dir=${DATADIR}
 MAKE_JOBS_UNSAFE=yes
 
-PLIST_FILES=	bin/${PORTNAME}
+PLIST_FILES=	bin/stumpish \
+		bin/${PORTNAME}
 INFO=		${PORTNAME}
+PORTEXAMPLES=	sample-stumpwmrc.lisp
+PORTDATA=	*
 
 OPTIONS=	SBCL "Build with lang/sbcl (otherwise with lang/clisp)" on
 
@@ -30,10 +34,10 @@ DISTFILES+=	clx-0.7.4.tgz:clx
 .endif
 
 .if defined(WITH_SBCL)
-CONFIGURE_ARGS=	--with-lisp=sbcl
+CONFIGURE_ARGS+=	--with-lisp=sbcl
 BUILD_DEPENDS+=	sbcl:${PORTSDIR}/lang/sbcl
 .else
-CONFIGURE_ARGS=	--with-lisp=clisp
+CONFIGURE_ARGS+=	--with-lisp=clisp
 BUILD_DEPENDS+=	clisp:${PORTSDIR}/lang/clisp
 .endif
 
@@ -49,12 +53,27 @@ post-extract:	.SILENT
 	${LN} -sf ${WRKDIR}/clx*/*.asd ${WRKSRC}/cl-ppcre/*.asd ${WRKSRC}
 
 post-patch:	.SILENT
-	${REINPLACE_CMD} 's|sbcl_.*OPTS=|&--disable-debugger --no-userinit \
+	${REINPLACE_CMD} 's|sbcl_.*OPTS=|& \
+		--disable-debugger \
+		--no-userinit \
+		--no-sysinit \
 		--eval "(require :asdf)" \
-		--eval "(pop asdf:*central-registry*)" |' \
-		${WRKSRC}/Makefile.in
+		--eval "(pop asdf:*central-registry*)" \
+		|' ${WRKSRC}/Makefile.in
 	${REINPLACE_CMD} 's/\(sb-introspect:function-\)arglist/\1lambda-list/' \
 		${WRKSRC}/manual.lisp
 .endif
 
+post-install:
+	${INSTALL_SCRIPT} ${WRKSRC}/contrib/stumpish ${PREFIX}/bin
+.if !defined(NOPORTEXAMPLES)
+	${MKDIR} ${EXAMPLESDIR}
+	${INSTALL_DATA} ${WRKSRC}/${PORTEXAMPLES} ${EXAMPLESDIR}
+.endif
+.if !defined(NOPORTDATA)
+	${MKDIR} ${DATADIR}
+	${TAR} cf - -C${WRKSRC}/contrib --exclude stumpish\* . \
+		| ${TAR} xovf - -C${DATADIR}
+.endif
+
 .include <bsd.port.mk>
Index: x11-wm/stumpwm/files/patch-contrib-stumpish
===================================================================
RCS file: x11-wm/stumpwm/files/patch-contrib-stumpish
diff -N x11-wm/stumpwm/files/patch-contrib-stumpish
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ x11-wm/stumpwm/files/patch-contrib-stumpish	13 Sep 2010 21:51:24 -0000
@@ -0,0 +1,178 @@
+ - use `echo' wrapper and work around \0XXX vs. \XXX in dash
+ - use tput(1) wrapper and try termcap(5) capabilities first
+ - remove GNUisms from sed(1) lines without breaking GNU sed usage
+ - try to guess whether sleep(1) supports fractions
+ - prevent word splitting when reading command list
+ - remove command list not only when exiting but on SIGINT and SIGTERM, too
+ - don't use backquotes, they have side effect of removing one layer of quoting
+ - prevent glob expansion when stripping output
+ - no need for persistence across reboots, use /tmp and TMPDIR from environ(7)
+ - remove workaround for `read -p', it's supported by every ash descendant
+ - correct example line in usage
+
+---
+ contrib/stumpish |   93 ++++++++++++++++++++++++++++++++++++-----------------
+ 1 files changed, 63 insertions(+), 30 deletions(-)
+
+diff --git contrib/stumpish~ contrib/stumpish
+index 1d48bb4..2b0fca1 100755
+--- contrib/stumpish~
++++ contrib/stumpish
+@@ -21,19 +21,25 @@
+ 
+ ### STUMPwm Interactive SHell.
+ 
+-if sleep --version 2>/dev/null | grep -q GNU
++DELAY=0.01
++
++if ! sleep $DELAY 2>/dev/null >&2
+ then
+-    DELAY=0.1
+-else
+     DELAY=1
+ fi
+ 
++# parse C-style backslash sequences by default
++if [ "$(echo -e foo)" = foo ]; then
++    echo() { builtin echo -e "$@"; }
++fi
++
+ wait_result ()
+ {
+     while true
+     do
+-	RESULT=`xprop -root -f STUMPWM_COMMAND_RESULT 8s STUMPWM_COMMAND_RESULT 2>/dev/null`
+-
++	RESULT=$(xprop -root -f STUMPWM_COMMAND_RESULT 8s \
++	    STUMPWM_COMMAND_RESULT 2>/dev/null |
++	    sed -E 's/\\([[:digit:]]+)/\\0\1/g')
+ 	if echo "$RESULT" | grep -v -q 'not found.$'
+ 	then
+ 	    break
+@@ -49,8 +55,14 @@ wait_result ()
+ 	return 1
+     fi
+ 
+-    echo $RESULT | sed 's/[^"]*"//;s/"$//;s/\\n/\n/g;s/\\"/"/g;s/\n\+$//;
+-			s/\^[*[:digit:]]\{2\}//g;s/\^[Bbn]//g;'
++    echo "$RESULT" |
++    sed -E 's/[^"\\n]+"//
++            s/"[[:space:]]*$//
++            s/([^\\])\\n/\1\
++/g
++            s/\\(["\\n])/\1/g
++            s/\^([*[:digit:]]+|[Bbn])//g' |
++    sed '/^[[:space:]]*$/d'
+ }
+ 
+ send_cmd ()
+@@ -73,7 +85,7 @@ send_cmd ()
+ usage ()
+ {
+     cat <<EOF
+-Usage: "$0" [[-e] command [args...]]
++Usage: ${0##*/} [[-e|-r] command [args...]]
+ 
+ StumpIsh is the StumpWM shell. Use it to interact a running StumpWM
+ instance.  When run from a terminal with no arguments, stumpish
+@@ -87,11 +99,31 @@ the first is considered the name of the command to execute and the
+ remainder is concatenated to form the argument.
+ 
+ Example:
+-	echo '(group-windows (current-group))' | "$0" eval
++	echo '(group-windows (current-group))' | ${0##*/} -e eval
+ EOF
+     exit 0;
+ }
+ 
++warn ()
++{
++  {
++    tput md bold
++    tput AF setaf 1
++    echo 'WARN:\c'
++    tput me sgr0
++    echo " $*"
++  } >&2
++}
++
++tput ()
++{
++    local cap1=$1 cap2=$2
++    shift 2
++
++    command tput $cap1 $@ 2>/dev/null ||
++    command tput $cap2 $@ 2>/dev/null
++}
++
+ READLINE=yes
+ 
+ if [ "x$1" = "x-r" ]
+@@ -112,7 +144,7 @@ then
+ 	fi
+ 	shift 1
+ 	IFS=''
+-	ARGS=`cat /dev/stdin`
++	ARGS=$(cat /dev/stdin)
+ 	send_cmd "$1 $ARGS"
+     else
+ 	IFS=' '
+@@ -121,37 +153,36 @@ then
+ else
+     if [ -t 0 ]
+     then
+-	if [ $READLINE = yes ] && type rlwrap >/dev/null 2>&1
++	if ! type rlwrap 2>/dev/null >&2
+ 	then
+-	    # Note: $TEMP is not conventional; it is left here purely
+-	    # for backwards compatibility.
+-	    COMMANDS="${TEMP:-${TEMPDIR:-/var/tmp}}/stumpish.commands.$$"
+-	    echo `send_cmd "commands"` | sed 's/[[:space:]]\+/\n/g' | sort > "$COMMANDS"
+-	    rlwrap -f "$COMMANDS" "$0" -r
+-	    rm -f "$COMMANDS"
++	    warn rlwrap not found, command completion won\'t work
++	elif [ $READLINE = yes ]
++	then
++	    COMMANDS="${TMPDIR:-/tmp}/stumpish.commands.$$"
++	    echo $(send_cmd "commands") |
++	    sed -E 's/[[:space:]]+/\
++/g' |
++	    sort > "$COMMANDS"
++	    trap 'rm -f "$COMMANDS"' exit int term
++	    rlwrap -b '' -f "$COMMANDS" "$0" -r
+ 	    exit
+ 	fi
+ 
+-	tput setaf 5
++	tput AF setaf 5
+         echo Welcome to the STUMPwm Interactive SHell.
+-        tput sgr0
+-        echo -n 'Type '
+-        tput setaf 2
+-        echo -n commands
+-        tput sgr0
++        tput me sgr0
++        echo 'Type \c'
++        tput AF setaf 2
++        echo 'commands\c'
++        tput me sgr0
+         echo \ for a list of commands.
+ 
+-        IFS='
+-'
+-	echo -n "> "
+-	while read REPLY
++	while read -p '> ' REPLY
+ 	do
+-	    tput bold
+-	    tput setaf 2
++	    tput md bold
++	    tput AF setaf 2
+ 	    send_cmd "$REPLY"
+-	    tput sgr0
+-
+-	    echo -n "> "
++	    tput me sgr0
+ 	done
+     else
+ 	while read REPLY
--- stumpwm.diff ends here ---
Comment 22 Ashish SHUKLA freebsd_committer freebsd_triage 2010-09-14 10:42:28 UTC
Hi,

This port built fine on 8.0-amd64 in tinderbox. Let me try building it on
other platforms as well.

-- 
Ashish SHUKLA      | GPG: F682 CDCC 39DC 0FEA E116  20B6 C746 CFA9 E74F A4B0
freebsd.org!ashish | http://people.freebsd.org/~ashish/

Avoid Success At All Costs !!
Comment 23 dfilter service freebsd_committer freebsd_triage 2010-09-15 12:57:04 UTC
ashish      2010-09-15 11:56:58 UTC

  FreeBSD ports repository

  Modified files:
    x11-wm/stumpwm       Makefile 
  Added files:
    x11-wm/stumpwm/files patch-contrib-stumpish 
  Log:
  - Add to "lisp" virtual category
  - Install stumpish and other contrib stuff
  - Add LICENSE
  
  PR:             ports/149397
  Submitted by:   Anonymous <swell.k at gmail.com>
  Approved by:    tabthorpe (mentor)
  
  Revision  Changes    Path
  1.9       +30 -7     ports/x11-wm/stumpwm/Makefile
  1.1       +178 -0    ports/x11-wm/stumpwm/files/patch-contrib-stumpish (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 24 Ashish SHUKLA freebsd_committer freebsd_triage 2010-09-15 12:57:47 UTC
State Changed
From-To: open->closed

Committed, with minor changes. Thanks!