zsh-workers
 help / color / mirror / code / Atom feed
* Re: Want to replace bash w zsh as system shell on Ubuntu
       [not found] ` <87vdefkeuf.fsf@ft.bewatermyfriend.org>
@ 2010-02-02 15:06   ` Peter Stephenson
  2010-02-03 13:38     ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2010-02-02 15:06 UTC (permalink / raw)
  To: Zsh Hackers' List

On Tue, 02 Feb 2010 13:21:44 +0100
Frank Terbeck <ft@bewatermyfriend.org> wrote:
> One of the problems (which was worked around after four years in debian)
> was a script defining a function called `repeat'. That's also a shell
> reserved word in zsh, leading to a parsing error. If zsh would disable
> `repeat' in sh mode, which would also be correct, that problem would be
> gone.
> 
> The other problem mentioned in grml's FAQ is #329288[1], where the
> problem is a script using `ulimit'. In sh mode, zsh does not make
> `ulimit' available as a builtin command. The guy responding to the bug
> report closed the bug, stating that zsh in sh mode is not a POSIX
> compatible shell and therefore not supported. I guess strictly speaking,
> you cannot dispute that - although sh mode is trying as hard as possible
> to be compatible. Demanding POSIX here is kind of a two sided sword,
> though. If you look at the actual standard for ulimit[2] you'll find
> that `ulimit' is only an extension to the standard.

I'm perfectly happy to change things like this if it's more convenient.
Emulations aren't there to keep normal zsh users happy, so *backwards*
compatibility is not the issue for once.  (If ulimit is allowed as an
extension, then making it available is presumably not making any
compatibility problems worse.)

This makes it possible to have loadable features available in emulation
mode, makes the "ulimit" builtin one such, and disables "repeat" in emulation
mode.  I'm not sure how sophisticated this would need to be; having things
other than parameters different in different (non-native) emulation modes
is a complexity it would be good to avoid.

Would need some documentation.

Index: Etc/zsh-development-guide
===================================================================
RCS file: /cvsroot/zsh/zsh/Etc/zsh-development-guide,v
retrieving revision 1.22
diff -u -r1.22 zsh-development-guide
--- Etc/zsh-development-guide	11 May 2009 09:03:28 -0000	1.22
+++ Etc/zsh-development-guide	2 Feb 2010 14:57:45 -0000
@@ -198,12 +198,16 @@
   - nozshdep        non-empty indicates no dependence on the `zsh/main'
                     pseudo-module
   - alwayslink      if non-empty, always link the module into the executable
-  - autobins        builtins defined by the module, for autoloading
-  - autoinfixconds  infix condition codes defined by the module, for
-                    autoloading (without the leading `-')
-  - autoprefixconds like autoinfixconds, but for prefix condition codes
-  - autoparams      parameters defined by the module, for autoloading
-  - automathfuncs   math functions defined by the module, for autoloading
+  - autofeatures    features defined by the module for autoloading,
+                    a space-separated list.  The syntax for features is as
+                    for zmodload -F, e.g. b:mybin refers to the builtin
+                    mybin.  This replaces the previous mechanism with
+                    separate variables for builtins, conditions, math
+                    functions and parameters.  Note the features are only
+		    available in zsh's native mode, not in emulation modes.
+  - autofeatures_emu As autofeatures, but the features so presented are
+                    available in modes that are *not* zsh's native mode.
+		    The variable autofeatures must also be present.
   - objects         .o files making up this module (*must* be defined)
   - proto           .syms files for this module (default generated from $objects)
   - headers         extra headers for this module (default none)
Index: Src/builtin.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/builtin.c,v
retrieving revision 1.237
diff -u -r1.237 builtin.c
--- Src/builtin.c	29 Jan 2010 21:44:59 -0000	1.237
+++ Src/builtin.c	2 Feb 2010 14:57:45 -0000
@@ -206,6 +206,17 @@
     }
 }
 
+/**/
+void
+init_builtins(void)
+{
+    if (!EMULATION(EMULATE_ZSH)) {
+	HashNode hn = reswdtab->getnode2(reswdtab, "repeat");
+	if (hn)
+	    reswdtab->disablenode(hn, 0);
+    }
+}
+
 /* Make sure we have space for a new option and increment. */
 
 #define OPT_ALLOC_CHUNK 16
Index: Src/init.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/init.c,v
retrieving revision 1.109
diff -u -r1.109 init.c
--- Src/init.c	27 Jan 2010 19:25:34 -0000	1.109
+++ Src/init.c	2 Feb 2010 14:57:45 -0000
@@ -1443,6 +1443,7 @@
     setupvals();
     init_signals();
     init_bltinmods();
+    init_builtins();
     run_init_scripts();
     init_misc();
 
Index: Src/mkbltnmlst.sh
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/mkbltnmlst.sh,v
retrieving revision 1.10
diff -u -r1.10 mkbltnmlst.sh
--- Src/mkbltnmlst.sh	11 Feb 2009 20:42:16 -0000	1.10
+++ Src/mkbltnmlst.sh	2 Feb 2010 14:57:45 -0000
@@ -37,18 +37,38 @@
         echo "/* non-linked-in known module \`$x_mod' */"
 	linked=no
     esac
-    unset moddeps autofeatures
+    unset moddeps autofeatures autofeatures_emu
     . $srcdir/../$modfile
     if test "x$autofeatures" != x; then
-	echo "  if (EMULATION(EMULATE_ZSH)) {"
-	echo "    char *features[] = { "
-	for feature in $autofeatures; do
-	    echo "      \"$feature\","
-	done
-	echo "      NULL"
-	echo "    }; "
-	echo "    autofeatures(\"zsh\", \"$x_mod\", features, 0, 1);"
-	echo "  }"
+        if test "x$autofeatures_emu" != x; then
+            echo "  {"
+	    echo "    char *zsh_features[] = { "
+	    for feature in $autofeatures; do
+		echo "      \"$feature\","
+	    done
+	    echo "      NULL"
+	    echo "    }; "
+	    echo "    char *emu_features[] = { "
+	    for feature in $autofeatures_emu; do
+		echo "      \"$feature\","
+	    done
+	    echo "      NULL"
+	    echo "    }; "
+	    echo "    autofeatures(\"zsh\", \"$x_mod\","
+	    echo "       EMULATION(EMULATE_ZSH) ? zsh_features : emu_features,"
+	    echo "       0, 1);"
+	    echo "  }"
+        else
+	    echo "  if (EMULATION(EMULATE_ZSH)) {"
+	    echo "    char *features[] = { "
+	    for feature in $autofeatures; do
+		echo "      \"$feature\","
+	    done
+	    echo "      NULL"
+	    echo "    }; "
+	    echo "    autofeatures(\"zsh\", \"$x_mod\", features, 0, 1);"
+	    echo "  }"
+	fi
     fi
     for dep in $moddeps; do
 	echo "  add_dep(\"$x_mod\", \"$dep\");"
Index: Src/Builtins/rlimits.mdd
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Builtins/rlimits.mdd,v
retrieving revision 1.4
diff -u -r1.4 rlimits.mdd
--- Src/Builtins/rlimits.mdd	20 Jun 2007 20:59:17 -0000	1.4
+++ Src/Builtins/rlimits.mdd	2 Feb 2010 14:57:46 -0000
@@ -3,6 +3,7 @@
 load=yes
 
 autofeatures="b:limit b:ulimit b:unlimit"
+autofeatures_emu="b:ulimit"
 
 objects="rlimits.o"
 

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Want to replace bash w zsh as system shell on Ubuntu
  2010-02-02 15:06   ` Want to replace bash w zsh as system shell on Ubuntu Peter Stephenson
@ 2010-02-03 13:38     ` Peter Stephenson
  2010-02-03 13:42       ` Peter Stephenson
  2010-02-03 13:50       ` Frank Terbeck
  0 siblings, 2 replies; 4+ messages in thread
From: Peter Stephenson @ 2010-02-03 13:38 UTC (permalink / raw)
  To: Zsh Hackers' List

On Tue, 2 Feb 2010 15:06:39 +0000
Peter Stephenson <pws@csr.com> wrote:
> Would need some documentation.

This, I think.  The fact that ulimit is now present when starting in an
emulation mode (I'm not sure of the best way to phrase that) doesn't need
documenting, we never actually said it wasn't, which is an omission given
it's listed as a builtin (hence the sched change, too).

Index: Doc/Zsh/builtins.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/builtins.yo,v
retrieving revision 1.129
diff -u -r1.129 builtins.yo
--- Doc/Zsh/builtins.yo	5 Jan 2010 16:29:35 -0000	1.129
+++ Doc/Zsh/builtins.yo	3 Feb 2010 13:01:46 -0000
@@ -872,6 +872,10 @@
 sitem(var(n)tt(m))(megabytes or minutes)
 sitem([var(mm)tt(:)]var(ss))(minutes and seconds)
 endsitem()
+
+The tt(limit) command is not made available by default when the
+shell starts in a mode emulating another shell.  It can be made available
+with the command `tt(zmodload -F zsh/rlimits b:limit)'.
 )
 findex(local)
 item(tt(local) [ {tt(PLUS())|tt(-)}tt(AEFHUahlprtux) ] \
@@ -1286,6 +1290,10 @@
 For historical reasons, `tt(set -)' is treated as `tt(set +xv)'
 and `tt(set -) var(args)' as `tt(set +xv --) var(args)' when in
 any other emulation mode than zsh's native mode.
+
+The tt(sched) builtin is not made available by default when the shell
+starts in a mode emulating another shell.  It can be made available
+with the command `tt(zmodload -F zsh/sched b:sched)'.
 )
 module(setcap)(zsh/cap)
 findex(setopt)
@@ -1794,6 +1802,10 @@
 the hard resource limit for each var(resource) is removed.
 The resources of the shell process are only changed if the tt(-s)
 flag is given.
+
+The tt(limit) command is not made available by default when the
+shell starts in a mode emulating another shell.  It can be made available
+with the command `tt(zmodload -F zsh/rlimits b:unlimit)'.
 )
 findex(unset)
 cindex(parameters, unsetting)
Index: Doc/Zsh/grammar.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/grammar.yo,v
retrieving revision 1.17
diff -u -r1.17 grammar.yo
--- Doc/Zsh/grammar.yo	15 Sep 2009 13:51:19 -0000	1.17
+++ Doc/Zsh/grammar.yo	3 Feb 2010 13:01:46 -0000
@@ -222,6 +222,10 @@
 var(word) is expanded and treated as an arithmetic expression,
 which must evaluate to a number var(n).
 var(list) is then executed var(n) times.
+
+The tt(repeat) syntax is disabled by default when the
+shell starts in a mode emulating another shell.  It can be enabled
+with the command `tt(enable -r repeat)'
 )
 findex(case)
 cindex(case selection)

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Want to replace bash w zsh as system shell on Ubuntu
  2010-02-03 13:38     ` Peter Stephenson
@ 2010-02-03 13:42       ` Peter Stephenson
  2010-02-03 13:50       ` Frank Terbeck
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2010-02-03 13:42 UTC (permalink / raw)
  To: Zsh Hackers' List

Peter Stephenson wrote:
> +The tt(limit) command is not made available by default when the
> +shell starts in a mode emulating another shell.  It can be made available
> +with the command `tt(zmodload -F zsh/rlimits b:unlimit)'.

Should be "The tt(unlimit) command...", I've fixed that.

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Want to replace bash w zsh as system shell on Ubuntu
  2010-02-03 13:38     ` Peter Stephenson
  2010-02-03 13:42       ` Peter Stephenson
@ 2010-02-03 13:50       ` Frank Terbeck
  1 sibling, 0 replies; 4+ messages in thread
From: Frank Terbeck @ 2010-02-03 13:50 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh Hackers' List

Peter Stephenson wrote:
> On Tue, 2 Feb 2010 15:06:39 +0000
> Peter Stephenson <pws@csr.com> wrote:
>> Would need some documentation.
>
> This, I think.  The fact that ulimit is now present when starting in an
> emulation mode (I'm not sure of the best way to phrase that) doesn't need
> documenting, we never actually said it wasn't, which is an omission given
> it's listed as a builtin (hence the sched change, too).
[...]
> +The tt(limit) command is not made available by default when the
       ^^^^^^^^^-- tt(unlimit), right?

> +shell starts in a mode emulating another shell.  It can be made available
> +with the command `tt(zmodload -F zsh/rlimits b:unlimit)'.

Apart from that, I think this covers the changes nicely.

Regards, Frank

-- 
In protocol design, perfection has been reached not when there is
nothing left to add, but when there is nothing left to take away.
                                                  -- RFC 1925


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-02-03 13:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20100202081546.GA5930@panix.com>
     [not found] ` <87vdefkeuf.fsf@ft.bewatermyfriend.org>
2010-02-02 15:06   ` Want to replace bash w zsh as system shell on Ubuntu Peter Stephenson
2010-02-03 13:38     ` Peter Stephenson
2010-02-03 13:42       ` Peter Stephenson
2010-02-03 13:50       ` Frank Terbeck

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).