zsh-workers
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* Re: kill problem on Ultrix
       [not found]     <7461.199506041454@stone.dcs.warwick.ac.uk>
@ 1995-06-04 17:28  7% ` Marek Andricik
  0 siblings, 0 replies; 200+ results
From: Marek Andricik @ 1995-06-04 17:28 UTC (permalink / raw)
  To: zsh-workers

Zefram wrote:
> 
> >42 hron /..nt/PVS/andricik % zsh-2.6-beta9 -f
> >hron% kill -l
> >HUP INT QUIT ILL TRAP IOT
> 
> Could you post the contents of your signal.h header to the list?  It is very
> relevant to this matter.
> 

    Here it is, /usr/include/signal.h.  I've tried to force the cc compiler
but the result was the same (configure found gcc and used it by default).
The signals.h file in gcc's tree differs a bit. Mostly the __mips symbols
are changed to __mips__. Is it also important? If it is, tell me and I'll
send the diff. Thanks a lot.

							Bye, Marek


/*	@(#)signal.h	2.8	(ULTRIX)	11/9/89	*/

/************************************************************************
 *									*
 *			Copyright (c) 1987-1989 by			*
 *		Digital Equipment Corporation, Maynard, MA		*
 *			All rights reserved.				*
 *									*
 *   This software is furnished under a license and may be used and	*
 *   copied  only  in accordance with the terms of such license and	*
 *   with the  inclusion  of  the  above  copyright  notice.   This	*
 *   software  or  any  other copies thereof may not be provided or	*
 *   otherwise made available to any other person.  No title to and	*
 *   ownership of the software is hereby transferred.			*
 *									*
 *   This software is  derived  from  software  received  from  the	*
 *   University    of   California,   Berkeley,   and   from   Bell	*
 *   Laboratories.  Use, duplication, or disclosure is  subject  to	*
 *   restrictions  under  license  agreements  with  University  of	*
 *   California and with AT&T.						*
 *									*
 *   The information in this software is subject to change  without	*
 *   notice  and should not be construed as a commitment by Digital	*
 *   Equipment Corporation.						*
 *									*
 *   Digital assumes no responsibility for the use  or  reliability	*
 *   of its software on equipment which is not supplied by Digital.	*
 *									*
 ************************************************************************/
/************************************************************************
 *			Modification History				*
 *									*
 *	Debby Haeck 11/14/90						*
 *		added new Vector Arithmetic Exception handling codes	*
 *	Debby Haeck 9/4/90						*
 *		added new u_code for vector support			*
 *		ILL_VECOP_FAULT, ILL_VECINST_FAULT, TERM_VECT_HARD and	*
 *		TERM_VECT_TOOMANY					*
 *	Tak Yin Wong 3/390                                              *
 *		Add ifdef's for POSIX and XOPEN                         *
 *	Linda Wilson 9/12/89                                            *
 *		typedef sigset_t for X/OPEN			        *
 *	Linda Wilson 9/12/89                                            *
 *      	ifdef out sigmask for POSIX                             *
 *	Jon Reeves 7/14/89						*
 *		Add X/Open mandated function declarations.		*
 *	Jon Reeves 5/16/89						*
 *		Add new BRK_STACKOVERFLOW def from MIPS 2.0 cmplrs	*
 *	Jon Reeves 5/12/89						*
 *		Add raise() and sig_atomic_t for ANSI			*
 *	Mark Parenti 2/06/88						*
 *		Change SA_CLDSTOP to SA_NOCLDSTOP per POSIX change	*
 *	Fred Glover 1/12/88						*
 *		Add SIGLOST - server crash Sys-V lock notification      *
 *									*
 *	Larry Cohen 10/1/85						*
 *		Add SIGWINCH - window change signal			*
 *									*
 *	Greg Depp  25 Jun 85						*
 *	Moved SIGUSR1 and SIGUSR2 to 30 and 31 to conform with Berkeley *
 *									*
 *	David L Ballenger, 28-Mar-1985					*
 * 0001 Add definitions for System V compatibility			*
 *									*
 ************************************************************************/


#ifndef	_SIGNAL_H_
#define _SIGNAL_H_

#ifdef KERNEL
#include "../h/ansi_compat.h"
#else
#include <ansi_compat.h>
#endif

#if !defined(_POSIX_SOURCE)
#define NSIG	32
#endif /* !defined(_POSIX_SOURCE) */

#define	SIGHUP     1	/* hangup */
#define	SIGINT     2	/* interrupt */
#define	SIGQUIT    3	/* quit */
#define	SIGILL     4	/* illegal instruction (not reset when caught) */

#if !defined(_POSIX_SOURCE)
#define	    ILL_RESAD_FAULT	0x0	/* reserved addressing fault */
#define	    ILL_PRIVIN_FAULT	0x1	/* privileged instruction fault */
#define	    ILL_RESOP_FAULT	0x2	/* reserved operand fault */
#define	    ILL_VECOP_FAULT	0x100	/* illegal vector opcode */
#define	    ILL_VECINST_FAULT	0x101	/* legal vector opcode on vector    */
					/* absent or non-vector capable sys */
/* CHME, CHMS, CHMU are not yet given back to users reasonably */
#endif /* !defined(_POSIX_SOURCE) */

#define	SIGTRAP    5	/* trace trap (not reset when caught) */
#define	SIGIOT     6	/* IOT instruction */
#define	SIGEMT     7	/* EMT instruction */
#define	SIGFPE     8	/* floating point exception */

#if !defined(_POSIX_SOURCE)
#define	    FPE_INTOVF_TRAP	0x1	/* integer overflow */
#define	    FPE_INTDIV_TRAP	0x2	/* integer divide by zero */
#define	    FPE_FLTOVF_TRAP	0x3	/* floating overflow */
#define	    FPE_FLTDIV_TRAP	0x4	/* floating/decimal divide by zero */
#define	    FPE_FLTUND_TRAP	0x5	/* floating underflow */
#define	    FPE_DECOVF_TRAP	0x6	/* decimal overflow */
#define	    FPE_SUBRNG_TRAP	0x7	/* subscript out of range */
#define	    FPE_FLTOVF_FAULT	0x8	/* floating overflow fault */
#define	    FPE_FLTDIV_FAULT	0x9	/* divide by zero floating fault */
#define	    FPE_FLTUND_FAULT	0xa	/* floating underflow fault */

/* the following are used to for Vector Arithmetic Exception handling */

#define	FPE_VECTOR           0x3e0	/* Vector Arithmetic Exception Mask */
#define	VFPE_FLTUND_TRAP      0x20	/* Floating Underflow */
#define	VFPE_FLTDIV_TRAP      0x40	/* Floating Divide by Zero */
#define	VFPE_FLTRSV_TRAP      0x80	/* Floating Reserved Operan */
#define	VPFE_FLTOVF_FAULT   0x0100	/* Floating Overflow */
#define	VFPE_INTOVF_TRAP    0x0200	/* Integer Overflow */
#endif /* !defined(_POSIX_SOURCE) */

#define	SIGKILL    9	/* kill (cannot be caught or ignored) */
#define	SIGBUS    10	/* bus error */
#define	SIGSEGV   11	/* segmentation violation */
#define	SIGSYS    12	/* bad argument to system call */
#define	SIGPIPE   13	/* write on a pipe with no one to read it */
#define	SIGALRM   14	/* alarm clock */
#define	SIGTERM   15	/* software termination signal from kill */

#if !defined(_POSIX_SOURCE)
#define	    TERM_VECT_HARD	0x1	/* terminated - vector hardware err */
#define	    TERM_VECT_TOOMANY	0x2	/* terminated - too many vect procs */
#endif /* !defined(_POSIX_SOURCE) */

#define	SIGURG    16	/* urgent condition on IO channel */
#define	SIGSTOP   17	/* sendable stop signal not from tty */
#define	SIGTSTP   18	/* stop signal from tty */
#define	SIGCONT   19	/* continue a stopped process */
#define	SIGCHLD   20	/* to parent on child stop or exit */
#define	SIGTTIN   21	/* to readers pgrp upon background tty read */
#define	SIGTTOU   22	/* like TTIN for output if (tp->t_local&LTOSTOP) */
#define	SIGIO     23	/* input/output possible signal */
#define	SIGXCPU   24	/* exceeded CPU time limit */
#define	SIGXFSZ   25	/* exceeded file size limit */
#define	SIGVTALRM 26	/* virtual time alarm */
#define	SIGPROF   27	/* profiling time alarm */
#define SIGWINCH  28	/* window size changes */
#define SIGLOST	  29	/* Sys-V rec lock: notify user upon server crash */
#define SIGUSR1   30	/* User signal 1 (from SysV) */
#define SIGUSR2   31	/* User signal 2 (from SysV) */

/* Add System V signal definitions (DLB001) */
#define SIGCLD	SIGCHLD	/* System V name for SIGCHLD	*/
#define SIGABRT	SIGIOT	/* Added from BRL package for /usr/group. Signal
			 * returned by abort(3C).  Map onto SIGIOT.
			 */

#if !defined(_POSIX_SOURCE)
#ifdef __mips
/*
 * Codes for the mips break instruction.
 */
#define	BRK_USERBP	0	/* user bp (used by debuggers) */
#define	BRK_KERNELBP	1	/* kernel bp (used by prom) */
#define	BRK_ABORT	2	/* no longer used */
#define	BRK_BD_TAKEN	3	/* for taken bd emulation */
#define	BRK_BD_NOTTAKEN	4	/* for not taken bd emulation */
#define	BRK_SSTEPBP	5	/* user bp (used by debuggers) */
#define	BRK_OVERFLOW	6	/* overflow check */
#define	BRK_DIVZERO	7	/* divide by zero check */
#define	BRK_RANGE	8	/* range error check */
#define	BRK_STACKOVERFLOW	9	/* used by Ada */
#endif /* __mips */
#endif /* !defined(_POSIX_SOURCE) */

#if defined(__vax) || (defined(__mips) && defined(__LANGUAGE_C))
#ifndef	__SYSTEM_FIVE

/* Accesses to sig_atomic_t are atomic, even with async interrupts.
   Not an issue for us, but ANSI requires the definition. */
typedef long	sig_atomic_t;
typedef int sigset_t;	/* type used for sigsetops() functions  */

#if !defined(_POSIX_SOURCE)
/*
 * Signal vector "template" used in sigvec call.
 */
struct	sigvec {
	void	 (*sv_handler)();	/* signal handler */
	sigset_t sv_mask;		/* signal mask to apply */
	int	sv_flags;		/* see signal options below */
};
#endif /* !defined(_POSIX_SOURCE) */

/*
 * The following structure must be exactly the same as the above structure
 * with the names changed for POSIX compliance.
 */
struct	sigaction {
	void	 (*sa_handler)();	/* signal handler */
	sigset_t sa_mask;		/* signal mask to apply */
	int	 sa_flags;		/* see signal options below */
};

#if !defined(_POSIX_SOURCE)
#define SV_ONSTACK      0x0001  /* take signal on signal stack */
#define SV_INTERRUPT    0x0002  /* do not restart system on signal return */
#endif /* !defined(_POSIX_SOURCE) */

#define	SA_NOCLDSTOP	0x0004	/* Don't generate SIGCLD when children stop */

#if !defined(_POSIX_SOURCE)
#define	SV_OLDSIG	0x1000	/* Emulate old signal() for POSIX */
#define sv_onstack sv_flags     /* isn't compatibility wonderful! */
#endif /* !defined(_POSIX_SOURCE) */


/* Defines for sigprocmask() call. POSIX.
 */
#define	SIG_BLOCK	1		/* Add these signals to block mask	*/
#define	SIG_UNBLOCK	2		/* Remove these signals from block mask */
#define	SIG_SETMASK	3		/* Set block mask to this mask		*/


#if !defined(_POSIX_SOURCE)
/*
 * Structure used in sigstack call.
 */
struct	sigstack {
	char	*ss_sp;			/* signal stack pointer */
	int	ss_onstack;		/* current status */
};

/*
 * Information pushed on stack when a signal is delivered.
 * This is used by the kernel to restore state following
 * execution of the signal handler.  It is also made available
 * to the handler to allow it to properly restore state if
 * a non-standard exit is performed.
 *
#ifdef __vax
 *	XXX - sigcontext needs updating per 4.3BSD - rr
 *
#endif __vax
#ifdef __mips
 * WARNING: THE sigcontext MUST BE KEPT CONSISTENT WITH /usr/include/setjmp.h
 * AND THE LIBC ROUTINES setjmp() AND longjmp()
#endif __mips
 */
struct	sigcontext {
#ifdef __mips
	/*
	 * BEGIN REGION THAT MUST CORRESPOND WITH setjmp.h
	 * BEGIN REGION THAT MUST CORRESPOND WITH A jmp_buf
	 */
#endif /* __mips */
	int	sc_onstack;		/* sigstack state to restore */
	int	sc_mask;		/* signal mask to restore */
#ifdef __vax
	int	sc_sp;			/* sp to restore */
	int	sc_pc;			/* pc to retore */
	int	sc_ps;			/* psl to restore */
#endif /* __vax */
#ifdef __mips
	int	sc_pc;			/* pc at time of signal */
	/*
	 * General purpose registers
	 */
	int	sc_regs[32];	/* processor regs 0 to 31 */
	int	sc_mdlo;	/* mul/div low */
	int	sc_mdhi;	/* mul/div high */
	/*
	 * Floating point coprocessor state
	 */
	int	sc_ownedfp;	/* fp has been used */
	int	sc_fpregs[32];	/* fp regs 0 to 31 */
	int	sc_fpc_csr;	/* floating point control and status reg */
	int	sc_fpc_eir;	/* floating point exception instruction reg */
	/*
	 * END OF REGION THAT MUST AGREE WITH setjmp.h
	 * END OF jmp_buf REGION
	 */
	/*
	 * System coprocessor registers at time of signal
	 */
	int	sc_cause;	/* cp0 cause register */
	int	sc_badvaddr;	/* cp0 bad virtual address */
	int	sc_badpaddr;	/* cpu bd bad physical address */
#endif /* __mips */
};
#endif /* !defined(_POSIX_SOURCE) */
#endif	/* __SYSTEM_FIVE */

#if !defined(_POSIX_SOURCE)
#define	BADSIG		((void (*)())(-1))
#endif /* !defined(_POSIX_SOURCE) */

#define	SIG_ERR		((void (*)())(-1))
#define	SIG_DFL		((void (*)())( 0))
#define	SIG_IGN		((void (*)())( 1))


#ifdef KERNEL
#define	SIG_CATCH	((void (*)())( 2))
#define	SIG_HOLD	((void (*)())( 3))
#else /* KERNEL */

#ifdef __STDC__

#ifndef _PID_T_
#define _PID_T_
typedef int pid_t;
#endif /* _PID_T_ */
/*
 *  prototypes
 *
 */
extern void	(*signal(int __sig, void(*__func)(int)))(int);
int	raise( int __sig );
int 	kill( pid_t __pid, int __sig );
int 	sigemptyset( sigset_t *__set );
int 	sigfillset( sigset_t *__set );
int 	sigaddset( sigset_t *__set, int __signo );
int	sigdelset( sigset_t *__set, int __signo );
int	sigismember( const sigset_t *__set, int __signo );
int 	sigaction( int __sig, const struct sigaction *__act,
		struct sigaction *__oact );
int 	sigprocmask( int __how, const sigset_t *__set, sigset_t *__oset );
int	sigpending( sigset_t *__set );
int	sigsuspend( const sigset_t *__sigmask );

#else
extern void		(*signal())();
extern int		raise();
extern int		kill();
extern int		sigaction(), sigaddset(), sigdelset(), sigemptyset(), 				sigfillset(), sigismember(), sigpending(), 
			sigprocmask(), sigsuspend();
#endif /* __STDC__ */
#endif /* KERNEL */
#endif /* defined(__vax) || (defined(__mips) && defined(__LANGUAGE_C)) */

/*
 * Macro for converting signal number to a mask suitable for
 * sigblock().
 */


#if !defined(_POSIX_SOURCE)
#define sigmask(m)	(1 << ((m)-1))
#endif /* !defined(_POSIX_SOURCE) */
#endif /* _SIGNAL_H_ */


--
                                          Marek Andricik, nick Nevedko
                 andricik@hron.ef.tuke.sk, andricik@derpi.tuwien.ac.at
... theyJustTakeCareOfNumberOneAndNumberOneAintYouYouAintEvenNumberTwo
                                                          [FrankZappa]


^ permalink raw reply	[relevance 7%]

* Re: Z-Shell Frequently-Asked Questions (monthly posting)
       [not found]     <26983.9506231110@pyro.swan.ac.uk>
@ 1995-06-28 19:16  5% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1995-06-28 19:16 UTC (permalink / raw)
  To: zsh-workers

> B1) Differences from sh and ksh
> ...
>   Command line substitutions, globbing etc.:

Just one addition here: foo=* assignment assigns the list of files in the
current directory as an array to foo if there are at least two matches, or if
there is a single file in the directory, foo becames a scalar whose value is
the name of that file. Other Bourne shells does not glob the right hand side
of assignments. In my releases the default behaviour is to not glob here, but
this can be changed by setting the GLOB_ASSIGN option.

>     The $((...)) version of numeric evaluation was not available before
>       version 2.6 (use $[...]).

And even in vanila 2.6 $((...)) is done after fork, hence if used as an
argument to an external program, assignments inside $((...) has no effect. Of
course this bug is also fixed in my release.

>     Treatment of backslashes within backquotes is subtly different.

I still do not know about such differences. I use zsh as /bin/sh without
probles, so there are probably no differences. Either remove that not, or give
an example.

>     $PSn do not do parameter substitution by default (use PROMPT_SUBST).

And even if PROMPT_SUBST is set, things like ${foo#*bar} does not work
properly in prompts. Thats also fixed in my release.

>   However, zsh has no claims towards Posix compliancy and will not use

Could anyone tell me how zsh differs from POSIX if invoked as sh?

There is an other thing where zsh differs from e.g. bash: characters in the
range 0x80-0x9b (or may be between 0x80-0x9f) cannot be used in scripts and
such characters in backquote or parameter substitutions are discarded (or
interpreted in a completely wrong way). That because these are used for
tokenization, hence to fix it, major parts of zsh would have to be rewritten.

>   ...
>   Of course, this makes zsh rather large and quite messy so that it

But zsh is only a little bit larger than bash or tcsh, and it seems to use
much less memory and CPU time than tcsh.

Cheers,
  Zoltan


^ permalink raw reply	[relevance 5%]

* Re: Serious HP-UX problem ! Shell hangs !
  @ 1995-07-06 22:45  6% ` Richard Coleman
  1995-07-07 11:30  0%   ` P.Stephenson
  1995-07-07 13:58  0%   ` chen
  0 siblings, 2 replies; 200+ results
From: Richard Coleman @ 1995-07-06 22:45 UTC (permalink / raw)
  To: zsh-workers

> > This is a *serious* HP-UX 9 problem of the zsh, which it didn't have
> > with previous versions (not with beta6 at least).
> > 
> >   Situation :
> > 
> >   $ sleep 10 (any process will do)
> >   [Ctrl-Z] 
> >   zsh: 16763 suspended  sleep 10
> >   $ sleep 5 (any process)
> >   *hang*
> > 
> > Fiddling with gdb shows that we are hanging in sigsuspend(), which is
> > called exactly once: signals.c with POSIX_SIGNALS defined.
> 
> This is a quite old problem (it is present at least since beta6). It is OS
> dependent, and it is also present on ULTRIX. As I remember it appeared after
> Richard rewrote the signals code. He promised to fix that.

I don't have any HP or DEC machines, so it is difficult for me to
track down.  Does this still happen if you change POSIX_SIGNALS to
BSD_SIGNALS?  It might be bugs in the Posix code for these machines.
If this fixes it, I can just force configure to use BSD signals on
these machines.

rc


^ permalink raw reply	[relevance 6%]

* Re: Serious HP-UX problem ! Shell hangs !
  1995-07-06 22:45  6% ` Richard Coleman
@ 1995-07-07 11:30  0%   ` P.Stephenson
  1995-07-07 13:58  0%   ` chen
  1 sibling, 0 replies; 200+ results
From: P.Stephenson @ 1995-07-07 11:30 UTC (permalink / raw)
  To: Zsh hackers list

coleman@math.gatech.edu wrote:
> > > This is a *serious* HP-UX 9 problem of the zsh, which it didn't have
> > > with previous versions (not with beta6 at least).
> > > 
> > >   Situation :
> > > 
> > >   $ sleep 10 (any process will do)
> > >   [Ctrl-Z] 
> > >   zsh: 16763 suspended  sleep 10
> > >   $ sleep 5 (any process)
> > >   *hang*
> > 
> > This is a quite old problem (it is present at least since beta6). It is OS
> > dependent, and it is also present on ULTRIX. As I remember it appeared afte
> r
> > Richard rewrote the signals code. He promised to fix that.
> 
> I don't have any HP or DEC machines, so it is difficult for me to
> track down.  Does this still happen if you change POSIX_SIGNALS to
> BSD_SIGNALS?  It might be bugs in the Posix code for these machines.
> If this fixes it, I can just force configure to use BSD signals on
> these machines.

I can't reproduce this bug at all for Ultrix 4.3, even with
POSIX_SIGNALS.

-- 
Peter Stephenson <P.Stephenson@swansea.ac.uk>  Tel: +44 1792 205678 extn. 4461
WWW:  http://python.swan.ac.uk/~pypeters/      Fax: +44 1792 295324
Department of Physics, University of Wales, Swansea,
Singleton Park, Swansea, SA2 8PP, U.K.


^ permalink raw reply	[relevance 0%]

* Re: Serious HP-UX problem ! Shell hangs !
  1995-07-06 22:45  6% ` Richard Coleman
  1995-07-07 11:30  0%   ` P.Stephenson
@ 1995-07-07 13:58  0%   ` chen
  1995-07-07 20:05  0%     ` Zoltan Hidvegi
  1 sibling, 1 reply; 200+ results
From: chen @ 1995-07-07 13:58 UTC (permalink / raw)
  To: zsh-workers

Richard Coleman writes:
> > > This is a *serious* HP-UX 9 problem of the zsh, which it didn't have
> > > with previous versions (not with beta6 at least).
> > > 
> > >   Situation :
> > > 
> > >   $ sleep 10 (any process will do)
> > >   [Ctrl-Z] 
> > >   zsh: 16763 suspended  sleep 10
> > >   $ sleep 5 (any process)
> > >   *hang*
> > > 
> > > Fiddling with gdb shows that we are hanging in sigsuspend(), which is
> > > called exactly once: signals.c with POSIX_SIGNALS defined.
> > 
> > This is a quite old problem (it is present at least since beta6). It is OS
> > dependent, and it is also present on ULTRIX. As I remember it appeared after
> > Richard rewrote the signals code. He promised to fix that.
> 
> I don't have any HP or DEC machines, so it is difficult for me to
> track down.  Does this still happen if you change POSIX_SIGNALS to
> BSD_SIGNALS?  It might be bugs in the Posix code for these machines.
> If this fixes it, I can just force configure to use BSD signals on
> these machines.

I have been unable to reproduce this problem.

6 ~ chen@gar$ uname -a
HP-UX gar A.09.03 A 9000/720 2000519265 two-user license
7 ~ chen@gar$ echo $ZSH_VERSION
2.6-beta10
8 ~ chen@gar$ sleep 10

zsh: 11651 suspended  sleep 10
9 ~ chen@gar$ sleep 5
10 ~ chen@gar$ jobs
[1]  + suspended  sleep 10
11 ~ chen@gar$ fg
[1]  + continued  sleep 10
12 ~ chen@gar$ jobs
13 ~ chen@gar$



I build zsh (and all other autoconf-based software) with
	CC="c89 -D_HPUX_SOURCE" configure
and below is the config.cache I have accumulated:

# This file is a shell script that caches the results of configure
# tests run on this system so they can be shared between configure
# scripts and configure runs.  It is not useful on other systems.
# If it contains results you don't want to keep, you may remove or edit it.
#
# By default, configure uses ./config.cache as the cache file,
# creating it if it does not exist already.  You can give configure
# the --cache-file=FILE option to use a different cache file; that is
# what configure does when it calls configure scripts in
# subdirectories, so they share the cache.
# Giving --cache-file=/dev/null disables caching, for debugging configure.
# config.status only pays attention to the cache file if you give it the
# --recheck option to rerun configure.
#
: ${ac_cv_c_const='yes'}
: ${ac_cv_c_cross='no'}
: ${ac_cv_c_stack_direction='1'}
: ${ac_cv_check_symbol__sys_siglist='no'}
: ${ac_cv_check_symbol_sys_siglist='no'}
: ${ac_cv_decl_sys_siglist='no'}
: ${ac_cv_func__getpty='no'}
: ${ac_cv_func__setjmp='yes'}
: ${ac_cv_func_access='yes'}
: ${ac_cv_func_alarm='yes'}
: ${ac_cv_func_alloca='no'}
: ${ac_cv_func_closedir_void='no'}
: ${ac_cv_func_difftime='yes'}
: ${ac_cv_func_dup2='yes'}
: ${ac_cv_func_ftime='yes'}
: ${ac_cv_func_getcwd='yes'}
: ${ac_cv_func_getdomainname='yes'}
: ${ac_cv_func_getdtablesize='no'}
: ${ac_cv_func_getgroups='yes'}
: ${ac_cv_func_gethostent='yes'}
: ${ac_cv_func_gethostname='yes'}
: ${ac_cv_func_getloadavg='no'}
: ${ac_cv_func_getloadavg_setgid='no'}
: ${ac_cv_func_getlogin='yes'}
: ${ac_cv_func_getpagesize='no'}
: ${ac_cv_func_getpgrp_void='yes'}
: ${ac_cv_func_gettimeofday='yes'}
: ${ac_cv_func_getwd='no'}
: ${ac_cv_func_grantpt='no'}
: ${ac_cv_func_killpg='no'}
: ${ac_cv_func_link='yes'}
: ${ac_cv_func_memcpy='yes'}
: ${ac_cv_func_mkdir='yes'}
: ${ac_cv_func_mkfifo='yes'}
: ${ac_cv_func_mkstemp='yes'}
: ${ac_cv_func_mktemp='yes'}
: ${ac_cv_func_poll='yes'}
: ${ac_cv_func_psignal='no'}
: ${ac_cv_func_rand48='no'}
: ${ac_cv_func_random='no'}
: ${ac_cv_func_select='yes'}
: ${ac_cv_func_setegid='no'}
: ${ac_cv_func_seteuid='no'}
: ${ac_cv_func_setlinebuf='no'}
: ${ac_cv_func_setlocale='yes'}
: ${ac_cv_func_setpgid='yes'}
: ${ac_cv_func_setregid='no'}
: ${ac_cv_func_setresuid='yes'}
: ${ac_cv_func_setreuid='no'}
: ${ac_cv_func_setsid='yes'}
: ${ac_cv_func_setuid='yes'}
: ${ac_cv_func_setvbuf='yes'}
: ${ac_cv_func_setvbuf_reversed='no'}
: ${ac_cv_func_sigaction='yes'}
: ${ac_cv_func_sigaltstack='no'}
: ${ac_cv_func_sigblock='yes'}
: ${ac_cv_func_sighold='no'}
: ${ac_cv_func_sigprocmask='yes'}
: ${ac_cv_func_sigrelse='no'}
: ${ac_cv_func_sigsetmask='yes'}
: ${ac_cv_func_sigstack='yes'}
: ${ac_cv_func_sigvec='no'}
: ${ac_cv_func_strchr='yes'}
: ${ac_cv_func_strcoll='yes'}
: ${ac_cv_func_strerror='yes'}
: ${ac_cv_func_strftime='yes'}
: ${ac_cv_func_strrchr='yes'}
: ${ac_cv_func_strsignal='no'}
: ${ac_cv_func_strstr='yes'}
: ${ac_cv_func_strtol='yes'}
: ${ac_cv_func_system='yes'}
: ${ac_cv_func_tcgetattr='yes'}
: ${ac_cv_func_tcsetpgrp='yes'}
: ${ac_cv_func_times='yes'}
: ${ac_cv_func_tmpfile='yes'}
: ${ac_cv_func_ttyname='yes'}
: ${ac_cv_func_unlink='yes'}
: ${ac_cv_func_utime='yes'}
: ${ac_cv_func_utimes='no'}
: ${ac_cv_func_vfork='yes'}
: ${ac_cv_func_vprintf='yes'}
: ${ac_cv_func_wait3='no'}
: ${ac_cv_func_waitpid='yes'}
: ${ac_cv_header_alloca_h='no'}
: ${ac_cv_header_ctype_h='yes'}
: ${ac_cv_header_dirent_dirent_h='yes'}
: ${ac_cv_header_elf_h='no'}
: ${ac_cv_header_errno_h='yes'}
: ${ac_cv_header_fcntl_h='yes'}
: ${ac_cv_header_getopt_h='no'}
: ${ac_cv_header_inq_stats_cpustats_h='no'}
: ${ac_cv_header_ioctl_h='no'}
: ${ac_cv_header_libc_h='no'}
: ${ac_cv_header_limits_h='yes'}
: ${ac_cv_header_locale_h='yes'}
: ${ac_cv_header_mach_mach_h='no'}
: ${ac_cv_header_malloc_h='yes'}
: ${ac_cv_header_memory_h='yes'}
: ${ac_cv_header_minix_config_h='no'}
: ${ac_cv_header_nlist_h='yes'}
: ${ac_cv_header_poll_h='yes'}
: ${ac_cv_header_select_h='no'}
: ${ac_cv_header_setjmp_h='yes'}
: ${ac_cv_header_sgtty_h='yes'}
: ${ac_cv_header_siginfo_h='no'}
: ${ac_cv_header_signal_h='yes'}
: ${ac_cv_header_stat_broken='no'}
: ${ac_cv_header_stdc='yes'}
: ${ac_cv_header_stddef_h='yes'}
: ${ac_cv_header_stdio_h='yes'}
: ${ac_cv_header_stdlib_h='yes'}
: ${ac_cv_header_string_h='yes'}
: ${ac_cv_header_stropts_h='no'}
: ${ac_cv_header_sys_cpustats_h='no'}
: ${ac_cv_header_sys_dg_sys_info_h='no'}
: ${ac_cv_header_sys_filio_h='no'}
: ${ac_cv_header_sys_ioctl_h='yes'}
: ${ac_cv_header_sys_param_h='yes'}
: ${ac_cv_header_sys_ptem_h='no'}
: ${ac_cv_header_sys_resource_h='yes'}
: ${ac_cv_header_sys_select_h='no'}
: ${ac_cv_header_sys_socket_h='yes'}
: ${ac_cv_header_sys_stat_h='yes'}
: ${ac_cv_header_sys_stream_h='no'}
: ${ac_cv_header_sys_systeminfo_h='no'}
: ${ac_cv_header_sys_time_h='yes'}
: ${ac_cv_header_sys_timeb_h='yes'}
: ${ac_cv_header_sys_times_h='yes'}
: ${ac_cv_header_sys_types_h='yes'}
: ${ac_cv_header_sys_utsname_h='yes'}
: ${ac_cv_header_sys_wait_h='yes'}
: ${ac_cv_header_termcap_h='no'}
: ${ac_cv_header_termio_h='yes'}
: ${ac_cv_header_termios_h='yes'}
: ${ac_cv_header_time='yes'}
: ${ac_cv_header_time_h='yes'}
: ${ac_cv_header_unistd_h='yes'}
: ${ac_cv_header_utime_h='yes'}
: ${ac_cv_header_values_h='yes'}
: ${ac_cv_header_vfork_h='no'}
: ${ac_cv_lib_ICE='no'}
: ${ac_cv_lib_PW='yes'}
: ${ac_cv_lib_curses='yes'}
: ${ac_cv_lib_dir='no'}
: ${ac_cv_lib_dnet='no'}
: ${ac_cv_lib_dnet_stub='no'}
: ${ac_cv_lib_elf='no'}
: ${ac_cv_lib_fl='no'}
: ${ac_cv_lib_gen='no'}
: ${ac_cv_lib_getloadavg='no'}
: ${ac_cv_lib_intl='no'}
: ${ac_cv_lib_kvm='no'}
: ${ac_cv_lib_nsl='no'}
: ${ac_cv_lib_seq='no'}
: ${ac_cv_lib_socket='no'}
: ${ac_cv_lib_sun='no'}
: ${ac_cv_lib_termcap='yes'}
: ${ac_cv_lib_termlib='yes'}
: ${ac_cv_lib_ucb='no'}
: ${ac_cv_lib_util='no'}
: ${ac_cv_os_cray='no'}
: ${ac_cv_path_AWKPATH='/usr/bin/awk'}
: ${ac_cv_path_PERLPATH='/usr/bin/perl'}
: ${ac_cv_path_install='./install-sh -c'}
: ${ac_cv_path_x='no_x= ac_x_includes=/usr/include/X11R5 ac_x_libraries=/usr/lib/X11R5'}
: ${ac_cv_prog_AR='ar'}
: ${ac_cv_prog_AWK='gawk'}
: ${ac_cv_prog_CC='c89 -D_HPUX_SOURCE'}
: ${ac_cv_prog_COULD_BE_SCO='maybenot'}
: ${ac_cv_prog_CPP='c89 -D_HPUX_SOURCE -E'}
: ${ac_cv_prog_LEX='flex'}
: ${ac_cv_prog_LINT='lint'}
: ${ac_cv_prog_LN_S='ln -s'}
: ${ac_cv_prog_NROFF='nroff -man'}
: ${ac_cv_prog_RANLIB='ranlib'}
: ${ac_cv_prog_RSH='remsh'}
: ${ac_cv_prog_YACC='bison -y'}
: ${ac_cv_prog_cc_c89_c_o='yes'}
: ${ac_cv_prog_cc_stdc=''}
: ${ac_cv_prog_gcc='no'}
: ${ac_cv_prog_make_make_set='yes'}
: ${ac_cv_sizeof_long='4'}
: ${ac_cv_struct_nlist_n_un='no'}
: ${ac_cv_struct_st_blksize='yes'}
: ${ac_cv_struct_st_blocks='yes'}
: ${ac_cv_struct_st_rdev='yes'}
: ${ac_cv_struct_tm='time.h'}
: ${ac_cv_sys_long_file_names='yes'}
: ${ac_cv_td_popen='no'}
: ${ac_cv_td_size_t='yes'}
: ${ac_cv_td_yyerror='no'}
: ${ac_cv_type_mode_t='yes'}
: ${ac_cv_type_off_t='yes'}
: ${ac_cv_type_pid_t='yes'}
: ${ac_cv_type_signal='void'}
: ${ac_cv_type_size_t='yes'}
: ${ac_cv_type_uid_t='yes'}
: ${make_cv_sysconf_open_max='yes'}
: ${make_cv_union_wait='no'}
: ${zsh_cv_func_ut_host_in_utmp='yes'}
: ${zsh_cv_getpgrp_takes_arguments='no'}
: ${zsh_cv_have_nis='yes'}
: ${zsh_cv_have_superroot='no'}
: ${zsh_cv_include_defines_ospeed='no'}
: ${zsh_cv_must_define_ospeed='no'}
: ${zsh_cv_sigset_t='yes'}
: ${zsh_cv_sys_errlist='no'}
: ${zsh_cv_sys_posix_termios='yes'}
: ${zsh_cv_sys_tiocgwinsz_in_termios_h='yes'}

-- 
Franklin Chen                                              chen@adi.com
Applied Dynamics International
3800 Stone School Road
Ann Arbor, MI 48108-2499


^ permalink raw reply	[relevance 0%]

* Re: Serious HP-UX problem ! Shell hangs !
  1995-07-07 13:58  0%   ` chen
@ 1995-07-07 20:05  0%     ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1995-07-07 20:05 UTC (permalink / raw)
  To: chen

Franklin Chen wrote:
> Richard Coleman writes:
> > > > This is a *serious* HP-UX 9 problem of the zsh, which it didn't have
> > > > with previous versions (not with beta6 at least).
> > > > 
> > > >   Situation :
> > > > 
> > > >   $ sleep 10 (any process will do)
> > > >   [Ctrl-Z] 
> > > >   zsh: 16763 suspended  sleep 10
> > > >   $ sleep 5 (any process)
> > > >   *hang*
> > > > 
> > > > Fiddling with gdb shows that we are hanging in sigsuspend(), which is
> > > > called exactly once: signals.c with POSIX_SIGNALS defined.
> > > 
> > > This is a quite old problem (it is present at least since beta6). It is OS
> > > dependent, and it is also present on ULTRIX. As I remember it appeared after
> > > Richard rewrote the signals code. He promised to fix that.
> > 
> > I don't have any HP or DEC machines, so it is difficult for me to
> > track down.  Does this still happen if you change POSIX_SIGNALS to
> > BSD_SIGNALS?  It might be bugs in the Posix code for these machines.
> > If this fixes it, I can just force configure to use BSD signals on
> > these machines.
> 
> I have been unable to reproduce this problem.
> 
> 6 ~ chen@gar$ uname -a
> HP-UX gar A.09.03 A 9000/720 2000519265 two-user license
> 7 ~ chen@gar$ echo $ZSH_VERSION
> 2.6-beta10
> 8 ~ chen@gar$ sleep 10
> 
> zsh: 11651 suspended  sleep 10
> 9 ~ chen@gar$ sleep 5
> 10 ~ chen@gar$ jobs
> [1]  + suspended  sleep 10
> 11 ~ chen@gar$ fg
> [1]  + continued  sleep 10
> 12 ~ chen@gar$ jobs
> 13 ~ chen@gar$
> 
> 
> 
> I build zsh (and all other autoconf-based software) with
> 	CC="c89 -D_HPUX_SOURCE" configure

This bug seems to be compiler dependent. Here is a quotion from my BUGS file:


------------------------------------------------------------------------
On ULTRIX 4.2, if NOTIFY is unset, zsh gets SEGV each time a background
job terminates if compiled with gcc-2.6.3 or c89. It does not happen
with cc (non-ANSI compiler, ansi2knr is used). Terminal suspension
does not seem work regardless of the compiler. HP-UX seems to have
similar problems.
------------------------------------------------------------------------

And with gcc 2.6.3 on ultrix 4.2 ^Z does not work. The job won'n continue
after ^Z but the shell also hangs.

Bye,
  Zoltan


^ permalink raw reply	[relevance 0%]

* A couple of queries
@ 1995-07-09  4:28  5% Zefram
  1995-07-09  4:53  5% ` Richard Coleman
  0 siblings, 1 reply; 200+ results
From: Zefram @ 1995-07-09  4:28 UTC (permalink / raw)
  To: Z Shell workers mailing list

-----BEGIN PGP SIGNED MESSAGE-----

In glob.c, in the function file_type() (which contains the delightful
comment "screw POSIX"), there is commented-out code that would return a
character '&' instead of '@' for a symbolic link that doesn't point
anywhere accessible.  Considering that compatibility with "ls -F" isn't
really an issue here (and '%' and '#' are returned for devices which ls
doesn't do), why is this code not used?

Secondly, I had an idea for a new option for a couple of builtins.
compctl has an option -L that makes zsh output the actual compctl
commands that one would have to input in order to get to the current
set of completion options.  A similar option would be very useful for
alias, bindkey (especially), limit, sched and typeset.  (typeset -L is
already taken, so it would have to be something else, but the others
can be -L.)  These options would not only be useful in normal use of
the shell, but would also simplify the reporter script greatly (which
btw won't run here -- awk syntax errors).  This option could be added
to each of the builtins quite easily, and without (much) risk of
breaking anything else.  What are people's opinions on this idea?
Richard, would you be willing to add this to the baseline before the
2.7 release?

 -zefram

-----BEGIN PGP SIGNATURE-----
Version: 2.6.i

iQBVAgUBL/9a32WJ8JfKi+e9AQGF7AH9HAhCS6kfVrKN66tXP6mjG255v4GkEmAS
2Ffm2ABz/NS3YpuGkDBeAV7ZwagpCdVSJFFSlwQCZiW/zLioO4yt8A==
=M++8
-----END PGP SIGNATURE-----


^ permalink raw reply	[relevance 5%]

* Re: A couple of queries
  1995-07-09  4:28  5% A couple of queries Zefram
@ 1995-07-09  4:53  5% ` Richard Coleman
  1995-07-09  5:47  7%   ` Zefram
  0 siblings, 1 reply; 200+ results
From: Richard Coleman @ 1995-07-09  4:53 UTC (permalink / raw)
  To: zsh-workers

> In glob.c, in the function file_type() (which contains the delightful
> comment "screw POSIX"), there is commented-out code that would return a
> character '&' instead of '@' for a symbolic link that doesn't point
> anywhere accessible.  Considering that compatibility with "ls -F" isn't
> really an issue here (and '%' and '#' are returned for devices which ls
> doesn't do), why is this code not used?

I haven't seen that code.  I was going to remove that comment, but forgot.
The code has been posix-ified considerably since the start of the 2.6
cycle.

> Secondly, I had an idea for a new option for a couple of builtins.
> compctl has an option -L that makes zsh output the actual compctl
> commands that one would have to input in order to get to the current
> set of completion options.  A similar option would be very useful for
> alias, bindkey (especially), limit, sched and typeset.  (typeset -L is
> already taken, so it would have to be something else, but the others
> can be -L.)  These options would not only be useful in normal use of
> the shell, but would also simplify the reporter script greatly (which
> btw won't run here -- awk syntax errors).  This option could be added
> to each of the builtins quite easily, and without (much) risk of
> breaking anything else.  What are people's opinions on this idea?
> Richard, would you be willing to add this to the baseline before the
> 2.7 release?

I'm not against adding them if they don't add too much code.  I think these
would be useful.  But I would prefer to use the same option for all of them.
So we need an option letter that is free on all of these builtins, and would
have to change compctl -L to match this.  Since compctl -L is new, this
shouldn't cause too much problem.  Also, in order to make things easier,
I would prefer that the changes to each builtin be put in a separate patch
if possible.

But I would prefer that we wait until the next beta release before this is
implemented.  My box is overflowing with patches.  I'm in the process
of making more changes to the code dealing with internal hash tables.  So
any patch adding these features would be broken by the time I receive it.
Also, with the big patches from Peter (for the history code) and some of the
other big patches, the code will change a lot in the next couple of releases.

Also, just to let everyone know, I'll probably also add the compctl -Q option
either in this release or the next one.

But, my current priority is still to continue the process of cleaning up the
code.  I want to fix the structural problems first, so things like Peter's
patch for history.c will go in first.  I'm also doing some work on param.c.

So the next beta release might take a while.  So what I'll probably do is
make code snapshots (test releases) available starting in about a week,
so people can help me work out all the bugs I'll probably be adding.

rc


^ permalink raw reply	[relevance 5%]

* Re: A couple of queries
  1995-07-09  4:53  5% ` Richard Coleman
@ 1995-07-09  5:47  7%   ` Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1995-07-09  5:47 UTC (permalink / raw)
  To: Richard Coleman

-----BEGIN PGP SIGNED MESSAGE-----

>I haven't seen that code.  I was going to remove that comment, but forgot.
>The code has been posix-ified considerably since the start of the 2.6
>cycle.

The code in that function seems to indicate that S_IF* isn't POSIX.
Not having a copy of POSIX.1 (and the library here won't open for a
while :-(), can someone confirm that this is the case?  Should the code
be rewritten to use the (ugly, less efficient) S_IS* macros?

>I'm not against adding them if they don't add too much code.  I think these
>would be useful.  But I would prefer to use the same option for all of them.
>So we need an option letter that is free on all of these builtins, and would
>have to change compctl -L to match this.  Since compctl -L is new, this
>shouldn't cause too much problem.

I'd like them all to use the same letter, and was rather disappointed
to see that typeset -L is taken.  -L is a very obvious, quite intuitive
choice, so personally I'd be prepared to have an exception.  I would
probably have chosen -Q.

If we want them *all* to be the same letter, the possibilities are -J,
- -M, -U, -V, -W, -Y, -w and -y, assuming -Q is taken by compctl.  (Hmm,
I hope we don't start needing to use digits for compctl, it's terribly
ugly (why did we do that with zsh's command line options?))  None of
these is anywhere near as good as -L; can someone come up with a
rational reason to pick one of them?  Perhaps -M for coMMands?

>But I would prefer that we wait until the next beta release before this is
>implemented.  My box is overflowing with patches.  I'm in the process
>of making more changes to the code dealing with internal hash tables.  So
>any patch adding these features would be broken by the time I receive it.

I don't think so.  Most of the listing code is there already -- I'll
just need to add a little code to output in a different format.  It's a
fundamentally simple addition.  Anyway, I'll wait for the next beta
before writing this stuff.

 -zefram

-----BEGIN PGP SIGNATURE-----
Version: 2.6.i

iQBVAgUBL/9tWWWJ8JfKi+e9AQGG9gH8D6R7CNNYlLOtDorySrrmFR8lS3YrFjUb
UNhpCrtbXeqMBOUAhoVJs6VGX6vim12nV0BkWuctCeemzL5DCKkFWw==
=s7Jb
-----END PGP SIGNATURE-----


^ permalink raw reply	[relevance 7%]

* size glob qualifier patch
  @ 1995-09-22 22:42  3% ` Thorsten Meinecke
  0 siblings, 0 replies; 200+ results
From: Thorsten Meinecke @ 1995-09-22 22:42 UTC (permalink / raw)
  To: zsh-workers

In message #346, Subject: Re: zshexpn(1) doc suggestion,
Peter Stephenson <P.Stephenson@swansea.ac.uk> wrote:

>This is not exactly relevant, but I've always wanted the L (size)
>qualifier to accept k or m (or K or M) as modifiers.  I never seem to
>want to check for anything smaller than about 50k, in which case
>zeros proliferate.

This is maybe not exactly what you want, but it is easy to mimic
the behaviour of find(1)'s -size option, with modifiers similiar
to those used by the time glob qualifiers. The relevant part of
the zshexpn.1 man page would then read: 

              L[+|-]n
                     files  less  than  n  bytes (-), more than n
                     bytes (+), or exactly n bytes in length.  If
                     this flag is directly followed by a k (K), m
                     (M), or p (P) (e.g. Lk+50) the check is per-
                     formed  with kilobytes, megabytes, or blocks
                     (of 512 bytes) instead.

Since I'm used to the use of Kbyte (2^10) to denote the difference
to the SI-prefix k (10^3), it seems preferable to accept these
modifiers case-insensitive.

What this patch does. Data is passed to the qual*() functions by
means of parameter, and of a couple of static vars. Of those, which
are reloaded each time before a different function is called, `timef'
as time multiplier was renamed to `units' and serves now as size mul-
tiplier, too. In qualsize(), the range adjustment for e.g.

       `*(Lk1)' == `find . -size 1k' == 1 .. 1024 bytes

is done by adding factor-1 before the division by factor, thus re-
quiring an unsigned var. For size qualifier without unit modifier,
operation hasn't changed.

Side notes:

o  The size code has still a hard limit, in that it will break when
   there are filesizes greater than One Less Than Two Gigabytes
   (2^31-1) on machines with 32-bit longs. What about POSIX (off_t)?

o  Is it considered useful to have Yet Another Globbing Qualifier,
   e.g. B, for size globbing based on the real amount of disk space
   used, as opposed to the `length' of possibly sparse files now?
   Cf. du(1)

o  Would it be fun if there was a zsh shell function as a find(1)-
   compatible front-end, or converter, to zsh's globbing capabilities?
   That is, long option names are easier to remember than one-letter
   qualifiers.


This is for hzoli10.3, but should also apply to plain zsh-2.6-beta10.

*** Doc/zshexpn.1.ORIG	Wed Sep 20 16:33:57 1995
--- Doc/zshexpn.1	Fri Sep 22 15:27:48 1995
***************
*** 643,649 ****
  .TP
  \fBL\fI[+|-]n\fR
  files less than n bytes (-), more than n bytes (+), or
! exactly n bytes in length.
  .TP
  \fB^\fP
  negates all qualifiers following it
--- 643,652 ----
  .TP
  \fBL\fI[+|-]n\fR
  files less than n bytes (-), more than n bytes (+), or
! exactly n bytes in length. If this flag is directly followed by a \fBk\fP
! (\fBK\fP), \fBm\fP (\fBM\fP), or \fBp\fP (\fBP\fP) (e.g. \fBLk+50\fP)
! the check is performed with kilobytes, megabytes, or blocks (of 512 bytes)
! instead.
  .TP
  \fB^\fP
  negates all qualifiers following it
*** Src/glob.c.ORIG	Wed Sep 20 16:34:03 1995
--- Src/glob.c	Fri Sep 22 15:17:38 1995
***************
*** 49,60 ****
--- 49,67 ----
  typedef struct stat *Statptr;	 /* This makes the Ultrix compiler happy.  Go figure. */
  #endif
  
+ /* modifier for unit conversions */
+ 
  #define TT_DAYS 0
  #define TT_HOURS 1
  #define TT_MINS 2
  #define TT_WEEKS 3
  #define TT_MONTHS 4
  
+ #define TT_BYTES 0
+ #define TT_POSIX_BLOCKS 1
+ #define TT_KILOBYTES 2
+ #define TT_MEGABYTES 3
+ 
  /* max # of qualifiers */
  
  typedef int (*TestMatchFunc) _((struct stat *, long));
***************
*** 67,73 ****
      int sense;			/* Whether asserting or negating             */
      int amc;			/* Flag for which time to test (a, m, c)     */
      int range;			/* Whether to test <, > or = (as per signum) */
!     int timef;			/* Multiplier for time                       */
  };
  
  /* Qualifiers pertaining to current pattern */
--- 74,80 ----
      int sense;			/* Whether asserting or negating             */
      int amc;			/* Flag for which time to test (a, m, c)     */
      int range;			/* Whether to test <, > or = (as per signum) */
!     int units;			/* Multiplier for time or size, respectively */
  };
  
  /* Qualifiers pertaining to current pattern */
***************
*** 75,81 ****
  
  /* Other state values for current pattern */
  static int qualct, qualorct;
! static int range, amc, timef;
  static int gf_nullglob, gf_markdirs, gf_noglobdots, gf_listtypes;
  
  /* Prefix, suffix for doing zle trickery */
--- 82,88 ----
  
  /* Other state values for current pattern */
  static int qualct, qualorct;
! static int range, amc, units;
  static int gf_nullglob, gf_markdirs, gf_noglobdots, gf_listtypes;
  
  /* Prefix, suffix for doing zle trickery */
***************
*** 436,453 ****
  			/* File size (Length) in given range */
  			func = qualsize;
  			amc = -1;
  		      getrange:
- 			timef = TT_DAYS;
  			/* Get time multiplier */
! 			if (amc >= 0)
  			    if (*s == 'h')
! 				timef = TT_HOURS, ++s;
  			    else if (*s == 'm')
! 				timef = TT_MINS, ++s;
  			    else if (*s == 'w')
! 				timef = TT_WEEKS, ++s;
  			    else if (*s == 'M')
! 				timef = TT_MONTHS, ++s;
  			/* See if it's greater than, equal to, or less than */
  			if ((range = *s == '+' ? 1 : *s == '-' ? -1 : 0))
  			    ++s;
--- 443,469 ----
  			/* File size (Length) in given range */
  			func = qualsize;
  			amc = -1;
+ 			/* Get size multiplier */
+ 			units = TT_BYTES;
+ 			if (*s == 'p' || *s == 'P')
+ 			    units = TT_POSIX_BLOCKS, ++s;
+ 			else if (*s == 'k' || *s == 'K')
+ 			    units = TT_KILOBYTES, ++s;
+ 			else if (*s == 'm' || *s == 'M')
+ 			    units = TT_MEGABYTES, ++s;
  		      getrange:
  			/* Get time multiplier */
! 			if (amc >= 0) {
! 			    units = TT_DAYS;
  			    if (*s == 'h')
! 				units = TT_HOURS, ++s;
  			    else if (*s == 'm')
! 				units = TT_MINS, ++s;
  			    else if (*s == 'w')
! 				units = TT_WEEKS, ++s;
  			    else if (*s == 'M')
! 				units = TT_MONTHS, ++s;
! 			}
  			/* See if it's greater than, equal to, or less than */
  			if ((range = *s == '+' ? 1 : *s == '-' ? -1 : 0))
  			    ++s;
***************
*** 471,477 ****
  		    qn->sense = sense;
  		    qn->data = data;
  		    qn->range = range;
! 		    qn->timef = timef;
  		    qn->amc = amc;
  		    qn = NULL;
  		    qualct++;
--- 487,493 ----
  		    qn->sense = sense;
  		    qn->data = data;
  		    qn->range = range;
! 		    qn->units = units;
  		    qn->amc = amc;
  		    qn = NULL;
  		    qualct++;
***************
*** 656,662 ****
  		for (qn = qo; t && qn && qn->func; qn = qn->next) {
  		    range = qn->range;
  		    amc = qn->amc;
! 		    timef = qn->timef;
  		    if ((qn->sense & 2) && !statted) {
  			/* If (sense & 2), we're following links */
  			statted = 1;
--- 672,678 ----
  		for (qn = qo; t && qn && qn->func; qn = qn->next) {
  		    range = qn->range;
  		    amc = qn->amc;
! 		    units = qn->units;
  		    if ((qn->sense & 2) && !statted) {
  			/* If (sense & 2), we're following links */
  			statted = 1;
***************
*** 2239,2247 ****
  int
  qualsize(struct stat *buf, long size)
  {
!     return (range < 0 ? buf->st_size < size :
! 	    range > 0 ? buf->st_size > size :
! 	    buf->st_size == size);
  }
  
  /* time in required range? */
--- 2255,2280 ----
  int
  qualsize(struct stat *buf, long size)
  {
!     unsigned long scaled = buf->st_size;
! 
!     switch (units) {
!     case TT_POSIX_BLOCKS:
! 	scaled += 511l;
! 	scaled /= 512l;
! 	break;
!     case TT_KILOBYTES:
! 	scaled += 1023l;
! 	scaled /= 1024l;
! 	break;
!     case TT_MEGABYTES:
! 	scaled += 1048575l;
! 	scaled /= 1048576l;
! 	break;
!     }
! 
!     return (range < 0 ? scaled < size :
! 	    range > 0 ? scaled > size :
! 	    scaled == size);
  }
  
  /* time in required range? */
***************
*** 2256,2262 ****
      diff = now - (amc == 0 ? buf->st_atime : amc == 1 ? buf->st_mtime :
  		  buf->st_ctime);
      /* handle multipliers indicating units */
!     switch (timef) {
      case TT_DAYS:
  	diff /= 86400l;
  	break;
--- 2289,2295 ----
      diff = now - (amc == 0 ? buf->st_atime : amc == 1 ? buf->st_mtime :
  		  buf->st_ctime);
      /* handle multipliers indicating units */
!     switch (units) {
      case TT_DAYS:
  	diff /= 86400l;
  	break;

-- 
Thorsten Meinecke
<kaefer@aglaia.snafu.de> 


^ permalink raw reply	[relevance 3%]

* ZSH's future [longish] ?
@ 1995-10-26  6:26  3% Mark Borges
  1995-10-26 15:13  6% ` Zoltan Hidvegi
  0 siblings, 1 reply; 200+ results
From: Mark Borges @ 1995-10-26  6:26 UTC (permalink / raw)
  To: ZSH mailing list

I know, I hate these vague and open-ended subject lines, too. This is
not really related to zsh development either. So feel free to quit
reading, if you've even gotten this far...

Anyway, I discovered this URL last night:

     http://www.research.att.com/orgs/ssr/book/reuse/

and apparently ATT is giving away free copies of ksh93 for personal
use. You have to agree to a non-exclusive license agreement, but it
appears to be fairly liberal for single user usage. Unless I'm
misunderstanding it (quite possible) and will have the ATT police
after me tomorrow.

I was curious if anyone on this list has seen it (I've appended a list
of features below) and what their reactions would be.

How do the people actively involved in ZSH development think zsh
compares with ksh93? (Windows95, ksh93. Yuck. What's the world coming
to? ;-) 

Lest I be misunderstood, let me state that I've really enjoyed having
zsh as my shell, and have been using it for the past 4 years. I like
it better than ksh88. I don't see myself using ksh anytime soon. 

But I'm wondering if people will start flocking to ksh93 (now that it
appears to be easier to get a hold of), and the incentive and impetus
for actively developing zsh will wane such that zsh will be more of a
"hobby" than it already is.

Comments? Anyone care to do a feature-by-feature comparison? (I'm not
sure what all of them mean) If anything glaring is missing in zsh,
does anyone foresee it being added in zsh-4.0?

After a quick glance, it appears ksh93 can handle arithmetic and
arrays in a more powerful way than zsh currently does, e.g.,

	$ ./ksh
	$ ((a=1.e-3+3.4/1.2))
	$ echo $a
	2.83433333333
	$ ^D
	$ ((a=1.e-3+3.4/1.2))
	zsh: bad math expression: illegal character: .

But, so what, really. If one wants to do heavy duty math in a script,
use perl, right?

I think zsh's niche is being king of the interactive features and
conveniences. Perhaps that should be stressed more in the ZSH WWW
pages? 

  -mb-

==============================================================================
KSH-93 - The KornShell Command and Programming Language

KSH-93 is the most recent version of the KornShell Language described
in "The KornShell Command and Programming Language," by Morris Bolsky
and David Korn of AT&ampT Bell Laboratories. The KornShell is a shell
programming language, which is upward compatible with "sh" (the Bourne
Shell), and is intended to conform to the IEEE P1003.2/ISO 9945.2
Shell and Utilities standard. KSH-93 provides an enhanced programming
environment in addition to the major command-entry features of the BSD
shell "csh". With KSH-93, medium-sized programming tasks can be
performed at shell-level without a significant loss in performance. In
addition, "sh" scripts can be run on KSH-93 without modification.

The code should conform to the IEEE POSIX 1003.1 standard and to the
proposed ANSI-C standard so that it should be portable to all such
systems. Like the previous version, KSH-88, it is designed to accept
eight bit character sets transparently, thereby making it
internationally compatible. It can support multi-byte characters sets
with some characteristics of the character set given at run time.

KSH-93 provides the following features, many of which were also
inherent in KSH-88:

    o Enhanced Command Re-entry Capability: The KSH-93 history
      function records commands entered at any shell level and stores
      them, up to a user-specified limit, even after you log off. This
      allows you to re-enter long commands with a few keystrokes -
      even those commands you entered yesterday. The history file
      allows for eight bit characters in commands and supports
      essentially unlimited size histories.

    o In-line Editing: In "sh", the only way to fix mistyped commands
      is to backspace or retype the line. KSH-93 allows you to edit a
      command line using a choice of EMACS-TC or "vi" functions. You
      can use the in-line editors to complete filenames as you type
      them. You may also use this editing feature when entering
      command lines from your history file. A user can capture
      keystrokes and rebind keys to customize the editing interface.

    o Extended I/O Capabilities: KSH-93 provides several I/O
      capabilities not available in "sh", including the ability to:
        * specify a file descriptor for input and output
        * start up and run co-processes
        * produce a prompt at the terminal before a read
        * easily format and interpret responses to a menu
        * echo lines exactly as output without escape processing
        * format output using printf formats.
        * read and echo lines ending in "\\".

    o Improved performance: KSH-93 executes many scripts faster than
      the System V Bourne shell. A major reason for this is that many
      of the standard utilities are built-in. To reduce the time to
      initiate a command, KSH-93 allows commands to be added as
      built-ins at run time on systems that support dynamic loading
      such as System V Release 4.

    o Arithmetic: KSH-93 allows you to do integer arithmetic in any
      base from two to sixty-four. You can also do double precision
      floating point arithmetic. Almost the complete set of C language
      operators are available with the same syntax and
      precedence. Arithmetic expressions can be used to as an argument
      expansion or as a separate command. In addition there is an
      arithmetic for command that works like the for statement in C.

    o Arrays: KSH-93 supports both indexed and associative arrays. The
      subscript for an indexed array is an arithmetic expression,
      whereas, the subscript for an associative array is a string.

    o Shell Functions and Aliases: Two mechanisms - functions and
      aliases - can be used to assign a user-selected identifier to an
      existing command or shell script. Functions allow local
      variables and provide scoping for exception handling. Functions
      can be searched for and loaded on first reference the way
      scripts are.

    o Substring Capabilities: KSH-93 allows you to create a substring
      of any given string either by specifying the starting offset and
      length, or by stripping off leading or trailing substrings
      during parameter substitution. You can also specify attributes,
      such as upper and lower case, field width, and justification to
      shell variables.

    o More pattern matching capabilities: KSH-93 allows you to specify
      extended regular expressions for file and string matches.

    o KSH-93 uses a hierarchal name space for variables. Compound
      variables can be defined and variables can be passed by
      reference. In addition, each variable can have one or more
      disciplines associated with it to intercept assignments and
      references.

    o Improved debugging: KSH-93 can generate line numbers on
      execution traces. Also, I/O redirections are now traced. There
      is a DEBUG trap that gets evaluated after each command so that
      errors can be localized.

    o Job Control: On systems that support job control, including
      System V Release 4, KSH-93 provides a job-control mechanism
      almost identical to that of the BSD "csh", version 4.1. This
      feature allows you to stop and restart programs, and to move
      programs between the foreground and the background.

    o Added security: KSH-93 can execute scripts which do not have
      read permission and scripts which have the setuid and/or setgid
      set when invoked by name, rather than as an argument to the
      shell. It is possible to log or control the execution of setuid
      and/or setgid scripts. The noclobber option prevents you from
      accidentally erasing a file by redirecting to an existing file.

    o KSH-93 can be extended by adding built-in commands at run
      time. In addition, KSH-93 can be used as a library that can be
      embedded into an application to allow scripting.


^ permalink raw reply	[relevance 3%]

* Re: ZSH's future [longish] ?
  1995-10-26  6:26  3% ZSH's future [longish] ? Mark Borges
@ 1995-10-26 15:13  6% ` Zoltan Hidvegi
  1995-10-26 22:44  0%   ` Mark Borges
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1995-10-26 15:13 UTC (permalink / raw)
  To: Mark Borges

> ...
> Shell), and is intended to conform to the IEEE P1003.2/ISO 9945.2
> Shell and Utilities standard. KSH-93 provides an enhanced programming
> ...

I think zsh is mostly POSIX compatible.  I think it would not be difficult to
improve POSIX compatibility without affectin present features.  I already did
some work for it and I use zsh as /bin/sh for more than a half year now
without problems.

> environment in addition to the major command-entry features of the BSD
> shell "csh". With KSH-93, medium-sized programming tasks can be
> performed at shell-level without a significant loss in performance. In
> addition, "sh" scripts can be run on KSH-93 without modification.

I use zsh for these medium-sized programming staff.  It is very poverfull, and
it has the advantage that it is free and I can compile zsh on any machine I
have (there are 7 different unices here).

> The code should conform to the IEEE POSIX 1003.1 standard and to the
> proposed ANSI-C standard so that it should be portable to all such

Thanks to Richard, zsh is one of the most portable program I've ever seen.  I
think ksh could'n beat it.

> systems. Like the previous version, KSH-88, it is designed to accept
> eight bit character sets transparently, thereby making it
> internationally compatible. It can support multi-byte characters sets
> with some characteristics of the character set given at run time.

This is a weak point in zsh, since it has problems with character codes
between 128 and 159.  This is not really a big broblem sine this code range is
not usually used for printable characters.  Multibyte character support is
completely missing.  I may try to do something for these sometime (but I
probably won't do anything before next summer).

History features of zsh are quite good I think (except some bugs in the
baseline which I fixed long ago), and command line editing is unbeatable.
Same for the I/O capabilities.  Performance is also pretty good although I did
not compared with ksh.

The only thing missing from zsh's arithmetic capabilities is floating point
arithmetic.  The vanilla version may also have problems with indexed arrays in
arithmetic expressions and assignments inside $((...)) substitutions.

>     o Arrays: KSH-93 supports both indexed and associative arrays. The
>       subscript for an indexed array is an arithmetic expression,
>       whereas, the subscript for an associative array is a string.

I think zsh provides all of these array features.  Some of this code is broken
in the baseline version, but I fixed these problems long ago.

>     o Substring Capabilities: KSH-93 allows you to create a substring
>       of any given string either by specifying the starting offset and
>       length, or by stripping off leading or trailing substrings
>       during parameter substitution. You can also specify attributes,
>       such as upper and lower case, field width, and justification to
>       shell variables.

Zsh can handle substrings perfectly and the variable expansion features are
excelent.  Unfortunately the baseline release have some bugs here but I fixed
these bugs log ago.

>     o More pattern matching capabilities: KSH-93 allows you to specify
>       extended regular expressions for file and string matches.

Zsh glob patterns can do anything that an extended regular expression can do.
This syntax is different but I think this is not really a big problem.  A
bonus with zsh that it can use exclude patterns and file modes for globing and
supports qualifiers.

>     o KSH-93 uses a hierarchal name space for variables. Compound
>       variables can be defined and variables can be passed by
>       reference. In addition, each variable can have one or more
>       disciplines associated with it to intercept assignments and
>       references.
> 
>     o Improved debugging: KSH-93 can generate line numbers on
>       execution traces. Also, I/O redirections are now traced. There
>       is a DEBUG trap that gets evaluated after each command so that
>       errors can be localized.

These seems to be missing from zsh.  An especially week point of zsh is
special variable handling.

Job control is fully functional in zsh.

>     o Added security: KSH-93 can execute scripts which do not have
>       read permission and scripts which have the setuid and/or setgid
>       set when invoked by name, rather than as an argument to the
>       shell. It is possible to log or control the execution of setuid
>       and/or setgid scripts. The noclobber option prevents you from
>       accidentally erasing a file by redirecting to an existing file.

These features are already in zsh, or can be added if necessary.  When zsh
invoked as setuid, it disables user startup/shutdown files.  I think it would
be reasonable to source an additional suid_zprofile when invoked as a suid
script (as it is already done when invoked as sh/ksh).

>     o KSH-93 can be extended by adding built-in commands at run
>       time. In addition, KSH-93 can be used as a library that can be
>       embedded into an application to allow scripting.

That would be nice in zsh as well.  It may help to keep zsh a small shell and
load feature modules on-demand.  E.g.  I often write complicated scripts with
zsh where the whole zle staff is not needed.

To summarize my opinion, zsh is at least as good as ksh.  It has outstanding
interactive capabilities with advanced features completely missing from ksh.
But it can also be used as a powerful script language.  An example: with my
releases the expansion of ${${(f)$(</etc/group)}%%:*} gives the list of the
group names from /etc/groups.  With ksh you would have to write $(cat -d: -f1
/etc/group) which may look nicer but requires an expensive fork and exec.

With zsh using this kind of nested expansion almost anything can be done.
This, together with the extended globbing (using file type/date/owner/length
etc) makes zsh an extremely powerful script language.  The problem is that
most of the zsh users are not aware of these capabilities.  A good and
easy-to-understand zsh book would help a lot.

Cheers,
  Zoltan


^ permalink raw reply	[relevance 6%]

* Re: ZSH's future [longish] ?
  1995-10-26 15:13  6% ` Zoltan Hidvegi
@ 1995-10-26 22:44  0%   ` Mark Borges
  1995-10-27  8:16 18%     ` ZSH's future - POSIX Geoff Wing
  0 siblings, 1 reply; 200+ results
From: Mark Borges @ 1995-10-26 22:44 UTC (permalink / raw)
  To: ZSH mailing list

Thanks for the comments, Zoltan.

>> On Thu, 26 Oct 1995 16:13:26 +0100 (MET),
>> Zoltan Hidvegi(Z) wrote:

>> The code should conform to the IEEE POSIX 1003.1 standard and to
>> the proposed ANSI-C standard so that it should be portable to all
>> such

Z> Thanks to Richard, zsh is one of the most portable program I've
Z> ever seen.  I think ksh could'n beat it.

Yes, I agree. Richard should take a bow here ;-).

Z> and command line editing is unbeatable.

Yep. zle wins over readline in my book.

>> o Arrays: KSH-93 supports both indexed and associative arrays. The
>> subscript for an indexed array is an arithmetic expression,
>> whereas, the subscript for an associative array is a string.

Z> I think zsh provides all of these array features.  Some of this
Z> code is broken in the baseline version, but I fixed these problems
Z> long ago.

Does zsh support associative arrays?

Z> But it can also be used as a powerful script language.  An example:
Z> with my releases the expansion of ${${(f)$(</etc/group)}%%:*} gives
Z> the list of the group names from /etc/groups.

Uh-oh. If I use the (f) qualifier I only get the first line -- without
it, I get all the group names in a single line separated by
whitespace. A bug in my (old) hzoli version -- 2.6-beta11-test7-hzoli11 --
perhaps? 

Thanks again everyone for the comments. 

Unless I receive some objections, I plan to collect information from
this thread and create a summary article to put on the web site. With
proper credits/acknowledgements, of course.

  -mb-


^ permalink raw reply	[relevance 0%]

* Re: ZSH's future - POSIX
@ 1995-10-27  8:20 18% Geoff Wing
  0 siblings, 0 replies; 200+ results
From: Geoff Wing @ 1995-10-27  8:20 UTC (permalink / raw)
  To: zsh-list

:>> Zoltan Hidvegi(Z) wrote:
:>> The code should conform to the IEEE POSIX 1003.1 standard and to
:>> the proposed ANSI-C standard so that it should be portable to all
:>> such
:Z> Thanks to Richard, zsh is one of the most portable program I've
:Z> ever seen.  I think ksh could'n beat it.
:Yes, I agree. Richard should take a bow here ;-).
	
I seem to remember there was a problem with some of the stat() and associated
stuff.  Mainly because POSIX doesn't support all the S_I*() stuff used.
There would need to be a large rewrite of one part of code to make it fully
POSIX compatible.  One really big drawback with POSIX compatibility is its
lack of support for things like symbolic-links, sockets, etc.
-- 
Mason [G.C.W]  mason@werple.mira.net.au    "Hurt...Agony...Pain...LOVE-IT"


^ permalink raw reply	[relevance 18%]

* Re: ZSH's future - POSIX
  1995-10-26 22:44  0%   ` Mark Borges
@ 1995-10-27  8:16 18%     ` Geoff Wing
  1995-10-27 22:53 18%       ` Richard Coleman
  0 siblings, 1 reply; 200+ results
From: Geoff Wing @ 1995-10-27  8:16 UTC (permalink / raw)
  To: Mark Borges

:>> Zoltan Hidvegi(Z) wrote:
:>> The code should conform to the IEEE POSIX 1003.1 standard and to
:>> the proposed ANSI-C standard so that it should be portable to all
:>> such
:Z> Thanks to Richard, zsh is one of the most portable program I've
:Z> ever seen.  I think ksh could'n beat it.
:Yes, I agree. Richard should take a bow here ;-).
	
I seem to remember there was a problem with some of the stat() and associated
stuff.  Mainly because POSIX doesn't support all the S_I*() stuff used.
There would need to be a large rewrite of one part of code to make it fully
POSIX compatible.  One really big drawback with POSIX compatibility is its
lack of support for things like symbolic-links, sockets, etc.
-- 
Mason [G.C.W]  mason@werple.mira.net.au    "Hurt...Agony...Pain...LOVE-IT"


^ permalink raw reply	[relevance 18%]

* Re: ZSH's future - POSIX
  1995-10-27  8:16 18%     ` ZSH's future - POSIX Geoff Wing
@ 1995-10-27 22:53 18%       ` Richard Coleman
  0 siblings, 0 replies; 200+ results
From: Richard Coleman @ 1995-10-27 22:53 UTC (permalink / raw)
  To: zsh-workers

> > The code should conform to the IEEE POSIX 1003.1 standard and to
> > the proposed ANSI-C standard so that it should be portable to all
> > such
> 	
> I seem to remember there was a problem with some of the stat() and associated
> stuff.  Mainly because POSIX doesn't support all the S_I*() stuff used.
> There would need to be a large rewrite of one part of code to make it fully
> POSIX compatible.  One really big drawback with POSIX compatibility is its
> lack of support for things like symbolic-links, sockets, etc.

There are two notions of POSIX compatibility here.

The first is whether the code itself uses only POSIX features.  Zsh is
fairly good in this respect.  This was one of the reasons I rewrote the
signals code a while back.  But I don't think zsh would compile in a strict
POSIX environment.  Most of the problems would probably be because zsh
assumes the existentence of things not covered in the POSIX standard,
but available on most all unix machines (such as symbolic links).
This could probably be easily fixed if necessary, but I don't really
see the need for this.  If every vendor supports a feature, then it is
standard enough for me.  The goal after all is portability.

The second is whether zsh comforms to the POSIX standard concerning
shell syntax.  I believe this was what the ksh literature for ksh93
was referring to.  I believe ksh93 is supposed to be a conforming
superset of the POSIX shell standard.  I assume that zsh doesn't
conform to this standard.  It might be worth investigating what
parts of zsh don't conform.

rc






^ permalink raw reply	[relevance 18%]

* Re: Expansion/quoting quirks
  @ 1995-11-06 17:25  5% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1995-11-06 17:25 UTC (permalink / raw)
  To: Thorsten Meinecke

Thorsten Meinecke wrote:
> echo `echo \\\\`    # broken in hzoli, and in vanilla zsh if invoked as (k)sh

Yes, that's really broken.  However echo is not good for testing here since
shells are diffen in how they interpret escape sequences in echo.  It's better
to alias echo to 'print -r --'.  With zsh it is enough to set the bsdecho
option.  This bug appeared with the input patches from Peter.  The following
happens:  the \\\\ within `...` is parsed as Bnull\Bnull\.  The lexer is
called again with that and it thinks that the first \ quotes the Bnull.  The
last \ then a parse error.  Below is a patch to input.c to drop tokens from
the input.  These returned tokens caused some other bugs earlier and it can be
dangerous when a script contains some tokens.

> echo "$(echo \\\\)" # sh and ksh seem to differ here (bash would give `\\')

sh should give two slashes.  The difference is probably in the escape handling
of sh.

> nargs ${undef-"a b"}             # vanilla + hzoli: shouldn't split here

That's difficult.  sh_word_split splits the result of a parameter expansion.
Here the result is 'a b' which is split to 'a' 'b'.

> #% argc=3, argv=( 'a b' '' 'c' )
> nargs ${undef-"$@"}              # hzoli: 'a b' shouldn't split into 'a' 'b'

Same as the previous example.

> #% argc=3, argv=( 'a b' '' 'c' )
> nargs "${undef-"$@"}"            # hzoli: zsh: closing brace expected

That's because the second " closes the first.  It would be easy to fix it.

My problem is that I do not know what is the standard behaviour here.  My
library does not have the relevant POSIX papers.

It would be important to know how to parse these things.  It seems that the
lexer should be called on the body of ${...-...}.  I'll try to fix these if
someone tells me what the standards say here.  I have ksh93.  May I assume
that ksh93 behaviour is the standard?

The most difficult part here is ${...##...}.  Here the body should be
interpreted as a pattern.  Here the expanded body shoud be parsed again for
quotes.  E.g. foo='te\s\t' bar='\s\t' ; echo ${foo%%$bar} does not removes the
tail of foo since \ only escapes the s and t.  But foo='te"st"' bar='"??"'
echo ${foo%$bar} does remove the tail.

Bye,

  Zoltan

diff -c Src/input.c~ Src/input.c
*** Src/input.c~	Sat Nov  4 09:47:43 1995
--- Src/input.c	Mon Nov  6 17:50:17 1995
***************
*** 109,115 ****
  	if (inbufleft) {
  	    inbufleft--;
  	    inbufct--;
! 	    return lastc = (unsigned)*inbufptr++;
  	}
  	/*
  	 * No characters in input buffer.
--- 109,118 ----
  	if (inbufleft) {
  	    inbufleft--;
  	    inbufct--;
! 	    lastc = (unsigned)*inbufptr++;
! 	    if (itok(lastc))
! 		continue;
! 	    return lastc;
  	}
  	/*
  	 * No characters in input buffer.


^ permalink raw reply	[relevance 5%]

* zsh-2.6-beta11 bug on HP-UX
@ 1995-11-07 20:32  8% Sai Rama Krishna Susarla
  1995-11-07 20:32  0% ` Richard Coleman
  1995-11-08  9:05  0% ` Martin Steed
  0 siblings, 2 replies; 200+ results
From: Sai Rama Krishna Susarla @ 1995-11-07 20:32 UTC (permalink / raw)
  To: zsh-workers

Hi,
I compiled zsh-2.6-beta11 on a HP-UX machine. Here is some configure output :
checking host system type... hppa1.1-hp-bsd
...
checking POSIX termios... no
checking TIOCGWINSZ in sys/ioctl.h... yes
checking for sys/ptem.h... no


It compiled well on gcc version 2.5.8.

But when I run it, 

fast:zsh-2.6-beta11> Src/zsh

[1]  + Suspended (tty input)         Src/zsh
fast:zsh-2.6-beta11> fg
Src/zsh

[1]  + Suspended (tty input)         Src/zsh
fast:zsh-2.6-beta11>


It immediately gets suspended for tty input. I encountered this problem with
zsh-2.6-beta10 also and reported it to Richard Coleman. He said it might be
because zsh switched to using POSIX signals and HP-UX might have a bug in POSIX
signal handling code. 

Could you please look into this and give me a workaround?

Thank you,
- Sai.


^ permalink raw reply	[relevance 8%]

* Re: zsh-2.6-beta11 bug on HP-UX
  1995-11-07 20:32  8% zsh-2.6-beta11 bug on HP-UX Sai Rama Krishna Susarla
@ 1995-11-07 20:32  0% ` Richard Coleman
  1995-11-08  9:05  0% ` Martin Steed
  1 sibling, 0 replies; 200+ results
From: Richard Coleman @ 1995-11-07 20:32 UTC (permalink / raw)
  To: sai; +Cc: zsh-workers

> I compiled zsh-2.6-beta11 on a HP-UX machine. Here is some configure output :
> checking host system type... hppa1.1-hp-bsd
> ...
> 
> fast:zsh-2.6-beta11> Src/zsh
> 
> [1]  + Suspended (tty input)         Src/zsh
> fast:zsh-2.6-beta11> fg
> Src/zsh
> 
> [1]  + Suspended (tty input)         Src/zsh
> fast:zsh-2.6-beta11>
> 
> 
> It immediately gets suspended for tty input. I encountered this problem with
> zsh-2.6-beta10 also and reported it to Richard Coleman. He said it might be
> because zsh switched to using POSIX signals and HP-UX might have a bug in POSIX
> signal handling code. 

Is POSIX_SIGNALS defined to 1 in config.h?  If so, change it to 0, and define
BSD_SIGNALS to 1.  Let me know if that fixes it or not.

rc



^ permalink raw reply	[relevance 0%]

* Re: zsh-2.6-beta11 bug on HP-UX
  1995-11-07 20:32  8% zsh-2.6-beta11 bug on HP-UX Sai Rama Krishna Susarla
  1995-11-07 20:32  0% ` Richard Coleman
@ 1995-11-08  9:05  0% ` Martin Steed
  1 sibling, 0 replies; 200+ results
From: Martin Steed @ 1995-11-08  9:05 UTC (permalink / raw)
  To: zsh-workers

On Tue Nov  7 20:32:39 1995, Sai Rama Krishna Susarla wrote to zsh-workers@math.gatech.edu saying:

> Hi,
> I compiled zsh-2.6-beta11 on a HP-UX machine. Here is some configure output :
> checking host system type... hppa1.1-hp-bsd
> ...
> checking POSIX termios... no
> checking TIOCGWINSZ in sys/ioctl.h... yes
> checking for sys/ptem.h... no
> 
> 
> It compiled well on gcc version 2.5.8.

It worked perfectly well on my HP9000/827 running 9.04. Some noticable differences though:

checking host system type... hppa1.1-hp-hpux9.04

And I'm using HP's ANSI 'cc'.

Martin

-- 
Martin N. Steed							<msteed@tfs.com>

All human beings associate sex with love. Except men.
	- Roseanne.


^ permalink raw reply	[relevance 0%]

* build zsh 2.6-beta13 on SCO 3.2v5.0.0 problem
@ 1996-01-03 16:23  6% Paul Lew
  0 siblings, 0 replies; 200+ results
From: Paul Lew @ 1996-01-03 16:23 UTC (permalink / raw)
  To: zsh-workers

I failed to build zsh on SCO Unix 3.2 release 5.0 with the configure.
I have to make the following adjustment, please modify the configure
accordingly.  The linked zsh works fine.

					-- Paul  01/03/96  10:59 AM --

(1) in Src/system.h around line 114:

	/* We may need to define this for any machine    *
	 * that doesn't have gettimeofday.  Of course we *
	 * probably will move to the POSIX time function *
	 *  anyway.                                      */
	#ifdef __sco
	struct timezone {
	    short minutes;
	};
	#endif

    This ifdef is not necessary for release 5.0, maybe it was added
    for version before 5.0.

(2) I have to add:

	LDFLAGS=-lsocket

    otherwise I will get:
	Undefined                       first referenced
	 symbol                             in file
	yp_all                              zle_tricky.o
	getdomainname                       zle_tricky.o


^ permalink raw reply	[relevance 6%]

* Re: zsh arg list too long
  @ 1996-02-13  7:32  5% ` Geoff Wing
  0 siblings, 0 replies; 200+ results
From: Geoff Wing @ 1996-02-13  7:32 UTC (permalink / raw)
  To: zsh-list

jarausch@igpm.rwth-aachen.de (Helmut Jarausch) wrote:
:Sorry, I could find it in the FAQs althoug it should be a common problem.
:On my machine (SGI,IRIX6.1) I often get the error "zsh arg list too long".
:Last time I only tried   rm  ~/.netscape-cache/*
:and it failed because there were (only) 576 files (filename length 24)
:Is this a general restrictions of my OS or is ZSH configurable to allow
:longer parameter lists?

Hrvoje.Niksic@public.srce.hr (Hrvoje Niksic) replied:
:I noticed it too. It should not be OS restriction, since it works in other
:shells. I am afraid it is a zsh bug.

The limitation is imposed by the OS.  You can usually find it in 
/usr/include/sys/syslimits.h  as something like ARG_MAX (256Kb on my machine)
According to POSIX: "The number of bytes available for the combined
argument list and environment list is given by ARG_MAX macro in <limits.h>"

Look through the /usr/include/**/*limit* files or try something like:  
% fgrep ARG_ /usr/include/**/*.h

Zoltan mentioned that the builtin echo wasn't limited thus, so maybe you 
could do
% echo ~/.netscape-cache/* | xargs rm
or maybe this will work if there aren't too many
% (cd ~/.netscape-cache; echo *)

-- 
Mason [G.C.W]  mason@werple.mira.net.au    "Hurt...Agony...Pain...LOVE-IT"


^ permalink raw reply	[relevance 5%]

* zsh 2.6-beta13 problem on SCO Unix 5.0v3.2
@ 1996-02-19 23:13  4% Paul Lew
  0 siblings, 0 replies; 200+ results
From: Paul Lew @ 1996-02-19 23:13 UTC (permalink / raw)
  To: zsh-workers

I built zsh 2.6-beta13 on SCO Unix 5.0v3.2 and it runs ok.  But for
some reason, the zsh is using all the virtual memory and cause the
machine to hang and the only way out is to reboot the machine.

	  SZ  VSZ COMMAND	<-- this is the output of the command:
	43416 44188 -zsh	<-- "ps -e -o size -o vsz -o args"

So the program size is over 44 MB, seems like a memory leak somewhere.
This happen about twice a week, currently, we use the SCO machine
lightly.  Anyone has a clue about this?  Any suggestion to detect
the problem?  Thanks in advance...

					-- Paul  02/19/96  05:38 PM --
$ uname -a
SCO_SV scpc 3.2 2 i386

$ gcc -v
Reading specs from /usr/cygnus/progressive-95q4/
	H-i486-unknown-sco3.2v5.0.0/
	lib/gcc-lib/i486-unknown-sco3.2v5.0.0/2.7-95q4/specs
gcc version 2.7-95q4

$ cat config.h
/* config.h.  Generated automatically by configure.  */
/* config.h.in.  Generated automatically from configure.in by autoheader.  */

/***** begin user configuration section *****/

/* Define this to be the location of your password file */
#define PASSWD_FILE "/etc/passwd"

/* Define this to be the name of your NIS/YP password *
 * map (if applicable)                                */
#define PASSWD_MAP "passwd.byname"

/* Define to 1 if you want user names to be cached */
#define CACHE_USERNAMES 1

/* Define to 1 if system supports job control */
#define JOB_CONTROL 1

/* Define to 1 if system has working FIFO's */
#define HAVE_FIFOS 1

/* Define this if you use "suspended" instead of "stopped" */
#define USE_SUSPENDED 1
 
/* The default history buffer size in lines */
#define DEFAULT_HISTSIZE 30

/* The default editor for the fc builtin */
#define DEFAULT_FCEDIT "vi"

/* The default prefix for temporary files */
#define DEFAULT_TMPPREFIX "/tmp/zsh"

/* The global file to source absolutely first whenever zsh is run; *
 * if undefined, don't source anything                             */
#define GLOBAL_ZSHENV "/etc/zshenv"

/* The global file to source whenever zsh is run; *
 * if undefined, don't source anything            */
#define GLOBAL_ZSHRC "/etc/zshrc"

/* The global file to source whenever zsh is run as a login shell; *
 * if undefined, don't source anything                             */
#define GLOBAL_ZLOGIN "/etc/zlogin"

/* The global file to source whenever zsh is run as a login shell, *
 * before zshrc is read; if undefined, don't source anything       */
#define GLOBAL_ZPROFILE "/etc/zprofile"

/* The global file to source whenever zsh was run as a login shell.  *
 * This is sourced right before exiting.  If undefined, don't source *
 * anything                                                          */
#define GLOBAL_ZLOGOUT "/etc/zlogout"

/***** end of user configuration section            *****/
/***** shouldn't have to change anything below here *****/

/* Define to empty if the keyword does not work.  */
/* #undef const */

/* Define if the `getpgrp' function takes no argument.  */
#define GETPGRP_VOID 1

/* Define to `int' if <sys/types.h> doesn't define.  */
/* #undef gid_t */

/* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
#define HAVE_SYS_WAIT_H 1

/* Define to `int' if <sys/types.h> doesn't define.  */
/* #undef mode_t */

/* Define to `long' if <sys/types.h> doesn't define.  */
/* #undef off_t */

/* Define to `int' if <sys/types.h> doesn't define.  */
/* #undef pid_t */

/* Define as the return type of signal handlers (int or void).  */
#define RETSIGTYPE void

/* Define to `unsigned' if <sys/types.h> doesn't define.  */
/* #undef size_t */

/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly.  */
/* #undef STAT_MACROS_BROKEN */

/* Define if you have the ANSI C header files.  */
#define STDC_HEADERS 1

/* Define if you can safely include both <sys/time.h> and <time.h>.  */
#define TIME_WITH_SYS_TIME 1

/* Define to `int' if <sys/types.h> doesn't define.  */
/* #undef uid_t */

/* Define to 1 if compiler incorrectly cast signed to unsigned */
/* #undef BROKEN_SIGNED_TO_UNSIGNED_CASTING */

/* Define if your system defines TIOCGWINSZ in sys/ioctl.h.  */
/* #undef GWINSZ_IN_SYS_IOCTL */

/* Define to 1 if you have NIS */
#define HAVE_NIS "1"

/* Define to 1 if you have RFS superroot directory. */
/* #undef HAVE_SUPERROOT */

/* Define to 1 if you have the /dev/fd filesystem */
#define HAVE_DEV_FD 1

/* Define if your system's struct utmp has a member named ut_host.  */
#define HAVE_UT_HOST 1

/* Define if you have the <utmpx.h> header file.  */
#define HAVE_UTMPX_H 1

/* Define to be a string corresponding to the host type */
#define HOSTTYPE "sco3.2v5.0.0"

/* Define to be the machine type (microprocessor class or machine model) */
#define MACHTYPE "i486"

/* Define to be the name of the operating system */
#define OSTYPE "sco3.2v5.0.0"

/* Define to 1 if ANSI function prototypes are usable.  */
#define PROTOTYPES 1

/* Define to be location of utmp file.  This value is only used if UTMP_FILE, *
 * UTMPX_FILE, or _PATH_UTMP are not defined in an include file.              */
#define UTMP_FILE_CONFIG "/etc/utmp"

/* Define to be a string corresponding the vendor of the machine */
#define VENDOR "unknown"

/* Define if your system defines `struct winsize' in sys/ptem.h.  */
#define WINSIZE_IN_PTEM 1

/* Define  to be location of wtmp file.  This value is only use if WTMP_FILE, *
 * WTMPX_FILE, or _PATH_WTMP are not defined in an include file.              */
#define WTMP_FILE_CONFIG "/etc/wtmp"

/* Define to 1 if you want to use zsh's own memory allocation routines */
/* #undef ZSH_MEM */

/* Define to 1 if you want to debug zsh memory allocation routines */
/* #undef ZSH_MEM_DEBUG */

/* Define to 1 if you want to turn on warnings of memory allocation errors */
/* #undef ZSH_MEM_WARNING */

/* Define to 1 if you want to turn on memory checking for free() */
/* #undef ZSH_SECURE_FREE */

/* Define to 1 if you want to get debugging information on internal *
 * hash tables.  This turns on the `hashinfo' builtin.              */
/* #undef ZSH_HASH_DEBUG */

/* Define to 1 if your termcap library has the ospeed variable */
#define HAVE_OSPEED 1
/* Define to 1 if you have ospeed, but it is not defined in termcap.h */
#define MUST_DEFINE_OSPEED 1

/* Define to 1 if you use POSIX style signal handling */
#define POSIX_SIGNALS 1

/* Define to 1 if you use BSD style signal handling (and can block signals) */
/* #undef BSD_SIGNALS */

/* Define to 1 if you use SYS style signal handling (and can block signals) */
/* #undef SYSV_SIGNALS */

/* Define to 1 if you have no signal blocking at all (bummer) */
/* #undef NO_SIGNAL_BLOCKING */

/* Define to `unsigned int' if <sys/types.h> or <signal.h> doesn't define */
/* #undef sigset_t */

/* Define if your system's typeahead disappears from the shell editor. */
/* #undef CLOBBERS_TYPEAHEAD */

/* The number of bytes in a long.  */
#define SIZEOF_LONG 4

/* Define if you have the difftime function.  */
#define HAVE_DIFFTIME 1

/* Define if you have the getdomainname function.  */
/* #undef HAVE_GETDOMAINNAME */

/* Define if you have the gethostname function.  */
/* #undef HAVE_GETHOSTNAME */

/* Define if you have the getlogin function.  */
#define HAVE_GETLOGIN 1

/* Define if you have the getrlimit function.  */
#define HAVE_GETRLIMIT 1

/* Define if you have the gettimeofday function.  */
#define HAVE_GETTIMEOFDAY 1

/* Define if you have the killpg function.  */
#define HAVE_KILLPG 1

/* Define if you have the lstat function.  */
#define HAVE_LSTAT 1

/* Define if you have the mkfifo function.  */
#define HAVE_MKFIFO 1

/* Define if you have the select function.  */
#define HAVE_SELECT 1

/* Define if you have the seteuid function.  */
#define HAVE_SETEUID 1

/* Define if you have the setpgid function.  */
#define HAVE_SETPGID 1

/* Define if you have the setresuid function.  */
/* #undef HAVE_SETRESUID */

/* Define if you have the setreuid function.  */
#define HAVE_SETREUID 1

/* Define if you have the setuid function.  */
#define HAVE_SETUID 1

/* Define if you have the sigaction function.  */
#define HAVE_SIGACTION 1

/* Define if you have the sigblock function.  */
/* #undef HAVE_SIGBLOCK */

/* Define if you have the sighold function.  */
#define HAVE_SIGHOLD 1

/* Define if you have the sigprocmask function.  */
#define HAVE_SIGPROCMASK 1

/* Define if you have the sigrelse function.  */
#define HAVE_SIGRELSE 1

/* Define if you have the sigsetmask function.  */
/* #undef HAVE_SIGSETMASK */

/* Define if you have the strerror function.  */
#define HAVE_STRERROR 1

/* Define if you have the strftime function.  */
#define HAVE_STRFTIME 1

/* Define if you have the strstr function.  */
#define HAVE_STRSTR 1

/* Define if you have the tcgetattr function.  */
#define HAVE_TCGETATTR 1

/* Define if you have the tcsetpgrp function.  */
#define HAVE_TCSETPGRP 1

/* Define if you have the wait3 function.  */
#define HAVE_WAIT3 1

/* Define if you have the waitpid function.  */
#define HAVE_WAITPID 1

/* Define if you have the <dirent.h> header file.  */
#define HAVE_DIRENT_H 1

/* Define if you have the <errno.h> header file.  */
#define HAVE_ERRNO_H 1

/* Define if you have the <fcntl.h> header file.  */
#define HAVE_FCNTL_H 1

/* Define if you have the <libc.h> header file.  */
/* #undef HAVE_LIBC_H */

/* Define if you have the <limits.h> header file.  */
#define HAVE_LIMITS_H 1

/* Define if you have the <locale.h> header file.  */
#define HAVE_LOCALE_H 1

/* Define if you have the <memory.h> header file.  */
#define HAVE_MEMORY_H 1

/* Define if you have the <ndir.h> header file.  */
/* #undef HAVE_NDIR_H */

/* Define if you have the <stdlib.h> header file.  */
#define HAVE_STDLIB_H 1

/* Define if you have the <string.h> header file.  */
#define HAVE_STRING_H 1

/* Define if you have the <sys/dir.h> header file.  */
/* #undef HAVE_SYS_DIR_H */

/* Define if you have the <sys/filio.h> header file.  */
/* #undef HAVE_SYS_FILIO_H */

/* Define if you have the <sys/ndir.h> header file.  */
/* #undef HAVE_SYS_NDIR_H */

/* Define if you have the <sys/param.h> header file.  */
#define HAVE_SYS_PARAM_H 1

/* Define if you have the <sys/resource.h> header file.  */
#define HAVE_SYS_RESOURCE_H 1

/* Define if you have the <sys/select.h> header file.  */
#define HAVE_SYS_SELECT_H 1

/* Define if you have the <sys/time.h> header file.  */
#define HAVE_SYS_TIME_H 1

/* Define if you have the <sys/times.h> header file.  */
#define HAVE_SYS_TIMES_H 1

/* Define if you have the <sys/utsname.h> header file.  */
#define HAVE_SYS_UTSNAME_H 1

/* Define if you have the <termcap.h> header file.  */
/* #undef HAVE_TERMCAP_H */

/* Define if you have the <termio.h> header file.  */
#define HAVE_TERMIO_H 1

/* Define if you have the <termios.h> header file.  */
#define HAVE_TERMIOS_H 1

/* Define if you have the <unistd.h> header file.  */
#define HAVE_UNISTD_H 1

/* Define if you have the nsl library (-lnsl).  */
/* #undef HAVE_LIBNSL */


^ permalink raw reply	[relevance 4%]

* is anyone using non-POSIX signals?
@ 1996-04-11  1:10 17% Richard J. Coleman
  1996-04-11  5:34 16% ` Barton E. Schaefer
  0 siblings, 1 reply; 200+ results
From: Richard J. Coleman @ 1996-04-11  1:10 UTC (permalink / raw)
  To: zsh-workers

Is anyone using zsh (say newer than beta8) on a machine
that doesn't have POSIX signals?  When you run configure
on your machine, one of the tests should say something like

checking what style of signals to use... POSIX_SIGNALS

I'm curious if anyone has been using zsh on a machine that
returns BSD_SIGNALS or SYSV_SIGNALS for this configure check.

I'm planning on doing some more work on the signals code
and wondered if keeping all the compatability code around
was useful to anyone.  I believe almost every machine around
should have the posix signals by now.

rc



^ permalink raw reply	[relevance 17%]

* Re: is anyone using non-POSIX signals?
  1996-04-11  1:10 17% is anyone using non-POSIX signals? Richard J. Coleman
@ 1996-04-11  5:34 16% ` Barton E. Schaefer
  1996-04-11  5:47  9%   ` Richard J. Coleman
  0 siblings, 1 reply; 200+ results
From: Barton E. Schaefer @ 1996-04-11  5:34 UTC (permalink / raw)
  To: Richard J. Coleman, zsh-workers

On Apr 10,  9:10pm, Richard J. Coleman wrote:
} Subject: is anyone using non-POSIX signals?
}
} Is anyone using zsh (say newer than beta8) on a machine
} that doesn't have POSIX signals?

Asking this of the zsh *developers* isn't necessarily a good cross-
section of platforms on which people use zsh.

Call me a reactionary, but I'd rather not abandon anyone if it can
be avoided.  We still get requests for builds of zmail on really
ancient unixes (most of which we have to turn down, to my chagrin).

Even if you don't keep supporting/testing the compatibility code,
it'd be nice to have some idea that the changes you're making don't
depend on something that it's impossible to emulate in the older
styles.  Someone stuck on one of those older systems ought to at
least have a chance of fixing it himself.

-- 
Bart Schaefer                     Vice President, Technology, Z-Code Software
schaefer@z-code.com                  Division of NCD Software Corporation
http://www.well.com/www/barts



^ permalink raw reply	[relevance 16%]

* Re: is anyone using non-POSIX signals?
  1996-04-11  5:34 16% ` Barton E. Schaefer
@ 1996-04-11  5:47  9%   ` Richard J. Coleman
  0 siblings, 0 replies; 200+ results
From: Richard J. Coleman @ 1996-04-11  5:47 UTC (permalink / raw)
  To: schaefer; +Cc: zsh-workers

> } Is anyone using zsh (say newer than beta8) on a machine
> } that doesn't have POSIX signals?
> 
> Asking this of the zsh *developers* isn't necessarily a good cross-
> section of platforms on which people use zsh.
> 
> Call me a reactionary, but I'd rather not abandon anyone if it can
> be avoided.  We still get requests for builds of zmail on really
> ancient unixes (most of which we have to turn down, to my chagrin).
> 
> Even if you don't keep supporting/testing the compatibility code,
> it'd be nice to have some idea that the changes you're making don't
> depend on something that it's impossible to emulate in the older
> styles.  Someone stuck on one of those older systems ought to at
> least have a chance of fixing it himself.

Well, I was mainly asking out of curiousity.  I don't think the
SYSV_SIGNALS and NO_SIGNAL_BLOCKING compatibility code even works.
Since no one has complained, I was wondering if anyone was using it.

rc



^ permalink raw reply	[relevance 9%]

* Re: IFS problem
  @ 1996-04-30 17:19  6% ` Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1996-04-30 17:19 UTC (permalink / raw)
  To: Florent Guillaume; +Cc: zsh-workers

>	var="a%b%c"
>	OIFS=$IFS
>	IFS='%'; set - $var; IFS=$OIFS
>	echo $#
>
>returns 3 under sh, ksh, bash 1.14.3
>but 1 under zsh 2.6.beta15
>
>Is it a known bug ?

No, it's a known feature.  It's discussed in the FAQ.

By default, zsh does not perform field splitting (which IFS is used
for).  To get standard Bourne/Korn/POSIX shell behaviour, use `setopt
sh_word_split`.  (That option, by the way, is misnamed -- word
splitting is something else entirely.)  To get field splitting on a
case-by-case basis, use "$=var" instead of "$var".  "$==var" can also
be used to *dis*able field splitting for one substitution only.

For example:

	var="a%b%c"
	OIFS=$IFS
	IFS='%'; set - $=var; IFS=$OIFS
	echo $#

-zefram



^ permalink raw reply	[relevance 6%]

* Re: zsh-2.6-beta17 : compiling on SCO - results
  @ 1996-05-15 18:03  5% ` Wayne Davison
  0 siblings, 0 replies; 200+ results
From: Wayne Davison @ 1996-05-15 18:03 UTC (permalink / raw)
  To: Peter Bray; +Cc: zsh-workers

Peter Bray writes:
> host operating system : sco3.2v4.2

Here's the patches I used to apply to zsh when I compiled it for
this version of sco.  The first change allows zsh to accept tty
changes via things like stty.  It does have the effect of allowing
all program to change the tty settings (even the background ones),
but that's the best SCO can do since they have a bug in their
library.  SCO 5 doesn't have this problem, so it would have to
be made conditional for only older versions of SCO, and I never
figured out how best to conditionalize this (because we got rid
of SCO from my machine).

The line numbers will be a little off, since this patch was
last applied to beta 14.

Index: jobs.c
@@ -133,6 +133,10 @@
     }
 
     pgrp = gettygrp();           /* get process group of tty      */
+#ifdef __sco
+    if (pgrp == mypgrp)
+	pgrp = jn->gleader;
+#endif
 
     /* is this job in the foreground of an interactive shell? */
     if ((jn->gleader == pgrp || (pgrp > 1 && kill(-pgrp, 0) == -1)) &&
Index: system.h
@@ -110,7 +110,7 @@
  * that doesn't have gettimeofday.  Of course we *
  * probably will move to the POSIX time function *
  *  anyway.                                      */
-#ifdef __sco
+#ifdef __old_sco
 struct timezone {
     short minutes;
 };
@@ -119,7 +119,7 @@
 /* Sco needs the following include for struct utimbuf *
  * which is strange considering we do not use that    *
  * anywhere in the code                               */
-#ifdef __sco
+#ifdef __old_sco
 # include <utime.h>
 #endif
 
@@ -215,7 +215,7 @@
 # define WSTOPSIG(X) (((X)>>8)&0377)
 #endif
 
-#ifdef HAVE_SYS_SELECT_H
+#if defined(HAVE_SYS_SELECT_H) && !defined(__sco)
 # include <sys/select.h>
 #endif
 

..wayne..



^ permalink raw reply	[relevance 5%]

* kill-word & friends in ZLE
@ 1996-05-15 23:02  7% Hrvoje Niksic
  0 siblings, 0 replies; 200+ results
From: Hrvoje Niksic @ 1996-05-15 23:02 UTC (permalink / raw)
  To: zsh-workers

It is quite irritating for me that in zsh's Emacs mode functions like
backward-kill-word and similar behave in a different fashion. Examples:

fly% cd /usr/local/lib/gwembljh[Esc-Backspace]

and everything is erased, instead of just gwembljh. The same applies for
{backward,forward}-word. Since zshparam man-page states that zsh uses the
value of WORDCHARS for this purpose, I think the default value should be
changed at least not to contain '/', if not to an empty string (for strict
Emacs compliance, since Emacs recognizes all of the default wordchars as
word boundaries).

If I understood the situation correctly, the patch should be something like:
*** Src/system.h.orig	Thu May 16 00:29:00 1996
--- Src/system.h	Thu May 16 01:01:54 1996
***************
*** 305,311 ****
  # define DEFAULT_WATCHFMT "%n has %a %l."
  #endif
  
! #define DEFAULT_WORDCHARS "*?_-.[]~=/&;!#$%^(){}<>"
  #define DEFAULT_TIMEFMT   "%J  %U user %S system %P cpu %*E total"
  
  /* Posix getpgrp takes no argument, while the BSD version *
--- 305,311 ----
  # define DEFAULT_WATCHFMT "%n has %a %l."
  #endif
  
! #define DEFAULT_WORDCHARS "" /* For Emacs compliance */
  #define DEFAULT_TIMEFMT   "%J  %U user %S system %P cpu %*E total"
  
  /* Posix getpgrp takes no argument, while the BSD version *


-- 
hniksic@srce.hr              |  Student of electrical engineering
hniksic@fly.cc.fer.hr        |  University of Zagreb, Croatia
------------------------------------------------------------------
`VI' - An editor used by those heretics that don't subscribe to
       the Emacs religion.



^ permalink raw reply	[relevance 7%]

* Re: 8-bit patch for zle_tricky.c
  @ 1996-05-20 18:36  6% ` Zoltan Hidvegi
  1996-05-20 21:09  6%   ` Zefram
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1996-05-20 18:36 UTC (permalink / raw)
  To: schaefer; +Cc: A.Main, zsh-workers

> } > Adding it to $IFS has no effect in this matter, because zsh does not do
> } > field splitting on normal words.  (It should, at least if SH_WORD_SPLIT
> } > is set.)
> } 
> } I do not think so.  Neither bash nor ksh93 does this.  Look:
> } 
> } % ksh
> } $ count () { echo $# ; }
> } $ IFS=/
> } $ count as/df/gh
> } 1
> } 
> } SH_WORD_SPLIT only changes the result of substitutions.
> 
> zsh% /bin/sh
> $ IFS=/
> $ echo/bar
> bar
> $ exit/1
> zsh% echo $?
> 1
> zsh%

Yes, the original Bourne Shell used IFS in the lexer to separate words but
I think that this does not conform the POSIX Shell and Utilities standard.
Also it may be a security hole if IFS is exported.  That's why bash and
ksh does not use IFS here, and zsh should not use it either.

Zoltan



^ permalink raw reply	[relevance 6%]

* Re: 8-bit patch for zle_tricky.c
  1996-05-20 18:36  6% ` Zoltan Hidvegi
@ 1996-05-20 21:09  6%   ` Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1996-05-20 21:09 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: schaefer, A.Main, zsh-workers

>Yes, the original Bourne Shell used IFS in the lexer to separate words but
>I think that this does not conform the POSIX Shell and Utilities standard.

It's been a while since I read the standard, and I don't have access to
a copy any more, but I'm pretty sure it's required.  I needed to check
this particular matter for some reason.  Can someone with a POSIX shell
or the standard check this?

>Also it may be a security hole if IFS is exported.  That's why bash and
>ksh does not use IFS here, and zsh should not use it either.

It is a security hole, but (a) setuid shell scripts are insecure anyway
on most systems, and (b) there's a way to avoid it:

#!/bin/sh
IFS=' 	
'
echo Note that IFS is now safe.

The above, as a shell script, is secure if setuid on, for example,
Solaris.  Anyone writing setuid scripts should know this technique.

Another solution would be to remove sensitive parameters such as IFS
and LD_* on initialisation if the PRIVILEGED option is set (euid !=
ruid).  Note that a script can already totally clear the exported
environment by doing `typeset +x -m \*`.

-zefram



^ permalink raw reply	[relevance 6%]

* [zsh-2.6-b18] signames.awk and the backslash treatment bug
@ 1996-05-22 19:53  8% Mark Borges
  0 siblings, 0 replies; 200+ results
From: Mark Borges @ 1996-05-22 19:53 UTC (permalink / raw)
  To: ZSH mailing list; +Cc: Zoltan Hidvegi

I wrote the author of mawk, Michael Brennan, concerning the behavior
of mawk w.r.t. the backslashes introduced into the signames.awk script
in beta18. Appended is his take on the matter.

This is probably more than anyone ever wanted to know, but in case you
are curious...

------- start of forwarded message (RFC 934 encapsulation) -------
Content-Type: text
content-length: 891
From: brennan@amc.com (Michael Brennan)
Subject: Re: [mawk-1.2.2] backslash treatment
Date: Wed, 22 May 1996 12:36:00 -0700 (PDT)
To: mdb@cdc.noaa.gov (Mark Borges)

> 
> Is this a bug in mawk?
> 
> Apparently the use of a `\' preceding a character that need not be
> escaped in a print statement is ambiguous. Some awks remove it, others
> (like mawk) leave it verbatim.
> 

The posix answer is "\z" has undefined meaning which implies that it is
not portable to use it.  The posix standard says it is explicitly
undefined.   Note that the same thing is true for ansi C.  See K&R
(ansi version) page 193.

I discuss this issue in the portability section of the mawk man pages
(near the back).

[man page excerpt]

     With mawk, the following are all equivalent,
          x ~ /a\+b/    x ~ "a\+b"     x ~ "a\\+b"
     The strings get scanned twice, once as string  and  once  as
     regular  expression.   On  the string scan, mawk ignores the
     escape on non-escape characters while the AWK book advocates
     \c be recognized as c which necessitates the double escaping
     of meta-characters in strings. Posix explicitly declines  to
     define  the  behavior  which  passively forces programs that
     must run under a variety of awks to use  the  more  portable
     but less readable, double escape.

[end man page excerpt]
 
In mawk, I wanted 

	 x ~ /c\+/
	 x ~ "c\+"

to work the same.  Note with nawk or gawk, you need to

	 x ~ "c\\+"

to escape + once for the string scan and once for the regexp scan.
With mawk
	 x ~ "c\\+"

works correctly too.

- --
Mike
brennan@amc.com

------- end -------



^ permalink raw reply	[relevance 8%]

* zsh-2.5.03 seems to build 'out of box' on my MachTen 4.0.2
@ 1996-05-22 20:06  5% Richard Yeh
  0 siblings, 0 replies; 200+ results
From: Richard Yeh @ 1996-05-22 20:06 UTC (permalink / raw)
  To: support; +Cc: zsh-list

Whether it works, I can't say yet.  I'll let you know if I have any problems.
	I'm running MachTen 4.0.2 (including Tenon's patches through April)
		on a Power Macintosh 7200/75 running System 7.5.3.

Here are the warnings that occurred during the make:

	cc -O3 -c  builtin.c
	builtin.c: In function `bin_unlimit':
	builtin.c:1613: warning: left shift count >= width of type
	builtin.c:1634: warning: left shift count >= width of type
	builtin.c: In function `showlimits':
	builtin.c:1654: warning: left shift count >= width of type
	builtin.c: In function `printulimit':
	builtin.c:3770: warning: left shift count >= width of type
	builtin.c: In function `bin_ulimit':
	builtin.c:3888: warning: left shift count >= width of type

(cc is actually gcc 2.7.0.)

Richard

Below is what resulted from running the 'reporter' script.
The first two lines are from STDERR.

strings: /lib/cpp: No such file or directory
./reporter: no such file or directory: /lib/cpp [118]
# START zsh saveset
# uname:  powerpc-tenon-machten sphere 4 0.1 Power Macintosh

# Aliases.

alias run-help='man'
alias which-command='whence'

# Key bindings.

bindkey -r "^@"
bindkey -r "^A"
bindkey -r "^B"
bindkey -r "^C"
bindkey -r "^D"
bindkey -r "^H"
bindkey -r "^I"
bindkey -r "^J"
bindkey -r "^K"
bindkey -r "^L"
bindkey -r "^M"
bindkey -r "^R"
bindkey -r "^S"
bindkey -r "^T"
bindkey -r "^U"
bindkey -r "^V"
bindkey -r "^W"
bindkey -r "\e"
bindkey -r "^?"
bindkey -r "\e"
bindkey -r "\e[A"
bindkey -r "\e[B"
bindkey -r "\e[C"
bindkey -r "\e[D"

bindkey "^@"	undefined-key
bindkey "^A"	self-insert
bindkey "^B"	self-insert
bindkey "^C"	undefined-key
bindkey "^D"	list-choices
bindkey "^H"	vi-backward-delete-char
bindkey "^I"	expand-or-complete
bindkey "^J"	accept-line
bindkey "^K"	kill-line
bindkey "^L"	clear-screen
bindkey "^M"	accept-line
bindkey "^R"	redisplay
bindkey "^S"	self-insert
bindkey "^T"	self-insert
bindkey "^U"	vi-kill-line
bindkey "^V"	quoted-insert
bindkey "^W"	vi-backward-kill-word
bindkey "\e"	prefix
bindkey "^?"	backward-delete-char
bindkey "\e"	vi-cmd-mode
bindkey "\e[A"	up-line-or-history
bindkey "\e[B"	down-line-or-history
bindkey "\e[C"	forward-char
bindkey "\e[D"	backward-char

# Completions.

compctl -b  bindkey
compctl -c  builtin
compctl -v  export
compctl -o  setopt
compctl -v  typeset
compctl -v  unset
compctl -o  unsetopt
compctl -v  vared
compctl -c  which

# Undefined functions.


# Defined functions.


# Limits.

limit cputime 596523h
limit filesize        2047m
limit datasize        240m
limit stacksize       2m
limit coredumpsize    2047m
limit memoryuse       2047m
limit memorylocked    2047m
limit maxproc         103
limit descriptors     64

# Non-array variables.

TERMCAP='vt100:do=^J:co#80:li#24:cl=50\E[;H\E[2J:sf=2*\ED:le=^H:bs:am:cm=5\E[%i%d;%dH:nd=2\E[C:up=2\E[A:ce=3\E[K:cd=50\E[J:so=2\E[7m:se=2\E[m:us=2\E[4m:ue=2\E[m:md=2\E[1m:mr=2\E[7m:mb=2\E[5m:me=2\E[m:is=\E[1;24r\E[24;1H:if=/usr/share/tabset/vt100:rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=2*\EM:vt#3:xn:sc=\E7:rc=\E8:cs=\E[%i%d;%dr:'
TERM='vt100'
ARGC="0"
BAUD="0"
CDPATH=""
COLUMNS="80"
DIRSTACKSIZE="-1"
DISPLAY=":0"
EDITOR="/usr/bin/nvi"
EGID="10"
ERRNO="9"
EUID="8"
EXINIT="set shell=/bin/csh magic redraw"
FCEDIT="vi"
FIGNORE=""
FPATH=""
GID="10"
HISTCHARS="!^#"
HISTSIZE="30"
HOME="/home/rcyeh"
HOST="sphere"
HOSTTYPE="Power_Macintosh-machten"
KEYTIMEOUT="40"
LINENO="294"
LINES="24"
LISTMAX="100"
LITHISTSIZE="5"
LOGCHECK="60"
LOGNAME="rcyeh"
MACHTEN="4"
MAIL=""
MAILCHECK="60"
MAILPATH=""
MANPATH=""
NULLCMD="cat"
OLDPWD="/home/rcyeh/project/zsh-2.5.03/examples/scripts"
OPTARG=""
OPTIND="1"
PATH=".:~/bin:/usr/bin:/bin:/usr/X11/bin:/usr/libexec:/usr/sbin:/sbin"
PERIOD="0"
POSIX="true"
POSTEDIT=""
PPID="334"
PROMPT="%m%# "
PROMPT2="> "
PROMPT3="?# "
PROMPT4="+ "
PS1="%m%# "
PS2="> "
PS3="?# "
PS4="+ "
PSVAR=""
PWD="/home/rcyeh/project/zsh-2.5.03/examples/scripts"
RANDOM="26658"
READNULLCMD="more"
REPORTTIME="-1"
RPROMPT=""
RPS1=""
SAVEHIST="0"
SECONDS="25"
SHELL="/bin/csh"
SHLVL="2"
SPROMPT="zsh: correct \`%R\' to \`%r\' [nyae]? "
TIMEFMT="%E real  %U user  %S system  %P %J"
TMOUT="0"
TMPPREFIX="/tmp/zsh"
TTY=""
UID="8"
USER="rcyeh"
USERNAME="rcyeh"
VERSION="zsh 2.5.03"
VIRTUAL_MEMORY="false"
VISUAL="/usr/bin/nvi"
WATCH=""
WATCHFMT="%n has %a %l from %m."
WIND_NAME="Terminal 3"
WORDCHARS="*?_-.[]~=/&;!#$%^(){}<>"
status="0"
str="powerpc-tenon-machten sphere 4 0.1 Power Macintosh"
prompt='test%'

# Array variables.

argv=()
cdpath=()
fignore=()
fpath=()
mailpath=()
manpath=()
path=(. ~/bin /usr/bin /bin /usr/X11/bin /usr/libexec /usr/sbin /sbin)
psvar=()
signals=(EXIT hup int quit ill trap abrt emt fpe kill bus segv sys pipe alrm term urg stop tstp cont chld ttin ttou io xcpu xfsz vtalrm prof winch info usr1 usr2 ZERR DEBUG)
watch=()

# Exported variables.

export TERMCAP
export TERM
export DISPLAY=:0
export EDITOR=/usr/bin/nvi
export EXINIT=set shell=/bin/csh magic redraw
export HOME=/home/rcyeh
export LOGNAME=rcyeh
export MACHTEN=4
export PATH=.:~/bin:/usr/bin:/bin:/usr/X11/bin:/usr/libexec:/usr/sbin:/sbin
export POSIX=true
export PWD=/home/rcyeh/project/zsh-2.5.03/examples/scripts
export SHELL=/bin/csh
export SHLVL=2
export TERM=vt100
export TTY=
export USER=rcyeh
export VIRTUAL_MEMORY=false
export VISUAL=/usr/bin/nvi
export WIND_NAME=Terminal 3

# Setopt.

setopt bgnice
setopt hashcmds
setopt hashdirs
setopt hashlistall
setopt notify

# END zsh saveset



^ permalink raw reply	[relevance 5%]

* zsh and portability
@ 1996-05-27 23:16  6% Richard Coleman
  1996-05-28 11:44  0% ` Zoltan Hidvegi
  0 siblings, 1 reply; 200+ results
From: Richard Coleman @ 1996-05-27 23:16 UTC (permalink / raw)
  To: zsh-workers

There been a lot of talk in the last couple of days about
various assumptions that zsh makes (NULL has all zero bits,
or char has 8 bits, etc..).

My suggestion would be to not worry too much about such things unless
they become a problem.  I want zsh to be portable as well, but not at
the expense of needlessly complicating the code for machines that zsh
will probably not run on anyway.

In any portable unix software, you must make assumptions that are not
guaranteed by any standard (ANSI C, POSIX, whatever).  I don't think
anything is wrong with this (withing reason).  If the code is kept
clean and well documented, and someone REALLY wants to run zsh on an
OS that goes against these assumptions, then they could can port it
themselves without too much trouble.

I think time could be better spent documenting the assumptions that
are made, rather than adding more complexity in the name of
portability.

Remember.  Keep things as simple as possible.  I will of course,
repeat this mantra on a regular basis.

rc




^ permalink raw reply	[relevance 6%]

* Re: zsh and portability
  1996-05-27 23:16  6% zsh and portability Richard Coleman
@ 1996-05-28 11:44  0% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-05-28 11:44 UTC (permalink / raw)
  To: Richard Coleman; +Cc: zsh-workers

> There been a lot of talk in the last couple of days about
> various assumptions that zsh makes (NULL has all zero bits,
> or char has 8 bits, etc..).
> 
> My suggestion would be to not worry too much about such things unless
> they become a problem.  I want zsh to be portable as well, but not at
> the expense of needlessly complicating the code for machines that zsh
> will probably not run on anyway.
> 
> In any portable unix software, you must make assumptions that are not
> guaranteed by any standard (ANSI C, POSIX, whatever).  I don't think
> anything is wrong with this (withing reason).  If the code is kept
> clean and well documented, and someone REALLY wants to run zsh on an
> OS that goes against these assumptions, then they could can port it
> themselves without too much trouble.
> 
> I think time could be better spent documenting the assumptions that
> are made, rather than adding more complexity in the name of
> portability.
> 
> Remember.  Keep things as simple as possible.  I will of course,
> repeat this mantra on a regular basis.

I agree, but if a change is simple and trivial, and improves portability
than it would be usefull to add.

Also I think that in the near future there will be systems where
sizeof(long) > sizeof(void*).  The other problems will probably not come up
on modern systems but this one has to be handled somehow.  In other words
we need a portable method to initialise a union.

Zoltan



^ permalink raw reply	[relevance 0%]

* zsh-2.6.b19: handling of locale probably wrong?
@ 1996-06-06  8:46  5% Andrej Borsenkow
  0 siblings, 0 replies; 200+ results
From: Andrej Borsenkow @ 1996-06-06  8:46 UTC (permalink / raw)
  To: zsh-workers

I just started to work with zsh, and already am fond of it. However, one
small problem:

zsh is using value of LANG to set locale (langsetfn()). It means, that as
long as zsh sees LANG it sets *complete* locale to the value of LANG.

I don't have standards at hand, but according to man pages on our system
(and as far as I know it is consistent with XPG and POSIX) the locale is
set to the value of (in decreasing precedence);

LC_ALL
LC_CTYPE, LC_MESSAGES, LC_COLLATE, ...
LC_LANG.

that is, if LC_ALL is set, it overrides any other settings;
if any category is set, it overrides value of LANG;
otherweise use value of LANG.

My problem is, I (and many others as well) using LANG=english and
LC_CTYPE, LC_COLLATE=russian. So I get messages, dates, times and so on in
english, which I prefer, while still have correct character handling.

zsh sets it correct at first (setlocale(LC_ALL,"")), but it seems that
after it sees LANG, it resets the *complete* locale to english
(setlocale(LC_ALL,<value of LANG>) in langsetfn()), LC_CTYPE and
LC_COLLATE including.

Probably, it wouldn't be so bad idea to implement correct hadling of it?
That is, check for existence of LC_ALL and LC_* befor setting LANG?

I am not so nuch deep in sources; but if you tell, how to check for the
variable value (and get it) I could make the patches.

thanks in advance

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------




^ permalink raw reply	[relevance 5%]

* Re: Globbing in redirections
  @ 1996-06-06 16:25  7% ` Zoltan Hidvegi
  1996-06-06 16:36  0%   ` Zefram
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1996-06-06 16:25 UTC (permalink / raw)
  To: Zefram; +Cc: Zsh workers list

> This patch makes redirection behave a little more like ksh.
> It disables globbing on filenames in redirections, but only when
> multios are disabled.  (Globbed redirections are a very useful way
> to generate multios.)  Note that behaviour is still not exactly
> like ksh, as brace expansion is still done.  But ksh seems to treat
> brace expansion as part of globbing: compare "echo ~{root,nobody}"
> in the two shells.  (KSH_BRACES, anyone?)

No, that's a different problem.  In zsh filename expansion is performed
after most other substitutions while POSIX says that it must be the first
expansion which must be done before $ susbstitutions.  In zsh I can use

USER=hzoli ; echo ~$USER

but this does not work in a POSIX compilant shell.  I'll move filename
expansion before the other substitutions if zsh is invoked as sh/ksh.  Or
maybe an option should control this?  I personally think that the best
would be to do filename expansions first even if zsh is invoked as zsh but
I'm sure that it will break some scripts.  Does anyone have such a script?

Zoltan



^ permalink raw reply	[relevance 7%]

* Re: Globbing in redirections
  1996-06-06 16:25  7% ` Zoltan Hidvegi
@ 1996-06-06 16:36  0%   ` Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1996-06-06 16:36 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: A.Main, zsh-workers

>No, that's a different problem.  In zsh filename expansion is performed
>after most other substitutions while POSIX says that it must be the first
>expansion which must be done before $ susbstitutions.  In zsh I can use
>
>USER=hzoli ; echo ~$USER
>
>but this does not work in a POSIX compilant shell.  I'll move filename
>expansion before the other substitutions if zsh is invoked as sh/ksh.  Or
>maybe an option should control this?  I personally think that the best
>would be to do filename expansions first even if zsh is invoked as zsh but
>I'm sure that it will break some scripts.  Does anyone have such a script?

I don't actually have a script that does this, but it's very nice
behaviour, and I do use it from time to time.  I think we should have
another option for this, which would have options
OPT_EMULATE|OPT_BOURNE.  Note that zsh actually follows csh behaviour,
so this really should be OPT_BOURNE and not OPT_NONZSH.  (If you've
never heard of these options, you'll need to check the patch in article
1275.)

However, my original point stands.  ksh doesn't do brace expansion in
redirections.  We need to split up prefork() somewhere -- is there
another function that would be more appropriate to use in this case?
We need all expansions except for brace expansion and globbing, but
prefork() does everything except globbing.

-zefram



^ permalink raw reply	[relevance 0%]

* fc bug when histNoStore
@ 1996-06-07  7:13  6% J.D. Laub
  0 siblings, 0 replies; 200+ results
From: J.D. Laub @ 1996-06-07  7:13 UTC (permalink / raw)
  To: zsh-workers

I'm not a zsh list subscriber, so please email me directly if you need
more info.  Thanks for your time.

Here's a bug in the fc builtin.  Running "fc -l -1 -1" works fine
unless I setopt histNoStore, at which time the command yields what
should be output with "fc -l -2 -2".

Script started on Fri Jun  7 00:58:29 1996
$ pwd
/home5/jdl/zsh/zsh-2.6-beta19
$ ./Src/zsh -f
chimay% . ./Util/reporter
# START zsh saveset
# uname:  HP-UX chimay A.09.04 E 9000/887 1962770231 8-user license

# Aliases.

alias run-help=man
alias which-command=whence

# Key bindings.

bindkey -r "^@"
bindkey -r "^A"
bindkey -r "^B"
bindkey -r "^C"
bindkey -r "^D"
bindkey -r "^E"
bindkey -r "^F"
bindkey -r "^G"
bindkey -r "^H"
bindkey -r "^I"
bindkey -r "^J"
bindkey -r "^K"
bindkey -r "^L"
bindkey -r "^M"
bindkey -r "^N"
bindkey -r "^O"
bindkey -r "^P"
bindkey -r "^Q"
bindkey -r "^R"
bindkey -r "^S"
bindkey -r "^T"
bindkey -r "^U"
bindkey -r "^V"
bindkey -r "^W"
bindkey -r "^X"
bindkey -r "^Y"
bindkey -r "^Z"
bindkey -r "\e"
bindkey -r "^_"
bindkey -r "^?"
bindkey -r "^X^B"
bindkey -r "^X^F"
bindkey -r "^X^J"
bindkey -r "^X^K"
bindkey -r "^X^N"
bindkey -r "^X^O"
bindkey -r "^X^U"
bindkey -r "^X^V"
bindkey -r "^X^X"
bindkey -r "^X*"
bindkey -r "^XG"
bindkey -r "^Xg"
bindkey -r "^Xr"
bindkey -r "^Xs"
bindkey -r "^Xu"
bindkey -r "\e^D"
bindkey -r "\e^G"
bindkey -r "\e^H"
bindkey -r "\e^I"
bindkey -r "\e^J"
bindkey -r "\e^L"
bindkey -r "\e^M"
bindkey -r "\e^_"
bindkey -r "\e "
bindkey -r "\e!"
bindkey -r "\e\\""
bindkey -r "\e$"
bindkey -r "\e'"
bindkey -r "\e-"
bindkey -r "\e."
bindkey -r "\e0"
bindkey -r "\e1"
bindkey -r "\e2"
bindkey -r "\e3"
bindkey -r "\e4"
bindkey -r "\e5"
bindkey -r "\e6"
bindkey -r "\e7"
bindkey -r "\e8"
bindkey -r "\e9"
bindkey -r "\e<"
bindkey -r "\e>"
bindkey -r "\e?"
bindkey -r "\eA"
bindkey -r "\eB"
bindkey -r "\eC"
bindkey -r "\eD"
bindkey -r "\eF"
bindkey -r "\eG"
bindkey -r "\eH"
bindkey -r "\eL"
bindkey -r "\eN"
bindkey -r "\eP"
bindkey -r "\eQ"
bindkey -r "\eS"
bindkey -r "\eT"
bindkey -r "\eU"
bindkey -r "\eW"
bindkey -r "\e[A"
bindkey -r "\e[B"
bindkey -r "\e[C"
bindkey -r "\e[D"
bindkey -r "\e_"
bindkey -r "\ea"
bindkey -r "\eb"
bindkey -r "\ec"
bindkey -r "\ed"
bindkey -r "\ef"
bindkey -r "\eg"
bindkey -r "\eh"
bindkey -r "\el"
bindkey -r "\en"
bindkey -r "\ep"
bindkey -r "\eq"
bindkey -r "\es"
bindkey -r "\et"
bindkey -r "\eu"
bindkey -r "\ew"
bindkey -r "\ex"
bindkey -r "\ey"
bindkey -r "\ez"
bindkey -r "\e|"
bindkey -r "\e^?"

bindkey "^@"    set-mark-command
bindkey "^A"    beginning-of-line
bindkey "^B"    backward-char
bindkey "^C"    undefined-key
bindkey "^D"    delete-char-or-list
bindkey "^E"    end-of-line
bindkey "^F"    forward-char
bindkey "^G"    send-break
bindkey "^H"    backward-delete-char
bindkey "^I"    expand-or-complete
bindkey "^J"    accept-line
bindkey "^K"    kill-line
bindkey "^L"    clear-screen
bindkey "^M"    accept-line
bindkey "^N"    down-line-or-history
bindkey "^O"    accept-line-and-down-history
bindkey "^P"    up-line-or-history
bindkey "^Q"    push-line
bindkey "^R"    history-incremental-search-backward
bindkey "^S"    history-incremental-search-forward
bindkey "^T"    transpose-chars
bindkey "^U"    kill-whole-line
bindkey "^V"    quoted-insert
bindkey "^W"    backward-kill-word
bindkey "^X"    prefix
bindkey "^Y"    yank
bindkey "^Z"    undefined-key
bindkey "\e"    prefix
bindkey "^_"    undo
bindkey "^?"    backward-delete-char
bindkey "^X^B"  vi-match-bracket
bindkey "^X^F"  vi-find-next-char
bindkey "^X^J"  vi-join
bindkey "^X^K"  kill-buffer
bindkey "^X^N"  infer-next-history
bindkey "^X^O"  overwrite-mode
bindkey "^X^U"  undo
bindkey "^X^V"  vi-cmd-mode
bindkey "^X^X"  exchange-point-and-mark
bindkey "^X*"   expand-word
bindkey "^XG"   list-expand
bindkey "^Xg"   list-expand
bindkey "^Xr"   history-incremental-search-backward
bindkey "^Xs"   history-incremental-search-forward
bindkey "^Xu"   undo
bindkey "\e^D"  list-choices
bindkey "\e^G"  send-break
bindkey "\e^H"  backward-kill-word
bindkey "\e^I"  self-insert-unmeta
bindkey "\e^J"  self-insert-unmeta
bindkey "\e^L"  clear-screen
bindkey "\e^M"  self-insert-unmeta
bindkey "\e^_"  copy-prev-word
bindkey "\e "   expand-history
bindkey "\e!"   expand-history
bindkey "\e\\"" quote-region
bindkey "\e$"   spell-word
bindkey "\e'"   quote-line
bindkey "\e-"   neg-argument
bindkey "\e."   insert-last-word
bindkey "\e0"   digit-argument
bindkey "\e1"   digit-argument
bindkey "\e2"   digit-argument
bindkey "\e3"   digit-argument
bindkey "\e4"   digit-argument
bindkey "\e5"   digit-argument
bindkey "\e6"   digit-argument
bindkey "\e7"   digit-argument
bindkey "\e8"   digit-argument
bindkey "\e9"   digit-argument
bindkey "\e<"   beginning-of-buffer-or-history
bindkey "\e>"   end-of-buffer-or-history
bindkey "\e?"   which-command
bindkey "\eA"   accept-and-hold
bindkey "\eB"   backward-word
bindkey "\eC"   capitalize-word
bindkey "\eD"   kill-word
bindkey "\eF"   forward-word
bindkey "\eG"   get-line
bindkey "\eH"   run-help
bindkey "\eL"   down-case-word
bindkey "\eN"   history-search-forward
bindkey "\eP"   history-search-backward
bindkey "\eQ"   push-line
bindkey "\eS"   spell-word
bindkey "\eT"   transpose-words
bindkey "\eU"   up-case-word
bindkey "\eW"   copy-region-as-kill
bindkey "\e[A"  up-line-or-history
bindkey "\e[B"  down-line-or-history
bindkey "\e[C"  forward-char
bindkey "\e[D"  backward-char
bindkey "\e_"   insert-last-word
bindkey "\ea"   accept-and-hold
bindkey "\eb"   backward-word
bindkey "\ec"   capitalize-word
bindkey "\ed"   kill-word
bindkey "\ef"   forward-word
bindkey "\eg"   get-line
bindkey "\eh"   run-help
bindkey "\el"   down-case-word
bindkey "\en"   history-search-forward
bindkey "\ep"   history-search-backward
bindkey "\eq"   push-line
bindkey "\es"   spell-word
bindkey "\et"   transpose-words
bindkey "\eu"   up-case-word
bindkey "\ew"   copy-region-as-kill
bindkey "\ex"   execute-named-cmd
bindkey "\ey"   yank-pop
bindkey "\ez"   execute-last-named-cmd
bindkey "\e|"   vi-goto-column
bindkey "\e^?"  backward-kill-word

# Completions.

compctl -b bindkey
compctl -c builtin
compctl -v export
compctl -o setopt
compctl -v typeset
compctl -v unset
compctl -o unsetopt
compctl -v vared
compctl -c which
compctl -C -c
compctl -D -f
compctl -T

# Undefined functions.


# Defined functions.


# Limits.

limit filesize        3MB
limit datasize        64MB
limit stacksize       8MB
limit descriptors     2048

# Non-array variables.

TERMCAP=''
TERM='vt100'
\'!\'="0"
\'#\'="0"
\'$\'="18993"
\'?\'="1"
ANNEX_REL="6.2"
ANNEX_RELEASE="6"
ARGC="0"
AWK="awk"
BAUD="19200"
CCSITE="chimay"
CDPATH="\'\'"
COLUMNS="80"
CPP="/lib/cpp"
DIRSTACKSIZE="-1"
EGID="206"
ERRNO="0"
EUID="4033"
FCEDIT="vi"
FIGNORE="\'\'"
FPATH="\'\'"
GID="206"
HISTSIZE="30"
HOME="/home5/jdl"
HOST="chimay"
HOSTTYPE="hpux9.04"
KEYTIMEOUT="40"
LANG="\'\'"
LINENO="329"
LINES="24"
LISTMAX="100"
LOGCHECK="60"
LOGNAME="jdl"
MACHINE="hp9000"
MACHTYPE="hppa1.1"
MAIL="/usr/mail/jdl"
MAILCHECK="60"
MAILPATH="\'\'"
MANPATH="/usr/local/man:/usr/man:/usr/contrib/man:/usr/lib/hpnp/man"
NODE_NAME="chimay"
NULLCMD="cat"
OLDPWD="/home5/jdl/zsh/zsh-2.6-beta19"
OPS="HPUX"
OPS_PATH="/bin/posix:/bin:/usr/bin:/usr/contrib/bin"
OPS_RELEASE="9"
OPTARG="\'\'"
OPTIND="1"
OSTYPE="hpux9.04"
PATH="/usr/local/bin:/bin/posix:/bin:/usr/bin:/usr/contrib/bin"
PERIOD="0"
POSTEDIT="\'\'"
PPID="17932"
PROMPT="\'%m%# \'"
PROMPT2="\'> \'"
PROMPT3="\'?# \'"
PROMPT4="\'+ \'"
PS1="\'%m%# \'"
PS2="\'> \'"
PS3="\'?# \'"
PS4="\'+ \'"
PSVAR="\'\'"
PWD="/home5/jdl/zsh/zsh-2.6-beta19"
RANDOM="21754"
READNULLCMD="more"
RELS="\'4.1.5 5.1.5 5.1.6 6.1.1\'"
REPORTTIME="-1"
RPROMPT="\'\'"
RPS1="\'\'"
SAVEHIST="0"
SECONDS="13"
SHELL="/bin/ksh"
SHLVL="1"
SPROMPT="\'zsh: correct \'\\'\'%R\'\\'\' to \'\\'\'%r\'\\'\' [nyae]? \'"
TIMEFMT="\'%J  %U user %S system %P cpu %*E total\'"
TMOUT="0"
TMPPREFIX="/tmp/zsh"
TTY="/dev/ttyp8"
TTYIDLE="-1"
TZ="MST7MDT"
UID="4033"
USERNAME="jdl"
VENDOR="hp"
WATCH="\'\'"
WATCHFMT="\'%n has %a %l from %m.\'"
WORDCHARS="\'*?_-.[]~=/&;!#$%^(){}<>\'"
ZSH_NAME="zsh"
ZSH_VERSION="2.6-beta19"
each="\'__unix"
histchars="\'!^#\'"
reporter_OSVersion="HP-UX_A.09.04"
reporter_junkiequotes="no"
status="1"
str="\'HP-UX chimay A.09.04 E 9000/887 1962770231 8-user license\'"
prompt='test%'

# Array variables.

argv=()
'*'=()
cdpath=()
fignore=()
fpath=()
mailpath=()
manpath=(/usr/local/man /usr/man /usr/contrib/man/usr/lib/hpnp/man)
path=(/usr/local/bin /bin/posix /bin /usr/bin/usr/contrib/bin )
psvar=()
signals=(EXIT HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM USR1 USR2 CHLD PWR VTALRM PROF IO WINCH STOP TSTP CONT TTIN TTOU URG LOST RESERVE DIL ZERRDEBUG )
watch=()

# Exported variables.

export TERMCAP
export TERM
export ANNEX_REL=6.2
export ANNEX_RELEASE=6
export CCSITE=chimay
export HOME=/home5/jdl
export LOGNAME=jdl
export MACHINE=hp9000
export MAIL=/usr/mail/jdl
export MANPATH=/usr/local/man:/usr/man:/usr/contrib/man:/usr/lib/hpnp/man
export NODE_NAME=chimay
export OPS=HPUX
export OPS_PATH=/bin/posix:/bin:/usr/bin:/usr/contrib/bin
export OPS_RELEASE=9
export PATH=/usr/local/bin:/bin/posix:/bin:/usr/bin:/usr/contrib/bin
export PWD=/home5/jdl/zsh/zsh-2.6-beta19
export RELS='4.1.5 5.1.5 5.1.6 6.1.1'
export SHELL=/bin/ksh
export SHLVL=1
export TERM=vt100
export TZ=MST7MDT

# Setopt.

setopt bgnice
setopt hashcmds
setopt hashdirs
setopt hashlistall
setopt norcs
setopt notify

# END zsh saveset
chimay% echo one two
one two
chimay% echo three four
three four
chimay% fc -l -1 -1
    3  echo three four
chimay% fc -l
    1  . ./Util/reporter
    2  echo one two
    3  echo three four
    4  fc -l -1 -1
    5  fc -l
chimay% setopt histNoStore
chimay% echo five six
five six
chimay% echo seven eight
seven eight
chimay% fc -l -1 -1
    7  echo five six
chimay% fc -l
    1  . ./Util/reporter
    2  echo one two
    3  echo three four
    4  fc -l -1 -1
    5  fc -l
    6  setopt histNoStore
    7  echo five six
    8  echo seven eight
chimay% exit
$ exit

script done on Fri Jun  7 01:00:46 1996
-- 
J.D. Laub (Laubster) HBOC/CliniCom|"I think you're very, very, very, very, very,
jdl@clinicom.com     Boulder,CO   |very, very, very, very, ..." - Flying Lizards



^ permalink raw reply	[relevance 6%]

* Re: [ -z $FOO ] seems broken in beta13
    @ 1996-06-10 17:34  6% ` Zoltan Hidvegi
  1 sibling, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-06-10 17:34 UTC (permalink / raw)
  To: Zefram; +Cc: olsenc, zsh-workers

> >I use [ -z $TERM ] to check for terminal settings, and since we revved up
> >from 2.5, I'm now forced to use $+TERM.
> >
> >Now I get "argument expected".  Is this correct?
> 
> Yes.  If $TERM is empty, then $TERM will be removed from the command
> line completely, leaving `[ -z ]`, which is a syntax error.  If you use
> "$TERM" (note the quotes), then the result will be `[ -z "" ]`, which
> is legal.

Actually POSIX says that

with no arguments test should exit with status 1. 

With 1 argument it should exit true iff that argument is non-null (this
means that `test -n' and `test -z' both exit true).  

With 2 arguments: if $1 is a bang `!' exit true iff $2 is null.  If $1 is
an unary operator, exit true iff the unary test is true.

etc.

I'll modify zsh according to this.

Zoltan



^ permalink raw reply	[relevance 6%]

* Re: Is this really correct ?
  @ 1996-06-10 18:17  6% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-06-10 18:17 UTC (permalink / raw)
  To: Hrvoje Niksic; +Cc: zsh-workers, gene

> gene@bear.com (gene@bear.com) wrote:
> > 
> > 
> >    Hpux 9.05.
> > 
> > % echo $ZSH_VERSION
> > 2.6-beta20
> > % a="-s"; if [ "$a" = "-s" ] ;  then echo "yeh" ; fi 
> > % 
> > 
> > (if fails)
> 
> If $a is -s, then the test builtin probably tests for whether file '='
> exists and has a size greater than zero :-). This works for me:
> $ echo hi > =
> $ a="-s"; if [ "$a" = "-s" ] ;  then echo "yeh" ; fi
> yeh
> 
> Thus, it may be an sh incompatibility, but not a bug. Unless the shell
> is supposed to count the arguments first, and then use draw the
> conclusions according to the argument values (in which case the middle
> argument would recognized as two-operand =).

POSIX 1003.2 says that if test has three arguments and $2 is a binary
operator then perform the binary test of $1 and $3.  If $1 is `!', negate
the two-argument test of $2 and $3.  Otherwise, produce unspecified
results.

Zsh will be modified according to this (which is more logical than the
present behaviour).

Zoltan



^ permalink raw reply	[relevance 6%]

* Re: Re: is this really correct
  @ 1996-06-10 18:33  6% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-06-10 18:33 UTC (permalink / raw)
  To: gene; +Cc: Zsh workers list

>   What is the "preferred" way of testing strings that may be arbitrarily
>   input then given the above ? I mean one does not know what 'a' is until
>   you do a test on it right ?

As I said I'll modify [ ... ] according to POSIX which will fix this
problem (maybe it was not clear that test and [ are the same).  But in zsh
one can use

% a="-s"; if [[ "$a" = "-s" ]] then echo "yeh" ; fi

which should work with all zsh versions.

Zoltan



^ permalink raw reply	[relevance 6%]

* Re: [ -z $FOO ] seems broken in beta13
       [not found]       ` <hniksic@srce.hr>
@ 1996-06-10 19:41  7%     ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 1996-06-10 19:41 UTC (permalink / raw)
  To: ZSH Workers Mailing List

On Jun 10,  7:18pm, Hrvoje Niksic wrote:
} Subject: Re: [ -z $FOO ] seems broken in beta13
}
} Zefram (A.Main@dcs.warwick.ac.uk) wrote:
} > 
} > >I use [ -z $TERM ] to check for terminal settings, and since we revved up
} > >from 2.5, I'm now forced to use $+TERM.
} > >
} > >Now I get "argument expected".  Is this correct?
} > 
} > Yes.  If $TERM is empty, then $TERM will be removed from the command
} > line completely, leaving `[ -z ]`, which is a syntax error.  If you use
} > "$TERM" (note the quotes), then the result will be `[ -z "" ]`, which
} > is legal.
} 
} I thought you got this behaviour only by turning on shwordsplit?

Probably that was true at one time.

In any case, it would be nice to be able to get a Bourne-shell-compatible
"test" as well as a POSIX-compatible "test".  As demonstrated here before,
bash appears to use the POSIX semantics, but sh and ksh use the "argument
expected" semantics quoted above.

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



^ permalink raw reply	[relevance 7%]

* Re: zsh.texi
  @ 1996-06-15  1:53  6% ` Zoltan Hidvegi
  1996-06-15  7:44  0%   ` zsh.texi Zefram
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1996-06-15  1:53 UTC (permalink / raw)
  To: schaefer; +Cc: mdb, zsh-workers, clive

Bart Schaefer wrote:
> I'm just glancing at the programmable completion section at the moment.
> Some of it is still pretty hard to decipher.  Here's an example:
> 
> 
> -d This can be combined with -F, -B, -w, -a, -R and -G to get names of
>        disabled functions, builtins, reserved words or aliases. 
> -e Without -d this option has no effect. Otherwise this can be combined
>        with -F, -B, -w, -a, -R and -G to get names of functions, builtins,
>        reserved words or aliases even if they are disabled. 
> 
> 
> That stuff under -e doesn't make sense to me -- Without -d, has no effect?
> You mean I have to use `compctl -d -e ...'?  Why? -- and it conflicts with
> the zshcompctl.man description:
> 
> -e Names of executable (and enabled) commands.

Sorry for the late response but I was away in the last few days.  Actually
in beta20 I corrected the documentation of compctl -e and compctl -d, and I
also changed its behaviout a little bit.  If you try compctl -e and compctl
-d in any zsh version you'll see that it does not behave as it is
documented.  In beta20 it behaved as described above.  -e or -d only have
effect if combined with -F, -B, -w, -a, -R or -G.  But these flags by
default only complete enabled commands, so compctl -e has no effect
(because it is assumed as default).  This means that -e is only necessary
if you'd like to complete both enabled and disabled commands when you use
-ed.  This may seem to be illogical.  The logical solution is to list
enabled commands by default, but with -d, list only disabled ones and with
an other flag list all of them but this would be incompatible with the old
versions (but since -e and -d was not documented correctly this may not be
a big problem).

Before beta20 the above options listed all builtins/aliases/functions even
if they were disabled.  Before beta20 there were no commands to complete
external commands or reserved words.  These new flags were added in beta20.

There are some problems with compctl -L output in beta20 which I've already
fixed (but I did not send patch, it'll be in beta21).  The maual still
needs some corrections.  The description of -, command, noglob and exec
prefixes should probably be moved into zshbuiltins.man because these are
builtins now.  But the present location may be better for these so it may
be better to keep them there noting that these are builtins, remove these
from the reserved word list and add to zshbuiltins.man with pointers to the
documentation in zshmisc(1).

There will be some other changes in beta21 which require changes in the
maual.  I rewrote redirection handling to conform POSIX.  In beta21 in a
>& $foo redirection $foo will be expanded first, and if the result is a
number, - or p, that filenumber is duplicated, a file is closed or the
output is written to the coprocess.  Otherwise >& redirects both stdout and
stderr.  The &>, &>|, &>> etc. syntax can be used for redirecting both
stdout and stderr when the filename is a number or - or p.  This was taken
from bash.

I'd like to implement <> redirection as well which is often quite useful
and it is required by POSIX as well.  When not in sh/ksh mode <> will only
be recocnized as a redirection if it is delimited from the word before and
after it or if it is immediately preceeded by a digit.  E.g.
% foo arguments 2<> bar      # redirection
% foo arguments2<>  bar      # numeric glob
% foo arguments 22<> bar     # numeric glob
% foo arguments <>bar        # numeric glob
% foo arguments <> bar       # redirection
% foo arguments <-> bar      # numeric glob

In sh/ksh mode <> will always be interpreted as a redirection and <-> will
be required to match an arbitrary number.

Zoltan



^ permalink raw reply	[relevance 6%]

* Re: zsh.texi
  1996-06-15  1:53  6% ` zsh.texi Zoltan Hidvegi
@ 1996-06-15  7:44  0%   ` Zefram
  1996-06-15 22:08  0%     ` <> redirection operator (was: zsh.texi) Zoltan Hidvegi
  0 siblings, 1 reply; 200+ results
From: Zefram @ 1996-06-15  7:44 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: schaefer, mdb, zsh-workers, clive

>I'd like to implement <> redirection as well which is often quite useful
>and it is required by POSIX as well.  When not in sh/ksh mode <> will only
>be recocnized as a redirection if it is delimited from the word before and
>after it or if it is immediately preceeded by a digit.  E.g.

I think actually <> should *always* do redirection.  The glob syntax,
<->, is only one charater longer.

-zefram



^ permalink raw reply	[relevance 0%]

* <> redirection operator (was: zsh.texi)
  1996-06-15  7:44  0%   ` zsh.texi Zefram
@ 1996-06-15 22:08  0%     ` Zoltan Hidvegi
  1996-06-16 13:23  6%       ` Zefram
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1996-06-15 22:08 UTC (permalink / raw)
  To: Zsh hacking and development

Zefram wrote:
> >I'd like to implement <> redirection as well which is often quite useful
> >and it is required by POSIX as well.  When not in sh/ksh mode <> will only
> >be recocnized as a redirection if it is delimited from the word before and
> >after it or if it is immediately preceeded by a digit.  E.g.
> 
> I think actually <> should *always* do redirection.  The glob syntax,
> <->, is only one charater longer.

I agree with that but I'm afraid that this change will break many scripts.
But it would be definitely simpler and cleaner, and the documentation would
be much simpler and less confusing.

Zoltan



^ permalink raw reply	[relevance 0%]

* Re: <> redirection operator (was: zsh.texi)
  1996-06-15 22:08  0%     ` <> redirection operator (was: zsh.texi) Zoltan Hidvegi
@ 1996-06-16 13:23  6%       ` Zefram
  1996-06-17 13:10  7%         ` Zoltan Hidvegi
  0 siblings, 1 reply; 200+ results
From: Zefram @ 1996-06-16 13:23 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: zsh-workers

>I agree with that but I'm afraid that this change will break many scripts.
>But it would be definitely simpler and cleaner, and the documentation would
>be much simpler and less confusing.

How often do you use numerical globbing?  I've only ever used it
interactively.  It wouldn't be the first time we've changed behaviour,
and the change required to scripts is trivial.

And regarding the &> redirection you mentioned: I think this is a bad
idea.  It's not POSIX conformant (consider `a &> b c`), and it's not
really necessary.  It is possible to redirect to a file called "-" by
doing `>& ./-`.

-zefram



^ permalink raw reply	[relevance 6%]

* Re: <> redirection operator (was: zsh.texi)
  1996-06-16 13:23  6%       ` Zefram
@ 1996-06-17 13:10  7%         ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-06-17 13:10 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

> >I agree with that but I'm afraid that this change will break many scripts.
> >But it would be definitely simpler and cleaner, and the documentation would
> >be much simpler and less confusing.
> 
> How often do you use numerical globbing?  I've only ever used it
> interactively.  It wouldn't be the first time we've changed behaviour,
> and the change required to scripts is trivial.

I decided: in beta21, <> will always do redirection.

> And regarding the &> redirection you mentioned: I think this is a bad
> idea.  It's not POSIX conformant (consider `a &> b c`), and it's not

Yes, a &> b c will work differently from what POSIX requires but a & > b c
will be OK.  I do not think that there is any script which contains
adjacent & and >.

> really necessary.  It is possible to redirect to a file called "-" by
> doing `>& ./-`.

The biggest problem is when you use parameter expansion.  When you write
>& $foo you cannot tell in advance wether the output will be closed or if
it goes to a file, or to an other file descriptor or to the coprocess.

Implementing &> is very simple and I do not think that it conflicts with
any scripts (and a portable script which expects POSIX behaviour should not
use &> anyway since bash uses it for redirectiog standard output and
error which means that such a script will not work under Linux).

Zoltan



^ permalink raw reply	[relevance 7%]

* Compiling zsh 2.5.0 on LynxOS 2.3.0
@ 1996-06-18 13:18 10% Robin Kirkham
  0 siblings, 0 replies; 200+ results
From: Robin Kirkham @ 1996-06-18 13:18 UTC (permalink / raw)
  To: zsh-list

Hello

I've hacked zsh 2.5.0 to run on the current version of LynxOS, a real-time
Unix. A brief description of my procedure and the patches I had to make appear
below. It compiles and runs OK, but I have not tested it with other than my
normal zsh configuration files. Having work to do :-( I don't have time to
fiddle with it any further.

I hope someone finds this useful. I'm not a member of zsh-list, so any
feedback please to address below.

Robin Kirkham			CSIRO Division of Manufacturing Technology
Project Engineer		Locked Bag 9, Preston 3072, Australia
robin.kirkham@mlb.dmt.csiro.au	Phone: +61 3 9662-7756  Fax: +61 3 9662-7853


To compile zsh 2.5.0 for LynxOS version 2.3.0, run buildzsh as normal, ask to 
answer the questions and accept the defaults EXCEPT say "no" to the questions
about dirent.h and about sigset, and specify gcc, not cc for the compiler.
Rename zsh.h and exec.c to zsh.h-orig and exec.c-orig, and apply the patches
below (I think I've done these right: anyway there quite simple). Make sure
you are using the `new' Cygnus GCC, by running /CYGNUS.csh. It should then
type `make' and it should compile and run OK.

Both patches depend on the preprocessor symbol __Lynx, which the compiler
defines automatically. The first patch substitutes the LynxOS setprio() for
nice(), with, I believe, roughly equivalent effect. nice() (and sigset()) are
actually in a System V compatibility library, but to use this library I think
you have to use the old compiler cc, and I had trouble with other things
with cc.

The second patch disables the resource limits stuff, by #undef'ing symbol
RLIM_INFINITY. LynxOS actually has resource limits, but to use them would mean
quite a lot of hacks to builtin.c and others, as well as sys/resource.h
(RLIM_NLIMITS, for instance, is missing).  It also #define's "dirent" to be
"direct" (LynxOS has both sys/dir.h and sys/dirent.h, with are different).


*** exec.c	Tue May 28 00:47:19 1996
--- exec.c-orig	Tue May 28 00:21:06 1996
***************
*** 21,30 ****
  #include "zsh.h"
  #include <errno.h>
  
- #ifdef __Lynx
- #include <sys/sched.h>
- #endif
- 
  #define execerr() { if (forked) _exit(1); \
  	closemnodes(mfds); lastval = 1; return; }
  
--- 21,26 ----
***************
*** 1012,1023 ****
  	entersubsh(bkg);
  
      if (bkg && isset(BGNICE))
- #ifdef __Lynx
- 	/* should have more or less the same effect */
- 	setprio(0, getprio(0) - 5);
- #else
  	nice(5);
- #endif
  
  /* perform postfork substitutions */
      postfork(args, !(cmd->flags & CFLAG_NOGLOB));
--- 1008,1014 ----
*** zsh.h	Tue Jun 18 22:21:45 1996
--- zsh.h-orig	Mon May 27 22:40:00 1996
***************
*** 175,185 ****
  
  #if !defined(SYSV) || defined(SYSVR4)
  #include <sys/resource.h>
- #ifdef __Lynx
-     /* LynxOS resource.h is wierd, just disable it */
- #undef RLIM_INFINITY
  #endif
- #endif
  
  #if defined(RLIMIT_OFILE) && defined(RLIMIT_NOFILE)
  #undef RLIMIT_NOFILE
--- 175,181 ----
***************
*** 254,260 ****
  #include <dirent.h>
  #else
  #include <sys/dir.h>
! #if defined(sony) || defined(MACH) || defined(__Lynx)
  #define dirent direct
  #endif
  #endif
--- 250,256 ----
  #include <dirent.h>
  #else
  #include <sys/dir.h>
! #if defined(sony) || defined(MACH)
  #define dirent direct
  #endif
  #endif
***************
*** 341,347 ****
  /* SYSV or POSIX compatible BSD */
  /* ARGH, this is currently broken as the 'BSD' test had to be taken stripped
   * of an additional test BSD >= 199301 as Solaris cpp is broken ++jhi; */
! #if (defined(SYSV) || defined(_POSIX_SOURCE) || defined(BSD) || defined(__convex__) || defined(_CRAY) || defined(__osf__) || defined(__linux__) || defined(__Lynx)) && !defined(NeXT)
  #if !defined(__sgi) || !defined(_BSD_COMPAT)	/* IRIX */
  #ifdef __hpux
  #define GETPGRP()  getpgrp2(0)
--- 337,343 ----
  /* SYSV or POSIX compatible BSD */
  /* ARGH, this is currently broken as the 'BSD' test had to be taken stripped
   * of an additional test BSD >= 199301 as Solaris cpp is broken ++jhi; */
! #if (defined(SYSV) || defined(_POSIX_SOURCE) || defined(BSD) || defined(__convex__) || defined(_CRAY) || defined(__osf__) || defined(__linux__)) && !defined(NeXT)
  #if !defined(__sgi) || !defined(_BSD_COMPAT)	/* IRIX */
  #ifdef __hpux
  #define GETPGRP()  getpgrp2(0)



^ permalink raw reply	[relevance 10%]

* Re: zsh.texi commentary (actually, HTML pages commentary)
  @ 1996-06-21 12:15  5% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-06-21 12:15 UTC (permalink / raw)
  To: schaefer; +Cc: clive, mdb, zsh-workers

> For the rest of these comments, I don't know which need to change the
> man pages, the FAQ, zsh.texi, and/or all of them; but they're all from
> reading the HTML at the above URL.

Undoubtadly there are things in the manual which is not very clear.  Any
patches are welcome.

> Aside:  Question about NO_RCS:
>     Commands are first read from `/etc/zshenv'. If the -f flag is
>     given or if the NO_RCS option is set within `/etc/zshenv', all
>     other initialization files are skipped.
> Why doesn't NO_RCS in any init file stop reading of any files that would
> normally follow the one where it is set?  Or does it, and the doc just
> doesn't explicitly say so?

No, the documentation is correct.

> Shell Grammar section:
> 
>     A simple command is a sequence of optional parameter assignments
>     followed by blank-separated words,
>                 ^^^^^
> Should this read "whitespace" or some such?  (Too early to mention $IFS.)

IFS is not used for that.  I think that blank and whitespace are synonyms.
whitespace may also include newline which cannot be used here.

> Aside:  What's the value of a command executed in the background?  E.g.
> 	if false & then echo Hmmm & fi
> Is it always consistent?

Backgrounded commands always have 0 exit status (that is explicitely
mentioned in POSIX 1003.2).

> Precommand modifiers, `exec', should explain that the "parent" zsh is
> replaced by the exec'd command, as if zsh had exited and the command
> was run in its place.

Also these are builins now, which is not yet documented.

> Aside:  Why doesn't `foreach name ( word ... )' need CSH_JUNKIE_PARENS?

foreach is a csh command and in csh that is the only way it works as I
know.  When someone uses foreach he is a already a csh junkie and the shell
knows that.

> Aside:  That it is possible to `disable -r fi' without first disabling
> `if', scares the willies out of me.  Simliarly for `done' and `esac'.

Yes, disable -r should be use very carefully.  But I do not think that any
change is necessary here.

> Aside:  Given the above behavior of `disable -r', it'd be nice to be able
> to get at the internal tokens for the disabled reserved words.  E.g.:
>     foo() { if true ; then echo This function keeps working ; fi }
>     alias endif=fi
>     disable -r fi
>     bar() { if true ; then echo I wish this still worked ; endif }
> Maybe an option to the alias builtin?

Aliases realy modify the input to the lexer.  I do not think that such a
feature is necessary.

> The paragraph on Comments still refers to HISTCHARS; it's now histchars.

Perhaps I should have mentioned it: I put back HISTCHARS and now both
histchars and HISTCHARS can be used.  But HISTCHARS is disabled in sh/ksh
mode.

> Only the "expression" part of identifier=expression is expanded, right?

Identifier is also expanded but it contains only letters, numbers and
underscore so there is nothing to expand.  I think that's clear.

> The following statement is false for ${name:#pattern}, is it not?
>     If the colon is omitted from one of the above expressions
>     containing a colon, then the shell only checks whether name
>     is set or not, not whether it is null.

Yes, but there the form without a colon is also documented.

> There's something odd here:
>     Arithmetic Expansion
> 
>     A string of the form $[exp] is substituted with the value of
>     the arithmetic expression exp. exp is subjected to parameter
>     expansion, command substitution and arithmetic expansion before
>                                     ^^^^^^^^^^^^^^^^^^^^^^^^
>     it is evaluated. See section Arithmetic Evaluation. 
> Is this wrong, or is it just a goofy way of saying that $[exp] can be
> nested?  (Which doesn't seem to be true, so that's not it.)

It should be possible to nest arithmentic exansions.  Unfortunately
$[$[...]] does not work, that's a bug, I'll fix it.  But $[$((...))] works.

> Why isn't ***/ mentioned anywhere?  That's like **/ except it follows
> symlinks, correct?

It is documented in the manual.

Zoltan



^ permalink raw reply	[relevance 5%]

* quoting bug
@ 1996-06-21 13:17  6% Raymond Nijssen
    0 siblings, 1 reply; 200+ results
From: Raymond Nijssen @ 1996-06-21 13:17 UTC (permalink / raw)
  To: zsh-workers


zsh fails to break up strings properly where other shells do the right thing.

This happens with beta21 and all previous versions I have.

Best Regards,
-Raymond

----------------------------------------------------------------------

123[krait:~/tmp/zshbug]% <bug.zsh 

FOO="ls -C"

BAR="`$FOO -F`"

echo $BAR

124[krait:~/tmp/zshbug]% ksh ./bug.zsh
bug.zsh

125[krait:~/tmp/zshbug]% bash ./bug.zsh 
bug.zsh

126[krait:~/tmp/zshbug]% sh ./bug.zsh 
bug.zsh

127[krait:~/tmp/zshbug]% /bin/posix/sh ./bug.zsh 
bug.zsh

128[krait:~/tmp/zshbug]% zsh -f ./bug.zsh 
./bug.zsh: command not found: ls -C [4]

----------------------------------------------------------------------



^ permalink raw reply	[relevance 6%]

* Re: quoting bug
  @ 1996-06-21 13:55  6%   ` Bruce Stephens
  1996-06-21 14:03  8%     ` Zoltan Hidvegi
  1996-06-21 14:17  6%     ` quoting bug Zefram
  0 siblings, 2 replies; 200+ results
From: Bruce Stephens @ 1996-06-21 13:55 UTC (permalink / raw)
  To: zsh-workers

>>>>> "Zefram" == Zefram  <A.Main@dcs.warwick.ac.uk> writes:

>> zsh fails to break up strings properly where other shells do the
>> right thing.

> setopt SH_WORD_SPLIT

What does POSIX say?



^ permalink raw reply	[relevance 6%]

* Re: quoting bug, and comparisons with ksh93
  1996-06-21 14:03  8%     ` Zoltan Hidvegi
@ 1996-06-21 14:24  7%       ` Bruce Stephens
  0 siblings, 0 replies; 200+ results
From: Bruce Stephens @ 1996-06-21 14:24 UTC (permalink / raw)
  To: zsh-workers

>>>>> "Zoltan" == Zoltan Hidvegi <hzoli@cs.elte.hu> writes:

>> >>>>> "Zefram" == Zefram <A.Main@dcs.warwick.ac.uk> writes:
>> 
>> > setopt SH_WORD_SPLIT
>> 
>> What does POSIX say?

> Zsh must be invoked as sh/ksh if you want POSIX.  Even is sh/ksh
> mode there are some minor incompatibilities between zsh and POSIX
> but these rarely cause problems.  Also the zsh documentation does
> not claim that zsh conforms to POSIX.  On my computer /bin/sh is a
> link to zsh and it works fine.

That sounds fine then.  It would be a shame to have SH_WORD_SPLIT be
the default: the current position is more logical, even if it does
sometimes fool me.

Moving to another topic, I was reading about ksh93 in the recent AT&T
book on reusable UNIX software.  They've extended the pattern syntax
so it's equivalent to egrep style regexps (my guess is that zsh's are
pretty close), and added the nice touch that some option of print will
convert from a regexp to a ksh pattern.  There are lots of handy
things for writing scripts, but I tend to use zsh only interactively,
so for all I know some of these may already exist, although some
definitely don't: I can't have a variable called a.fred, for example.

One interesting, and probably not too hard feature (now that TCL and
Perl have done it) is dynamic loading of commands (on systems which
support it).  The idea is that they've written a library of routines
wc(argc, argv), basename(argc, argv) and so on which are all POSIX
implementations of the commands of the same names (so you can wrap a
10 line main around them to get the POSIX commands), and if you want
(and your machine supports it), you can arrange for ksh to dynamically
load this library, making lots of commands builtins.  It would be a
nice addition to zsh, I think: the mechanism that Perl uses is more
complex, because of its different types, but TCL's extensions are just
bunches of routines which take (int argc, char **argv), so presumably
the mechanism it uses to dynamically load things could be borrowed.



^ permalink raw reply	[relevance 7%]

* Re: quoting bug
  1996-06-21 14:17  6%     ` quoting bug Zefram
@ 1996-06-21 14:30  7%       ` Zoltan Hidvegi
  1996-06-21 14:43  0%       ` Hrvoje Niksic
  1996-06-21 14:48  7%       ` Chet Ramey
  2 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-06-21 14:30 UTC (permalink / raw)
  To: Zefram; +Cc: stephens, zsh-workers

> >> setopt SH_WORD_SPLIT
> >
> >What does POSIX say?
> 
> POSIX requires the SH_WORD_SPLIT behaviour.  It also requires field
> splitting in normal words, as well as the result of expansions:
> 
> % setopt SH_WORD_SPLIT
> % IFS=x
> % echo fooxbar
> fooxbar

No.  POSIX does not allow field splitting here:

"IFS is used for performing field splitting on the results of parameter
 and command substitution; it is not used for splitting all fields.
 Previous versions of the shell used it for splitting all fields during
 field splitting, but this has severe problems because the shell can no
 longer parse its own script.  There are also important security
 implications caused by this behavior.  All useful applications of IFS use
 it for parsing input of the read utility and for splitting the results of
 parameter and command substitution.  New versions of the shell have fixed
 this bug, and POSIX.2 requires the corrected behavior."

> I think we should implement this behaviour -- when SH_WORD_SPLIT is
> set, of course.  It should be very easy.  I also think we should retain
> the current default, as it's much nicer behaviour.

Yes, it can be implemented easily by adding IBLANK type to IFS elements but
I still think that it is unnecessary.  And there may be hidden problems as
this change affects the parser.

Zoltan



^ permalink raw reply	[relevance 7%]

* Re: quoting bug
  1996-06-21 13:55  6%   ` Bruce Stephens
  1996-06-21 14:03  8%     ` Zoltan Hidvegi
@ 1996-06-21 14:17  6%     ` Zefram
  1996-06-21 14:30  7%       ` Zoltan Hidvegi
                         ` (2 more replies)
  1 sibling, 3 replies; 200+ results
From: Zefram @ 1996-06-21 14:17 UTC (permalink / raw)
  To: Bruce Stephens; +Cc: zsh-workers

>> setopt SH_WORD_SPLIT
>
>What does POSIX say?

POSIX requires the SH_WORD_SPLIT behaviour.  It also requires field
splitting in normal words, as well as the result of expansions:

% setopt SH_WORD_SPLIT
% IFS=x
% echo fooxbar
fooxbar

$ IFS=x
$ echo fooxbar
foo bar

I think we should implement this behaviour -- when SH_WORD_SPLIT is
set, of course.  It should be very easy.  I also think we should retain
the current default, as it's much nicer behaviour.

-zefram



^ permalink raw reply	[relevance 6%]

* Re: quoting bug
  1996-06-21 13:55  6%   ` Bruce Stephens
@ 1996-06-21 14:03  8%     ` Zoltan Hidvegi
  1996-06-21 14:24  7%       ` quoting bug, and comparisons with ksh93 Bruce Stephens
  1996-06-21 14:17  6%     ` quoting bug Zefram
  1 sibling, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1996-06-21 14:03 UTC (permalink / raw)
  To: Bruce Stephens; +Cc: zsh-workers

> >>>>> "Zefram" == Zefram  <A.Main@dcs.warwick.ac.uk> writes:
> 
> >> zsh fails to break up strings properly where other shells do the
> >> right thing.
> 
> > setopt SH_WORD_SPLIT
> 
> What does POSIX say?

Zsh must be invoked as sh/ksh if you want POSIX.  Even is sh/ksh mode there
are some minor incompatibilities between zsh and POSIX but these rarely
cause problems.  Also the zsh documentation does not claim that zsh
conforms to POSIX.  On my computer /bin/sh is a link to zsh and it works
fine.

Zoltan



^ permalink raw reply	[relevance 8%]

* Re: quoting bug
  1996-06-21 14:17  6%     ` quoting bug Zefram
  1996-06-21 14:30  7%       ` Zoltan Hidvegi
@ 1996-06-21 14:43  0%       ` Hrvoje Niksic
  1996-06-21 15:18  9%         ` Zefram
  1996-06-21 14:48  7%       ` Chet Ramey
  2 siblings, 1 reply; 200+ results
From: Hrvoje Niksic @ 1996-06-21 14:43 UTC (permalink / raw)
  To: ZSH Workers Mailing List

Zefram (A.Main@dcs.warwick.ac.uk) wrote:
> POSIX requires the SH_WORD_SPLIT behaviour.  It also requires field
> splitting in normal words, as well as the result of expansions:

What do you think of setting shwordsplit when the environmental
variable POSIXLY_CORRECT is set?

-- 
hniksic@srce.hr              |  Student of electrical engineering
hniksic@fly.cc.fer.hr        |  University of Zagreb, Croatia
------------------------------------------------------------------
   Mime is a standard for waving your hands through the air, aimlessly,
while people stand around yawning.



^ permalink raw reply	[relevance 0%]

* Re: quoting bug
  1996-06-21 14:17  6%     ` quoting bug Zefram
  1996-06-21 14:30  7%       ` Zoltan Hidvegi
  1996-06-21 14:43  0%       ` Hrvoje Niksic
@ 1996-06-21 14:48  7%       ` Chet Ramey
  2 siblings, 0 replies; 200+ results
From: Chet Ramey @ 1996-06-21 14:48 UTC (permalink / raw)
  To: A.Main; +Cc: stephens, zsh-workers

> POSIX requires the SH_WORD_SPLIT behaviour.  It also requires field
> splitting in normal words, as well as the result of expansions:

I'm usually silent here, but I can't let this one by.  POSIX.2 explicitly
disallows field splitting on words that are not the result of expansions.
See section 3.6.5 of POSIX.2-1992.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, Case Western Reserve University	Internet: chet@po.CWRU.Edu



^ permalink raw reply	[relevance 7%]

* Re: quoting bug
  1996-06-21 14:43  0%       ` Hrvoje Niksic
@ 1996-06-21 15:18  9%         ` Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1996-06-21 15:18 UTC (permalink / raw)
  To: Hrvoje Niksic; +Cc: zsh-workers

>Zefram (A.Main@dcs.warwick.ac.uk) wrote:
>> POSIX requires the SH_WORD_SPLIT behaviour.  It also requires field
>> splitting in normal words, as well as the result of expansions:

Actually it appears that it doesn't.  It's been a while since I read
this area of the standard, but as I had specifically looked up this
issue I thought I had remembered it correctly.  I think it would be
nice to implement this kind of field splitting anyway (predicated on
SH_WORD_SPLIT, and have POSIX_FIELD_SPLIT to get POSIX behaviour).

>What do you think of setting shwordsplit when the environmental
>variable POSIXLY_CORRECT is set?

I think that we should have a POSIX emulation mode ("emulate posix").
It would be nice to use it by default if invoked as sh with
POSIXLY_CORRECT set in the environment.  We are going to need a couple
of options for POSIX conformance that contradict sh and ksh
compatibility.

-zefram



^ permalink raw reply	[relevance 9%]

* read broken in beta21
@ 1996-06-21 17:16  6% Zefram
  1996-06-24 11:57  7% ` Zoltan Hidvegi
  0 siblings, 1 reply; 200+ results
From: Zefram @ 1996-06-21 17:16 UTC (permalink / raw)
  To: Z Shell workers mailing list

It appears that the changes to bin_read in beta21 have introduced a
bug.  Trailing non-whitespace IFS characters on the input line are
appended to the last parameter being set, instead of removed.  This
change has broken a script of mine.  Or does POSIX require this?  sh
matches zsh's previous behaviour.

-zefram



^ permalink raw reply	[relevance 6%]

* Re: read broken in beta21
  1996-06-21 17:16  6% read broken in beta21 Zefram
@ 1996-06-24 11:57  7% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-06-24 11:57 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

> It appears that the changes to bin_read in beta21 have introduced a
> bug.  Trailing non-whitespace IFS characters on the input line are
> appended to the last parameter being set, instead of removed.  This
> change has broken a script of mine.  Or does POSIX require this?  sh
> matches zsh's previous behaviour.

What is sh?  On Linux, sh is bash which matches zsh's new behaviour.  Other
sh's.  Here is what POSIX says:

 The line shall be split into fields (see the definition in 3.1.3) as in
 the shell (see 3.6.5); the first field shall be assigned to the first
 variable var, the second field to the second variable var, etc.  If there
 are fewer var operands specified than there are fields, the leftover
 fields and their intervening separators shall be assigned to the last
 var. If there are fewer fields than vars, the remaining vars shall be set
 to empty strings.

So it is clear that the `intervening separators' should be assigned to the
last parameter.  A non-whitespace IFS character is always a separator so it
should not be removed.  bash and pdksh behaves as zsh while ksh93 removes
training non-whitespace IFS characters (which is wrong if I interpret POSIX
correctly).  This also means that trailing IFS-whitespaces should be
removed as these are not and intervening separarators.

Zoltan



^ permalink raw reply	[relevance 7%]

* Re: $BAUD is strange on Linux for 115200
  @ 1996-06-24 18:15  7% ` Janos Farkas
  0 siblings, 0 replies; 200+ results
From: Janos Farkas @ 1996-06-24 18:15 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: zsh-workers



On Mon, 24 Jun 1996, Zoltan Hidvegi wrote:
[about the following patch]
> >  # if defined(HAVE_TCGETATTR) && defined(HAVE_TERMIOS_H)
> >      tempbaud = cfgetospeed(&shttyinfo->tio);
> > +#if defined CBAUDEX && CBAUDEX > 100
> > +    /* If we have CBAUDEX, then it's a mask of the extended
> > +       speeds, and the baud rates are still encoded.  At least
> > +       this is so on Linux, and I hope this logic is true on
> > +       most systems.  */
> > +#else
> >      if (tempbaud >= 100)
> >          return tempbaud;
> >      else
> > +#endif

> Is'n it better to move the tempbaud >= 100 check to the default case in
> switch (speedcode) (modifying the type of speedcode from int to long)?
> I'm sure that if cfgetospeed() returns the value of a B... macro than its
> the logical meaning should always be used.

For me, it's ok; but I thought it were there for purpose.  Maybe POSIX
doesn't define that speed_t can only contain Bxxxx constants, or some
(maybe non-POSIX) systems are broken in this aspect, or maybe some can
get away with B9600=9600 and so they don't really need constants...

This way, we hopefully won't break on anyone's system...  Or, that's what
beta-testing is for? :)

Janos



^ permalink raw reply	[relevance 7%]

* Re: Use of qualifiers without glob pattern?
  @ 1996-06-26 14:52  5% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-06-26 14:52 UTC (permalink / raw)
  To: schaefer; +Cc: zsh-workers

> On Jun 26,  1:02pm, Zoltan Hidvegi wrote:
> } Subject: Re: Use of qualifiers without glob pattern?
> }
> } > the problem is, $i(:r) gives the same as $i!!!
> } 
> } Yes, it stopped working in beta20.  Here is the fix.
> 
> Gosh, guys, this is pretty basic stuff to have suddenly stop working.
> This is why I get nervous every time a big patch like the metafication
> stuff gets put in.

The (:...) modifiers stopped working only if the argument had no wildcards
so *(:r) always worked.  And foo.bar(:r) works only since about a year.

That particular bug is related to the execcmd reorganization to allow
things like foo=exec ; $foo bar work which is probably more basic than the
modifiers.

> Speaking of big patches and breaking things that have been working for
> a long time, it's now been more than a year since RC said he was going
> to stop accepting major changes and stabilize zsh to get an official
> (not beta) release put out.  No indictment of anyone intended -- I know
> zsh takes a back seat to the real world, which is among the reasons why
> RC handed the archive over to Zoltan; and some of the recent changes
> have fixed some really annoying long-standing bugs -- but do we have
> any idea when a true release can finally happen?

In beta21 there was no really serious problems.  I'm going to release
beta22 within a couple of days.  It will contain a partial solution of the
signal reentrancy problem by saving and resoring some variables which fixes
the most serious problems.  If no problems reported within a few days
of that release I'll announce this beta in some newsgroups as a 3.0
pre-release.  Maybe beta22 is not a good name for that.  It may be better
to call it to zsh-2.99.0 as the next stable release will be zsh-3.0.0.

I know that there were many changes since beta16, more than I wanted.  RC
announced a feature freeze a year ago.  New features were introduced in
beta17 but these new features were already well tested as these were
present in my non-official releases for more than a year.  Sine beta17
there were many conceptual changes to fix long-standing bugs and to improve
sh compatibility.  The biggest change was making zsh 8-bit clean which was
unavoidable.  I think that beta21 is much more stable than beta16.  /bin/sh
can now be safely linked to zsh-2.6-beta21.  If invoked as sh/ksh zsh
almost conforms to POSIX 1003.2.

Also several debug tests were added and these are enabled by default.
These debug messages might give a feeling that recent betas are more buggy
than older ones but most of these bugs were always there.  In the final
stable release debug checks will be disabled by default but in beta
releases I'd like zsh to complain loudly if it thinks that there is a bug.

Zoltan



^ permalink raw reply	[relevance 5%]

* Re: zsh-3.0-pre1 released
  @ 1996-06-28 17:10  6% ` Zoltan Hidvegi
  1996-06-28 17:21  0%   ` Zefram
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1996-06-28 17:10 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

> >! versions of complex commands should be considered deprecated and may be 
> >--- 612,618 ----
> >! versions of complex commands should be considered depreciated and may be 
> 
> You might want to reverse this patch for the 3.0 release.  The same
> error was made in a couple of other places too.

It's not me who made this change.  This comes from Clive's texinfo
documentation.  ispell says that depreciate is correct.  I assume it has
the same meaning as deprecate.  I do not know enough about English to
decide which is better.

> Less trivially, if you haven't done so already, I suggest you look
> through my old -M patches.  Some of them contained small bug fixes in
> addition to adding the option, and I think some of the bugs are still
> around.

I'm still thinking about adding some or all of them to the baseline.  POSIX
requires export -p and readonly -p.  But I do not find any patches to
typeset.  Did I lost it or you'v never sent such a patch?

Zoltan



^ permalink raw reply	[relevance 6%]

* Re: zsh-3.0-pre1 released
  1996-06-28 17:10  6% ` Zoltan Hidvegi
@ 1996-06-28 17:21  0%   ` Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1996-06-28 17:21 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: A.Main, zsh-workers

>It's not me who made this change.  This comes from Clive's texinfo
>documentation.  ispell says that depreciate is correct.  I assume it has
>the same meaning as deprecate.  I do not know enough about English to
>decide which is better.

"depreciate" and "deprecate" are both valid English words.  They have
completely different meanings, and the appropriate one here is
"deprecate".

>I'm still thinking about adding some or all of them to the baseline.  POSIX
>requires export -p and readonly -p.  But I do not find any patches to
>typeset.  Did I lost it or you'v never sent such a patch?

I've not done a typeset -M patch yet.  I was planning to wait until the
ones I've sent so far have got in.  I have a list of builtins waiting
to have this option added, but while the patches aren't being used
there's not much point working on it.

Btw, the reason I haven't sent any patches in the last couple of weeks
is that my computer is not in a very usable state right now.  The
graphics card is sulking, and the serial card is only sending data in
one direction (out).  This means that I can do the minimal admin tasks
needed to configure the software side of the serial I/O, but it's not
very conducive to editing source.  :-)  I should be back in action
within a week.

-zefram



^ permalink raw reply	[relevance 0%]

* Re: cshjunkieparen bothers me (and always has)
  @ 1996-07-04 13:14  9% ` Zoltan Hidvegi
  1996-07-04 15:58  5%   ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1996-07-04 13:14 UTC (permalink / raw)
  To: schaefer; +Cc: pws, zsh-workers

> I *think* this is what happened:
> 
> Cshjunkieparen at one time affected whether
> 
> 	if [[ $TERM == xterm ]] then
> 
> would work.  This was the csh compatibility feature, even though it
> wasn't precisely csh syntax.  I have no idea why "paren" was used in
> the name of the option.

This syntax is really a ksh compatibility syntax.  But by a more general
rure it is a POSIX compatibility syntax.  POSIX does not requires separator
before then so the syntax

if (subshell ...) then

should be accepted by a POSIX shell.  The accepted syntax is

if compound_list then compound_list fi

So

if true ; false ; true ; then echo yes ; fi

is valid, and should print yes.  The semicolon before then is necessary
to recognize then as a reserved word.

POSIX also states that reserved words are recognized after one of the
reserved words other than case, for, or in.  In ksh [[ and ]] are reserved
words so it is not necessary to use a semicolon before then (in zsh [[ is
not a reserved word but it behaves similarily).

> However, par_list() now permits empty statements, consuming all trailing
> SEPER tokens; so by necessity par_if() no longer requires a SEPER before
> the "then".

POSIX does not seem to allow that but the zsh behaviour is more logical.
The biggest problem using braces instead of then ... fi is the following:

if (true)
{ echo yes; }

The patch I posted recently to the manual says that it is equivalent to

if (true)
then
	echo yes
fi

But that's not true since par_list parses a list as long as it is possible
so the above is the same as

if (true) ; { echo yes; }

And now a then or an open brace should come after some semicolons.  I think
csh junkies do not like that change.

if true {
	echo yes
}

does not work either since { behaves like a reserved word (POSIX says that
{ and } should be reserved words).

if (true) {
	echo yes
}

works since a separator must come after a subshell so par_list could not
continue parsing of the list.

if [[ foo -eq 13 ]] {
	echo yes
}

and

if ((foo == 13)) {
	echo yes
}

works for similar reasons.  As it turns out { can only be used in place of
if when it comes after a ) terminating a subshell or a ]] terminating a
conditional command.  When csh_junkie_paren was on zsh digested an open
parenthesis before calling par_list which terefore stopped before the
matching closing parenthesis.  To summarize this after Bart's patch the

if (foo)
{
	...
}

syntax will not work but the

if (foo) {
	...
}

syntax still works.

Zoltan



^ permalink raw reply	[relevance 9%]

* Re: cshjunkieparen bothers me (and always has)
  1996-07-04 13:14  9% ` Zoltan Hidvegi
@ 1996-07-04 15:58  5%   ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 1996-07-04 15:58 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: pws, zsh-workers

On Jul 4,  3:14pm, Zoltan Hidvegi wrote:
> Subject: Re: cshjunkieparen bothers me (and always has)
>
> > I *think* this is what happened:
> > 
> > Cshjunkieparen at one time affected whether
> > 
> > 	if [[ $TERM == xterm ]] then
> > 
> > would work.  This was the csh compatibility feature, even though it
> > wasn't precisely csh syntax.  I have no idea why "paren" was used in
> > the name of the option.
> 
> This syntax is really a ksh compatibility syntax.  But by a more general
> rure it is a POSIX compatibility syntax.

That may be, but there wasn't any such thing as `POSIX compatibility' (at
least within zsh) at the time that it was originally introduced as csh
compatibility.

> The biggest problem using braces instead of then ... fi is the following:
> 
> if (true)
> { echo yes; }
> 
> The patch I posted recently to the manual says that it is equivalent to
> 
> if (true)
> then
> 	echo yes
> fi
> 
> But that's not true since par_list parses a list as long as it is possible
> so the above is the same as
> 
> if (true) ; { echo yes; }
> 
> And now a then or an open brace should come after some semicolons.  I think
> csh junkies do not like that change.

I don't think csh junkies care one way or the other.  C junkies might,
but braces are not a command-grouping syntax in csh EXCEPT in exactly
one circumstance:

	#! /bin/csh
	if { something } then
	    echo something succeeded
	endif

I.e., in "if" (and possibly "while", I forget) statements, using braces
instead of parens is equivalent to:

	#! /bin/csh
	something
	if ( $status == 0 ) then
	    echo something succeeded
	endif

> if true {
> 	echo yes
> }
> 
> does not work either since { behaves like a reserved word (POSIX says that
> { and } should be reserved words).

That's equivalent to passing '{' as an argument to 'true', which is fine.
No problem with that either from a csh junkie standpoint; you can't omit
the parens in csh.  I note that this works:

	if { true } {
	    echo yes
	}

> To summarize this after Bart's patch the
> 
> if (foo)
> {
> 	...
> }
> 
> syntax will not work

But that in turn means that

	if [[ -f foo ]]
	{
	    ...
	}

has never worked, or at least hasn't worked for quite some time.  (Boy,
sometimes I wish my old machine with the 2.0.0 zsh on it hadn't died.)
In any case, I think this bit of consistency is worthwhile.


-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



^ permalink raw reply	[relevance 5%]

* Re: Bug Report: Env Vars and shell functions
  @ 1996-07-12 15:27  9% ` Zoltan Hidvegi
  1996-07-12 16:01  6%   ` Anthony Heading
  1996-07-12 17:18  9%   ` Bart Schaefer
  0 siblings, 2 replies; 200+ results
From: Zoltan Hidvegi @ 1996-07-12 15:27 UTC (permalink / raw)
  To: Anthony Heading; +Cc: acs, pws, zsh-workers

> I get a segfault with the following
> 
> sun4% zsh -c xyzzy 
> hello
> zsh: 18399 segmentation fault  zsh -c xyzzy
> 
> where xyzzy is an autoloaded function containing
> 
> #!/usr/local/bin/zsh
> . thing
> 
> and `thing' is a file reading
> 
> echo hello
> 
> Traceback attached.  None of the alloc_stackp related patches applied, since
> they seemed all to be cosmetic.

They were not really cosmetic.  Had you applied these you would not have
received this.  These SEGV's are all caused by DPUTS, since it seems that
you did not applied the patch which replaces X to Y in DPUTS in zsh.h line
1314.  That was a silly typo I made before pre2 which means zsh crashes
every time when DPUTS wants to print something (which makes it look much
more serious).

> On a related note, should the following not restore IFS?
> 
> sun4% IFS=@ set a@b@c@d; echo $IFS 
> @

Here is what POSIX says:

     (2)  Variable assignments specified with special built-in utilities
          shall remain in effect after the built-in completes; this shall
          not be the case with a regular built-in or other utility.

And POSIX special builtins are

              .          continue   exit       return     trap
              :          eval       export     set        unset
              break      exec       readonly   shift

And it also says that shell functions should be handled similarily to
special builtins (which means that recent patches from Peter and me make
zsh less conformant).

Zsh currently treats a builtin this way only if the BINF_MAGICEQUALS flag
is set for the builtin.  These builtins are: alias, declare, hash, integer,
local, readonly and typeset.

Of course zsh does not conforms to the POSIX rule and handling of special
parameters in undoubtadly not the best but it also means that applications
should not expect local variable assignments before special builtins since
it may change in the future.

Also note that command arguments are evaluated before variable assignments
so the above example will never work.  The other problem with that example
is that field splitting is only done on the result of expansions so the
explicitely given a@b@c@d is not split even if IFS is set correctly before
set.

In a POSIX shell the command builtin can be used to execute special
builtins (in zsh it executes external command only).  Note that command in
not listed among the special builtins above which means that the special
assignment behaviour can be prevented by prefixing a special builtin with
the command builtin (I'm talking about POSIX and not about zsh).

I'm writing these because these differences between zsh and POSIX are
probably the most important ones.  Other than that zsh is now mostly POSIX
conformant (POSIX does not allow the MAGICEQUALS behaviour of the typeset
family but all other shells (bash, ksh93 and pdksh) do that unles
POSIXLY_CORRECT is defined).

> Ah. Another core dump:
> sun4% $(grep[TAB][TAB]
> Program received signal SIGSEGV, Segmentation fault.
> 0x6ff8128c in _doprnt ()
> #2  0x9afd0 in doexpandhist () at zle_tricky.c:3817
> 3817        DPUTS(useheap, "BUG: useheap in doexpandhist()");

That is already fixed some time ago.  It was a misplaced goto label.

Zoltan



^ permalink raw reply	[relevance 9%]

* Re: Error in zsh.texi and zshexpn.man
  @ 1996-07-12 15:53  6% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-07-12 15:53 UTC (permalink / raw)
  To: schaefer; +Cc: zsh-workers

No, the manual is not wrong.  Filename expansion is different from filename
generation (which is also called globbing).  Filename expansion is always
performed on the right hand side of assignments and this behaviour is
compatible with other shell and POSIX.  GLOB_ASSIGN is not mentioned here
and I not not think it should be mentined at all.  It id documented in the
zshoptions page but it is really a _very_ deprecated option and it will
surely be removed sometime since it introduces unpredictable ambiguity into
the assignment (when the glob result in one word, the variable is assigned
as a scalar otherwise it is assigned as an array, which can cause
mysterious problems).

Zoltan



^ permalink raw reply	[relevance 6%]

* Re: Bug Report: Env Vars and shell functions
  1996-07-12 15:27  9% ` Zoltan Hidvegi
@ 1996-07-12 16:01  6%   ` Anthony Heading
  1996-07-12 17:18  9%   ` Bart Schaefer
  1 sibling, 0 replies; 200+ results
From: Anthony Heading @ 1996-07-12 16:01 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: zsh-workers

> They were not really cosmetic.  Had you applied these you would not have
> received this.  These SEGV's are all caused by DPUTS, since it seems that
> you did not applied the patch which replaces X to Y in DPUTS in zsh.h line
> 1314.

Damn.  Sorry, then.  It was late.

> > On a related note, should the following not restore IFS?
> > 
> > sun4% IFS=@ set a@b@c@d; echo $IFS 
> > @
> 
> Here is what POSIX says:
> 
>      (2)  Variable assignments specified with special built-in utilities
>           shall remain in effect after the built-in completes; this shall
>           not be the case with a regular built-in or other utility.
> [ and ten other reasons why it wouldn't work...]

Aha.  There isn't a copy of the POSIX standard on the net, is there?  Then I
could stop identifying spurious non-bugs.  But IFS=$OLDIFS is so *ugly*.

> I'm writing these because these differences between zsh and POSIX are
> probably the most important ones.  Other than that zsh is now mostly POSIX
> conformant (POSIX does not allow the MAGICEQUALS behaviour of the typeset
> family but all other shells (bash, ksh93 and pdksh) do that unles
> POSIXLY_CORRECT is defined).

Those are pretty useful to know.  Thanks.

A



^ permalink raw reply	[relevance 6%]

* Re: Bug Report: Env Vars and shell functions
  1996-07-12 15:27  9% ` Zoltan Hidvegi
  1996-07-12 16:01  6%   ` Anthony Heading
@ 1996-07-12 17:18  9%   ` Bart Schaefer
  1996-07-12 17:43  7%     ` Zoltan Hidvegi
  1 sibling, 1 reply; 200+ results
From: Bart Schaefer @ 1996-07-12 17:18 UTC (permalink / raw)
  To: Zoltan Hidvegi, zsh-workers; +Cc: pws

On Jul 12,  5:27pm, Zoltan Hidvegi wrote:
} Subject: Re: Bug Report: Env Vars and shell functions
}
} > On a related note, should the following not restore IFS?
} > 
} > sun4% IFS=@ set a@b@c@d; echo $IFS 
} > @
} 
} Here is what POSIX says:
} 
}      (2)  Variable assignments specified with special built-in utilities
}           shall remain in effect after the built-in completes; this shall
}           not be the case with a regular built-in or other utility.
} 
} And it also says that shell functions should be handled similarily to
} special builtins (which means that recent patches from Peter and me make
} zsh less conformant).

But more intuitive.  I suspect POSIX was merely codifying existing sh/ksh
behavior there.

} Zsh currently treats a builtin this way

Clarity:  Zsh treats a builtin the way it treats a shell function ...

} only if the BINF_MAGICEQUALS flag
} is set for the builtin.  These builtins are: alias, declare, hash, integer,
} local, readonly and typeset.

[...]

} Of course zsh does not conforms to the POSIX rule and handling of special
} parameters in undoubtadly not the best but it also means that applications
} should not expect local variable assignments before special builtins since
} it may change in the future.

Hopefully it would merely become dependent on a POSIX-compliance option;
the whole reason for introducing the BINF_MAGICEQUALS behavior was so
that applications could expect these local variable assignments.

} Also note that command arguments are evaluated before variable assignments
} so the above example will never work.

Has this always been the case?  (Peter?)  Is this correct according to
POSIX?  Of what use is the BINF_MAGICEQUALS behavior if the args are
evaluated before the variable gets assigned?

} In a POSIX shell the command builtin can be used to execute special
} builtins (in zsh it executes external command only).  Note that command in
} not listed among the special builtins above which means that the special
} assignment behaviour can be prevented by prefixing a special builtin with
} the command builtin (I'm talking about POSIX and not about zsh).

Hmm.  So `command typeset foo=bar ; echo $foo' has what effect in POSIX?

} I'm writing these because these differences between zsh and POSIX are
} probably the most important ones.

Perhaps that means they should be recorded somewhere, maybe Etc/BUGS or
a new file?  (Where's the wish-list/ToDo-list nowadays?)

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



^ permalink raw reply	[relevance 9%]

* Re: Bug Report: Env Vars and shell functions
  1996-07-12 17:18  9%   ` Bart Schaefer
@ 1996-07-12 17:43  7%     ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-07-12 17:43 UTC (permalink / raw)
  To: schaefer; +Cc: zsh-workers, pws

> } And it also says that shell functions should be handled similarily to
> } special builtins (which means that recent patches from Peter and me make
> } zsh less conformant).
> 
> But more intuitive.  I suspect POSIX was merely codifying existing sh/ksh
> behavior there.

I agree.

> } Zsh currently treats a builtin this way
> 
> Clarity:  Zsh treats a builtin the way it treats a shell function ...

Not, the question is wether FOO=bar builtin should affect the shell
environment or not.

> } only if the BINF_MAGICEQUALS flag
> } is set for the builtin.  These builtins are: alias, declare, hash, integer,
> } local, readonly and typeset.

[...]

> } Also note that command arguments are evaluated before variable assignments
> } so the above example will never work.
> 
> Has this always been the case?  (Peter?)  Is this correct according to
> POSIX?  Of what use is the BINF_MAGICEQUALS behavior if the args are
> evaluated before the variable gets assigned?

I think it has.  Substitution is always done in the current shell
environment while FOO=bar something type assignments are done after fork()
(that's why they are local).  Of course fork() is not called for builtins
and functions but the behaviour should be similar (in the future some new
builtins may be added as a builtin replacement for external commands and
that change sould be transparent).

> Hmm.  So `command typeset foo=bar ; echo $foo' has what effect in POSIX?

The command prefix makes special builtins behave like external commands.
So command typeset foo=bar is probably a no-op in POSIX.  It is a no-op in
pdksh but not in bash and ksh93.  But what I really meant is that in POSIX
(and in zsh too)

FOO=bar export FOO

exports foo but

FOO=bar command export FOO

is just a no-op.  Bash does not know that but ksh93 and pdksh do.

> } I'm writing these because these differences between zsh and POSIX are
> } probably the most important ones.
> 
> Perhaps that means they should be recorded somewhere, maybe Etc/BUGS or
> a new file?  (Where's the wish-list/ToDo-list nowadays?)

I'd like to add a COMPATIBILITY section to the manual where these things
will be documented.  Unfortunately at the moment I'm quite busyly fixing
the zsh code which I consider more important.

Zoltan



^ permalink raw reply	[relevance 7%]

* Re: Blocking child signals
  @ 1996-07-15  6:02  4% ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 1996-07-15  6:02 UTC (permalink / raw)
  To: Zoltan Hidvegi, Zsh hacking and development

On Jul 15,  4:43am, Zoltan Hidvegi wrote:
} Subject: Blocking child signals
}
} In exec.c and in jobs.c there are several child_block() and child_unblock()
} calls.  Tracing the system calls used by zsh it turns out that perhaps the
} majority of these are these child block/unblock calls.  I think that the
} performance of zsh could be improved a little bit by calling these blocking
} code more carefully.

It's possible you'd get a little performance, but I don't think it's
worth the effort.  Signal blocking/unblocking shouldn't be a very time-
consuming operation, except maybe for the old-style SYSV_SIGNALS or no-
signal-blocking cases.

I'd be willing to bet that the vast majority of those block/unblock pairs
are happening in waitjob() and relatives, where zsh is in a loop doing
almost nothing else.  You're not going to get any useful performance out
of speeding that up, because at that point zsh is bound by the execution
of one or more child processes.

} Unfortunately this child blocking stuff is quite a
} mess.  I'm sure that there are some bugs hiding here (ie. the child signal
} may remain blocked sometimes for quite a long time or it may be unblocked
} when it should not be unblocked).

I'm just scanning through it ... there's a bug on line 602 of exec.c,
where if initjob() fails zsh returns without unblocking the signals.

Otherwise it looks as though all the blocks are correctly matched
with unblocks; it's just a little hard to follow because in some cases
the block happens in a subroutine [e.g. down in execcmd()] and the
unblock doesn't happen until after returning from a couple of levels
deep of nested call [e.g. in execpline()].

There certainly isn't anyplace in jobs.c where the the calls are not
matched, nor is there anywhere in jobs.c where the signal could be
blocked for less time.  Part of the reason exec.c is so difficult to
follow is because of delaying the block until the last possible moment;
that makes it impossible to set up syntactically matched pairs as we
did with the allocation routines.

} I think that zsh should not block child signals when it does not fork.  Is
} there anyone who knows the details of this child blocking staff in exec.c?

Most of it actually originated with me, although it got heavily modified
by someone (RC?) to take better advantage of the POSIX signal stuff.  It
was also during my hiatus from the list that most of the block calls got
pushed farther down the subroutine stack to limit the duration of signal
blocking.  Peter may recall something about that.

It's important to block SIGCHLD signals not just before forking, but at
any time you're going to manipulate the job table if any child is still
executing.  You could add code to examine the job table and avoid making
the system call when no children exist, but my guess is that would be
just as expensive as simply making the call.

The child blocking stuff corrected a whole bunch of zsh bugs, including
(if I recall correctly) one where pipelines like "/bin/echo foo | less",
where the first command exits very quickly, confused zsh into thinking
the entire pipeline had exited, thus leaving "less" an orphan.

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



^ permalink raw reply	[relevance 4%]

* Bugfix in $0 saving
@ 1996-07-16 19:43  3% Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1996-07-16 19:43 UTC (permalink / raw)
  To: Z Shell workers mailing list

-----BEGIN PGP SIGNED MESSAGE-----

There is a problem with the conditional saving of $0 around functions
and sourcing, which was introduced a few betas ago.  Try the following:

emulate zsh
ek () { emulate ksh }
ek
echo $0

There's a problem going in the other direction too.  The cause of this
behaviour is that emulation is checked before and after the function
is executed, without regard for the fact that it might have changed in
the meantime.

There is also, in my opinion, a philosophical bug in the code.  It checks
the emulation mode directly, but (a) it's not currently possible to
directly query the current setting, and (b) more importantly, aspects of
behaviour such as this should be settable independently -- ksh/sh/POSIX
etc. emulation should not be an all-or-nothing choice.  Before the
"emulation" variable was added, compatibility behaviour was always
added by the use of separate options, and I think that was a Good Thing.
(Maybe those EMULATE_*SH constants make it too easy, eh?)

The patch below fixes both of these problems.  It adds an option,
FUNCTION_ARGZERO, which is set by default unless we are emulating ksh
or sh, and $0 is changed depending on this option.  Then $0 is restored
iff it was changed.

I made this patch using my working copy of zsh that has my option patch
from article 1275 applied.  If you're not using that patch, then the
context for a couple of the hunks will be wrong, so you'll need to apply
them by hand.  You'll also need to use "OPT_CSH|OPT_ZSH" instead of
"OPT_NONBOURNE" in the globals.h hunk.

On a completely different issue, why aren't the info files included in
the distribution any more?  Not everyone has makeinfo.

 -zefram

      Index: Doc/zshoptions.man
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Doc/zshoptions.man,v
      retrieving revision 1.10
      diff -c -r1.10 zshoptions.man
      *** zshoptions.man	1996/07/16 14:26:42	1.10
      --- zshoptions.man	1996/07/16 16:06:04
      ***************
      *** 194,199 ****
      --- 194,203 ----
        output flow control via start/stop characters (usually assigned to
        ^S/^Q) is disabled in the shell's editor.
        .TP
      + \fBFUNCTION_ARGZERO\fP
      + When executing a shell function or sourcing a script, set $0
      + temporarily to the name of the function/script.
      + .TP
        \fBGLOB\fP (+\fBF\fP, ksh: +\fBf\fP)
        Perform filename generation.
        .TP
      Index: Src/builtin.c
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/builtin.c,v
      retrieving revision 1.22
      diff -c -r1.22 builtin.c
      *** builtin.c	1996/07/16 14:26:48	1.22
      --- builtin.c	1996/07/16 15:50:19
      ***************
      *** 4599,4605 ****
        int
        bin_dot(char *name, char **argv, char *ops, int func)
        {
      !     char **old, *old0;
            int ret, diddot = 0, dotdot = 0;
            char buf[PATH_MAX];
            char *s, **t, *enam, *arg0;
      --- 4599,4605 ----
        int
        bin_dot(char *name, char **argv, char *ops, int func)
        {
      !     char **old, *old0 = NULL;
            int ret, diddot = 0, dotdot = 0;
            char buf[PATH_MAX];
            char *s, **t, *enam, *arg0;
      ***************
      *** 4608,4614 ****
            if (!*argv)
        	return 0;
            old = pparams;
      -     old0 = argzero;
            /* get arguments for the script */
            if (argv[1]) {
        	PERMALLOC {
      --- 4608,4613 ----
      ***************
      *** 4616,4623 ****
        	} LASTALLOC;
            }
            enam = arg0 = ztrdup(*argv);
      !     if (emulation != EMULATE_KSH && emulation != EMULATE_SH)
        	argzero = arg0;
            s = unmeta(enam);
            errno = ENOENT;
            ret = 1;
      --- 4615,4624 ----
        	} LASTALLOC;
            }
            enam = arg0 = ztrdup(*argv);
      !     if (isset(FUNCTIONARGZERO)) {
      ! 	old0 = argzero;
        	argzero = arg0;
      +     }
            s = unmeta(enam);
            errno = ENOENT;
            ret = 1;
      ***************
      *** 4667,4673 ****
            if (ret)
        	zwarnnam(name, "%e: %s", enam, errno);
            zsfree(arg0);
      !     if (emulation != EMULATE_KSH && emulation != EMULATE_SH)
        	argzero = old0;
            return ret ? ret : lastval;
        }
      --- 4668,4674 ----
            if (ret)
        	zwarnnam(name, "%e: %s", enam, errno);
            zsfree(arg0);
      !     if (old0)
        	argzero = old0;
            return ret ? ret : lastval;
        }
      Index: Src/exec.c
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/exec.c,v
      retrieving revision 1.22
      diff -c -r1.22 exec.c
      *** exec.c	1996/07/16 14:40:42	1.22
      --- exec.c	1996/07/16 15:50:26
      ***************
      *** 2416,2422 ****
         * was executed.                                            */
        {
            Param pm;
      !     char **tab, **x, *oargv0;
            int xexittr, oldzoptind, oldlastval;
            LinkList olist;
            char *s, *ou;
      --- 2416,2422 ----
         * was executed.                                            */
        {
            Param pm;
      !     char **tab, **x, *oargv0 = NULL;
            int xexittr, oldzoptind, oldlastval;
            LinkList olist;
            char *s, *ou;
      ***************
      *** 2431,2437 ****
        	sigtrapped[SIGEXIT] = 0;
        	sigfuncs[SIGEXIT] = NULL;
        	tab = pparams;
      - 	oargv0 = argzero;
        	oldzoptind = zoptind;
        	zoptind = 1;
        
      --- 2431,2436 ----
      ***************
      *** 2448,2462 ****
        
        	    node = doshargs->first;
        	    pparams = x = (char **) zcalloc(((sizeof *x) * (1 + countlinknodes(doshargs))));
      ! 	    if (emulation != EMULATE_KSH && emulation != EMULATE_SH)
        		argzero = ztrdup((char *) node->dat);
        	    node = node->next;
        	    for (; node; node = node->next, x++)
        		*x = ztrdup((char *) node->dat);
        	} else {
        	    pparams = (char **) zcalloc(sizeof *pparams);
      ! 	    if (emulation != EMULATE_KSH && emulation != EMULATE_SH)
        		argzero = ztrdup(argzero);
        	}
        	PERMALLOC {
        	    olist = locallist;		/* save the old locallist since shell functions may be nested */
      --- 2447,2465 ----
        
        	    node = doshargs->first;
        	    pparams = x = (char **) zcalloc(((sizeof *x) * (1 + countlinknodes(doshargs))));
      ! 	    if (isset(FUNCTIONARGZERO)) {
      ! 		oargv0 = argzero;
        		argzero = ztrdup((char *) node->dat);
      + 	    }
        	    node = node->next;
        	    for (; node; node = node->next, x++)
        		*x = ztrdup((char *) node->dat);
        	} else {
        	    pparams = (char **) zcalloc(sizeof *pparams);
      ! 	    if (isset(FUNCTIONARGZERO)) {
      ! 		oargv0 = argzero;
        		argzero = ztrdup(argzero);
      + 	    }
        	}
        	PERMALLOC {
        	    olist = locallist;		/* save the old locallist since shell functions may be nested */
      ***************
      *** 2481,2487 ****
        	locallist = olist;	/* restore the old list of local variables */
        	breaks = retflag = 0;
        	freearray(pparams);
      ! 	if (emulation != EMULATE_KSH && emulation != EMULATE_SH) {
        	    zsfree(argzero);
        	    argzero = oargv0;
        	}
      --- 2484,2490 ----
        	locallist = olist;	/* restore the old list of local variables */
        	breaks = retflag = 0;
        	freearray(pparams);
      ! 	if (oargv0) {
        	    zsfree(argzero);
        	    argzero = oargv0;
        	}
      Index: Src/globals.h
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/globals.h,v
      retrieving revision 1.10
      diff -c -r1.10 globals.h
      *** globals.h	1996/07/16 14:26:52	1.10
      --- globals.h	1996/07/16 15:52:45
      ***************
      *** 697,702 ****
      --- 697,703 ----
            {"extendedglob", 		0,    0,    0},
            {"extendedhistory", 	0,    0,    OPT_EMULATE|OPT_CSH},
            {"flowcontrol", 		0,    0,    OPT_ALL},
      +     {"functionargzero",		0,    0,    OPT_EMULATE|OPT_NONBOURNE},
            {"glob", 			x'F', x'f', OPT_ALL},
            {"globassign", 		0,    0,    OPT_EMULATE|OPT_CSH},
            {"globcomplete", 		0,    0,    0},
      Index: Src/zsh.h
      ===================================================================
      RCS file: /home/zefram/usr/cvsroot/zsh/Src/zsh.h,v
      retrieving revision 1.13
      diff -c -r1.13 zsh.h
      *** zsh.h	1996/07/16 14:27:08	1.13
      --- zsh.h	1996/07/16 15:50:01
      ***************
      *** 1079,1084 ****
      --- 1079,1085 ----
            EXTENDEDGLOB,
            EXTENDEDHISTORY,
            FLOWCONTROL,
      +     FUNCTIONARGZERO,
            GLOBOPT,
            GLOBASSIGN,
            GLOBCOMPLETE,

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBMevEbXD/+HJTpU/hAQGGagQAheGD479f2GWHgBQpwCZAWwJAJrOj2dmK
+oUNCU9F6JBhw1wi2uWpaYRKf8u4R6Hxfs4c2IcoQFAC4QA9uJH8E4v8zVCVTtPk
VgMp4Pf03Uy2UQP4CATj2bdhrBten0gK/yIplTVIBYD3DO3RzgN0WantZv881ZZt
71WefyfvnVk=
=W3Jz
-----END PGP SIGNATURE-----



^ permalink raw reply	[relevance 3%]

* Re: Misc. unresolved stuff
  @ 1996-07-19 19:30  5% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-07-19 19:30 UTC (permalink / raw)
  To: schaefer; +Cc: zsh-workers

> In article 1397, Zoltan said he'd fix $[$[1+2]+3], and apparently he has.
> Is there some reason why $((...)) doesn't nest?  I asked in article 1414
> whether there other differences between $[...] and $((...)).  There's
> exactly one mention of $((...)) in zshexpn.man, which says only that it's
> the same as $[...].

That's a bug again.  The fix is below.

> In article 1426, I asked why array subscript flags such as $foo[(f)...]
> don't work with $foo[@] and $foo[*].  Does anyone else want them to?

That's a bit more difficult because in this case $foo should be split.
$foo[(f)@] is interpreted in params.c while splitting is done in subst.c so
this cahnge is not trivial (but it is probably not difficult).

> In article 1428, I pointed out that zsh's "getopts" builtin doesn't seem
> to properly handle some error cases, by comparison to bash.  I don't have
> ksh to compare to that.  Does anyone think "getopts" is a problem?

I think that zsh getopts is ksh and POSIX compatible.  I do not use getopts
but you can compare it with the ksh version.  pdksh is free and the AT&T
ksh93 can also be downloaded and used free from
http://www.research.att.com/orgs/ssr/book/reuse/.

> In zsh-users article 257, I asked why there's no (:L) modifier, to go
> with the (L) flag; similarly (U) and (:U).  I also hoped for a better
> error message for unrecognized modifiers.  Any comment?

I think we can live with this inconsistency.  The biggest problem here that
there are too few letters in the alphabet.  Probably that's why (L) is not
(l).  But there is a bug in the parameter modifier code when a modifier is
used on an empty array and the diagnostics can certainly be improved.
Tell me if you like the behaviour after applying this patch.

Zoltan


rcsdiff -qc -kk -r2.41 -r2.43 Src/subst.c
*** Src/subst.c
--- Src/subst.c	1996/07/19 19:25:14	2.43
***************
*** 128,148 ****
  	    char endchar;
  	    int l1, l2;
  
! 	    if (*str == Inpar)
! 		endchar = Outpar, str[-1] = '\0';
! 	    else
! 		endchar = *str, *str = '\0';
! 
! 	    while (*++str != endchar)
! #ifdef DEBUG
! 		if (!*str) {
! 		    /* This shoud never happen */
! 		    zerr("Oops. parse error in command substitution", NULL, 0);
! 		    return NULL;
! 		}
! #else
! 		;
! #endif
  	    *str++ = '\0';
  	    if (endchar == Outpar && str2[1] == '(' && str[-2] == ')') {
  		/* Math substitution of the form $((...)) */
--- 128,146 ----
  	    char endchar;
  	    int l1, l2;
  
! 	    if (*str == Inpar) {
! 		endchar = Outpar;
! 		str[-1] = '\0';
! 		if (skipparens(Inpar, Outpar, &str))
! 		    DPUTS(1, "Oops. parse error in command substitution");
! 		str--;
! 	    } else {
! 		endchar = *str;
! 		*str = '\0';
! 
! 		while (*++str != endchar)
! 		    DPUTS(!*str, "Oops. parse error in command substitution");
! 	    }
  	    *str++ = '\0';
  	    if (endchar == Outpar && str2[1] == '(' && str[-2] == ')') {
  		/* Math substitution of the form $((...)) */
***************
*** 1201,1207 ****
  		if (!isarr)
  		    modify(&val, &s);
  		else {
! 		    char *ss = s;
  		    char **ap = aval;
  		    char **pp = aval = (char **)ncalloc(sizeof(char *) * (arrlen(aval) + 1));
  
--- 1199,1205 ----
  		if (!isarr)
  		    modify(&val, &s);
  		else {
! 		    char *ss;
  		    char **ap = aval;
  		    char **pp = aval = (char **)ncalloc(sizeof(char *) * (arrlen(aval) + 1));
  
***************
*** 1209,1215 ****
--- 1207,1226 ----
  			ss = s;
  			modify(pp++, &ss);
  		    }
+ 		    if (pp == aval) {
+ 			char t[] = "";
+ 			ss = s;
+ 			s = t;
+ 			modify(&s, &ss);
+ 		    }
  		    s = ss;
+ 		}
+ 		if (inbrace && *s != Outbrace) {
+ 		    if (*s == ':' && !imeta(s[1]))
+ 			zerr("unrecognized modifier `%c'", NULL, s[1]);
+ 		    else
+ 			zerr("unrecognized modifier", NULL, 0);
+ 		    return NULL;
  		}
  	    }
  	}



^ permalink raw reply	[relevance 5%]

* Re: Bug in case stmt with '('
       [not found]         ` <schaefer>
@ 1996-07-22  6:53  8%       ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 1996-07-22  6:53 UTC (permalink / raw)
  To: zsh-workers, Zoltan Hidvegi

On Jul 21, 11:31pm, Bart Schaefer wrote:
} Subject: Re: Bug in case stmt with '('
}
} I think we should leave it POSIX-style.
} 
} However, there is a remaining bug in Zoltan's patch.
} 
} zagzig<8> case foo in
} > (foo) echo yes;;
} zsh: parse error near `echo'
} 
} Apparently there still needs to be at least one token between the close
} paren and the first word of the actual command.

I thought Zoltan's "if" cascade looked a little too easy.  Here's the fix.

*** Src/parse.c.0	Fri Jul 19 11:17:12 1996
--- Src/parse.c	Sun Jul 21 23:45:10 1996
***************
*** 522,544 ****
  		str2[sl] = Bar;
  		str2[sl+1] = '\0';
  		str = str2;
! 	    } else if (tok == STRING) {
! 		char *str2;
  		int sl = strlen(str);
  
! 		if (str[sl - 1] != Bar)
! 		    YYERRORV;
! 		str2 = ncalloc(sl + strlen(tokstr) + 1);
! 		strcpy(str2, str);
! 		strcpy(str2 + sl, tokstr);
! 		str = str2;
! 	    } else {
! 		/* POSIX allows (foo*) patterns */
! 		char *s = str;
  
! 		if (skipparens(Inpar, Outpar, &s) || *s)
! 		    YYERRORV;
! 		break;
  	    }
  	}
  	addlinknode(pats, str);
--- 522,547 ----
  		str2[sl] = Bar;
  		str2[sl+1] = '\0';
  		str = str2;
! 	    } else {
  		int sl = strlen(str);
  
! 		if (str[sl - 1] != Bar) {
! 		    /* POSIX allows (foo*) patterns */
! 		    char *s = str;
  
! 		    if (skipparens(Inpar, Outpar, &s) || *s)
! 			YYERRORV;
! 		    break;
! 		} else {
! 		    char *str2;
! 
! 		    if (tok != STRING)
! 			YYERRORV;
! 		    str2 = ncalloc(sl + strlen(tokstr) + 1);
! 		    strcpy(str2, str);
! 		    strcpy(str2 + sl, tokstr);
! 		    str = str2;
! 		}
  	    }
  	}
  	addlinknode(pats, str);
***************

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



^ permalink raw reply	[relevance 8%]

* Re: Bug in case stmt with '('
       [not found]     <17651.199607222123@stone.dcs.warwick.ac.uk>
@ 1996-07-23 14:08  5% ` Zoltan Hidvegi
  1996-07-23 16:25  5%   ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1996-07-23 14:08 UTC (permalink / raw)
  To: Zefram; +Cc: segal, schaefer, Zsh workers list

> >Unfortunately there is still an incompatibility in case:
> >
> >case foo in
> >( f* | b* ) echo yes
> >esac
> >
> >should print yes but in zsh it works as
> >
> >case foo in
> >\ f*\ |\ b*\ ) echo yes;;
> >esac
> 
> I was wondering whether that would be the case.  It's a serious problem.
> 
> >To fix this would be really difficult I think.
> 
> It could be easily fixed by modifying glob semantics such that unquoted
> whitespace embedded in a pattern is ignored.  I doubt that any real
> code relies on the current behaviour, which is in any case
> undocumented.

It is used in ${...%...} substitutions where a space stands for itself.
And it is not even a zsh feature.  So unquoted whitespace should not always
be ignored.  Ignoring unquoted whitespace before | and ) and after ( and |
seems to be a better solution but it is more difficult to implement.
Consistency is desirable so patterns should behave similarily in case
statements, ${...%...} substitutions (double quoted or not), in argumenents
to builtins after -m etc.

At a few places the code assumes that the lexer just tokenizes the input
but does not actually modfy it so omitting these spaces in the lexer is not
the best solution.

The best would be to handle it in glob.c but here it is a problem how can
we distinguish ( foo\ | bar ) from ( foo | bar ).  It would require a new
token for a null-space (the word `token' is amiguous in zsh, it can be
either a token returned by gettok or a character token for a character in
ztokens, here I use the second meaning).  A token for null-TAB may also be
necessary here.  The simplest solution is to convert every unquoted space
and TAB which is inside a globbing paren to a null-space and null-tab token
and later in glob.c a null-space or null-tab is either treated as space/tab
or discarded if it is adjacent to | or comes after a `(' of before a `)'
(or it may be better to disard these after `)' and before `(' as well).

This seems to be a quite simple solution.

On the other topic of empty patterns: it is true that POSIX does not allow
that.  Even previous zsh versions had problems with empty patterns in case
statement so it probably does not cause any problems if we do not allow
that in case statement.  That would simplyfy parsing since it means that
after a BAR a STRING token must come in a case pattern.  But in other
places empty patterns are usefull.  I ofter use (...|) for an optional
match and this should not be disallowed.

Zoltan

PS.  I'm now moving this quite technical discussion to zsh-workers.



^ permalink raw reply	[relevance 5%]

* Re: Bug in case stmt with '('
  1996-07-23 14:08  5% ` Zoltan Hidvegi
@ 1996-07-23 16:25  5%   ` Bart Schaefer
       [not found]         ` <schaefer@candle.brasslantern.com>
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 1996-07-23 16:25 UTC (permalink / raw)
  To: Zefram, Zoltan Hidvegi; +Cc: segal, Zsh workers list

On Jul 23,  4:08pm, Zoltan Hidvegi wrote:
} Subject: Re: Bug in case stmt with '('
}
} The best would be to handle it in glob.c but here it is a problem how can
} we distinguish ( foo\ | bar ) from ( foo | bar ).

The `if (incasepat && ...)' patch that I sent handles this correctly.
The only drawback I've found so far to my patch is that if you *don't*
use the POSIX balanced-parens syntax for "case", then parenthesized
patterns can't have *meaningful* spaces in them.

I don't think this is a significant difficulty, since "case" already
has the `|' syntax so there's not much reason to use glob-grouping
parens in "case" patterns in the first place.

} The simplest solution is to convert every unquoted space
} and TAB which is inside a globbing paren to a null-space and null-tab token
} and later in glob.c a null-space or null-tab is either treated as space/tab
} or discarded if it is adjacent to | or comes after a `(' of before a `)'
} (or it may be better to disard these after `)' and before `(' as well).
} 
} This seems to be a quite simple solution.

Maybe, but not simpler than mine, and it's solving a problem that I don't
think we ought to be solving -- we don't need to be able to ignore spaces
in generalized glob patterns, only in "case" statements.  I don't like the
suggestion to do it everywhere.


-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



^ permalink raw reply	[relevance 5%]

* Re: Bug in case stmt with '('
       [not found]         ` <schaefer@candle.brasslantern.com>
@ 1996-07-23 20:01  0%       ` Morris M. Siegel
  1996-07-23 21:55  7%         ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Morris M. Siegel @ 1996-07-23 20:01 UTC (permalink / raw)
  To: schaefer; +Cc: zsh-workers

On Jul 23,  9:25am, Bart Schaefer wrote:
> Subject: Re: Bug in case stmt with '('
> On Jul 23,  4:08pm, Zoltan Hidvegi wrote:
> } Subject: Re: Bug in case stmt with '('
> }
> } The best would be to handle it in glob.c but here it is a problem how can
> } we distinguish ( foo\ | bar ) from ( foo | bar ).
>
> The `if (incasepat && ...)' patch that I sent handles this correctly.
> The only drawback I've found so far to my patch is that if you *don't*
> use the POSIX balanced-parens syntax for "case", then parenthesized
> patterns can't have *meaningful* spaces in them.

Do you really think it user-friendly for the semantics of the case-prefix
to depend on whether the optional leading '(' is present or not?

> I don't think this is a significant difficulty, since "case" already
> has the `|' syntax so there's not much reason to use glob-grouping
> parens in "case" patterns in the first place.

It seems to me, and I alluded to this in a previous posting, that it's
most elegant for a whole case-prefix such as
	( a | b | c )
to be in fact treated simply as a single zsh glob pattern (again, provided
that zsh options allow '(' to be a glob metacharacter as it usually is).
That's why it's useful to ignore trivial blanks after '(', around '|',
before ')', and maybe elsewhere, as Zoltan writes.  (Actually, it might
perhaps be best for all blanks inside parentheses [unless quoted or
backslashed] to be ignored unless their omission would cause distinct
tokens to be erroneously fused.  E.g., '( a b | ^ d .c )' would be
equivalent to '(a b|^d .c)'.  However, '~' might pose problems, since it
serves both as a directory symbol when unary and as a pattern complementation
operator when binary.  At any rate, the need for compatibility with standard
'case' syntax is satisfied if blanks are ignored minimally, as Zoltan
suggests.)

In order for me to participate more intelligently in this discussion,
it would be helpful for me to know where STRINGs occur in the zsh grammar.
Where do they in fact occur besides in glob patterns?
Is there some document containing the formal grammar of zsh?

> } The simplest solution is to convert every unquoted space
> } and TAB which is inside a globbing paren to a null-space and null-tab token
> } and later in glob.c a null-space or null-tab is either treated as space/tab
> } or discarded if it is adjacent to | or comes after a `(' of before a `)'
> } (or it may be better to disard these after `)' and before `(' as well).
> }
> } This seems to be a quite simple solution.
>
> Maybe, but not simpler than mine, and it's solving a problem that I don't
> think we ought to be solving -- we don't need to be able to ignore spaces
> in generalized glob patterns, only in "case" statements.  I don't like the
> suggestion to do it everywhere.

On the contrary, zsh is improved by having glob patterns have
a uniform meaning throughout the grammar.

-- Morrie Siegel



^ permalink raw reply	[relevance 0%]

* Re: Bug in case stmt with '('
  1996-07-23 20:01  0%       ` Morris M. Siegel
@ 1996-07-23 21:55  7%         ` Bart Schaefer
  1996-07-24  9:52  5%           ` Peter Stephenson
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 1996-07-23 21:55 UTC (permalink / raw)
  To: Morris M. Siegel; +Cc: zsh-workers

On Jul 23,  4:01pm, Morris M. Siegel wrote:
} Subject: Re: Bug in case stmt with '('
}
} > } The best would be to handle it in glob.c but here it is a problem how can
} > } we distinguish ( foo\ | bar ) from ( foo | bar ).
} >
} > The `if (incasepat && ...)' patch that I sent handles this correctly.
} > The only drawback I've found so far to my patch is that if you *don't*
} > use the POSIX balanced-parens syntax for "case", then parenthesized
} > patterns can't have *meaningful* spaces in them.
} 
} Do you really think it user-friendly for the semantics of the case-prefix
} to depend on whether the optional leading '(' is present or not?

Given the choice of:

1.  The "current" behavior, i.e. spaces ARE significant only when the
    optional leading paren is there;
2.  The POSIX behavior, i.e. spaces are not significant in case patterns;
3.  Spaces are never significant in glob patterns anywhere.

I'll take (2) before I'll take (3).  My solution is equivalent to (2),
because it makes the spaces insignificant whether or not the opening
paren is there.

The "drawback" of my solution is that it makes PARENTHESES significant
only when the leading paren is there.  I don't have a problem with that
because other shells don't permit parentheses [other than the half-
optional outermost set] at all; thus the optional leading paren is
simply also introducing *additional* optional syntax.

} It seems to me, and I alluded to this in a previous posting, that it's
} most elegant for a whole case-prefix such as
} 	( a | b | c )
} to be in fact treated simply as a single zsh glob pattern (again, provided
} that zsh options allow '(' to be a glob metacharacter as it usually is).

I can't find any case where zsh doesn't permit '(' to be a glob metachar.
SH_GLOB relates to parameter and command substitutions, not filenames.
I have no objection to treating the whole case prefix as a single pattern;
as I've said, this is how it already works.

} That's why it's useful to ignore trivial blanks after '(', around '|',
} before ')', and maybe elsewhere, as Zoltan writes.

Except that blanks inside parenthesized glob patterns ARE NEVER TRIVIAL,
by the CURRENT definition of parenthesized glob patters.  I object to
changing this behavior.

} (Actually, it might
} perhaps be best for all blanks inside parentheses [unless quoted or
} backslashed] to be ignored unless their omission would cause distinct
} tokens to be erroneously fused.  E.g., '( a b | ^ d .c )' would be
} equivalent to '(a b|^d .c)'.  [...])

This is a big reason why I don't like the idea of stripping the spaces
everywhere.  Do YOU really think it user-friendly to have a set of
magic tokens around which spaces are or are not stripped?

} Is there some document containing the formal grammar of zsh?

Only comments in parse.c, unfortunately, and they aren't complete.

} On the contrary, zsh is improved by having glob patterns have
} a uniform meaning throughout the grammar.

I agree with the sentiment, but not with the realization.  IMHO it is
the insignificant spaces in case patterns that should be disallowed,
not spaces in glob patterns that should become insignificant.  POSIX
forbids us from making the better change; I don't believe we should
compound the error by making a worse one.  Two wrongs don't make a
right, and being consistently wrong is not better than being right
whenever possible.

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



^ permalink raw reply	[relevance 7%]

* Re: Bug in case stmt with '('
  1996-07-23 21:55  7%         ` Bart Schaefer
@ 1996-07-24  9:52  5%           ` Peter Stephenson
  0 siblings, 0 replies; 200+ results
From: Peter Stephenson @ 1996-07-24  9:52 UTC (permalink / raw)
  To: Zsh hackers list

schaefer@candle.brasslantern.com wrote:
> Given the choice of:
> 
> 1.  The "current" behavior, i.e. spaces ARE significant only when the
>     optional leading paren is there;
> 2.  The POSIX behavior, i.e. spaces are not significant in case patterns;
> 3.  Spaces are never significant in glob patterns anywhere.
> 
> I'll take (2) before I'll take (3).  My solution is equivalent to (2),
> because it makes the spaces insignificant whether or not the opening
> paren is there.

This seems to me the best solution.  It seems to create the minimal
disruption to existing zsh users and to would-be POSIX users.
Changing glob semantics more widely worries me --- even if done
logically.  Shells just aren't logical anyway.

> I can't find any case where zsh doesn't permit '(' to be a glob metachar.

Actually, there's one place we had to handle syntactically specially:

[[ ($foo = (bar|rab)) ]]

The first and matching `(' do grouping, then following the `=' zsh has
to be told to expect glob patterns.  I've never seen a problem with
this, though, and the upshot is that `(' does pattern matching when
you want it to.


On something which is related, I've never been quiet happy with this:

[ ( foo = bar ) ]

(note no globbing metacharacters inside the parentheses).  As test is
an ordinary builtin, it simply gets called with the single argument `(
foo = bar )' --- the parentheses are not stripped, which has non-zero
length, so the test is true.  In fact, parentheses here are
effectively not treated as glob metacharacters.

I felt rather guilty about this: some time ago I allowed spaces inside
parentheses because I couldn't think of a good reason not to, and
because it seemed to work better with glob modifiers --- things like
*(:s/foo/bar/) --- which appeared in the same patch, rather than from
any fundamental syntactical reason.  Before, the shell would have
reported a syntax error on the above test and the user would have
known to quote the parentheses.  This is what ksh88 does.  Perhaps it
should be subject to nomatch testing (which it isn't at the moment),
perhaps to stripping of the parentheses, too.

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.



^ permalink raw reply	[relevance 5%]

* Re: Z-Shell Frequently Asked Questions (monthly posting)
       [not found]     <199607250812.KAA18570@sgi.ifh.de>
@ 1996-07-25 20:31  5% ` Zoltan Hidvegi
  1996-07-25 21:14  6%   ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1996-07-25 20:31 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh workers list

>   From 3.0-pre3, [[, { and } are reserved words, hence must be
>     separated from other characters by whitespace.  (This change may
>     be partially backed out since it breaks many scripts.)

I'm going to include this FAQ a little bit modified in pre4, patch included
below.  It is not likely that the old [[ ... ]] behaviour will ever be
restored because it conflicts with the POSIX character class patterns like
[[:alpha:]].

Zoltan

*** /tmp/FAQ	Thu Jul 25 22:22:34 1996
--- FAQ	Thu Jul 25 22:22:38 1996
***************
*** 204,210 ****
    completion.  This version is known to have a bug with pipelines
    inside other shell structures (now fixed in 2.6).
  
!   The release of zsh 3.0 is imminent; currently 3.0-pre3 is available.
    Major zsh sites are particularly encouraged to download this and
    report any bugs.  The new major number 3.0 largely reflects the
    considerable internal changes in zsh to make it more reliable,
--- 204,210 ----
    completion.  This version is known to have a bug with pipelines
    inside other shell structures (now fixed in 2.6).
  
!   The release of zsh 3.0 is imminent; currently 3.0-pre4 is available.
    Major zsh sites are particularly encouraged to download this and
    report any bugs.  The new major number 3.0 largely reflects the
    considerable internal changes in zsh to make it more reliable,
***************
*** 1127,1134 ****
  
    Changes since zsh 2.5:
    From 3.0-pre3, [[, { and } are reserved words, hence must be
!     separated from other characters by whitespace.  (This change may
!     be partially backed out since it breaks many scripts.)
    The option CSH_JUNKIE_PAREN has been removed:  csh-like code now
      always does what it looks like it does, so `if ( ... ) ...'
      executes the code in parentheses in a subshell.  To make this
--- 1127,1135 ----
  
    Changes since zsh 2.5:
    From 3.0-pre3, [[, { and } are reserved words, hence must be
!     separated from other characters by whitespace.  From 3.0-pre4
!     { and } work again without whitespace if the IGNORE_BRACES option
!     is not set.
    The option CSH_JUNKIE_PAREN has been removed:  csh-like code now
      always does what it looks like it does, so `if ( ... ) ...'
      executes the code in parentheses in a subshell.  To make this



^ permalink raw reply	[relevance 5%]

* Re: Z-Shell Frequently Asked Questions (monthly posting)
  1996-07-25 20:31  5% ` Z-Shell Frequently Asked Questions (monthly posting) Zoltan Hidvegi
@ 1996-07-25 21:14  6%   ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 1996-07-25 21:14 UTC (permalink / raw)
  To: Zoltan Hidvegi, zsh-workers

On Jul 25, 10:31pm, Zoltan Hidvegi wrote:
} Subject: Re: Z-Shell Frequently Asked Questions (monthly posting)
}
}     From 3.0-pre3, [[, { and } are reserved words, hence must be
} !     separated from other characters by whitespace.  From 3.0-pre4
} !     { and } work again without whitespace if the IGNORE_BRACES option
} !     is not set.

Er, but I thought you were also going to change it so that IGNORE_BRACES
is not set when zsh is invoked as ksh.  So does that mean you have to both
emulate ksh and additionally set IGNORE_BRACES to get the POSIX treatment?

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



^ permalink raw reply	[relevance 6%]

* Re: Odd behavior of "trap" and "functions" in 3.0-pre2
  @ 1996-07-26 11:56  8% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-07-26 11:56 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh workers list

> schaefer@candle.brasslantern.com wrote:
> > zagzig<14> trap "echo foo" USR2
> > zagzig<17> grep TRAP <<(functions)
> > TRAPALRM () {
> > zagzig<18>
> > 
> > I'm almost certain that `functions` used to list all the TRAPxxx ....
> 
> Looks like the `trap' form of traps don't handle functions properly,
> while the TRAPxxx functions do handle traps properly, so this is
> certainly a mistake.  It seems the bin_trap() end of things got missed
> out in some reorganisation.
> 
> I've tried to write this in such away as to maintain symmetry between
> settrap() and unsettrap().  They now have a final argument which is
> set to 1 if they should set/unset the corresponding function.  This is
> necessary because the function code needs to be able to do its own
> separate manipulations on the function.  The rule is therefore that
> any call from outside the function-handling code should set the last
> argument to 1 to maintain parallel trap/TRAPxxx settings.
> 
> Note there's no memory leak in the second last hunk:  the function,
> the command list, and the name all needed to be separately allocated.
> 
> I fixed a related bug:
> 
> % TRAPUSR1() { }
> % trap
> TRAPUSR1() {}
> 
> When defining the function, you now need the space between the braces

I've mostly rewritten most of the thing related to traps which fixed all of
these bugs you describe above.  Sorry for the duplicate work.  In pre4
traps defined by trap and TRAPxxx functions will be different.  trap will
be POSIX compatible.  It will not define any function and it executes the
trap in the current environment.  TRAPxxx functions will work as before.
Also traps set by trap will be unset in a subshell as required by POSIX but
this does not affect the TRAPxxx functions.  This is only done with
explicit subshells and with backgrounded commands, so trap | less still
works (in bash/ksh trap | less shows nothing).  This is legal since POSIX
does not tell wether a pipe element should be executed in a subshell or in
the current shell environment.  In fact I've already put together pre4 and
put in onto the ftp site yesterday.  Then I went home and I wanted to post
the announcement with my modem but then I discovered a bug in this new trap
implementation ...  So even if you see pre4 on an ftp site, do not download
it, it is not the final version.  The final pre4 will be ready within a few
hours.

Zoltan



^ permalink raw reply	[relevance 8%]

* Re: zsh-3.0-pre4 released
  @ 1996-07-27 20:02  5% ` Zefram
  1996-07-27 20:38  5%   ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Zefram @ 1996-07-27 20:02 UTC (permalink / raw)
  To: schaefer; +Cc: A.Main, hzoli, zsh-workers

>What I do consider important is the confusion from the introduction of a
>large number of new options -- which is what it looks like to anyone who
>simply glances at the output of "setopt"; and which it is, syntactically
>at least, although less so semantically.

I've been using the `new options' (slightly) longer than anyone else
(how's that for brag value :-)), and while I agree that it is initially
a little disconcerting, I find that I prefer the cleaner setopt
output.  I also find that the testing of options is a little clearer in
general, in the code.  (The option patch actually normalised all option
tests to either isset(FOO) or unset(FOO).)

>Further, although I'm extremely happy about the attention that was paid
>to backwards compatibility, I can only repeat how uncomfortable I am
>about options that end up named BAD_PATTERN, EQUALS, EXEC, HUP, RCS, and
>UNSET.  What does "setopt unset" look like to you?

Confusing.  However, I do prefer unset(UNSET) to isset(NOUNSET).

>                                                    Why shouldn't "nohup"
>parallel the command prefix of the same name?

It does.

>At least with the NO_ prefix, you could tell that there is some expected
>behavior that is being modified.

True, that's how the options used to work, but what is the "expected
behaviour"?  It varies depending on whether we're emulating sh, ksh,
csh, zsh, (when we get round to it) POSIX, or whatever.  Not to mention
that not even all the non-special options defaulted to off anyway,
IIRC.

>BTW, while I'm on the subject, I'd like to throw in my vote for changing
>SH_FILE_EXPN to KSH_FILE_EXPANSION.  Besides being, as Zefram pointed out,
>more a ksh than sh thing, spelling out the "expansion" is no longer than
>ALWAYS_LAST_PROMPT, and I think we should avoid unnecessary abbreviations.

Partially agreed.  When I produced that patch I used SH_FILE_SUBST, in
order to avoid excessive length but also avoid a cryptic abbreviation;
I guess a full "expansion" is fine.  But whether it's sh or ksh makes
little difference, as both behave the same way in this regard.

>("What does the Revision Control System have to do with my init files?")

That one had me stumped for a while.

>braceccl            (what's a CCL, anyway?)

Character CLass?  I think this one needs changing; how about
BRACE_CHARS?  Does anyone have a better idea?

>histnostore

Should be HIST_STORE.

>nobadpattern

BAD_PATTERN currently means "complain about malformed patterns".  I
can't immediately come up with a better name.

>nobanghist

Again, I don't see a better name.  There's history regardless of this
option -- it only enables the bangchar form.  (Admittedly not always a
!, but how else can one describe this?)

>norcs               (IGNORE_RC_FILES, perhaps?)

RC_FILES, meaning what RCS currently does.

>nounset             (NULL_UNSET, ala NULL_GLOB?)

Yes, NULL_UNSET is much clearer.  Currently we have UNSET meaning
"complain about unset parameters", and its negation isn't exactly
obvious.

Other possibilities: EXTENDED_GLOB should be ZSH_GLOB; RM_STAR_SILENT
should be negated to RM_STAR_WARNING (note that changing the default
behaviour is a separate issue); SHIN_STDIN should be STDIN or something
less cryptic; HIST_ALLOW_CLOBBER should be HIST_ADD_CLOBBER (that's
what it does); IGNORE_BRACES has already been discussed; NOMATCH should
be clearer; RC_EXPAND_PARAM arguably should be RC_ARRAYS; REC_EXACT
should be RECOGNISE_EXACT or ACCEPT_EXACT_MATCH or similar.

-zefram



^ permalink raw reply	[relevance 5%]

* Re: zsh-3.0-pre4 released
  1996-07-27 20:02  5% ` Zefram
@ 1996-07-27 20:38  5%   ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 1996-07-27 20:38 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

On Jul 27,  9:02pm, Zefram wrote:
} Subject: Re: zsh-3.0-pre4 released
}
} I've been using the `new options' (slightly) longer than anyone else
} (how's that for brag value :-)), and while I agree that it is initially
} a little disconcerting, I find that I prefer the cleaner setopt output.

Cleaner?  Like I said, the baseline behavior should be what happens when
all the options are unset.  The cleanest output is none at all.

} I also find that the testing of options is a little clearer in
} general, in the code.  (The option patch actually normalised all option
} tests to either isset(FOO) or unset(FOO).)
} 
} I do prefer unset(UNSET) to isset(NOUNSET).

There's nothing that requires us to use NOUNSET in the code.  You yourself
used EXECOPT instead of EXEC, for example (and for obvious reasons).

} >                                                    Why shouldn't "nohup"
} >parallel the command prefix of the same name?
} 
} It does.

"setopt nohup" parallels it, but the output of "setopt" doesn't say "nohup".

} >At least with the NO_ prefix, you could tell that there is some expected
} >behavior that is being modified.
} 
} True, that's how the options used to work, but what is the "expected
} behaviour"?  It varies depending on whether we're emulating sh, ksh,
} csh, zsh, (when we get round to it) POSIX, or whatever.

The "expected behavior" is what you get when you run "./zsh" out of
the build directory on a machine that's never had zsh near it before.

Emulations are just that; they're by definition not baseline behavior
(unless what you're writing is nothing more than an emulator).

] Not to mention
} that not even all the non-special options defaulted to off anyway

The only ones that didn't are FUNCTION_ARGZERO, which is new; BG_NICE,
which has always annoyed me anyway (and which originally didn't default
that way, if I recall correctly); and the three HASH options, which
don't change any user-visible behavior, only performance tradeoffs.

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"



^ permalink raw reply	[relevance 5%]

* Re: options shenanigans in pre4
  @ 1996-07-27 21:01  6% ` Zoltan Hidvegi
  1996-07-27 21:48  0%   ` Zefram
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1996-07-27 21:01 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

> >+ preceding the set of five substitutions mentioned above.
> >+ is
> >  .SH FILENAME EXPANSION
> 
> Where did that "is" come from?  It's obviously a typo, and should be
> removed.

I just applied your patch and replaced SH_FILE_SUBST with SH_FILE_EXPN.
Either it was already in the patch or I accidently pressed some keys.

> [Doc/zshoptions.man]
> >! \fBSHIN_STDIN\fP (\-\fBs\fP, ksh: \-\fBs\fP)
> >--- 467,473 ----
> >! \fBSHIN_STDIN\fP (\-\fBs\fP)
> 
> {setopt ramble localoptions
> Hmm, I didn't notice that ksh handled this differently from sh.  Maybe
> we *do* need a third set of option letters, though this seems to be the
> only actual incompatibility.  We might want to implement the ksh option
> at some point too.
> }

I would not like that.  I've just checked pdksh which interprets -s as
SH_IN_STDIN unlike ksh93 which sorts the positional parameters.  POSIX does
not requires -s.  It seems that the majority of the shells interpret -s as
shinstdin.  Perhaps the best is to bring it back even if it increases the
risk of misusing it.

> >+ \fBSH_OPTION_LETTERS\fP

> Virtually identical to a patch I was planning to produce after the pre4
> release.  I was going to call it KSH_OPTION_LETTERS, though, because
> the set of options it selects are emulating ksh, not sh.  The other

I'd rather say pdksh.  Neither bash nor ksh93 know about -X and -l, but
both know all of the other sh options in zsh only they interpret -s in a
different way.  pdksh knows both -X and -l but -s behaves as in bash (and
as in the Solaris 2.4 /bin/sh).  This means that the most precise option
name would be PDKSH_OPTION_LETTERS :-) but the next best match is
SH_OPTION_LETTERS if we restore -s as shinstdin.

Zoltan



^ permalink raw reply	[relevance 6%]

* Re: options shenanigans in pre4
  1996-07-27 21:01  6% ` Zoltan Hidvegi
@ 1996-07-27 21:48  0%   ` Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1996-07-27 21:48 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: A.Main, zsh-workers

>> Where did that "is" come from?  It's obviously a typo, and should be
>> removed.
>
>I just applied your patch and replaced SH_FILE_SUBST with SH_FILE_EXPN.
>Either it was already in the patch or I accidently pressed some keys.

I've checked; it was already in the patch.  It's a typo on my part.

>I would not like that.  I've just checked pdksh which interprets -s as
>SH_IN_STDIN unlike ksh93 which sorts the positional parameters.  POSIX does
>not requires -s.  It seems that the majority of the shells interpret -s as
>shinstdin.  Perhaps the best is to bring it back even if it increases the
>risk of misusing it.

I based the ksh option set on pdksh, not realising the
incompatibility.  As both sh and pdksh handle -s the way zsh does, I
think it would be better to use -s for SHIN_STDIN.  We should then
remove -t, if we're going to be consistent.

>I'd rather say pdksh.  Neither bash nor ksh93 know about -X and -l, but
>both know all of the other sh options in zsh only they interpret -s in a
>different way.  pdksh knows both -X and -l but -s behaves as in bash (and
>as in the Solaris 2.4 /bin/sh).  This means that the most precise option
>name would be PDKSH_OPTION_LETTERS :-) but the next best match is
>SH_OPTION_LETTERS if we restore -s as shinstdin.

OK, SH_OPTION_LETTERS seems fine in that case.

On a related matter, I suggest you re-examine the status of -1 and -C
(PRINT_EXIT_VALUE and NO_CLOBBER).  In pre4, -C returned to being
PRINT_EXIT_VALUE in the zsh option set, though zshoptions(1) claims
that -C is always NO_CLOBBER.  If this is due to me having merged the
change into my option patch incorrectly, I apologise.  Either the
documentation or the code needs to change, and I suggest that changing
the documentation would be preferable (as -C has traditionally been
PRINT_EXIT_VALUE in zsh, and it's NO_CLOBBER in the ksh option set
anyway).

-zefram



^ permalink raw reply	[relevance 0%]

* Re: Lethal option-related bug
  @ 1996-07-29 18:03  5% ` Zoltan Hidvegi
  1996-07-30  8:19  0%   ` Peter Stephenson
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1996-07-29 18:03 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

> I just submitted a batch job for the first time with an unpatched
> 3.0-pre4 and it dumped core straight away.  (I think the shell is
> still yelling out `Don't release me!  Don't release me!'.)

OK, I'll make a 3.0-pre5 and will release 3.0 later in August.

> It turns out to be easy to reproduce:
> 
> ./zsh -s
> zsh: 7863 segmentation fault (core dumped)  ./zsh -s

[...]

> and the problem is that ifs is null in inittyptab; possibly not too
> surprising, since it gets initialised in setupvals(), which is called
> a few lines after parseargs() in main().  It looks like SHINSTDIN
> wants inittytab set up before the shell's set up enough for it.
> 
> I could probably hack round this, but I'm not confident of producing
> the right fix, so I'll leave it.

OK, below is a simple and clean fix.  POSIX says that if IFS is unset it
should be treated as if it were set to space-tab-newline.  Zsh does this
but it adds an extra null here.

Zoltan


*** Src/zsh.h	1996/07/28 22:29:59	2.36
--- Src/zsh.h	1996/07/29 08:59:08
***************
*** 57,62 ****
--- 57,67 ----
  
  #define Meta		((char) 0x83)
  
+ /* Note that the fourth character in DEFAULT_IFS is Meta *
+  * followed by a space which denotes the null character. */
+ 
+ #define DEFAULT_IFS	" \t\n\203 "
+ 
  /* Character tokens */
  #define Pound		((char) 0x84)
  #define String		((char) 0x85)
*** Src/utils.c	1996/07/21 15:00:57	2.46
--- Src/utils.c	1996/07/29 17:54:59
***************
*** 2507,2513 ****
      typtab[STOUC(Meta)] |= IMETA;
      for (t0 = (int)STOUC(Pound); t0 <= (int)STOUC(Nularg); t0++)
  	typtab[t0] |= ITOK | IMETA;
!     for (s = ifs; *s; s++) {
  	if (inblank(*s))
  	    if (s[1] == *s)
  		s++;
--- 2507,2513 ----
      typtab[STOUC(Meta)] |= IMETA;
      for (t0 = (int)STOUC(Pound); t0 <= (int)STOUC(Nularg); t0++)
  	typtab[t0] |= ITOK | IMETA;
!     for (s = ifs ? ifs : DEFAULT_IFS; *s; s++) {
  	if (inblank(*s))
  	    if (s[1] == *s)
  		s++;
*** Src/params.c	1996/07/25 18:22:08	2.30
--- Src/params.c	1996/07/29 17:55:53
***************
*** 1574,1583 ****
  ifssetfn(Param pm, char *x)
  {
      zsfree(ifs);
!     if (x)
! 	ifs = x;
!     else
! 	ifs = ztrdup(" \t\n  "), ifs[3] = Meta;
      inittyptab();
  }
  
--- 1574,1580 ----
  ifssetfn(Param pm, char *x)
  {
      zsfree(ifs);
!     ifs = x;
      inittyptab();
  }
  
*** Src/init.c	1996/07/27 20:24:36	2.35
--- Src/init.c	1996/07/29 17:57:54
***************
*** 520,527 ****
  
      if (!(ttystrname = ztrdup(ttyname(SHTTY))))
  	ttystrname = ztrdup("");
!     ifs         = ztrdup(" \t\n  ");
!     ifs[3]      = Meta;
      wordchars   = ztrdup(DEFAULT_WORDCHARS);
      postedit    = ztrdup("");
      underscore  = ztrdup("");
--- 520,526 ----
  
      if (!(ttystrname = ztrdup(ttyname(SHTTY))))
  	ttystrname = ztrdup("");
!     ifs         = ztrdup(DEFAULT_IFS);
      wordchars   = ztrdup(DEFAULT_WORDCHARS);
      postedit    = ztrdup("");
      underscore  = ztrdup("");


^ permalink raw reply	[relevance 5%]

* Re: Lethal option-related bug
  1996-07-29 18:03  5% ` Zoltan Hidvegi
@ 1996-07-30  8:19  0%   ` Peter Stephenson
  0 siblings, 0 replies; 200+ results
From: Peter Stephenson @ 1996-07-30  8:19 UTC (permalink / raw)
  To: Zsh hackers list

hzoli@cs.elte.hu wrote:
> > It turns out to be easy to reproduce:
> > 
> > ./zsh -s
> > zsh: 7863 segmentation fault (core dumped)  ./zsh -s
> > the right fix, so I'll leave it.
> 
> OK, below is a simple and clean fix.  POSIX says that if IFS is unset it
> should be treated as if it were set to space-tab-newline.  Zsh does this
> but it adds an extra null here.

No, that doesn't work: you need to fix up wordchars as well which
causes the same problem.  (I didn't mention that in the original post
because I assumed whoever was making the patch would try it out and
discover this and perhaps other problems.)  The following less elegant
patch does at least fix the core dump.

*** Src/init.c.ifs	Mon Jul 29 18:01:46 1996
--- Src/init.c	Tue Jul 30 10:14:40 1996
***************
*** 59,64 ****
--- 59,67 ----
      opts[MONITOR] = 1;   /* may be unset in init_io() */
      opts[PRIVILEGED] = (getuid() != geteuid() || getgid() != getegid());
      opts[USEZLE] = 1;   /* may be unset in init_io() */
+     ifs         = ztrdup(" \t\n  ");
+     ifs[3]      = Meta;
+     wordchars   = ztrdup(DEFAULT_WORDCHARS);
      parseargs(argv);   /* sets INTERACTIVE, SHINSTDIN and SINGLECOMMAND */
  
      SHTTY = -1;
***************
*** 519,527 ****
  
      if (!(ttystrname = ztrdup(ttyname(SHTTY))))
  	ttystrname = ztrdup("");
-     ifs         = ztrdup(" \t\n  ");
-     ifs[3]      = Meta;
-     wordchars   = ztrdup(DEFAULT_WORDCHARS);
      postedit    = ztrdup("");
      underscore  = ztrdup("");
  
--- 522,527 ----

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


^ permalink raw reply	[relevance 0%]

* Re: BUG: set -n in interactive shell (3.0-xxx)
  @ 1996-07-31  2:40  6% ` Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1996-07-31  2:40 UTC (permalink / raw)
  To: borsenkow.msk; +Cc: zsh-workers

>Small problem with no_exec option. If I per chance do 'set -n' in
>interactive (worse, login) shell *and* ignoreeof option is set, it is no
>more possible to leave the shell at all!!!
>^D is rejected and logout/exit are not executed.

Ten ^Ds will still exit.  This is a safety feature in case the terminal
*really* goes away, as opposed to the user manually sending EOF, but it
can also be used to log out.

>Probably, the option should be set only on command line (as with some
>other)? What do you think?

No.  Two reasons: first, the options that can only be set on the
command line are very special ones that determine where commands come
from (and hence can't be meaningfully changed).  Second, not accepting
`set -n` would make a traditional shenanigan involving .profile
impossible.

(There's also the trifling issue of POSIX conformance, but we tend not
to be too concerned about that here.)

-zefram


^ permalink raw reply	[relevance 6%]

* Re: Something fishy in process timing
  @ 1996-07-31 19:26  6% ` Richard Coleman
  0 siblings, 0 replies; 200+ results
From: Richard Coleman @ 1996-07-31 19:26 UTC (permalink / raw)
  To: zsh-workers

> > By the way, my time reports look like this:
> > 
> > ./usetime 2 1000000: 1.37s(r) 1.35s(u) 0.02s(s) (99%): %K kb, max %M kb, %F pf
> > 
> > I still haven't worked out what happened to %K, %M and %F.
> 
> They've got removed on 30 March 1995 by Richard.  If you have the RCS
> sources it happened in revision 1.18 of jobs.c.
> 
> I think the corresponting ChangeLog entry is:
> 
>         * most of signals.{c,h} rewritten.
> 
> Perhaps it was not portable?

I can answer this one, since I removed them.  When I rewrote the
signals code, I converted zsh from using the BSD signals functions by
default to using the POSIX signal functions.  The flags such as %K
return information that is specific to the way resource usage is
reported on BSD.  I looked for portable alternatives, but didn't find
anything.  I also rewrote the way resource usage information was
reported.  It sucks that we lost those flags, but almost no one complained
at the time, and it greatly cleaned up the code, I consider it a small
loss.

rc


^ permalink raw reply	[relevance 6%]

* Announcement draft
@ 1996-07-31 21:11  4% Zoltan Hidvegi
  1996-08-01  6:36  6% ` Bas V. de Bakker
  1996-08-08 15:13  6% ` sh compatibility again :-> Andrej Borsenkow
  0 siblings, 2 replies; 200+ results
From: Zoltan Hidvegi @ 1996-07-31 21:11 UTC (permalink / raw)
  To: Zsh workers list

I'd like to announce zsh-3.0-pre5 in a few newsgroups.  Here is my proposed
announcement.  Please tell me your opinions about that.

Zoltan


-----BEGIN PGP SIGNED MESSAGE-----

 Zsh version 3.0 is going to be released soon!
 ---------------------------------------------

The latest version is zsh-3.0-pre5.  It is much more stable than the last
production release, zsh-2.5.0.  More than a thousand bugs have been fixed
since the release of zsh-2.5.0 (although none counted) and several new
features were added.  Everyone using zsh-2.5.0 or earlier is encouraged to
upgrade.  Note that some incompatible changes have been made to zsh so
old scripts may have to be modified to run with zsh-3.0.

For those who do not know what it is:

The Z-shell, zsh is the most powerful freely available Unix command
interpreter.  It most resembles the Korn shell (ksh).  It includes

 * a very powerful command-line editor which can even be used to edit
   files

 * 102 options for customizing its behavior

 * very powerful filename globing which can do almost everything that
   find can do

 * fully programmable completion

 * spelling correction

 * powerful substitution features which can often be used instead of cut
   or sed

 * features to make C-shell (csh) users feel more at home and extra
   features drawn from tcsh (another `custom' shell).

Additionally zsh is probably one of the most portable program available
for Unix.  It uses GNU autoconf and it builds out of the box on most
systems.

Zsh can emulate the POSIX shell and the Korn shell quite well when it is
invoked as sh or ksh respectively.  /bin/sh can be safely linked to zsh.

The latest release, the zsh FAQ and documentation is available from the
following anonymous ftp sites.  The first is the official archive site.
The rest are mirror sites which are kept frequently up to date.  The sites
marked with a star may mirror ftp.math.gatech.edu instead of the primary
site.

   HUNGARY
      ftp://ftp.cs.elte.hu/pub/zsh/

   Australia
    * ftp://ftp.ips.oz.au/pub/packages/zsh/

   France
      ftp://ftp.cenatls.cena.dgac.fr/pub/shells/zsh/

   Germany
      ftp://ftp.uni-trier.de/pub/unix/shell/zsh/
      ftp://ftp.prz.tu-berlin.de/pub/unix/shells/zsh/
    * ftp://ftp.fu-berlin.de/pub/unix/shells/zsh/

   Japan
      ftp://ftp.tohoku.ac.jp/mirror/zsh/
    * ftp://ftp.iij.ad.jp/pub/misc/zsh/

   Norway
    * ftp://ftp.uit.no/pub/unix/shells/zsh/

   Sweden
      ftp://ftp.lysator.liu.se/pub/unix/zsh/

   UK
      ftp://ftp.net.lut.ac.uk/zsh/

   USA
      ftp://ftp.math.gatech.edu/pub/zsh/
      ftp://uiarchive.cso.uiuc.edu/pub/packages/shells/zsh/
    * ftp://ftp.sterling.com/zsh/
    * ftp://ftp.rge.com/pub/shells/zsh/


Zoltan Hidvegi
Coordinator of the zsh development

My PGP public key is available from the above ftp sites (in pubring.pgp),
via finger -l hzoli@cs.elte.hu or from the key servers.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3i
Charset: noconv

iQCVAwUBMf/LUAupSCiLN749AQGxngP+ODNsh6ZTmILDasUJgYSDReHxSfE1bC6m
I9kOh2Cmd11Rr1VY/EGvTxFhNByW8kfxsJpTcJgQtbXZTFW5f7ysFIg7GqzkfDLR
vfpqVww6JsbVQ94vTjhlFROsMlDDfuiuHSUHPDIxu/V0S34UpkdoYoDJKg9qQ2my
CRsesNSH8HY=
=osRE
-----END PGP SIGNATURE-----


^ permalink raw reply	[relevance 4%]

* Spelling fixes, etc.
@ 1996-08-01 23:19  2% Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1996-08-01 23:19 UTC (permalink / raw)
  To: Z Shell workers mailing list

-----BEGIN PGP SIGNED MESSAGE-----

This patch fixes a number of spelling errors in some of the text files
in the Etc directory.  The term "spelling errors" is to be interpreted
liberally :-)

      *** Etc/BUGS.orig	Wed Jul 31 23:57:13 1996
      --- Etc/BUGS	Wed Jul 31 23:57:52 1996
      ***************
      *** 10,16 ****
        #include <sys/wait.h>
        #include <unistd.h>
        
      ! void main(int argc, char *argv[])
        {
            int status;
        
      --- 10,16 ----
        #include <sys/wait.h>
        #include <unistd.h>
        
      ! int main(int argc, char *argv[])
        {
            int status;
        
      *** Etc/FAQ.orig	Wed Jul 31 23:57:04 1996
      --- Etc/FAQ	Thu Aug  1 00:06:02 1996
      ***************
      *** 1261,1267 ****
        mailing list has been run by Peter Gray, Rick Ohnemus and Richard
        Coleman, all of whom deserve thanks.  The world is eternally in the
        debt of Paul Falstad for inventing zsh in the first place (though the
      ! wizzo extended completion is by Sven Wishnowsky).
        
        
        Copyright Information:
      --- 1261,1267 ----
        mailing list has been run by Peter Gray, Rick Ohnemus and Richard
        Coleman, all of whom deserve thanks.  The world is eternally in the
        debt of Paul Falstad for inventing zsh in the first place (though the
      ! wizzo extended completion is by Sven Wischnowsky).
        
        
        Copyright Information:
      *** Etc/FEATURES.orig	Wed Jul 31 23:57:00 1996
      --- Etc/FEATURES	Thu Aug  1 00:14:45 1996
      ***************
      *** 1,6 ****
        very close to ksh/sh grammar, with csh additions
        most features of ksh, bash, and tcsh
      ! 75 builtins, 89 options, 154 key bindings
        short for loops, ex: for i (*.c) echo $i
        select
        shell functions
      --- 1,7 ----
        very close to ksh/sh grammar, with csh additions
        most features of ksh, bash, and tcsh
      ! can emulate ksh or POSIX sh
      ! 81 builtins, 102 options, 162 key bindings
        short for loops, ex: for i (*.c) echo $i
        select
        shell functions
      ***************
      *** 33,40 ****
        magic-space history
        spelling correction
        array parameters
      ! $HOSTTYPE, $LINENO, $RANDOM, $SECONDS, $cdpath, $COLUMNS, $fignore,
      !   $HISTCHARS, $mailpath
        with autocd option, typing a directory name by itself is the same as
          typing "cd dirname"
        menu completion: pressing TAB repeatedly cycles through the possible matches
      --- 34,42 ----
        magic-space history
        spelling correction
        array parameters
      ! $MACHTYPE, $VENDOR and $OSTYPE identify the host machine
      ! $LINENO, $RANDOM, $SECONDS, $cdpath, $COLUMNS, $fignore, $HISTCHARS, $mailpath
      ! $UID, $EUID, $GID, $EGID and $USERNAME can be assigned to
        with autocd option, typing a directory name by itself is the same as
          typing "cd dirname"
        menu completion: pressing TAB repeatedly cycles through the possible matches
      ***************
      *** 44,50 ****
        utmp login/logout reporting
        with histverify option, performing csh-style history expansions causes the
          input line to be brought up for editing instead of being executed
      ! with sunkeyboardhack option, accidently typed trailing ` characters
          are removed from the input line (for those of you with Sun keyboards :-) )
        autoloaded functions (loaded from a file when they are first referenced)
        "cd old new" replaces "old" with "new" in directory string
      --- 46,52 ----
        utmp login/logout reporting
        with histverify option, performing csh-style history expansions causes the
          input line to be brought up for editing instead of being executed
      ! with sunkeyboardhack option, accidentally typed trailing ` characters
          are removed from the input line (for those of you with Sun keyboards :-) )
        autoloaded functions (loaded from a file when they are first referenced)
        "cd old new" replaces "old" with "new" in directory string
      ***************
      *** 63,67 ****
        command scheduling (like at(1), but in the shell's context)
        tty mode freezing
        up to 9 startup files (but you only need 1 or 2)
      ! 8-bit clean
      ! which -a cmd lists all occurences of "cmd" in the path
      --- 65,69 ----
        command scheduling (like at(1), but in the shell's context)
        tty mode freezing
        up to 9 startup files (but you only need 1 or 2)
      ! really 8-bit clean, and we mean it this time
      ! which -a cmd lists all occurrences of "cmd" in the path
      *** Etc/NEWS.orig	Wed Jul 31 23:57:16 1996
      --- Etc/NEWS	Thu Aug  1 00:02:49 1996
      ***************
      *** 27,36 ****
        
        ${~spec}, ${=spec} and ${^spec} used to toggle the effect of
        globsubst/shwordsplit/rcexpandparam.  Now these force the corresponding
      ! option. ~, = or ^ can be doubled to force the relevant option off for the
      ! substitution.
        
      ! Explicitely requested word splitting like ${=spec} or ${(s:delim:)spec}
        will be executed even if the substitution is double quoted.
        
        The right-hand side of assignments are no longer globbed by default hence
      --- 27,36 ----
        
        ${~spec}, ${=spec} and ${^spec} used to toggle the effect of
        globsubst/shwordsplit/rcexpandparam.  Now these force the corresponding
      ! option on. ~, = or ^ can be doubled to force the relevant option off for
      ! the substitution.
        
      ! Explicitly requested word splitting like ${=spec} or ${(s:delim:)spec}
        will be executed even if the substitution is double quoted.
        
        The right-hand side of assignments are no longer globbed by default hence
      ***************
      *** 37,43 ****
        assignment foo=* will assign '*' as a value of foo.  Use the foo=( * )
        array assignment syntax to get the old behaviour.  Alternatively the
        GLOB_ASSIGN can be set to emulate the old behaviour but the usage of this
      ! option is strongly discouraged and this optiom may be completely removed in
        the future.
        
        When foo is an array parameter ${#foo} will always return the length of the
      --- 37,43 ----
        assignment foo=* will assign '*' as a value of foo.  Use the foo=( * )
        array assignment syntax to get the old behaviour.  Alternatively the
        GLOB_ASSIGN can be set to emulate the old behaviour but the usage of this
      ! option is strongly discouraged and this option may be completely removed in
        the future.
        
        When foo is an array parameter ${#foo} will always return the length of the
      ***************
      *** 47,56 ****
        When the prompt_subst option is set prompts are fully expanded using
        parameter expansion, command substitution and arithmetic expansion.
        In 2.5 backquote substitution was not performed in the prompts so this
      ! cange might cause problems in some startup scripts if ` is used literaly
        in prompts.
        
      ! history substitution is now not performed if the history escape caracter
        appears in a single-quoted string.  This may break some interactive shell
        functions which use \! in single-quoted strings.
        
      --- 47,56 ----
        When the prompt_subst option is set prompts are fully expanded using
        parameter expansion, command substitution and arithmetic expansion.
        In 2.5 backquote substitution was not performed in the prompts so this
      ! change might cause problems in some startup scripts if ` is used literally
        in prompts.
        
      ! History substitution is now not performed if the history escape character
        appears in a single-quoted string.  This may break some interactive shell
        functions which use \! in single-quoted strings.
        
      ***************
      *** 64,70 ****
        
        The privileged (-p) option is automatically set on invocation if euid != uid
        or egid != gid.  If this option is set no user startup files are sourced.
      ! The shell will drop privileges when thisoption is unset.
        
        The =number substitution for accessing the directory stack is changed to
        ~number to allow =command substitution when a command name begins with a 
      --- 64,70 ----
        
        The privileged (-p) option is automatically set on invocation if euid != uid
        or egid != gid.  If this option is set no user startup files are sourced.
      ! The shell will drop privileges when this option is unset.
        
        The =number substitution for accessing the directory stack is changed to
        ~number to allow =command substitution when a command name begins with a 
      ***************
      *** 74,84 ****
        reading and writing.  To match a number use <->.
        
        Option letters -1 and -C for PRINT_EXIT_VALUE and NO_CLOBBER are swapped:
      ! `set -C' sets noclobber and `set -1' sets PRINT_EXIT_VALUE.
        
        AUTO_PUSHD behaviour is changed.  Now cd without arguments will always go
        to the $HOME directory even if AUTO_PUSHD is set and PUSHD_TO_HOME is not
      ! set.  If you prefered the old behaviour you can alias cd to pushd.
        
        IFS word splitting with SH_WORD_SPLIT and the splitting of the input in the
        read builtin has changed in cases when IFS contains characters other than
      --- 74,84 ----
        reading and writing.  To match a number use <->.
        
        Option letters -1 and -C for PRINT_EXIT_VALUE and NO_CLOBBER are swapped:
      ! `set -C' sets NO_CLOBBER and `set -1' sets PRINT_EXIT_VALUE.
        
        AUTO_PUSHD behaviour is changed.  Now cd without arguments will always go
        to the $HOME directory even if AUTO_PUSHD is set and PUSHD_TO_HOME is not
      ! set.  If you preferred the old behaviour you can alias cd to pushd.
        
        IFS word splitting with SH_WORD_SPLIT and the splitting of the input in the
        read builtin has changed in cases when IFS contains characters other than
      ***************
      *** 124,130 ****
        
        New options ALWAYS_LAST_PROMPT, ALWAYS_TO_END, AUTO_PARAM_KEYS,
        COMPLETE_ALIASES, COMPLETE_IN_WORD, CSH_JUNKIE_HISTORY, GLOB_SUBST,
      ! LIST_AMBIGOUS, MAGIC_EQUAL_SUBST, NO_FLOW_CONTROL, PROMPT_SUBST
        
        New option -m to many builtins makes arguments subject to pattern
        matching.
      --- 124,130 ----
        
        New options ALWAYS_LAST_PROMPT, ALWAYS_TO_END, AUTO_PARAM_KEYS,
        COMPLETE_ALIASES, COMPLETE_IN_WORD, CSH_JUNKIE_HISTORY, GLOB_SUBST,
      ! LIST_AMBIGUOUS, MAGIC_EQUAL_SUBST, NO_FLOW_CONTROL, PROMPT_SUBST
        
        New option -m to many builtins makes arguments subject to pattern
        matching.

-----BEGIN PGP SIGNATURE-----
Version: 2.6.i

iQCVAgUBMf/p6nD/+HJTpU/hAQGGygQArawJf063fltGsRGitDDoR4wIGkYJ8meD
qEW4f+bPO1/Krj1UsIvAd67XozFuHpavpuYwVxQudF1csEtg6mXkHPeJ6pgUXA7C
LrhcekpBivLCsgblBfsndXD6upnEj9JtBWXA4jOfrQw5vQxliqwhJkyZmHwSQtYp
Ova4aGCqUaA=
=OsoS
-----END PGP SIGNATURE-----


^ permalink raw reply	[relevance 2%]

* Re: Announcement draft
  1996-07-31 21:11  4% Announcement draft Zoltan Hidvegi
@ 1996-08-01  6:36  6% ` Bas V. de Bakker
  1996-08-01  8:31  0%   ` Peter Stephenson
  1996-08-08 15:13  6% ` sh compatibility again :-> Andrej Borsenkow
  1 sibling, 1 reply; 200+ results
From: Bas V. de Bakker @ 1996-08-01  6:36 UTC (permalink / raw)
  To: zsh-workers

Zoltan Hidvegi <hzoli@cs.elte.hu> writes:

> More than a thousand bugs have been fixed since the release of
> zsh-2.5.0

This makes 2.5.0 sound quite unusable, which it wasn't.  Are you also
counting the bugs introduced after 2.5.0?

> Additionally zsh is probably one of the most portable program
> available for Unix.  It uses GNU autoconf and it builds out of the
> box on most systems.

Considering the amount of system calls a shell uses, it is surely very
portable.  But I tend to doubt whether this is true when compared to
all kinds of programs that do not need to depend on system specific
features.

> /bin/sh can be safely linked to zsh.

This sounded too good to be true, so I just tested this on the perl
Configure script and it failed, sorry.  (To be slightly more precise:
when typing '& -d' at a prompt to make it use the defaults zsh gives
me a parse error, while /bin/sh (POSIX, not traditional Bourne) has no
problems.  This on HPUX 10.10.)

Bas.


^ permalink raw reply	[relevance 6%]

* Re: Announcement draft
  1996-08-01  6:36  6% ` Bas V. de Bakker
@ 1996-08-01  8:31  0%   ` Peter Stephenson
  0 siblings, 0 replies; 200+ results
From: Peter Stephenson @ 1996-08-01  8:31 UTC (permalink / raw)
  To: Zsh hackers list

bas@astro.uva.nl wrote:
> > /bin/sh can be safely linked to zsh.
> 
> This sounded too good to be true, so I just tested this on the perl
> Configure script and it failed, sorry.  (To be slightly more precise:
> when typing '& -d' at a prompt to make it use the defaults zsh gives
> me a parse error, while /bin/sh (POSIX, not traditional Bourne) has no
> problems.  This on HPUX 10.10.)

Irix, too.  I think I've pinpointed this: it happens when the `myread'
file for later sourcing is set up as a here document.

% <testscr
cat <<EOSC >test.out
eval "ans=\"\$answ\""
EOSC
% zsh -fc 'emulate sh; . ./testscr' 
% <test.out
eval "ans="$answ""
% sh -c '. ./testscr'
% <test.out
eval "ans=\"$answ\""

Zsh is stripping the backslash from the double quotes.  This looks
wrong to me.  `answ' contains the user input, here "& -d", which is
causing the problem.  (I didn't look into the specific nature of the
problem, but the errors is reported on that line, which is the only
one which is significantly different from the sh version of myread.)

Anyone know the proper backslash rules for here documents?


By the way: some time after 3.0 is released and stable (preferably not
in that order :-/) it would be quite nice to have ksh/sh emulation as
a command line option, to avoid what I had to do above (linking zsh
under sh, when there's a real sh on the machine, is no nicer).

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77330
Deutches Electronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


^ permalink raw reply	[relevance 0%]

* Re: Here docs
  @ 1996-08-01 14:07  5% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-08-01 14:07 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

Peter wrote:
> I expect Zoltan's already fixed this, but anyway...

Yes :-).

> > In this case, the backslash in the input will behave as the
> > backslash inside double-quotes (see Section 2.2.3) However, the
> > double-quote character (") will not be treated specially within a
> > here-document, except when the double-quote appears within $(), ``, or
> > ${}.
> 
> That's clear enough for here documents... the question is what should
> happen at other times when zsh is parsing something in the same way.
> This is usually when tokenising a string that hadn't already been

Here is my patch, a bit different from yours.  It fixes some other
inconsistencies and it also handles " in ${...} as reuired above.  When I
read POSIX I was pleased to know that here ducuments should be parsed the
same way as double-quoted strings, and relaxed knowing that zsh does
exactly that.  And indeed the problem was not really in the here-document
code.  I did not notice this problem because configure coming with zsh
always ran fine.

Zoltan


*** Src/lex.c	1996/07/24 14:39:19	2.40
--- Src/lex.c	1996/08/01 13:47:44
***************
*** 996,1008 ****
      while (((c = hgetc()) != endchar || bct ||
  	    (math && ((pct > 0) || (brct > 0))) ||
  	    intick) && !lexstop) {
  	switch (c) {
  	case '\\':
  	    c = hgetc();
! 	    if (c != '\n')
! 		add(c == '$' || c == '\\' || (c == '}' && !intick && bct) ||
! 		    c == '\"' || c == '`' ? Bnull : '\\');
! 	    else if (sub || unset(CSHJUNKIEQUOTES) || endchar != '"')
  		continue;
  	    break;
  	case '\n':
--- 996,1015 ----
      while (((c = hgetc()) != endchar || bct ||
  	    (math && ((pct > 0) || (brct > 0))) ||
  	    intick) && !lexstop) {
+       cont:
  	switch (c) {
  	case '\\':
  	    c = hgetc();
! 	    if (c != '\n') {
! 		if (c == '$' || c == '\\' || (c == '}' && !intick && bct) ||
! 		    c == endchar || c == '`')
! 		    add(Bnull);
! 		else {
! 		    /* lexstop is implicitely handled here */
! 		    add('\\');
! 		    goto cont;
! 		}
! 	    } else if (sub || unset(CSHJUNKIEQUOTES) || endchar != '"')
  		continue;
  	    break;
  	case '\n':
***************
*** 1092,1098 ****
  	    err = (!brct-- && math);
  	    break;
  	case '"':
! 	    if (intick || !endchar)
  		break;
  	    if (bct) {
  		add(Dnull);
--- 1099,1105 ----
  	    err = (!brct-- && math);
  	    break;
  	case '"':
! 	    if (intick || (!endchar && !bct))
  		break;
  	    if (bct) {
  		add(Dnull);


^ permalink raw reply	[relevance 5%]

* Re: Procmail rejects zsh as being "broken"
  @ 1996-08-01 14:44  8% ` Stephen R. van den Berg
  0 siblings, 0 replies; 200+ results
From: Stephen R. van den Berg @ 1996-08-01 14:44 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: pws, zsh-workers

Zoltan Hidvegi <hzoli@cs.elte.hu> wrote:
>Well, when zsh is invoked as zsh it does not pretend to be Bourne shell
>compatible.

Ah, a misconception on my part.  I've always seen zsh "advertised" as
Bourne shell compatible.

>as sh.  The complicated *zsh* test in procmail is unnecessary.  It'll never
>work.

I didn't know that.  I thought it was an oversight of zsh developers in
the default settings of zsh.  Now I know better, of course.

>  The problem is that procmail tells that zsh is broken.  Zsh is not
>broken, it is simply different from a Bourne shell when invoked as zsh.
>Procmail should just inform the user that it uses /bin/sh or whatever
>instead of zsh and should not spread misinformation about zsh.

Fair enough.  The problem in this case transposes itself to "make" then.
"make" *has* to make that SHELL is set to a Bourne shell compatible
shell.  If it leaves it at zsh, it's a bug.

In that light, we'll avoid the test and change the diagnostics to:
===================================================================
RCS file: /var/lib/cvs/procmail/initmake,v
retrieving revision 1.66
diff -u -r1.66 initmake
--- initmake	1996/07/29 18:48:23	1.66
+++ initmake	1996/08/01 14:42:50
@@ -23,7 +23,7 @@
   case "$BSHELL" in
      *zsh*) ;;
      *) echo "(If I wouldn't know better, I'd say you're trying to sell"
-	echo "me a buggy zsh :-)" ;;
+	echo "me an incompatible zsh :-)" ;;
   esac
   echo "Please edit the Makefile and try setting BSHELL to a shell which"
   echo "is more backwards compatible with a Bourne, Korn or POSIX shell."
@@ -55,17 +55,7 @@
 case "$SHELL" in
   *sh*)
      case "$SHELL" in
-	*csh*) echo "Warning: really perverted make detected"; SHELL="";;
-	*zsh*) $RM src/_autotst
-	    $SHELL <<HERE
-	    O="echo test >src/_autotst"
-	    exec 2>$DEVNULL
-	    \$O
-HERE
-	   if test ! -f src/_autotst
-	   then
-	      echo "Warning: your $SHELL is broken, avoiding it"; SHELL=""
-	   fi ;;
+	*[zc]sh*) echo "Warning: really perverted make detected"; SHELL="";;
      esac
      if test ! -z "$SHELL"
      then
-- 
Sincerely,                                                          srb@cuci.nl
           Stephen R. van den Berg (AKA BuGless).
Auto repair rates: basic labor $40/hour; if you wait, $60; if you watch, $80;
if you ask questions, $100; if you help, $120; if you laugh, $140.


^ permalink raw reply	[relevance 8%]

* Re: More Configure problems
  @ 1996-08-01 17:55  6% ` Zoltan Hidvegi
  1996-08-01 21:03  0%   ` Zoltan Hidvegi
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1996-08-01 17:55 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

Peter wrote:
> > Next problem with Configure... actually with the makedepend script
> > that comes with it:  this assignment is failing:
> > 
> >     defrule=`<$mf sed -n		\
> > ...
> > 
> > That first interestingly positioned <$mf (sometimes I wonder if people
> > do this deliberately) is supposed to be a redirection, but zsh is
> > treating it like $(<...).  ksh behaves like sh here, i.e. only $(<...)
> > has that behaviour.  Perhaps we should follow suit.
> 
> Well, there's only about one possible fix, as follows.  The manual
> page mentions $(<...) and specifically fails to mention `<...`, so I
> think we're in line with that after the patch.  No other Configure
> problems that I've noticed.  (This is actually non-trivial, if you
> want to install perl on Linux without having to have bash around.)

I'd prefer a different fix.  I think it is better to parse each command
substitution lexically and if it consists of a single redirection to stdin
than behave as $(< file) behaves now.  This is really preferrable since $(<
file command) should execute the given command.  That's the ksh behaviour
and that's what required by POSIX.  I'll try to write a patch for that.

Zoltan


^ permalink raw reply	[relevance 6%]

* Re: More Configure problems
  1996-08-01 17:55  6% ` Zoltan Hidvegi
@ 1996-08-01 21:03  0%   ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-08-01 21:03 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: pws, zsh-workers

I wrote:
> Peter wrote:
> > > Next problem with Configure... actually with the makedepend script
> > > that comes with it:  this assignment is failing:
> > > 
> > >     defrule=`<$mf sed -n		\
> > > ...
> > > 
> > > That first interestingly positioned <$mf (sometimes I wonder if people
> > > do this deliberately) is supposed to be a redirection, but zsh is
> > > treating it like $(<...).  ksh behaves like sh here, i.e. only $(<...)
> > > has that behaviour.  Perhaps we should follow suit.
> > 
> > Well, there's only about one possible fix, as follows.  The manual
> > page mentions $(<...) and specifically fails to mention `<...`, so I
> > think we're in line with that after the patch.  No other Configure
> > problems that I've noticed.  (This is actually non-trivial, if you
> > want to install perl on Linux without having to have bash around.)
> 
> I'd prefer a different fix.  I think it is better to parse each command
> substitution lexically and if it consists of a single redirection to stdin
> than behave as $(< file) behaves now.  This is really preferrable since $(<
> file command) should execute the given command.  That's the ksh behaviour
> and that's what required by POSIX.  I'll try to write a patch for that.

I made the patch below.  It really makes the code cleaner but unfortunately
the change is not trivial because it removes pushheap()/popheap() from
parse_string().  So far parse_string() used pushheap() before starting the
parser and it did not pop the heap if the parsing was successful.  Of
course this increases the possibility of a forgotten popheap() and indeed
I've found that there was no popheap() after calling getshunc() which
called getfpfunc() which called parse_string().  So this only happened when
getshfunc used on an autoloaded function, e.g. when chpwd was autoloaded.
Of course this did not cause any noticable problem except that it was a
memory leak.

The change below would be more difficult without removing this heap stuff
because the parsed list must be preserved somehow after popheap (it would
not be much more difficult, just 2 more lines I think).

I did not test this patch, since I'd like to catch the last but home from
the university so it may be buggy.  Please test it.

Zoltan


*** Src/exec.c	1996/07/31 14:05:25	2.78
--- Src/exec.c	1996/08/01 20:59:39
***************
*** 48,61 ****
      lexsave();
      inpush(s, 0);
      strinbeg();
-     pushheap();
      stophist = 2;
      l = parse_list();
      strinend();
      inpop();
      lexrestore();
-     if (!l)
- 	popheap();
      return l;
  }
  
--- 48,58 ----
***************
*** 475,484 ****
  {
      List list;
  
!     if ((list = parse_string(s))) {
  	execlist(list, dont_change_job, exiting);
! 	popheap();
!     }
  }
  
  /* Main routine for executing a list.                                *
--- 472,481 ----
  {
      List list;
  
!     pushheap();
!     if ((list = parse_string(s)))
  	execlist(list, dont_change_job, exiting);
!     popheap();
  }
  
  /* Main routine for executing a list.                                *
***************
*** 1991,2033 ****
      List list;
      int pipes[2];
      pid_t pid;
  
!     if (*cmd == '<') {
! 	int stream, l;
! 	char *fi, *s;
! 
! 	for (cmd++; *cmd == ' '; cmd++);
! 	for (fi = s = cmd + strlen(cmd); s > cmd && s[-1] == ' '; s--);
! 	if (s > cmd && s < fi && (s[-1] == '\\' || s[-1] == Meta))
! 	    s++;
! 	l = s - cmd;
! 	fi = ncalloc(l + 1);
! 	strncpy(fi, cmd, l);
! 	fi[l] = '\0';
! 	if (parsestr(fi))
! 	    return NULL;
! 	if (*fi == '~')
! 	    *fi = Tilde;
! 	else if (*fi == '=')
! 	    *fi = Equals;
! 	singsub(&fi);
  	if (errflag)
  	    return NULL;
! 	stream = open(unmeta(fi), O_RDONLY);
! 	if (stream == -1) {
! 	    zerr("%e: %s", fi, errno);
! 	    return NULL;
! 	}
  	return readoutput(stream, qt);
      }
!     if (!(list = parse_string(cmd)))
! 	return NULL;
      mpipe(pipes);
      child_block();
      cmdoutval = 0;
      if ((cmdoutpid = pid = zfork()) == -1) {
  	/* fork error */
- 	popheap();
  	zclose(pipes[0]);
  	zclose(pipes[1]);
  	errflag = 1;
--- 1988,2021 ----
      List list;
      int pipes[2];
      pid_t pid;
+     Cmd c;
+     Redir r;
  
!     if (!(list = parse_string(cmd)))
! 	return NULL;
!     if (list != &dummy_list && !list->right && !list->left->flags &&
! 	list->left->type == END && list->left->left->type == END &&
! 	(c = list->left->left->left)->type == SIMPLE && empty(c->args) &&
! 	empty(c->vars) && nonempty(c->redir) &&
! 	!nextnode(firstnode(c->redir)) &&
! 	(r = (Redir) getdata(firstnode(c->redir)))->fd1 == 0 &&
! 	r->type == READ) {
! 	/* $(< word) */
! 	int stream;
! 	char *s = r->name;
! 
! 	singsub(&s);
  	if (errflag)
  	    return NULL;
! 	stream = open(unmeta(s), O_RDONLY);
  	return readoutput(stream, qt);
      }
! 
      mpipe(pipes);
      child_block();
      cmdoutval = 0;
      if ((cmdoutpid = pid = zfork()) == -1) {
  	/* fork error */
  	zclose(pipes[0]);
  	zclose(pipes[1]);
  	errflag = 1;
***************
*** 2037,2043 ****
      } else if (pid) {
  	LinkList retval;
  
- 	popheap();
  	zclose(pipes[1]);
  	retval = readoutput(pipes[0], qt);
  	fdtable[pipes[0]] = 0;
--- 2025,2030 ----
***************
*** 2159,2172 ****
  
      if (fd < 0 || (cmdoutpid = pid = zfork()) == -1) {
  	/* fork or open error */
- 	popheap();
  	child_unblock();
  	return nam;
      } else if (pid) {
  	int os;
  
  	close(fd);
- 	popheap();
  	os = jobtab[thisjob].stat;
  	waitforpid(pid);
  	cmdoutval = 0;
--- 2146,2157 ----
***************
*** 2248,2254 ****
  	zclose(pipes[out]);
  	fdtable[pipes[!out]] = 2;
  #endif
- 	popheap();
  	return pnam;
      }
  #ifndef HAVE_DEV_FD
--- 2233,2238 ----
***************
*** 2285,2291 ****
  	return -1;
      mpipe(pipes);
      if (zfork()) {
- 	popheap();
  	zclose(pipes[out]);
  	return pipes[!out];
      }
--- 2269,2274 ----
***************
*** 2412,2418 ****
  	    shf->flags &= ~PM_UNDEFINED;
  	    funcdef = shf->funcdef = (List) dupstruct(funcdef);
  	} LASTALLOC;
- 	popheap();
  
  	/* Execute the function definition, we just retrived */
  	doshfunc(shf->funcdef, cmd->args, shf->flags, 0);
--- 2395,2400 ----
*** Src/builtin.c	1996/07/31 15:45:25	2.71
--- Src/builtin.c	1996/08/01 20:24:46
***************
*** 5501,5508 ****
  	if (settrap(sig, t))
  	    freestruct(t);
      }
-     if (l)
- 	popheap();
      return *argv != NULL;
  }
  
--- 5501,5506 ----


^ permalink raw reply	[relevance 0%]

* Re: Procmail rejects zsh as being "broken"
  @ 1996-08-02  1:20  7% ` Stephen R. van den Berg
  0 siblings, 0 replies; 200+ results
From: Stephen R. van den Berg @ 1996-08-02  1:20 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

Zefram <A.Main@dcs.warwick.ac.uk> wrote:
>I always set SHELL to /bin/sh explicitly in Makefiles.  GNU standards
>recommend this too.  This is really an example of the now deeply

Well, it's not that easy.
For a real POSIX environment, you could simply omit setting SHELL, since
the make utility will *always* set it to a /bin/sh compatible shell.

For non-posix environments, it gets a bit tricky.  Some makes set it,
some don't, some makes export the SHELL assignment to the environment,
some don't.  Then there is the possibility that the /bin/sh is a buggy
implementation with way too many bugs (some vendors delivered this
with their system).  So the users typically went and got themselves
a different shell (like pdksh, bash, zsh, whatever).  Now, if the
user is using that as his loginshell, and the shell is Bourne shell
compatible, then we'll try to use that one first.

Which is exactly why I was bothering with the zsh (in case it was more
/bin/sh compatible than the original /bin/sh installed on the system; why
wouldn't they replace the /bin/sh with a link to zsh, well, lots of
reasons: he's not the sysadmin, company policy, etc.).

>>+	*[zc]sh*) echo "Warning: really perverted make detected"; SHELL="";;

>Wouldn't it be better to do the feature tests, ignoring the name in
>$SHELL?  Maybe some perverted admin has a copy of sh under the name
>zsh.

Feature tests are difficult to make comprehensive.

>  Or even better, just use /bin/sh, which is Bourne-compatible
>everywhere, rather than accepting whatever $SHELL happens to be.

Not such a good idea, see above.
-- 
Sincerely,                                                          srb@cuci.nl
           Stephen R. van den Berg (AKA BuGless).
Auto repair rates: basic labor $40/hour; if you wait, $60; if you watch, $80;
if you ask questions, $100; if you help, $120; if you laugh, $140.


^ permalink raw reply	[relevance 7%]

* Re: More Configure problems
  @ 1996-08-02 10:03  6% ` Andrej Borsenkow
  1996-08-02 13:29  0%   ` Zoltan Hidvegi
  0 siblings, 1 reply; 200+ results
From: Andrej Borsenkow @ 1996-08-02 10:03 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list

On Fri, 2 Aug 1996, Peter Stephenson wrote:

> 
> With this set of patches perl built OK with zsh linked to sh and
> passed all tests, the process including & -d, shell escapes, etc.  I
> couldn't rewire /bin/sh, but most shell scripts during the build are
> called with an explicit `sh', so this is quite a good test.
> 

I did link /bin/sh to zsh and ran pel 5.003 Configure; it was O.K.,
including & -d, makedepend and make ;-)

But small problem with command substitution anyway. The following:

% : `
bquote> cat > foo << eof
bquote> a
bquote> eof
bquote> `
>        <-- !!!

runs perfectly on my /bin/sh (and should according to POSIX :)) but not
under zsh. (Including last three patches to heredoc an $(< ...) fix). It
wants something after the last backtick. The same problem with $() form.
If the heredoc delimiter is quoted, it is O.K. 

% : `
bquote> cat > foo << \eof
bquote> a
bquote> eof
bquote> `
%

Again in `` or $() form.

The example is probably perverse; so it just FYI

greetings

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------



^ permalink raw reply	[relevance 6%]

* zsh-3.0-pre5 on Alliant Concentrix 2800
@ 1996-08-02 12:53  8% Louis Granboulan
  0 siblings, 0 replies; 200+ results
From: Louis Granboulan @ 1996-08-02 12:53 UTC (permalink / raw)
  To: zsh-workers

I built zsh-3.0-pre5 on an architecture not listed in Etc/MACHINES.

The machine is an   Alliant Concentrix 2800 3.0.00  known by configure
as   i860-alliant-bsd   .

I have gcc version 2.1
I did `./configure' and then `make'. It didn't work immediatly.
Here is what I did to make it work.

signals.c:465: `WNOHANG' and `WUNTRACED' undeclared
	Diagnostic:
	  HAVE_SYS_WAIT_H was undefined by ./configure, since sys/wait.h
	  is not POSIX.1 compatible.
	  But it is POSIX.1 compatible when _POSIX_SOURCE is defined.
	Solution:
	  This patch:
		*** configure.orig Sat Jul 20 19:07:14 1996
		--- configure   Fri Aug  2 14:43:19 1996
		***************
		*** 1672,1673 ****
		--- 1672,1674 ----
		  #include "confdefs.h"
		+ #define _POSIX_SOURCE
		  #include <sys/types.h>
		*** Src/system.h.orig      Mon Jul  1 20:20:44 1996
		--- Src/system.h        Fri Aug  2 14:50:08 1996
		***************
		*** 180,182 ****
		--- 180,184 ----
		  #ifdef HAVE_SYS_WAIT_H
		+ # define _POSIX_SOURCE
		  # include <sys/wait.h>
		+ # undef _POSIX_SOURCE
		  #else
	Diagnostic:
	  waitpid does not work
	Solution:
	  #undef HAVE_WAITPID /* in config.h */
zle_main.c:109: `ONLCR' undeclared
	Diagnostic:
	  Not defined in sys/termios.h (probably POSIX compliance)
	Solution:
	  #define ONLCR 0x00000004 /* in zle_main.c */
ld:  undefined symbols: __strlen __strcpy __strncpy
	Diagnostic:
	  Might be a bug in the libc of gcc
	Solution:
	  Compiling and linking this file : strings.c
		int _strlen(s) char *s;
		  {return strlen(s);}
		char *_strcpy(s1,s2) char *s1,*s2;
		  {return strcpy(s1,s2); }
		char *_strncpy(s1,s2,n) char *s1,*s2; int n;
		  {return strncpy(s1,s2,n);}


^ permalink raw reply	[relevance 8%]

* Re: More Configure problems
  1996-08-02 10:03  6% ` Andrej Borsenkow
@ 1996-08-02 13:29  0%   ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-08-02 13:29 UTC (permalink / raw)
  To: borsenkow.msk; +Cc: pws, zsh-workers

> But small problem with command substitution anyway. The following:
> 
> % : `
> bquote> cat > foo << eof
> bquote> a
> bquote> eof
> bquote> `
> >        <-- !!!
> 
> runs perfectly on my /bin/sh (and should according to POSIX :)) but not
> under zsh. (Including last three patches to heredoc an $(< ...) fix). It
> wants something after the last backtick. The same problem with $() form.
> If the heredoc delimiter is quoted, it is O.K. 
> 
> % : `
> bquote> cat > foo << \eof
> bquote> a
> bquote> eof
> bquote> `
> %
> 
> Again in `` or $() form.

Yes, it is a problem, and I think it may cause problems in other
circumstances as well.  The patch below fixes that.  This bug is really
fixed by the hist.c patch below but it also contains a lex.c fix because I
first thought that the problem is there.

Zoltan


*** Src/hist.c	1996/07/21 00:05:50	2.22
--- Src/hist.c	1996/08/02 13:07:29
***************
*** 567,573 ****
  void
  strinbeg(void)
  {
!     strin = 1;
      hbegin();
      lexinit();
  }
--- 567,573 ----
  void
  strinbeg(void)
  {
!     strin++;
      hbegin();
      lexinit();
  }
***************
*** 579,585 ****
  strinend(void)
  {
      hend();
!     strin = 0;
      isfirstch = 1;
      histdone = 0;
  }
--- 579,586 ----
  strinend(void)
  {
      hend();
!     DPUTS(!strin, "BUG: strinend() called without strinbeg()");
!     strin--;
      isfirstch = 1;
      histdone = 0;
  }
*** Src/lex.c	1996/08/01 17:56:17	2.41
--- Src/lex.c	1996/08/02 13:16:25
***************
*** 65,70 ****
--- 65,71 ----
      int chwordlen;
      int chwordpos;
      int hwgetword;
+     int lexstop;
      struct heredocs *hdocs;
  
      unsigned char *cstack;
***************
*** 117,122 ****
--- 118,124 ----
      ls->chwordlen = chwordlen;
      ls->chwordpos = chwordpos;
      ls->hwgetword = hwgetword;
+     ls->lexstop = lexstop;
      ls->hdocs = hdocs;
      cmdsp = 0;
      inredir = 0;
***************
*** 162,171 ****
      chwordlen = lstack->chwordlen;
      chwordpos = lstack->chwordpos;
      hwgetword = lstack->hwgetword;
      hdocs = lstack->hdocs;
      clearalstack();
      hlinesz = lstack->hlinesz;
!     lexstop = errflag = 0;
  
      ln = lstack->next;
      free(lstack);
--- 164,174 ----
      chwordlen = lstack->chwordlen;
      chwordpos = lstack->chwordpos;
      hwgetword = lstack->hwgetword;
+     lexstop = lstack->lexstop;
      hdocs = lstack->hdocs;
      clearalstack();
      hlinesz = lstack->hlinesz;
!     errflag = 0;
  
      ln = lstack->next;
      free(lstack);
***************
*** 370,375 ****
--- 373,380 ----
    beginning:
      tokstr = NULL;
      while (iblank(c = hgetc()) && !lexstop);
+     if (lexstop)
+ 	return (errflag) ? LEXERR : ENDINPUT;
      isfirstln = 0;
      wordbeg = inbufct - (qbang && c == bangchar);
      hwbegin(-1);		/* word includes the last character read */
***************
*** 390,400 ****
  	return DOUTPAR;
      } else if (idigit(c)) {	/* handle 1< foo */
  	d = hgetc();
- 	hungetc(d);
- 	lexstop = 0;
  	if (d == '>' || d == '<') {
  	    peekfd = c - '0';
! 	    c = hgetc();
  	}
      }
  
--- 395,406 ----
  	return DOUTPAR;
      } else if (idigit(c)) {	/* handle 1< foo */
  	d = hgetc();
  	if (d == '>' || d == '<') {
  	    peekfd = c - '0';
! 	    c = d;
! 	} else {
! 	    hungetc(d);
! 	    lexstop = 0;
  	}
      }
  
***************
*** 423,430 ****
  	}
  	return peek;
      }
-     if (lexstop)
- 	return (errflag) ? LEXERR : ENDINPUT;
      switch (lexact1[STOUC(c)]) {
      case LX1_BKSLASH:
  	d = hgetc();
--- 429,434 ----


^ permalink raw reply	[relevance 0%]

* Patches since pre3 that are not in pre6
@ 1996-08-05  6:19  5% Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 1996-08-05  6:19 UTC (permalink / raw)
  To: zsh-workers

About a week ago I wrote that there appeared to be some patches from pre3
that didn't make it into pre4, but that I hadn't figured out which ones.
I finally had a chance to do so; most of the issues they addressed were
patched differently in pre5 or pre6, but a few are still completely missing
(all from me, as it turns out).

All the following patches are reversed diffs because they're changes made
to an older file that are missing from the newer file.  Use "patch -p1 -R".
All these patch hunks are very short, so I've interspersed commentary.

First is a simple change to the cvs compctl-example; it's not essential,
but it looks more consistent with the rest of the function.

--- zsh-3.0-pre3-work/Misc/compctl-examples	Mon Jul 15 10:46:51 1996
+++ zsh-3.0-pre4/Misc/compctl-examples	Sat Jul 27 08:52:55 1996
@@ -439,9 +439,8 @@
 	pref=
     fi
     [[ -n "$pref" && "$pref" != */ ]] && pref=$pref/
-    if [[ -f ${pref}CVS/Entries ]]
-    then
-	reply=( "${pref}${^${${(f@)$(<${pref}CVS/Entries)}#/}%%/*}"
+    if [[ -f "${pref}CVS/Entries" ]] then
+	reply=( "${pref}${^${${(f@)$(< ${pref}CVS/Entries)}#/}%%/*}"
 		${pref}*/**/CVS(:h) )
     else
 	reply=( ${pref}*/**/CVS(:h) )

Next is my change to ignore "insignificant" white space in case patterns,
approximately as per POSIX.  I don't *think* this was fixed in any other
way between pre4 and pre6; the ChangeLog doesn't mention it.

--- zsh-3.0-pre3-work/Src/lex.c	Mon Jul 22 14:38:56 1996
+++ zsh-3.0-pre4/Src/lex.c	Sat Jul 27 08:52:56 1996
@@ -638,10 +635,6 @@
 	if (inblank(c) && !in_brace_param && !pct)
 	    act = LX2_BREAK;
 	else {
-	    if (incasepat && pct == 1 && !in_brace_param && iblank(c)) {
-		c = hgetc();
-		continue;
-	    }
 	    act = lexact2[STOUC(c)];
 	    c = lextok2[STOUC(c)];
 	}

Finally, there's this little tweak to avoid wandering off the end of a
string during subsitution if the string happens not to contain 'endchar'
anywhere.  The current code will spit out a warning message upon crossing
the string terminator when DEBUG is defined, but otherwise it silently
goes off into never-never land.  Maybe this is an "impossible" condition,
but if we're going to bother producing a debug message, shouldn't we also
avoid creating the wild pointer?

--- zsh-3.0-pre3-work/Src/subst.c	Fri Jul 19 13:05:37 1996
+++ zsh-3.0-pre4/Src/subst.c	Sat Jul 27 08:52:56 1996
@@ -137,9 +137,8 @@
 		endchar = *str;
 		*str = '\0';
 
-		while (*++str && *str != endchar)
-		    ;
-		DPUTS(!*str, "Oops. parse error in command substitution");
+		while (*++str != endchar)
+		    DPUTS(!*str, "Oops. parse error in command substitution");
 	    }
 	    *str++ = '\0';
 	    if (endchar == Outpar && str2[1] == '(' && str[-2] == ')') {

Again, these are reversed diffs, so the interesting lines are the ones with
the '-' prefix.

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"


^ permalink raw reply	[relevance 5%]

* Rewrite of Functions/run-help
@ 1996-08-05  8:18  5% Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 1996-08-05  8:18 UTC (permalink / raw)
  To: zsh-workers

Now that the help subdirectory isn't distributed with zsh any longer, the
Functions/run-help autoloadable function isn't very useful.  Here's a new
version that uses `whence' to figure out the best way to run `man' (which
may mean not running it at all).  It also happens to demonstrate "emulate"
plus the new POSIX case-statement syntax combined with zsh glob patterns
containing significant whitespace. ;->

----- snip ----- 8< ----- snip -----
#!/usr/local/bin/zsh
#
# Figure out where to get the best help, and get it.
#
# Install this function by placing it in your FPATH and then
# adding to your .zshrc the lines:
#	unalias run-help
#	autoload run-help
#
# Bart Schaefer <schaefer@brasslantern.com>
#
emulate -R zsh				# Requires zsh 3.0-pre5 or later
setopt localoptions
local what places
integer i=0

places=( "${(@f)$(builtin whence -va $1)}" )

while ((i++ < $#places))
do
    what=$places[$i]
    builtin print -r $what
    case $what in
    (*( is an alias)*)
	[[ ${what[(w)6]:t} != ${what[(w)1]} ]] && run-help ${what[(w)6]:t}
	;;
    (*( is a * function))
	builtin functions ${what[(w)1]} | ${=PAGER:-more}
	;;
    (*( is a * builtin))
	case ${what[(w)1]} in
	(compctl) man zshcompctl;;
	(bindkey) man zshzle;;
	(*setopt) man zshoptions;;
	(*) man zshbuiltins;;
	esac
	;;
    (*)
	man $1
	;;
    esac
    if ((i < $#places))
    then
	builtin print -nP "%SPress return for more help%s"
	builtin read -q what
    fi
done
----- snip ----- 8< ----- snip -----

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"


^ permalink raw reply	[relevance 5%]

* sh compatibility again :->
  1996-07-31 21:11  4% Announcement draft Zoltan Hidvegi
  1996-08-01  6:36  6% ` Bas V. de Bakker
@ 1996-08-08 15:13  6% ` Andrej Borsenkow
  1996-08-12  2:18  0%   ` Zoltan Hidvegi
  1 sibling, 1 reply; 200+ results
From: Andrej Borsenkow @ 1996-08-08 15:13 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: Zsh workers list

On Wed, 31 Jul 1996, Zoltan Hidvegi wrote:

> 
> Zsh can emulate the POSIX shell and the Korn shell quite well when it is
> invoked as sh or ksh respectively.  /bin/sh can be safely linked to zsh.
>                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I wouldn't put it in. I dared to link zsh to /bin/sh and reboot the
system. It did come up - without /proc, /dev/fd and network ;-<

Here are some points, where zsh choked.

1. It doesn't like malformed constructs like

A="`cat /some/file"    (note missed backtick)

zsh tries to parse command substitution behind closing double-quote, and
ends up with `missing "' at the end of script. Our /bin/sh stops at
closing double-quote. In POSIX the result is undefined - thus, techically
neither violate it. 

2. Our /bin/sh silently ignores break's in case statement (I mean it; it
doesn't break out of case). zsh loudly complaints (well, it is rather
cosmetic).

3. The last bit, when I stopped this experiment. Our sh starts complex
command with redirections in subshell; that is

while read;
do
....
done < /some/file

is evaluated in subshell. The problem is, that some scripts use EXIT!!
rather than break to such loop. Well, I could do nothing against it.


These are just FYI; in no way would I suggest to mimic every historical
(broken?) sh; but it still means, that it is *not* safe to link /bin/sh to
zsh on *every* system. Probably, statement about POSIX conformance is
enough?

But the following things could probably be fixed 

4. Traditional /bin/sh interprets `set -' as set +xv. It could be well
undocumented (it is not on our system) but still is so. Could anybody test
it on more than one systems? zsh silently sets positional parameters to
null. At least on our system many startup scripts include 

set -$DEBUG

at the script start (intent is to set DEBUG=x somewhere in /etc/rc2 to see
what's going on). Under zsh, script just loses its arguments and ends up
with error (it is SVR4 startup scripts are called with
/bin/sh /etc/rc2.d/S*something start
if `start' is not there, script just exits). 

5. Currently zsh sets BSD_ECHO when running as sh. Our sh does support
escapes in echo; I recall that SCO sh does it as well. I don't know about
others. What about relaxing it? If scripts doesn't rely upon escapes in
echo, it would make no harm.


Sorry for long mail. Actually (apart from echo) I found *no* problems,
caused by zsh; so it is more our /bin/sh to blame ;)

greetings

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------



^ permalink raw reply	[relevance 6%]

* Re: sh compatibility again :->
  1996-08-08 15:13  6% ` sh compatibility again :-> Andrej Borsenkow
@ 1996-08-12  2:18  0%   ` Zoltan Hidvegi
  1996-08-12  4:36  5%     ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1996-08-12  2:18 UTC (permalink / raw)
  To: borsenkow.msk; +Cc: zsh-workers

Andrej Borsenkow wrote:
[...]
> 1. It doesn't like malformed constructs like
> 
> A="`cat /some/file"    (note missed backtick)
> 
> zsh tries to parse command substitution behind closing double-quote, and
> ends up with `missing "' at the end of script. Our /bin/sh stops at
> closing double-quote. In POSIX the result is undefined - thus, techically
> neither violate it. 

I copied the behaviour of bash here.  pdksh also behaves this way.

> But the following things could probably be fixed 
> 
> 4. Traditional /bin/sh interprets `set -' as set +xv. It could be well
> undocumented (it is not on our system) but still is so. Could anybody test
> it on more than one systems? zsh silently sets positional parameters to
> null. At least on our system many startup scripts include 
> 
> set -$DEBUG
> 
> at the script start (intent is to set DEBUG=x somewhere in /etc/rc2 to see
> what's going on). Under zsh, script just loses its arguments and ends up
> with error (it is SVR4 startup scripts are called with
> /bin/sh /etc/rc2.d/S*something start
> if `start' is not there, script just exits). 

OK.  I've changed that.  set - will be the same as set +xv and
set - args will be the same as set +xv -- args.  This will not be
documented since it is just an obsolecent compatibility feature and
noone should use that.

> 5. Currently zsh sets BSD_ECHO when running as sh. Our sh does support
> escapes in echo; I recall that SCO sh does it as well. I don't know about
> others. What about relaxing it? If scripts doesn't rely upon escapes in
> echo, it would make no harm.

I'll try to write a configure check for the echo style of /bin/sh and use
that.

Zoltan


^ permalink raw reply	[relevance 0%]

* Re: sh compatibility again :->
  1996-08-12  2:18  0%   ` Zoltan Hidvegi
@ 1996-08-12  4:36  5%     ` Bart Schaefer
  1996-08-12  5:00  6%       ` Zefram
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 1996-08-12  4:36 UTC (permalink / raw)
  To: Zoltan Hidvegi, borsenkow.msk, zsh-workers

On Aug 12,  4:18am, Zoltan Hidvegi wrote:
} Subject: Re: sh compatibility again :->
}
} Andrej Borsenkow wrote:
} [...]
} > 1. It doesn't like malformed constructs like
} > 
} > A="`cat /some/file"    (note missed backtick)
} > 
} > zsh tries to parse command substitution behind closing double-quote, and
} > ends up with `missing "' at the end of script. Our /bin/sh stops at
} > closing double-quote. In POSIX the result is undefined - thus, techically
} > neither violate it. 
} 
} I copied the behaviour of bash here.  pdksh also behaves this way.

Right; if I recall correctly, bash and ksh both permit stuff like:

$ echo "foo `echo "bar baz"` boing"

That is, bash and ksh nest double quotes inside backticks.  Old-fashioned
Bourne shell, on the other hand, does NOT permit nesting of double quotes,
even inside backticks.  So in bash/ksh the above is parsed as

	(echo) (foo `echo "bar baz"` boing)

but in sh it is

	(echo) (foo `echo bar) (baz` boing)

The only way to resolve this would be with yet another option, SH_QUOTES
or some such.  Worth it?  Dunno.

} > But the following things could probably be fixed 
} > 
} > 4. Traditional /bin/sh interprets `set -' as set +xv.
} 
} OK.  I've changed that.  set - will be the same as set +xv and
} set - args will be the same as set +xv -- args.

Hmm.  So what's the approved way of setting $1 to "-x"?  `set -- -x`?
And is `set --` equivalent to `shift $#`, since `set -` is not?

Are you sure `set - args` should act like `set +xv -- args`?

I can't say I'm entirely excited about this change.

} > 5. Currently zsh sets BSD_ECHO when running as sh. Our sh does support
} > escapes in echo; I recall that SCO sh does it as well. I don't know about
} > others. What about relaxing it? If scripts doesn't rely upon escapes in
} > echo, it would make no harm.
} 
} I'll try to write a configure check for the echo style of /bin/sh and use
} that.

Eww, no.  Let's pick one behavior and stick with it, please.  The default
options, even in an emulation mode, shouldn't vary from one installation
to the next!  It's been a long time since I encountered an sh that didn't
have a builtin SysV-style echo -- BSD_ECHO is needed mostly for csh
compatibility.  I'd vote for leaving BSD_ECHO off when run as "sh".

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"


^ permalink raw reply	[relevance 5%]

* Re: sh compatibility again :->
  1996-08-12  4:36  5%     ` Bart Schaefer
@ 1996-08-12  5:00  6%       ` Zefram
  1996-08-12  6:01  7%         ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Zefram @ 1996-08-12  5:00 UTC (permalink / raw)
  To: schaefer; +Cc: hzoli, borsenkow.msk, zsh-workers

>Right; if I recall correctly, bash and ksh both permit stuff like:
>
>$ echo "foo `echo "bar baz"` boing"
>
>That is, bash and ksh nest double quotes inside backticks.  Old-fashioned
>Bourne shell, on the other hand, does NOT permit nesting of double quotes,
>even inside backticks.
...
>The only way to resolve this would be with yet another option, SH_QUOTES
>or some such.  Worth it?  Dunno.

Not worth it.  POSIX leaves the behaviour undefined IIRC, and there's
no advantage in the traditional behaviour.

>} I'll try to write a configure check for the echo style of /bin/sh and use
>} that.
>
>Eww, no.  Let's pick one behavior and stick with it, please.  The default
>options, even in an emulation mode, shouldn't vary from one installation
>to the next!  It's been a long time since I encountered an sh that didn't
>have a builtin SysV-style echo -- BSD_ECHO is needed mostly for csh
>compatibility.  I'd vote for leaving BSD_ECHO off when run as "sh".

I also recommend against a configure check, but for a different reason:
some widespread shs (notably SunOS and Solaris) vary their echo
behaviour depending on $PATH, trying to emulate what would happen if
echo weren't a builtin.  It's really quite difficult to reliably detect
this behaviour.  I suggest that the behaviour should remain as it is.

-zefram


^ permalink raw reply	[relevance 6%]

* Re: sh compatibility again :->
  1996-08-12  5:00  6%       ` Zefram
@ 1996-08-12  6:01  7%         ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 1996-08-12  6:01 UTC (permalink / raw)
  To: Zefram, zsh-workers; +Cc: hzoli

On Aug 12,  6:00am, Zefram wrote:
} Subject: Re: sh compatibility again :->
}
} >The only way to resolve this would be with yet another option, SH_QUOTES
} >or some such.  Worth it?  Dunno.
} 
} Not worth it.  POSIX leaves the behaviour undefined IIRC, and there's
} no advantage in the traditional behaviour.

You're right about POSIX, but since it makes a pretty radical difference
to the parse of a script containing unbalanced backticks, the advantage
to the traditional behavior is to be able to execute traditional scripts.
We can decide that's not very important, but it is something.

BTW:  Zoltan:  Welcome back. ;-)

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern

New male in /home/schaefer:
>N  2 Justin William Schaefer  Sat May 11 03:43  53/4040  "Happy Birthday"


^ permalink raw reply	[relevance 7%]

* Re: History list fix
  @ 1996-08-13 23:08  5% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-08-13 23:08 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hacking and development

> By the way, there's another fix of mine for a traditional bug, namely
> the bogus `permission denied' error when trying to execute a
> non-existent programme with an unreadable directory somewhere in the
> path, which seems to have gone missing.

I did not find it.  I think I accidently deleted it because I thought that
I already merged it.  Cound you send it again to me?

An other question, is your fc fix work without the previous HISTIGNOREDUPS
patch?  I'd like to release 3.0.0 today or at least tomorrow (it's
Wednesday 1 am) and I'd like to add bugfixes only and perhaps some POSIX
compatibility patches.  3.0-pre6 seems to be quite bug-free (but it's just
because everyone is on holiday :-)).  The slow refresh on NeXT may be a
problem but I have absolutely no idea what can cause that.  It seems to be
an OS problem since the whole prompt is printed with one fwrite command.
Other than that I've found only one serious problem that zsh did not save
the history correctly on timeout, and dumped core when all memory debugging
was enabled but it was easy to fix (that bug was there befere 2.5 I think).

There is an other refresh bug which I reported a few months ago that in an
xterm when I type a multiline command like

% for i in *
do
done

and later bring it back from the history using up-line-or-history and
copy/paste the do/done lines, the result is do<spaces>done instead of
do<newline>done.

On Friday I'll go for an other one-week holiday :-).

Zoltan


^ permalink raw reply	[relevance 5%]

* POSIX builtins
@ 1996-08-14  1:17 10% Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-08-14  1:17 UTC (permalink / raw)
  To: Zsh hacking and development

The patch below adds a new POSIX_BUILTINS option.  Please test it before I
put it into zsh-3.0.0.  The patch to the manual should tell everything
about this option.  This is turned on for both sh and ksh emulation mode
(bash, pdksh and ksh93 behave this way).

Zoltan

*** Doc/zsh.man	1996/07/26 20:53:40	2.9
--- Doc/zsh.man	1996/08/14 00:43:43
***************
*** 101,103 ****
--- 101,107 ----
  .IR zshzle (%manext%),
  .IR zshoptions (%manext%),
  .IR zshmisc (%manext%).
+ .PP
+ .sp
+ .IR "IEEE Standard for information Technology \- Portable Operating System Interface (POSIX) \- Part 2: Shell and Utilities" ,
+ IEEE Inc, 1993, ISBN 1-55937-255-9.
*** Doc/zsh.texi	1996/08/13 20:36:44	2.18
--- Doc/zsh.texi	1996/08/14 00:49:34
***************
*** 380,385 ****
--- 380,390 ----
  zshcompctl(1), zshexpn(1), zshparam(1), zshzle(1), zshoptions(1), 
  zshmisc(1)
  
+ @noindent
+ IEEE Standard for information Technology -- Portable Operating System
+ Interface (POSIX) -- Part 2: Shell and Utilities, IEEE Inc, 1993, ISBN
+ 1-55937-255-9.
+ 
  
  @node Invocation, Startup/Shutdown Files, Introduction, Top
  @chapter Invocation
***************
*** 2435,2449 ****
  @code{ksh}:  @code{NO_BAD_PATTERN}, @code{NO_BANG_HIST}, @code{NO_EQUALS},
  @code{NO_FUNCTION_ARGZERO}, @code{GLOB_SUBST}, @code{NO_HUP}, 
  @code{INTERACTIVE_COMMENTS}, @code{KSH_ARRAYS}, @code{NO_MULTIOS}, 
! @code{NO_NOMATCH}, @code{RM_STAR_SILENT}, @code{SH_FILE_EXPANSION},  
! @code{SH_GLOB},  @code{SH_OPTION_LETTERS}, @code{SH_WORD_SPLIT}.
! Additionally the @code{KSH_OPTION_PRINT}, @code{LOCAL_OPTIONS},
! @code{PROMPT_SUBST} and @code{SINGLE_LINE_ZLE} options are set if
! @code{zsh} is invoked as @code{ksh} and the @code{IGNORE_BRACES} option
! is set if @code{zsh} is invoked as @code{sh}.  If the @code{echo}
! command called from @code{/bin/sh} does not interpret backslash escape
! sequences, the @code{BSD_ECHO} option is also set in @code{sh} emulation
! mode.
  
  
  @node Zsh Line Editor, Parameters, Compatibility, Top
--- 2440,2454 ----
  @code{ksh}:  @code{NO_BAD_PATTERN}, @code{NO_BANG_HIST}, @code{NO_EQUALS},
  @code{NO_FUNCTION_ARGZERO}, @code{GLOB_SUBST}, @code{NO_HUP}, 
  @code{INTERACTIVE_COMMENTS}, @code{KSH_ARRAYS}, @code{NO_MULTIOS}, 
! @code{NO_NOMATCH}, @code{RM_STAR_SILENT}, @code{POSIX_BUILTINS},
! @code{SH_FILE_EXPANSION}, @code{SH_GLOB}, @code{SH_OPTION_LETTERS},
! @code{SH_WORD_SPLIT}.  Additionally the @code{KSH_OPTION_PRINT},
! @code{LOCAL_OPTIONS}, @code{PROMPT_SUBST} and @code{SINGLE_LINE_ZLE}
! options are set if @code{zsh} is invoked as @code{ksh} and the
! @code{IGNORE_BRACES} option is set if @code{zsh} is invoked as @code{sh}.
! If the @code{echo} command called from @code{/bin/sh} does not interpret
! backslash escape sequences, the @code{BSD_ECHO} option is also set in
! @code{sh} emulation mode.
  
  
  @node Zsh Line Editor, Parameters, Compatibility, Top
***************
*** 5006,5011 ****
--- 5011,5027 ----
  This applies to the @code{.} builtin as well as to command execution.
  Commands explicitly beginning with
  @samp{./} or @samp{../} are not subject to path search.
+ 
+ @item POSIX_BUILTINS
+ @pindex POSIX_BUILTINS
+ When this option is set the @code{command} builtin can be used to execute
+ shell builtin commands.  Parameter assignments specified before shell
+ functions and special builtins are kept after the command completes unless
+ the special builtin is prefixed with the @code{command} builtin.  Special
+ builtins are @code{.}, @code{:}, @code{break}, @code{continue},
+ @code{declare}, @code{eval}, @code{exit}, @code{export}, @code{integer},
+ @code{local}, @code{readonly}, @code{return}, @code{set}, @code{shift},
+ @code{source}, @code{times}, @code{trap} and @code{unset}.
  
  @item PRINT_EXIT_VALUE (-1)
  @cindex exit status, printing
*** Doc/zshall.man	1996/07/21 00:05:50	2.8
--- Doc/zshall.man	1996/08/14 00:44:51
***************
*** 96,98 ****
--- 96,102 ----
  .IR rc (1),
  .IR bash (1),
  .IR ksh (1).
+ .PP
+ .sp
+ .IR "IEEE Standard for information Technology \- Portable Operating System Interface (POSIX) \- Part 2: Shell and Utilities" ,
+ IEEE Inc, 1993, ISBN 1-55937-255-9.
*** Doc/zshmisc.man	1996/08/12 03:53:13	2.20
--- Doc/zshmisc.man	1996/08/14 00:22:13
***************
*** 1095,1100 ****
--- 1095,1101 ----
  .BR NO_MULTIOS ,
  .BR NO_NOMATCH ,
  .BR RM_STAR_SILENT ,
+ .BR POSIX_BUILTINS ,
  .BR SH_FILE_EXPANSION ,
  .BR SH_GLOB ,
  .BR SH_OPTION_LETTERS ,
*** Doc/zshoptions.man	1996/07/28 22:34:08	2.20
--- Doc/zshoptions.man	1996/08/14 00:32:41
***************
*** 387,392 ****
--- 387,417 ----
  Commands explicitly beginning with "./" or "../" are not subject to
  path search.
  .TP
+ \fBPOSIX_BUILTINS\fP
+ When this option is set the \fBcommand\fP builtin can be used to execute
+ shell builtin commands.  Parameter assignments specified before shell
+ functions and special builtins are kept after the command completes unless
+ the special builtin is prefixed with the \fBcommand\fP builtin.  Special
+ builtins are
+ .BR. ,
+ .BR : ,
+ .BR break ,
+ .BR continue ,
+ .BR declare ,
+ .BR eval ,
+ .BR exit ,
+ .BR export ,
+ .BR integer ,
+ .BR local ,
+ .BR readonly ,
+ .BR return ,
+ .BR set ,
+ .BR shift ,
+ .BR source ,
+ .BR times ,
+ .BR trap " and"
+ .BR unset .
+ .TP
  \fBPRINT_EXIT_VALUE\fP (\-\fB1\fP)
  Print the exit value of programs with non-zero exit status.
  .TP
*** Src/exec.c	1996/08/11 19:20:39	2.81
--- Src/exec.c	1996/08/14 01:10:07
***************
*** 1171,1177 ****
  	    checked = !has_token(cmdarg);
  	    if (!checked)
  		break;
! 	    if (!(cflags & BINF_BUILTIN) &&
  		(hn = shfunctab->getnode(shfunctab, cmdarg))) {
  		is_shfunc = 1;
  		break;
--- 1171,1177 ----
  	    checked = !has_token(cmdarg);
  	    if (!checked)
  		break;
! 	    if (!(cflags & (BINF_BUILTIN | BINF_COMMAND)) &&
  		(hn = shfunctab->getnode(shfunctab, cmdarg))) {
  		is_shfunc = 1;
  		break;
***************
*** 1185,1196 ****
  		assign = (hn->flags & BINF_MAGICEQUALS);
  		break;
  	    }
! 	    cflags &= ~BINF_BUILTIN;
  	    cflags |= hn->flags;
  	    uremnode(args, firstnode(args));
  	    hn = NULL;
  	    checked = 0;
! 	    if (cflags & BINF_COMMAND)
  		break;
  	}
      }
--- 1185,1196 ----
  		assign = (hn->flags & BINF_MAGICEQUALS);
  		break;
  	    }
! 	    cflags &= ~BINF_BUILTIN & ~BINF_COMMAND;
  	    cflags |= hn->flags;
  	    uremnode(args, firstnode(args));
  	    hn = NULL;
  	    checked = 0;
! 	    if ((cflags & BINF_COMMAND) && unset(POSIXBUILTINS))
  		break;
  	}
      }
***************
*** 1257,1267 ****
  		}
  	    }
  
! 	    if (errflag || checked || (cflags & BINF_COMMAND))
  		break;
  
  	    cmdarg = (char *) peekfirst(args);
! 	    if (!(cflags & BINF_BUILTIN) &&
  		(hn = shfunctab->getnode(shfunctab, cmdarg))) {
  		is_shfunc = 1;
  		break;
--- 1257,1268 ----
  		}
  	    }
  
! 	    if (errflag || checked ||
! 		(unset(POSIXBUILTINS) && (cflags & BINF_COMMAND)))
  		break;
  
  	    cmdarg = (char *) peekfirst(args);
! 	    if (!(cflags & (BINF_BUILTIN | BINF_COMMAND)) &&
  		(hn = shfunctab->getnode(shfunctab, cmdarg))) {
  		is_shfunc = 1;
  		break;
***************
*** 1278,1284 ****
  		is_builtin = 1;
  		break;
  	    }
! 	    cflags &= ~BINF_BUILTIN;
  	    cflags |= hn->flags;
  	    uremnode(args, firstnode(args));
  	    hn = NULL;
--- 1279,1285 ----
  		is_builtin = 1;
  		break;
  	    }
! 	    cflags &= ~BINF_BUILTIN & ~BINF_COMMAND;
  	    cflags |= hn->flags;
  	    uremnode(args, firstnode(args));
  	    hn = NULL;
***************
*** 1601,1609 ****
  	    LinkList restorelist = 0, removelist = 0;
  	    /* builtin or shell function */
  
! 	    if (!forked && !assign)
  		save_params(cmd, &restorelist, &removelist);
! 	    
  	    if (cmd->vars) {
  		/* Export this if the command is a shell function,
  		 * but not if it's a builtin.
--- 1602,1613 ----
  	    LinkList restorelist = 0, removelist = 0;
  	    /* builtin or shell function */
  
! 	    if (!forked && ((cflags & BINF_COMMAND) ||
! 			    (unset(POSIXBUILTINS) && !assign) ||
! 			    (isset(POSIXBUILTINS) && !is_shfunc &&
! 			     !(hn->flags & BINF_PSPECIAL))))
  		save_params(cmd, &restorelist, &removelist);
! 
  	    if (cmd->vars) {
  		/* Export this if the command is a shell function,
  		 * but not if it's a builtin.
*** Src/globals.h	1996/08/12 03:52:50	2.38
--- Src/globals.h	1996/08/13 23:35:14
***************
*** 750,755 ****
--- 750,756 ----
      {"numericglobsort", 	0,    0,    0},
      {"overstrike", 		0,    0,    0},
      {"pathdirs", 		'Q',  0,    0},
+     {"posixbuiltins",		0,    0,    OPT_EMULATE|OPT_BOURNE},
      {"printexitvalue", 		'1',  0,    0},
      {"privileged", 		'p',  'p',  OPT_SPECIAL},
      {"promptcr", 		x'V', 0,    OPT_ALL},
*** Src/hashtable.h	1996/08/04 12:52:33	2.25
--- Src/hashtable.h	1996/08/13 23:30:51
***************
*** 249,267 ****
      PREFIX("exec", BINF_EXEC)
      PREFIX("noglob", BINF_NOGLOB)
      {NULL, "[", 0, bin_test, 0, -1, BIN_BRACKET, NULL, NULL},
!     {NULL, ".", 0, bin_dot, 1, -1, 0, NULL, NULL},
!     {NULL, ":", 0, bin_true, 0, -1, 0, NULL, NULL},
      {NULL, "alias", BINF_MAGICEQUALS, bin_alias, 0, -1, 0, "Lgmr", NULL},
      {NULL, "autoload", BINF_TYPEOPTS, bin_functions, 0, -1, 0, "t", "u"},
      {NULL, "bg", 0, bin_fg, 0, -1, BIN_BG, NULL, NULL},
      {NULL, "bindkey", 0, bin_bindkey, 0, -1, 0, "asvemdr", NULL},
!     {NULL, "break", 0, bin_break, 0, 1, BIN_BREAK, NULL, NULL},
      {NULL, "bye", 0, bin_break, 0, 1, BIN_EXIT, NULL, NULL},
      {NULL, "cd", 0, bin_cd, 0, 2, BIN_CD, NULL, NULL},
      {NULL, "chdir", 0, bin_cd, 0, 2, BIN_CD, NULL, NULL},
      {NULL, "compctl", 0, bin_compctl, 0, -1, 0, NULL, NULL},
!     {NULL, "continue", 0, bin_break, 0, 1, BIN_CONTINUE, NULL, NULL},
!     {NULL, "declare", BINF_TYPEOPTS | BINF_MAGICEQUALS, bin_typeset, 0, -1, 0, "LRUZfilrtux", NULL},
      {NULL, "dirs", 0, bin_dirs, 0, -1, 0, "v", NULL},
      {NULL, "disable", 0, bin_enable, 0, -1, BIN_DISABLE, "afmr", NULL},
      {NULL, "disown", 0, bin_fg, 0, -1, BIN_DISOWN, NULL, NULL},
--- 249,267 ----
      PREFIX("exec", BINF_EXEC)
      PREFIX("noglob", BINF_NOGLOB)
      {NULL, "[", 0, bin_test, 0, -1, BIN_BRACKET, NULL, NULL},
!     {NULL, ".", BINF_PSPECIAL, bin_dot, 1, -1, 0, NULL, NULL},
!     {NULL, ":", BINF_PSPECIAL, bin_true, 0, -1, 0, NULL, NULL},
      {NULL, "alias", BINF_MAGICEQUALS, bin_alias, 0, -1, 0, "Lgmr", NULL},
      {NULL, "autoload", BINF_TYPEOPTS, bin_functions, 0, -1, 0, "t", "u"},
      {NULL, "bg", 0, bin_fg, 0, -1, BIN_BG, NULL, NULL},
      {NULL, "bindkey", 0, bin_bindkey, 0, -1, 0, "asvemdr", NULL},
!     {NULL, "break", BINF_PSPECIAL, bin_break, 0, 1, BIN_BREAK, NULL, NULL},
      {NULL, "bye", 0, bin_break, 0, 1, BIN_EXIT, NULL, NULL},
      {NULL, "cd", 0, bin_cd, 0, 2, BIN_CD, NULL, NULL},
      {NULL, "chdir", 0, bin_cd, 0, 2, BIN_CD, NULL, NULL},
      {NULL, "compctl", 0, bin_compctl, 0, -1, 0, NULL, NULL},
!     {NULL, "continue", BINF_PSPECIAL, bin_break, 0, 1, BIN_CONTINUE, NULL, NULL},
!     {NULL, "declare", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "LRUZfilrtux", NULL},
      {NULL, "dirs", 0, bin_dirs, 0, -1, 0, "v", NULL},
      {NULL, "disable", 0, bin_enable, 0, -1, BIN_DISABLE, "afmr", NULL},
      {NULL, "disown", 0, bin_fg, 0, -1, BIN_DISOWN, NULL, NULL},
***************
*** 269,277 ****
      {NULL, "echotc", 0, bin_echotc, 1, -1, 0, NULL, NULL},
      {NULL, "emulate", 0, bin_emulate, 1, 1, 0, "R", NULL},
      {NULL, "enable", 0, bin_enable, 0, -1, BIN_ENABLE, "afmr", NULL},
!     {NULL, "eval", 0, bin_eval, 0, -1, BIN_EVAL, NULL, NULL},
!     {NULL, "exit", 0, bin_break, 0, 1, BIN_EXIT, NULL, NULL},
!     {NULL, "export", BINF_TYPEOPTS | BINF_MAGICEQUALS, bin_typeset, 0, -1, BIN_EXPORT, "LRUZfilrtu", "x"},
      {NULL, "false", 0, bin_false, 0, -1, 0, NULL, NULL},
      {NULL, "fc", BINF_FCOPTS, bin_fc, 0, -1, BIN_FC, "nlreIRWAdDfEim", NULL},
      {NULL, "fg", 0, bin_fg, 0, -1, BIN_FG, NULL, NULL},
--- 269,277 ----
      {NULL, "echotc", 0, bin_echotc, 1, -1, 0, NULL, NULL},
      {NULL, "emulate", 0, bin_emulate, 1, 1, 0, "R", NULL},
      {NULL, "enable", 0, bin_enable, 0, -1, BIN_ENABLE, "afmr", NULL},
!     {NULL, "eval", BINF_PSPECIAL, bin_eval, 0, -1, BIN_EVAL, NULL, NULL},
!     {NULL, "exit", BINF_PSPECIAL, bin_break, 0, 1, BIN_EXIT, NULL, NULL},
!     {NULL, "export", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, BIN_EXPORT, "LRUZfilrtu", "x"},
      {NULL, "false", 0, bin_false, 0, -1, 0, NULL, NULL},
      {NULL, "fc", BINF_FCOPTS, bin_fc, 0, -1, BIN_FC, "nlreIRWAdDfEim", NULL},
      {NULL, "fg", 0, bin_fg, 0, -1, BIN_FG, NULL, NULL},
***************
*** 285,296 ****
  #endif
  
      {NULL, "history", 0, bin_fc, 0, -1, BIN_FC, "nrdDfEim", "l"},
!     {NULL, "integer", BINF_TYPEOPTS | BINF_MAGICEQUALS, bin_typeset, 0, -1, 0, "lrtux", "i"},
      {NULL, "jobs", 0, bin_fg, 0, -1, BIN_JOBS, "lpZrs", NULL},
      {NULL, "kill", 0, bin_kill, 0, -1, 0, NULL, NULL},
      {NULL, "let", 0, bin_let, 1, -1, 0, NULL, NULL},
      {NULL, "limit", 0, bin_limit, 0, -1, 0, "sh", NULL},
!     {NULL, "local", BINF_TYPEOPTS | BINF_MAGICEQUALS, bin_typeset, 0, -1, 0, "LRUZilrtu", NULL},
      {NULL, "log", 0, bin_log, 0, 0, 0, NULL, NULL},
      {NULL, "logout", 0, bin_break, 0, 1, BIN_LOGOUT, NULL, NULL},
  
--- 285,296 ----
  #endif
  
      {NULL, "history", 0, bin_fc, 0, -1, BIN_FC, "nrdDfEim", "l"},
!     {NULL, "integer", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "lrtux", "i"},
      {NULL, "jobs", 0, bin_fg, 0, -1, BIN_JOBS, "lpZrs", NULL},
      {NULL, "kill", 0, bin_kill, 0, -1, 0, NULL, NULL},
      {NULL, "let", 0, bin_let, 1, -1, 0, NULL, NULL},
      {NULL, "limit", 0, bin_limit, 0, -1, 0, "sh", NULL},
!     {NULL, "local", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "LRUZilrtu", NULL},
      {NULL, "log", 0, bin_log, 0, 0, 0, NULL, NULL},
      {NULL, "logout", 0, bin_break, 0, 1, BIN_LOGOUT, NULL, NULL},
  
***************
*** 305,333 ****
      {NULL, "pwd", 0, bin_pwd, 0, 0, 0, "r", NULL},
      {NULL, "r", BINF_R, bin_fc, 0, -1, BIN_FC, "nrl", NULL},
      {NULL, "read", 0, bin_read, 0, -1, 0, "rzu0123456789pkqecnAlE", NULL},
!     {NULL, "readonly", BINF_TYPEOPTS | BINF_MAGICEQUALS, bin_typeset, 0, -1, 0, "LRUZfiltux", "r"},
      {NULL, "rehash", 0, bin_hash, 0, 0, 0, "df", "r"},
!     {NULL, "return", 0, bin_break, 0, 1, BIN_RETURN, NULL, NULL},
      {NULL, "sched", 0, bin_sched, 0, -1, 0, NULL, NULL},
!     {NULL, "set", 0, bin_set, 0, -1, 0, NULL, NULL},
      {NULL, "setopt", 0, bin_setopt, 0, -1, BIN_SETOPT, NULL, NULL},
!     {NULL, "shift", 0, bin_shift, 0, -1, 0, NULL, NULL},
!     {NULL, "source", 0, bin_dot, 1, -1, 0, NULL, NULL},
      {NULL, "suspend", 0, bin_suspend, 0, 0, 0, "f", NULL},
      {NULL, "test", 0, bin_test, 0, -1, BIN_TEST, NULL, NULL},
      {NULL, "ttyctl", 0, bin_ttyctl, 0, 0, 0, "fu", NULL},
!     {NULL, "times", 0, bin_times, 0, 0, 0, NULL, NULL},
!     {NULL, "trap", 0, bin_trap, 0, -1, 0, NULL, NULL},
      {NULL, "true", 0, bin_true, 0, -1, 0, NULL, NULL},
      {NULL, "type", 0, bin_whence, 0, -1, 0, "ampf", "v"},
!     {NULL, "typeset", BINF_TYPEOPTS | BINF_MAGICEQUALS, bin_typeset, 0, -1, 0, "LRUZfilrtuxm", NULL},
      {NULL, "ulimit", 0, bin_ulimit, 0, -1, 0, NULL, NULL},
      {NULL, "umask", 0, bin_umask, 0, 1, 0, "S", NULL},
      {NULL, "unalias", 0, bin_unhash, 1, -1, 0, "m", "a"},
      {NULL, "unfunction", 0, bin_unhash, 1, -1, 0, "m", "f"},
      {NULL, "unhash", 0, bin_unhash, 1, -1, 0, "adfm", NULL},
      {NULL, "unlimit", 0, bin_unlimit, 0, -1, 0, "hs", NULL},
!     {NULL, "unset", 0, bin_unset, 1, -1, 0, "m", NULL},
      {NULL, "unsetopt", 0, bin_setopt, 0, -1, BIN_UNSETOPT, NULL, NULL},
      {NULL, "vared", 0, bin_vared, 1, 7, 0, NULL, NULL},
      {NULL, "wait", 0, bin_fg, 0, -1, BIN_WAIT, NULL, NULL},
--- 305,333 ----
      {NULL, "pwd", 0, bin_pwd, 0, 0, 0, "r", NULL},
      {NULL, "r", BINF_R, bin_fc, 0, -1, BIN_FC, "nrl", NULL},
      {NULL, "read", 0, bin_read, 0, -1, 0, "rzu0123456789pkqecnAlE", NULL},
!     {NULL, "readonly", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "LRUZfiltux", "r"},
      {NULL, "rehash", 0, bin_hash, 0, 0, 0, "df", "r"},
!     {NULL, "return", BINF_PSPECIAL, bin_break, 0, 1, BIN_RETURN, NULL, NULL},
      {NULL, "sched", 0, bin_sched, 0, -1, 0, NULL, NULL},
!     {NULL, "set", BINF_PSPECIAL, bin_set, 0, -1, 0, NULL, NULL},
      {NULL, "setopt", 0, bin_setopt, 0, -1, BIN_SETOPT, NULL, NULL},
!     {NULL, "shift", BINF_PSPECIAL, bin_shift, 0, -1, 0, NULL, NULL},
!     {NULL, "source", BINF_PSPECIAL, bin_dot, 1, -1, 0, NULL, NULL},
      {NULL, "suspend", 0, bin_suspend, 0, 0, 0, "f", NULL},
      {NULL, "test", 0, bin_test, 0, -1, BIN_TEST, NULL, NULL},
      {NULL, "ttyctl", 0, bin_ttyctl, 0, 0, 0, "fu", NULL},
!     {NULL, "times", BINF_PSPECIAL, bin_times, 0, 0, 0, NULL, NULL},
!     {NULL, "trap", BINF_PSPECIAL, bin_trap, 0, -1, 0, NULL, NULL},
      {NULL, "true", 0, bin_true, 0, -1, 0, NULL, NULL},
      {NULL, "type", 0, bin_whence, 0, -1, 0, "ampf", "v"},
!     {NULL, "typeset", BINF_TYPEOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "LRUZfilrtuxm", NULL},
      {NULL, "ulimit", 0, bin_ulimit, 0, -1, 0, NULL, NULL},
      {NULL, "umask", 0, bin_umask, 0, 1, 0, "S", NULL},
      {NULL, "unalias", 0, bin_unhash, 1, -1, 0, "m", "a"},
      {NULL, "unfunction", 0, bin_unhash, 1, -1, 0, "m", "f"},
      {NULL, "unhash", 0, bin_unhash, 1, -1, 0, "adfm", NULL},
      {NULL, "unlimit", 0, bin_unlimit, 0, -1, 0, "hs", NULL},
!     {NULL, "unset", BINF_PSPECIAL, bin_unset, 1, -1, 0, "m", NULL},
      {NULL, "unsetopt", 0, bin_setopt, 0, -1, BIN_UNSETOPT, NULL, NULL},
      {NULL, "vared", 0, bin_vared, 1, 7, 0, NULL, NULL},
      {NULL, "wait", 0, bin_fg, 0, -1, BIN_WAIT, NULL, NULL},
*** Src/zsh.h	1996/08/03 02:53:55	2.42
--- Src/zsh.h	1996/08/13 23:32:31
***************
*** 759,764 ****
--- 759,765 ----
  #define BINF_COMMAND		(1<<12)
  #define BINF_EXEC		(1<<13)
  #define BINF_NOGLOB		(1<<14)
+ #define BINF_PSPECIAL		(1<<15)
  
  #define BINF_TYPEOPTS   (BINF_TYPEOPT|BINF_PLUSOPTS)
  
***************
*** 1128,1133 ****
--- 1129,1135 ----
      NUMERICGLOBSORT,
      OVERSTRIKE,
      PATHDIRS,
+     POSIXBUILTINS,
      PRINTEXITVALUE,
      PRIVILEGED,
      PROMPTCR,


^ permalink raw reply	[relevance 10%]

* Re: BSD_ECHO
  @ 1996-08-15  0:32  5% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-08-15  0:32 UTC (permalink / raw)
  To: Richard Coleman; +Cc: zsh-workers

Richard wrote:
[...]
> > I still object to having a configure test for the default behavior of
> > BSD_ECHO when run as "sh".  This should NOT be something that varies
> > from one installation to the next!
[...]
> I completely agree...
> 
> The options for zsh when called as sh, should not depend on
> your current configuration.  It is especially bad for us sysadmins
> who work on heterogenous environments.... I don't want zsh working
> one way on one machine, and another way on another machine.

Seing the big opposition I'll remove that configure check.  However this
was not a completely unreasonable change.  I use zsh as /bin/sh on Linux
where the default /bin/sh is bash.  I bet that without BSD_ECHO some
scripts will break.

On the other hand someone else reported that on an other system zsh broke
some scripts because of BSD_ECHO.  It is possible to turn on BSD_ECHO iff
zsh is invoked as /bin/sh (with full pathname) and configure detected that
/bin/sh use BSD_ECHO but it would not be set by emulate or alternatively is
would be always set or unset by emulate.  On systems where zsh is installed
as /bin/sh the system administrator probably knows enough about how to set
the desired default and others won't be affected by this change.

I know that prefect solution is not possible.  Even POSIX did not dare to
define the default echo behaviour.  If one wants to write a portable script
it must begin with something like #! /usr/local/bin/zsh -f.  We have 7
different OS'es in an NFS/NIS network where zsh is very useful as portable
script language (and as a login shell of course).

Zoltan


^ permalink raw reply	[relevance 5%]

* Installing 3.0
@ 1996-08-31 18:00  4% Andrew D. Jones Jr
  0 siblings, 0 replies; 200+ results
From: Andrew D. Jones Jr @ 1996-08-31 18:00 UTC (permalink / raw)
  To: zsh-workers


Dear Zshell Workers,

As I mentioned before, zsh-2.6 works well for me. I cannot get 3.0 to  
install. You asked me for a list of error messages. Here is the whole story:



onyx2# cd /usr/local/zsh-3.0-pre3
onyx2# ./configure
creating cache ./config.cache
configuring for zsh 3.0-pre3
checking host system type... m68k-next-nextstep3
checking for gcc... no
checking for cc... cc
checking whether we are using GNU C... yes
checking how to run the C preprocessor... cc -E -traditional-cpp
checking whether cc needs -traditional... no
checking for working const... yes
checking whether cross-compiling... no
checking for cc option to accept ANSI C...
checking for function prototypes... yes
checking size of long... 4
checking if signed to unsigned casting is broken... no
checking whether make sets ${MAKE}... yes
checking for a BSD compatible install... /usr/bin/install -c
checking for mawk... no
checking for gawk... no
checking for nawk... no
checking for awk... awk
checking for dirent.h that defines DIR... no
checking for sys/ndir.h that defines DIR... no
checking for sys/dir.h that defines DIR... yes
checking for -lx... no
checking for ANSI C header files... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether stat file-mode macros are broken... no
checking for sys/wait.h that is POSIX.1 compatible... no
checking for sys/time.h... yes
checking for sys/times.h... yes
checking for sys/select.h... no
checking for termcap.h... no
checking for termio.h... no
checking for termios.h... yes
checking for sys/param.h... yes
checking for sys/filio.h... no
checking for string.h... yes
checking for memory.h... yes
checking for limits.h... yes
checking for fcntl.h... yes
checking for libc.h... yes
checking for sys/utsname.h... yes
checking for sys/resource.h... yes
checking for locale.h... yes
checking for errno.h... yes
checking for stdlib.h... yes
checking for unistd.h... yes
checking ut_host in struct utmp... yes
checking POSIX termios... no
checking TIOCGWINSZ in sys/ioctl.h... yes
checking for sys/ptem.h... no
checking for -ltermcap... yes
checking for getdomainname... yes
checking if an include file defines ospeed... no
checking if you must define ospeed... no
checking if tgetent accepts NULL... no
checking return type of signal handlers... void
checking for pid_t... no
checking for off_t... yes
checking for mode_t... no
checking for uid_t in sys/types.h... yes
checking for size_t... yes
checking for sigset_t... no
checking for struct timezone... yes
checking whether getpgrp takes no argument... no
checking for strftime... yes
checking for waitpid... no
checking for select... yes
checking for tcsetpgrp... no
checking for tcgetattr... no
checking for strstr... yes
checking for lstat... yes
checking for getlogin... yes
checking for setpgid... no
checking for gettimeofday... yes
checking for gethostname... yes
checking for mkfifo... no
checking for wait3... yes
checking for difftime... yes
checking for sigblock... yes
checking for sigsetmask... yes
checking for sigrelse... no
checking for sighold... no
checking for killpg... yes
checking for sigaction... no
checking for getrlimit... yes
checking for sigprocmask... no
checking for setuid... yes
checking for seteuid... yes
checking for setreuid... yes
checking for setresuid... no
checking for strerror... yes
checking for strcoll... yes
checking what style of signals to use... BSD_SIGNALS
checking where signal.h is located... /usr/include/bsd/sys/signal.h
checking for /dev/fd filesystem... no
checking for RFS superroot directory... no
checking for NIS... no
checking for NIS+... no
checking where utmp is located... /etc/utmp
checking where wtmp is located... /usr/adm/wtmp
checking if typeahead needs FIONREAD... no
checking for brk() prototype in <unistd.h>... no
checking for sbrk() prototype in <unistd.h>... no
updating cache ./config.cache
creating ./config.status
creating Makefile
creating Src/Makefile
creating Doc/Makefile
creating Etc/Makefile
creating Misc/Makefile
creating Util/Makefile
creating Functions/Makefile
creating StartupFiles/Makefile
creating config.h

zsh configuration
-----------------
zsh version           : 3.0-pre3
host operating system : nextstep3
source code location  : .
compiler              : cc
compiler flags        :  -Wall -Wno-implicit -Wmissing-prototypes -O2 -DDEBUG
binary install path   : /usr/local/bin
man page install path : /usr/local/man
info install path     : /usr/local/info


onyx2# make
No suffix list.
cd Src && make CC='cc' CPPFLAGS='' DEFS='-DHAVE_CONFIG_H'  CFLAGS='-Wall  
-Wno-implicit -Wmissing-prototypes -O2 -DDEBUG' LDFLAGS='' LIBS='-ltermcap'   
prefix='/usr/local' exec_prefix='/usr/local' bindir='/usr/local/bin'   
infodir='/usr/local/info' mandir='/usr/local/man' manext='1'
sed -n -f ./makepro.sed builtin.c > builtin.pro
sed -n -f ./makepro.sed compat.c > compat.pro
sed -n -f ./makepro.sed cond.c > cond.pro
sed -n -f ./makepro.sed exec.c > exec.pro
sed -n -f ./makepro.sed glob.c > glob.pro
sed -n -f ./makepro.sed hashtable.c > hashtable.pro
sed -n -f ./makepro.sed hist.c > hist.pro
sed -n -f ./makepro.sed init.c > init.pro
sed -n -f ./makepro.sed input.c > input.pro
sed -n -f ./makepro.sed jobs.c > jobs.pro
sed -n -f ./makepro.sed lex.c > lex.pro
sed -n -f ./makepro.sed linklist.c > linklist.pro
sed -n -f ./makepro.sed loop.c > loop.pro
sed -n -f ./makepro.sed math.c > math.pro
sed -n -f ./makepro.sed mem.c > mem.pro
sed -n -f ./makepro.sed params.c > params.pro
sed -n -f ./makepro.sed parse.c > parse.pro
sed -n -f ./makepro.sed signals.c > signals.pro
sed -n -f ./makepro.sed subst.c > subst.pro
sed -n -f ./makepro.sed text.c > text.pro
sed -n -f ./makepro.sed utils.c > utils.pro
sed -n -f ./makepro.sed watch.c > watch.pro
sed -n -f ./makepro.sed zle_bindings.c > zle_bindings.pro
sed -n -f ./makepro.sed zle_hist.c > zle_hist.pro
sed -n -f ./makepro.sed zle_main.c > zle_main.pro
sed -n -f ./makepro.sed zle_misc.c > zle_misc.pro
sed -n -f ./makepro.sed zle_move.c > zle_move.pro
sed -n -f ./makepro.sed zle_refresh.c > zle_refresh.pro
sed -n -f ./makepro.sed zle_tricky.c > zle_tricky.pro
sed -n -f ./makepro.sed zle_utils.c > zle_utils.pro
sed -n -f ./makepro.sed zle_vi.c > zle_vi.pro
sed -n -f ./makepro.sed zle_word.c > zle_word.pro
awk -f ./signames.awk /usr/include/bsd/sys/signal.h > signames.h
cc -c -I.. -I. -I.  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes  
-O2 -DDEBUG builtin.c
cc -c -I.. -I. -I.  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes  
-O2 -DDEBUG compat.c
cc -c -I.. -I. -I.  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes  
-O2 -DDEBUG cond.c
cc -c -I.. -I. -I.  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes  
-O2 -DDEBUG exec.c
cc -c -I.. -I. -I.  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes  
-O2 -DDEBUG glob.c
glob.c: In function `notstrcmp':
glob.c:614: warning: passing arg 2 of `strcoll' makes integer from pointer  
without a cast
glob.c:614: too few arguments to function `strcoll'
glob.c: In function `doesmatch':
glob.c:1738: warning: passing arg 2 of `strcoll' makes integer from pointer  
without a cast
glob.c:1738: too few arguments to function `strcoll'
glob.c:1739: warning: passing arg 2 of `strcoll' makes integer from pointer  
without a cast
glob.c:1739: too few arguments to function `strcoll'
glob.c:1766: warning: passing arg 2 of `strcoll' makes integer from pointer  
without a cast
glob.c:1766: too few arguments to function `strcoll'
glob.c:1767: warning: passing arg 2 of `strcoll' makes integer from pointer  
without a cast
glob.c:1767: too few arguments to function `strcoll'
*** Exit 1
Stop.
*** Exit 1
Stop.


onyx2# make install.bin
No suffix list.
cd Src && make CC='cc' CPPFLAGS='' DEFS='-DHAVE_CONFIG_H'  CFLAGS='-Wall  
-Wno-implicit -Wmissing-prototypes -O2 -DDEBUG' LDFLAGS='' LIBS='-ltermcap'   
prefix='/usr/local' exec_prefix='/usr/local' bindir='/usr/local/bin'   
infodir='/usr/local/info' mandir='/usr/local/man' manext='1' install.bin
cc -c -I.. -I. -I.  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes  
-O2 -DDEBUG glob.c
glob.c: In function `notstrcmp':
glob.c:614: warning: passing arg 2 of `strcoll' makes integer from pointer  
without a cast
glob.c:614: too few arguments to function `strcoll'
glob.c: In function `doesmatch':
glob.c:1738: warning: passing arg 2 of `strcoll' makes integer from pointer  
without a cast
glob.c:1738: too few arguments to function `strcoll'
glob.c:1739: warning: passing arg 2 of `strcoll' makes integer from pointer  
without a cast
glob.c:1739: too few arguments to function `strcoll'
glob.c:1766: warning: passing arg 2 of `strcoll' makes integer from pointer  
without a cast
glob.c:1766: too few arguments to function `strcoll'
glob.c:1767: warning: passing arg 2 of `strcoll' makes integer from pointer  
without a cast
glob.c:1767: too few arguments to function `strcoll'
*** Exit 1
Stop.
*** Exit 1
Stop.
onyx2#


NeXTstation Turbo ADB Mono running NeXTstep 3.3 Dev. on a 525Mb Quantum hard  
drive with 32Mb of RAM

I hope this helps.

	Andrew


^ permalink raw reply	[relevance 4%]

* Re: Is this a bug in globbing
  @ 1996-09-10 21:30  9% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-09-10 21:30 UTC (permalink / raw)
  To: yamagata; +Cc: stucki, zsh-workers

> > I used a statement 'ls ...' with the pattern 'rc?.d/*[A-Z]'
> > and got lots of names with 'small' characters at the end !
[...]
> After automatic configure,
> there are one or two lines "#define HAVE_STRCOLL 1" in config.h.
> 
> If you comment out these lines, probably the problem may be solved.
> 
> //
> 
> Some OS use strcasecmp in strcoll,
> in case of absence of locale data used by strcoll().

As it turns out this is not a bug.  It seems that in the de_DE locale and
probably in other locales as well the upper and lowercase letters have the
same weight determined by the LC_COLLATE locale category.  POSIX says that
range expressions must use the collating order determined by LC_COLLATE.
Of course POSIX also tells that range expressions shall not be used in
Strictly Conforming POSIX.2 Applications because their behavior is
dependent on the collating sequence.  POSIX conforming applications should
use character class expressions instead which are not yet supported by zsh
:-(.  Setting LC_COLLATE to C or POSIX should cure these problems but note
that is also affects sorting.

Zoltan


^ permalink raw reply	[relevance 9%]

* Bug in Parsing?
@ 1996-09-23 18:47  6% alain (a.) caron
  0 siblings, 0 replies; 200+ results
From: alain (a.) caron @ 1996-09-23 18:47 UTC (permalink / raw)
  To: zsh-workers

ZSH has problems parsing the following line:

(( /bin/sh -c "ls" )& )

It replies with:

zsh: parse error near `/bin/sh -c '

ksh, bash, sh and posix-sh on the HP-UX all accept that command.

I've build ZSH-3.0.0 on HP-UX 9.05 with HP cc.

It seems that zsh does not like the outermost parenthesis.  At least,
it wants a blank between the two opening ones...  It is probably
related to the $(( construct ...

ZSH-2.6-beta21 shows the same behaviour.

This example might seem artificial but this is how our local setup is
working: we have to put in our .profile (or .zprofile in my case) the
following command:

 eval `setup`.

This setup program is supposed to set some environment variables.

The setup command is issuing a command like the faulty one.

I'll have to do eval `setup | sed ...` as a workaround.

Alain Caron
Nortel Technology, Montr?al, Qu?bec, Canada
email: alainc@nortel.ca
phone: 514-765-7718 or ESN 852-7718


^ permalink raw reply	[relevance 6%]

* Re: zsh3.0.0 bug: aliases in if-statement
  @ 1996-10-02 12:02  6% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-10-02 12:02 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

Peter Stephenson wrote:
> "Bart Schaefer" wrote:
> > IMHO, alias expansion has always happened too soon in zsh, but it greatly
> > complicates matters to go around reshaping syntax trees at execution time.
> 
> Not just too soon, I've often thought, but too much.  I don't like the
> following at all.
> 
> % which ls
> ls: aliased to ls -F
> % foo() { command ls }
> % which foo
> foo () {
>         command ls -F
> }

bash, ksh and pdksh behaves similarily.  Aliases should be thought as
macros which expand during compile time.  That's especially true for global
aliases.  Shell functions can do almost anything that a non-global alias
can.  Adding special checks for aliases in the body of comblex commands
would require reparsing of the body which would make zsh much slower and
the code would become more compicated.  POSIX omitted aliases because shell
functions have much more clear semantics and provide more functionality
than aliases and they are even more portable than aliases.

Zoltan


^ permalink raw reply	[relevance 6%]

* Some Etc/* spell fixes
@ 1996-10-03  3:19 11% Geoff Wing
  0 siblings, 0 replies; 200+ results
From: Geoff Wing @ 1996-10-03  3:19 UTC (permalink / raw)
  To: zsh-list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=US-ASCII, Size: 7351 bytes --]

Heyla,
 here are some spell fixes for Etc/*  (excluding FAQ) based on 3.0.1-test2


*** BUGS.bak	Mon Sep 30 12:45:59 1996
--- BUGS	Thu Oct  3 12:47:43 1996
***************
*** 6,12 ****
  If you suspend "man", zle seems to get into cooked mode.  It works ok
  for plain "less".
  It is not specific neither to man nor to zsh.
! E.g. call the fallowing program foo:
  #include <sys/wait.h>
  #include <unistd.h>
  
--- 6,12 ----
  If you suspend "man", zle seems to get into cooked mode.  It works ok
  for plain "less".
  It is not specific neither to man nor to zsh.
! E.g. call the following program foo:
  #include <sys/wait.h>
  #include <unistd.h>
  
***************
*** 24,35 ****
  from zsh/bash, zle/readline gets into cooked mode.
  ------------------------------------------------------------------------
  % zsh -c 'cat a_long_file | less ; :'
! can be interrupted with ^C. The prompt comes back and less is orphaed.
  If you go to the end of the file with less and cat terminates, ^C
  will not terminate less. The `; :' after less forces zsh to fork before
  executing less.
  ------------------------------------------------------------------------
! The pattern %?* maches names beginning with %? instead of names with at
  least two characters beginning with %. This is a hack to allow %?foo job
  substitution without quoting. This behaviour is incompatible with sh
  and ksh and may be removed in the future. A good fix would be to keep
--- 24,35 ----
  from zsh/bash, zle/readline gets into cooked mode.
  ------------------------------------------------------------------------
  % zsh -c 'cat a_long_file | less ; :'
! can be interrupted with ^C. The prompt comes back and less is orphaned.
  If you go to the end of the file with less and cat terminates, ^C
  will not terminate less. The `; :' after less forces zsh to fork before
  executing less.
  ------------------------------------------------------------------------
! The pattern %?* matches names beginning with %? instead of names with at
  least two characters beginning with %. This is a hack to allow %?foo job
  substitution without quoting. This behaviour is incompatible with sh
  and ksh and may be removed in the future. A good fix would be to keep


*** CONTRIBUTORS.bak	Mon Sep 30 12:45:59 1996
--- CONTRIBUTORS	Thu Oct  3 12:49:50 1996
***************
*** 7,21 ****
  this release.  If you feel that you or someone else have been unfairly
  omitted from this list please mail me (hzoli@cs.elte.hu).
  
! * Richard Coleman <coleman@math.gatech.edu> manintained the code till the
    release of zsh-2.6-beta16.  Converted zsh to use autoconf thus greatly
    improving the portability.  Rewrote signal handling code.  Reorganized
    internal hash tables and rewrote the related builtins (enable, disable,
    hash, unhash).  Made some cleanups in exec.c.
  
! * Zoltán Hidvégi <hzoli@cs.elte.hu> the current maintainer.  Rewrore most
    of the lexer and substitution and the related completion code.  Improved
!   sh/ksh/POSIX comapibility.  Fixed lots of bugs in completion, parameter
    and history code.  Made zsh fully 8-bit clean.  Made some
    reorganizations in exec.c.  Fixed signal handling bugs.  Fixed lots of
    bugs in various places.
--- 7,21 ----
  this release.  If you feel that you or someone else have been unfairly
  omitted from this list please mail me (hzoli@cs.elte.hu).
  
! * Richard Coleman <coleman@math.gatech.edu> maintained the code till the
    release of zsh-2.6-beta16.  Converted zsh to use autoconf thus greatly
    improving the portability.  Rewrote signal handling code.  Reorganized
    internal hash tables and rewrote the related builtins (enable, disable,
    hash, unhash).  Made some cleanups in exec.c.
  
! * Zoltán Hidvégi <hzoli@cs.elte.hu> the current maintainer.  Rewrote most
    of the lexer and substitution and the related completion code.  Improved
!   sh/ksh/POSIX compatibility.  Fixed lots of bugs in completion, parameter
    and history code.  Made zsh fully 8-bit clean.  Made some
    reorganizations in exec.c.  Fixed signal handling bugs.  Fixed lots of
    bugs in various places.


*** MACHINES.bak	Mon Sep 30 12:44:26 1996
--- MACHINES	Thu Oct  3 13:07:56 1996
***************
*** 22,30 ****
  	subdirectory and put a fixed version of the header file to it
  	before compiling.
  
! 	The strip comming with gcc-2.7.2 seems to create unusable
  	binaries.  This problem is not related to zsh.  If you have such
! 	problems, remove the bogous strip and use /bin/strip instead.
  
  DYNIX/ptx 1.4 and 2.0.4 with X11
  
--- 22,30 ----
  	subdirectory and put a fixed version of the header file to it
  	before compiling.
  
! 	The strip coming with gcc-2.7.2 seems to create unusable
  	binaries.  This problem is not related to zsh.  If you have such
! 	problems, remove the bogus strip and use /bin/strip instead.
  
  DYNIX/ptx 1.4 and 2.0.4 with X11
  
***************
*** 63,77 ****
  SUN:	SunOS 4.1.x
  	Should build `out-of-the-box'.
  	Under 4.1.3 if yellow pages is used, username completion
! 	may cause segmentation violaton.  This is a bug in the
  	shared library not in zsh.  Some libc.so.1.9.x has this
  	bug (it fails in yp_all).  Statically linked binaries will
  	work if linked with libc.so.1.8.1 (which means that if
  	you can get a statically linked binary compiled under 4.1.2
  	that it will probably work).
! 	An altermative but untested solution may be to undefine
  	HAVE_NIS in config.h.  This may work, but the first username
! 	completion will be _very_ solw (as slow as in tcsh).
  
  	Solaris 2.x
  	The UCB versions of the routines for reading directories are
--- 63,77 ----
  SUN:	SunOS 4.1.x
  	Should build `out-of-the-box'.
  	Under 4.1.3 if yellow pages is used, username completion
! 	may cause segmentation violation.  This is a bug in the
  	shared library not in zsh.  Some libc.so.1.9.x has this
  	bug (it fails in yp_all).  Statically linked binaries will
  	work if linked with libc.so.1.8.1 (which means that if
  	you can get a statically linked binary compiled under 4.1.2
  	that it will probably work).
! 	An alternative but untested solution may be to undefine
  	HAVE_NIS in config.h.  This may work, but the first username
! 	completion will be _very_ slow (as slow as in tcsh).
  
  	Solaris 2.x
  	The UCB versions of the routines for reading directories are


*** NEWS.bak	Mon Sep 30 12:44:27 1996
--- NEWS	Thu Oct  3 13:09:16 1996
***************
*** 3,9 ****
  Much improved sh/ksh emulation.  When zsh is invoked as sh it mostly
  conforms to POSIX 1003.2.
  
! Enhaced parameter expansion features: new flags: A, @, e, W, p, f, F.
  Expansions can be nested.  For example,
  "${${(M)${(f@)$(<builtin.pro)}:#char*}[2][(w)3]}" expands to the third
  word of the second line of builtin.pro which begins with char.  See
--- 3,9 ----
  Much improved sh/ksh emulation.  When zsh is invoked as sh it mostly
  conforms to POSIX 1003.2.
  
! Enhanced parameter expansion features: new flags: A, @, e, W, p, f, F.
  Expansions can be nested.  For example,
  "${${(M)${(f@)$(<builtin.pro)}:#char*}[2][(w)3]}" expands to the third
  word of the second line of builtin.pro which begins with char.  See

-- 
Geoff Wing [mason@primenet.com.au]   PrimeNet - Internet Consultancy
  Web: http://www.primenet.com.au/   Facsimile: +61-3-9819 3788


^ permalink raw reply	[relevance 11%]

* Re: Mailpath notification message
       [not found]     <199610240841.QAA00731@mermaid.ucc.gu.uwa.edu.au>
@ 1996-10-24  9:37  7% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-10-24  9:37 UTC (permalink / raw)
  To: Duncan Sargeant; +Cc: Zsh workers list

Duncan Sargeant wrote:
> I usually overcome this problem by using $HOME in my scripts.  I
> think this is a better way because you can put it in the middle of
> double-quote quoted strings (but not single quotes.)
> 
> export MAILPATH="$HOME/mailspool/rusty:$HOME/Mail/z?Zsh mail."
> 
> IMHO its a good habit to get into.
> 
> better understand parameter expansion??
> 
> echo $HOME "$HOME" '$HOME' ~ "~" '~'
> 
> /home/wheel/dunc /home/wheel/dunc $HOME /home/wheel/dunc ~ ~
> 
> 
> PS: what was the rationale behind quoting tildes?  Not critising
>     it, but this means it isn't a short parameter ... so what is
>     it?

Quoting rules are described quite precisely in POSIX which just documents
the usuall shell behaviour.  Note that in a strict POSIX shell
export MAILPATH=~/mbox:~/Mail/zsh does not expand the tildes but zsh does
similarily to other shells (but bash/ksh/pdksh probably disables this
expansion when POSIXLY_CORRECT is set).  The most portable is
MAILPATH=~/mbox:~/Mail/zsh ; export MAILPATH

About MAILPATH: bash does expand the mailpath component before checking the
file so in bash MAILPATH=~/mbox:~/Mail/zsh" works.  However AT&T ksh, pdksh
and zsh does not do that.

Zoltan


^ permalink raw reply	[relevance 7%]

* Re: Solaris x86?
  @ 1996-10-25 15:48  6% ` Scott Lipcon
  0 siblings, 0 replies; 200+ results
From: Scott Lipcon @ 1996-10-25 15:48 UTC (permalink / raw)
  To: Hrvoje Niksic; +Cc: Zefram, Scott Lipcon, zsh-workers

On 25 Oct 1996, Hrvoje Niksic wrote:

> > 
> > Neither seems to work.  Which library was the one that caused problems?
> 
> This may be a stupid question, but are you really using zsh?  This
> looks much like tcsh prompt and tcsh behaviour.

I'm using tcsh, to compile zsh, so I don't have to use tcsh anymore :-)

More specific information:
Its having a bunch of "assignment makes pointer from integer without a
cast" warnings, throughout the source.  Then, it totally dies when it gets
to signals.c  I tried fiddling with the #define's in config.h that have to
do with signals - I guess configure decided that Solaris had POSIX signal
handling.  I tried it with the SysV signal handling, and it got about 200
lines farther in signals.c before stopping with more errors.  Is it
possible that Solaris x86 has really weird signal handling?

Thanks,
Scott


> 
> -- 
> Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
> --------------------------------+--------------------------------
> main(){printf(&unix["\021%six\012\0"],(unix)["have"]+"fun"-0x60);}
> 


^ permalink raw reply	[relevance 6%]

* Re: compatibility problem with bash?
  @ 1996-10-29  1:29  6% ` Zoltan Hidvegi
  1996-10-29 13:24  6%   ` Carlos Carvalho
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1996-10-29  1:29 UTC (permalink / raw)
  To: Carlos Carvalho; +Cc: zsh-workers

> I linked /bin/sh to /bin/zsh 3.0.1. However, when installing certain
> specific debian packages in linux I get the following error:
> 
> Setting up gzip (1.2.4-11) ...
> install-info: read gzip -d </usr/info/gzip.info.gz |: 13
> 
> The problem doesn't happen if sh is a link to bash. I can get more
> details if necessary.

I would really appreciate if you can send me more details.  From that I
cannot tell anything.  Note that zsh is not fully compatible with bash but
it tries to be compatible with POSIX.  Please send this install-info script
and tell me as much as possuble about it knowing that I've never used
debian of dpkg.

Thanks,

Zoltan


^ permalink raw reply	[relevance 6%]

* Re: compatibility problem with bash?
  1996-10-29  1:29  6% ` Zoltan Hidvegi
@ 1996-10-29 13:24  6%   ` Carlos Carvalho
  0 siblings, 0 replies; 200+ results
From: Carlos Carvalho @ 1996-10-29 13:24 UTC (permalink / raw)
  To: zsh-workers, debian-user

Zoltan Hidvegi (hzoli@cs.elte.hu) wrote on 29 October 1996 02:29:
 >> I linked /bin/sh to /bin/zsh 3.0.1. However, when installing certain
 >> specific debian packages in linux I get the following error:
 >> 
 >> Setting up gzip (1.2.4-11) ...
 >> install-info: read gzip -d </usr/info/gzip.info.gz |: 13
 >> 
 >> The problem doesn't happen if sh is a link to bash. I can get more
 >> details if necessary.
 >
 >I would really appreciate if you can send me more details.  From that I
 >cannot tell anything.  Note that zsh is not fully compatible with bash but
 >it tries to be compatible with POSIX.  Please send this install-info script
 >and tell me as much as possuble about it knowing that I've never used
 >debian of dpkg.

Well, here's the installation script:

#! /bin/sh

set -e

install-info --quiet --section "General Commands" "General Commands" \
        /usr/info/gzip.info.gz

I put a -x in the set command, and it does work well. However,
install-info is a perl script! I could post it, but it has 352
lines... I can send it personally if necessary.

Carlos


^ permalink raw reply	[relevance 6%]

* Re: signal weirdness
  @ 1996-11-13 18:03  6% ` Zefram
  1996-11-13 18:32  7%   ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Zefram @ 1996-11-13 18:03 UTC (permalink / raw)
  To: schaefer; +Cc: zefram, zsh-workers

>    /* If the foreground job got a signal, pretend we got it, too.   */

Oh.

>This code is intended to handle (among other things) the case where the
>user types the interrupt character when a foreground job is executing,
>thereby causing zsh to behave the same as if interrupt were typed at a
>bare prompt.  Similarly, if the user typed the quit character, or if
>the foreground job got a HUP because the tty line dropped, we want zsh
>to notice and behave as if it got the signal as well.  But (except for
>INT and QUIT), the signals are only interesting if they're trapped, as
>zsh normally ignores the rest.

I don't see the problem with just ignoring the situation, in the case
of key-generated interrupts.  If the user wants to kill a program *and*
have the shell process a SIGINT handler, e can press ^C twice.  HUP is
the only one that we really need to handle specially.

>Anyway, the code is more general than it needs to be -- there is only
>a subset of signals (HUP, INT, QUIT, TSTP, ...) that really need to be
>handled this way.  On the other hand, there's no way to make a good
>comprehensive cross-platform list of all the signals that should be so
>treated, which is why it's as general as it is.

Shouldn't it be only INT, QUIT and HUP?  I can't see any others that
could justifiably be treated this way.

>                                                 It might be possible
>to come up with a list of signals that we know should *not* be treated
>this way (BUS, FPE, SEGV, others?) and explicitly omit them, if this
>is really annoying for some reason.

It is very annoying.  It seems like the shell is going out of its way
to cause inconvenience: without that code it would be easy to
distinguish between an external program crashing and the shell
crashing.

What does POSIX say about all of this?

-zefram


^ permalink raw reply	[relevance 6%]

* Re: signal weirdness
  1996-11-13 18:03  6% ` Zefram
@ 1996-11-13 18:32  7%   ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 1996-11-13 18:32 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

On Nov 13,  6:03pm, Zefram wrote:
} Subject: Re: signal weirdness
}
} I don't see the problem with just ignoring the situation, in the case
} of key-generated interrupts.  If the user wants to kill a program *and*
} have the shell process a SIGINT handler, he can press ^C twice.  HUP is
} the only one that we really need to handle specially.

Csh, at least, invokes its onintr handlers when any process spawned from
a csh script gets a keyboard interrupt.  /bin/sh (pre-POSIX, at least)
invokes its INT traps on a single interrupt, AFAIK.

Sometimes the shell is in a loop spawning jobs too fast for pressing ctrl-C
twice to have the desired effect.  What good is an INT handler if zsh never
gets the signal?

} What does POSIX say about all of this?

I'd be interested, too.

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern


^ permalink raw reply	[relevance 7%]

* Re: time command bug in next headers?
  @ 1996-12-03  6:42  7% ` Richard Coleman
  0 siblings, 0 replies; 200+ results
From: Richard Coleman @ 1996-12-03  6:42 UTC (permalink / raw)
  To: rft; +Cc: zsh-workers

> Now. in a similar vein I have a few questions: there are a number of  
> different system call interfaces for getting the user and system time of the  
> process:
> 	times(...)
> 	vtimes(....)
> 	getrusage(...)
> 
> What are the advantages and disadvantages of all these interfaces with respect
> to portability, overhead, and time resolution?  On Nextstep at least it seems  
> as if the getrusage(...) interface has a resolution of 1/100 of a second  
> whereas times only has 1/60 sec resolution.

times() is part of the POSIX standard, and so should give the greatest
amount of portability for the future.  At one time, the code used
getrusage() for BSD style machines, and times() for SYSV style machines.
The code to do this was very ugly (way too many #define's scattered in
the code).  As part of the POSIX-ification of the code, this was all
rewritten to use times() everywhere.

The best way to fix the problem with the Next's is to just use
some #ifdef's to change the clock tick back to 1/60 (what in the
hell was Next thinking when they changed this).

rc


^ permalink raw reply	[relevance 7%]

* Job control under IRIX [5.3/6.2]
@ 1996-12-03  6:40  2% Ryan Dooley
  0 siblings, 0 replies; 200+ results
From: Ryan Dooley @ 1996-12-03  6:40 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1349 bytes --]


Hello all,

	I just compiled Zsh 3.0.1 under IRIX 5.3 and 6.2 for the first
time.  It compiled clean and "out-of-the-box".  I then just noticed some 
strangeness with job control.

	If I startup an application, say netscape, and do not immediatly
background the process, say "netscape &", I cannot later, background the
application to regain shell control.  I also cannot kill the application
from this shell either.  I have to either exit the application or kill it
from another window.  This happens in both IRIX's Winterm (aka XWsh) and
plain-old XTerm.

	Here is a sample:

	babylon % netscape
	^C^Z
	...

etc.

	This doesn't happen on my Linux boxes or my FreeBSD boxes from
with in XTerms or on console.  I thought I might be something with not
defining -D_BSD_SIGNALS or -DPOSIX_SIGNALS properly, but config.h has them
included.

	Any ideas? (I am not the UNIX programmer... ;)

	I have attached:

	1. the config.log
	2. the configh.h
	3. my .zshrc file

Thanks
	--ryan

=========================================================================
+ Ryan Dooley                       * ryan@coe.missouri.edu             +
+ Network / Systems Administrator   * voice: (573) 882-2162             +
+ University of Missouri - Columbia * College of Education              +
=========================================================================

[-- Attachment #2: config.h --]
[-- Type: TEXT/PLAIN, Size: 11481 bytes --]

/* config.h.  Generated automatically by configure.  */
/* config.h.in.  Generated automatically from configure.in by autoheader.  */

/***** begin user configuration section *****/

/* Define this to be the location of your password file */
#define PASSWD_FILE "/etc/passwd"

/* Define this to be the name of your NIS/YP password *
 * map (if applicable)                                */
#define PASSWD_MAP "passwd.byname"

/* Define to 1 if you want user names to be cached */
#define CACHE_USERNAMES 1

/* Define to 1 if system supports job control */
#define JOB_CONTROL 1

/* Define to 1 if system has working FIFO's */
#define HAVE_FIFOS 1

/* Define this if you use "suspended" instead of "stopped" */
#define USE_SUSPENDED 1
 
/* The default history buffer size in lines */
#define DEFAULT_HISTSIZE 30

/* The default editor for the fc builtin */
#define DEFAULT_FCEDIT "vi"

/* The default prefix for temporary files */
#define DEFAULT_TMPPREFIX "/tmp/zsh"


/***** end of user configuration section            *****/
/***** shouldn't have to change anything below here *****/

/* Define to empty if the keyword does not work.  */
/* #undef const */

/* Define if the `getpgrp' function takes no argument.  */
#define GETPGRP_VOID 1

/* Define to `int' if <sys/types.h> doesn't define.  */
/* #undef gid_t */

/* Define if you have the strcoll function and it is properly defined.  */
#define HAVE_STRCOLL 1

/* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
#define HAVE_SYS_WAIT_H 1

/* Define to `int' if <sys/types.h> doesn't define.  */
/* #undef mode_t */

/* Define to `long' if <sys/types.h> doesn't define.  */
/* #undef off_t */

/* Define to `int' if <sys/types.h> doesn't define.  */
/* #undef pid_t */

/* Define as the return type of signal handlers (int or void).  */
#define RETSIGTYPE void

/* Define to `unsigned' if <sys/types.h> doesn't define.  */
/* #undef size_t */

/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly.  */
/* #undef STAT_MACROS_BROKEN */

/* Define if you have the ANSI C header files.  */
#define STDC_HEADERS 1

/* Define if you can safely include both <sys/time.h> and <time.h>.  */
#define TIME_WITH_SYS_TIME 1

/* Define to `int' if <sys/types.h> doesn't define.  */
/* #undef uid_t */

/* The global file to source absolutely first whenever zsh is run; *
 * if undefined, don't source anything                             */
#define GLOBAL_ZSHENV "/etc/zshenv"

/* The global file to source whenever zsh is run; *
 * if undefined, don't source anything            */
#define GLOBAL_ZSHRC "/etc/zshrc"

/* The global file to source whenever zsh is run as a login shell; *
 * if undefined, don't source anything                             */
#define GLOBAL_ZLOGIN "/etc/zlogin"

/* The global file to source whenever zsh is run as a login shell, *
 * before zshrc is read; if undefined, don't source anything       */
#define GLOBAL_ZPROFILE "/etc/zprofile"

/* The global file to source whenever zsh was run as a login shell.  *
 * This is sourced right before exiting.  If undefined, don't source *
 * anything                                                          */
#define GLOBAL_ZLOGOUT "/etc/zlogout"

/* Define to 1 if compiler incorrectly cast signed to unsigned */
/* #undef BROKEN_SIGNED_TO_UNSIGNED_CASTING */

/* Define if your system defines TIOCGWINSZ in sys/ioctl.h.  */
/* #undef GWINSZ_IN_SYS_IOCTL */

/* Define to 1 if you have NIS */
#define HAVE_NIS 1

/* Define to 1 if you have NISPLUS */
/* #undef HAVE_NIS_PLUS */

/* Define to 1 if you have RFS superroot directory. */
/* #undef HAVE_SUPERROOT */

/* Define to 1 if you have the /dev/fd filesystem */
#define HAVE_DEV_FD 1

/* Define if sys/time.h and sys/select.h cannot be both included */
/* #undef TIME_H_SELECT_H_CONFLICTS */

/* Define if your system's struct utmp has a member named ut_host.  */
#define HAVE_UT_HOST 1

/* Define if you have the <utmpx.h> header file.  */
#define HAVE_UTMPX_H 1

/* Define to be the machine type (microprocessor class or machine model) */
#define MACHTYPE "mips"

/* Define to be the name of the operating system */
#define OSTYPE "irix6.2"

/* Define to 1 if ANSI function prototypes are usable.  */
#define PROTOTYPES 1

/* Define to be location of utmp file.  This value is only used if UTMP_FILE, *
 * UTMPX_FILE, or _PATH_UTMP are not defined in an include file.              */
#define UTMP_FILE_CONFIG "/etc/utmp"

/* Define to be a string corresponding the vendor of the machine */
#define VENDOR "sgi"

/* Define if your system defines `struct winsize' in sys/ptem.h.  */
/* #undef WINSIZE_IN_PTEM */

/* Define  to be location of wtmp file.  This value is only use if WTMP_FILE, *
 * WTMPX_FILE, or _PATH_WTMP are not defined in an include file.              */
#define WTMP_FILE_CONFIG "/etc/wtmp"

/* Define to 1 if you want to use zsh's own memory allocation routines */
/* #undef ZSH_MEM */

/* Define to 1 if you want to debug zsh memory allocation routines */
/* #undef ZSH_MEM_DEBUG */

/* Define to 1 if you want to turn on warnings of memory allocation errors */
/* #undef ZSH_MEM_WARNING */

/* Define to 1 if you want to turn on memory checking for free() */
/* #undef ZSH_SECURE_FREE */

/* Define to 1 if you want to get debugging information on internal *
 * hash tables.  This turns on the `hashinfo' builtin.              */
/* #undef ZSH_HASH_DEBUG */

/* Define to 1 if your termcap library has the ospeed variable */
#define HAVE_OSPEED 1
/* Define to 1 if you have ospeed, but it is not defined in termcap.h */
#define MUST_DEFINE_OSPEED 1

/* Define to 1 if tgetent() accepts NULL as a buffer */
#define TGETENT_ACCEPTS_NULL 1

/* Define to 1 if you have a working strcoll function */
#define HAVE_STRCOLL 1

/* Define to 1 if you use POSIX style signal handling */
#define POSIX_SIGNALS 1

/* Define to 1 if you use BSD style signal handling (and can block signals) */
/* #undef BSD_SIGNALS */

/* Define to 1 if you use SYS style signal handling (and can block signals) */
/* #undef SYSV_SIGNALS */

/* Define to 1 if you have no signal blocking at all (bummer) */
/* #undef NO_SIGNAL_BLOCKING */

/* Define to `unsigned int' if <sys/types.h> or <signal.h> doesn't define */
/* #undef sigset_t */

/* Define to 1 if struct timezone is defined by a system header */
#define HAVE_STRUCT_TIMEZONE 1

/* Define if your system's typeahead disappears from the shell editor. */
/* #undef CLOBBERS_TYPEAHEAD */

/* Define to 1 if there is a prototype defined for brk() on your system */
#define HAVE_BRK_PROTO 1

/* Define to 1 if there is a prototype defined for sbrk() on your system */
#define HAVE_SBRK_PROTO 1

/* Define to 1 if there is a prototype defined for ioctl() on your system */
#define HAVE_IOCTL_PROTO 1

/* Define to 1 if /bin/sh does not interpret \ escape sequences */
/* #undef SH_USE_BSD_ECHO */

/* The number of bytes in a long.  */
#define SIZEOF_LONG 4

/* Define if you have the difftime function.  */
#define HAVE_DIFFTIME 1

/* Define if you have the getdomainname function.  */
#define HAVE_GETDOMAINNAME 1

/* Define if you have the gethostname function.  */
#define HAVE_GETHOSTNAME 1

/* Define if you have the getlogin function.  */
#define HAVE_GETLOGIN 1

/* Define if you have the getrlimit function.  */
#define HAVE_GETRLIMIT 1

/* Define if you have the gettimeofday function.  */
#define HAVE_GETTIMEOFDAY 1

/* Define if you have the initgroups function.  */
#define HAVE_INITGROUPS 1

/* Define if you have the killpg function.  */
#define HAVE_KILLPG 1

/* Define if you have the lstat function.  */
#define HAVE_LSTAT 1

/* Define if you have the mkfifo function.  */
#define HAVE_MKFIFO 1

/* Define if you have the nis_list function.  */
/* #undef HAVE_NIS_LIST */

/* Define if you have the select function.  */
#define HAVE_SELECT 1

/* Define if you have the seteuid function.  */
#define HAVE_SETEUID 1

/* Define if you have the setpgid function.  */
#define HAVE_SETPGID 1

/* Define if you have the setresuid function.  */
/* #undef HAVE_SETRESUID */

/* Define if you have the setreuid function.  */
#define HAVE_SETREUID 1

/* Define if you have the setuid function.  */
#define HAVE_SETUID 1

/* Define if you have the sigaction function.  */
#define HAVE_SIGACTION 1

/* Define if you have the sigblock function.  */
#define HAVE_SIGBLOCK 1

/* Define if you have the sighold function.  */
#define HAVE_SIGHOLD 1

/* Define if you have the sigprocmask function.  */
#define HAVE_SIGPROCMASK 1

/* Define if you have the sigrelse function.  */
#define HAVE_SIGRELSE 1

/* Define if you have the sigsetmask function.  */
#define HAVE_SIGSETMASK 1

/* Define if you have the strerror function.  */
#define HAVE_STRERROR 1

/* Define if you have the strftime function.  */
#define HAVE_STRFTIME 1

/* Define if you have the strstr function.  */
#define HAVE_STRSTR 1

/* Define if you have the tcgetattr function.  */
#define HAVE_TCGETATTR 1

/* Define if you have the tcsetpgrp function.  */
#define HAVE_TCSETPGRP 1

/* Define if you have the wait3 function.  */
#define HAVE_WAIT3 1

/* Define if you have the waitpid function.  */
#define HAVE_WAITPID 1

/* Define if you have the <dirent.h> header file.  */
#define HAVE_DIRENT_H 1

/* Define if you have the <errno.h> header file.  */
#define HAVE_ERRNO_H 1

/* Define if you have the <fcntl.h> header file.  */
#define HAVE_FCNTL_H 1

/* Define if you have the <libc.h> header file.  */
/* #undef HAVE_LIBC_H */

/* Define if you have the <limits.h> header file.  */
#define HAVE_LIMITS_H 1

/* Define if you have the <locale.h> header file.  */
#define HAVE_LOCALE_H 1

/* Define if you have the <memory.h> header file.  */
#define HAVE_MEMORY_H 1

/* Define if you have the <ndir.h> header file.  */
/* #undef HAVE_NDIR_H */

/* Define if you have the <stdlib.h> header file.  */
#define HAVE_STDLIB_H 1

/* Define if you have the <string.h> header file.  */
#define HAVE_STRING_H 1

/* Define if you have the <sys/dir.h> header file.  */
/* #undef HAVE_SYS_DIR_H */

/* Define if you have the <sys/filio.h> header file.  */
#define HAVE_SYS_FILIO_H 1

/* Define if you have the <sys/ndir.h> header file.  */
/* #undef HAVE_SYS_NDIR_H */

/* Define if you have the <sys/param.h> header file.  */
#define HAVE_SYS_PARAM_H 1

/* Define if you have the <sys/resource.h> header file.  */
#define HAVE_SYS_RESOURCE_H 1

/* Define if you have the <sys/select.h> header file.  */
#define HAVE_SYS_SELECT_H 1

/* Define if you have the <sys/time.h> header file.  */
#define HAVE_SYS_TIME_H 1

/* Define if you have the <sys/times.h> header file.  */
#define HAVE_SYS_TIMES_H 1

/* Define if you have the <sys/utsname.h> header file.  */
#define HAVE_SYS_UTSNAME_H 1

/* Define if you have the <termcap.h> header file.  */
/* #undef HAVE_TERMCAP_H */

/* Define if you have the <termio.h> header file.  */
#define HAVE_TERMIO_H 1

/* Define if you have the <termios.h> header file.  */
#define HAVE_TERMIOS_H 1

/* Define if you have the <unistd.h> header file.  */
#define HAVE_UNISTD_H 1

/* Define if you have the nsl library (-lnsl).  */
/* #undef HAVE_LIBNSL */

[-- Attachment #3: config.log --]
[-- Type: TEXT/PLAIN, Size: 9102 bytes --]

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

configure:866: cc -E conftest.c
configure:946: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1080: cc -c  -O  conftest.c 1>&5
configure:1111: cc -o conftest  -O   conftest.c  1>&5
configure:1152: cc -c  -O   conftest.c 1>&5
configure:1201: cc -o conftest  -O   conftest.c  1>&5
configure:1228: cc -o conftest  -O   conftest.c  1>&5
configure:1379: cc -c  -O  conftest.c 1>&5
configure:1422: cc -o conftest  -O   conftest.c -ldir   1>&5
ld: FATAL 9: I/O error (-ldir): No such file or directory
configure:1494: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1559: cc -o conftest  -O   conftest.c  1>&5
configure:1593: cc -c  -O  conftest.c 1>&5
configure:1689: cc -c  -O  conftest.c 1>&5
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
cfe: Error: configure: 1720: Cannot open file termcap.h for #include
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
cfe: Error: configure: 1720: Cannot open file libc.h for #include
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1724: cc -E  conftest.c >/dev/null 2>conftest.out
configure:1764: cc -c  -O  conftest.c 1>&5
configure:1798: cc -c  -O  conftest.c 1>&5
cfe: Error: configure, line 1794: 'ut_host' undefined; reoccurrences will not be reported.
 struct utmp ut; ut.ut_host;
 ------------------^
cfe: Error: configure, line 1794: member of structure or union required
 struct utmp ut; ut.ut_host;
 -------------------^
configure:1833: cc -c  -O  conftest.c 1>&5
configure:1873: cc -o conftest  -O   conftest.c  1>&5
configure:1901: cc -o conftest  -O   conftest.c  1>&5
configure:1963: cc -E  conftest.c >/dev/null 2>conftest.out
cfe: Error: configure: 1959: Cannot open file sys/ptem.h for #include
configure:2013: cc -o conftest  -O   conftest.c -ltermcap   1>&5
configure:2064: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2156: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
cfe: Error: configure, line 2152: 'ospeed' undefined; reoccurrences will not be reported.
 ospeed = 0;
 ^
configure:2183: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
configure:2225: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
configure:2266: cc -c  -O  conftest.c 1>&5
configure:2455: cc -c  -O  conftest.c 1>&5
configure:2487: cc -c  -O  conftest.c 1>&5
configure:2569: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
ld: ERROR 33: Unresolved text symbol "setresuid" -- 1st referenced by conftest.o.
ld: INFO 60: Output file removed because of error.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
ld: ERROR 33: Unresolved text symbol "nis_list" -- 1st referenced by conftest.o.
ld: INFO 60: Output file removed because of error.
configure:2625: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2661: cc -o conftest  -O   conftest.c  -ltermcap 1>&5
ld: WARNING 84: /usr/lib/libtermcap.so is not used for resolving any symbol.
configure:2855: cc -c  -O  conftest.c 1>&5
cfe: Error: configure, line 2848: redeclaration of 'brk'; previous declaration at line 306 in file '/usr/include/unistd.h'
 double brk();
 -------^
cfe: Error: configure, line 2848: Incompatible function return type for this function.
 double brk();
 ----------^
configure:2888: cc -c  -O  conftest.c 1>&5
cfe: Error: configure, line 2881: redeclaration of 'sbrk'; previous declaration at line 318 in file '/usr/include/unistd.h'
 double sbrk();
 -------^
cfe: Error: configure, line 2881: Incompatible function return type for this function.
 double sbrk();
 -----------^
configure:2923: cc -c  -O  conftest.c 1>&5
cfe: Error: configure, line 2916: redeclaration of 'ioctl'; previous declaration at line 54 in file '/usr/include/sys/ioctl.h'
    int ioctl(double x);
 -------^
cfe: Error: configure, line 2916: Incompatible type for the function parameter
    int ioctl(double x);
 --------------------^

[-- Attachment #4: zshrc --]
[-- Type: TEXT/PLAIN, Size: 1878 bytes --]

#
# $Id: zshrc,v 2.0 1996/05/02 22:57:04 hzoli Exp $
#
# Generic .zshrc file for zsh 2.7
#
# .zshrc is sourced in interactive shells.  It
# should contain commands to set up aliases, functions,
# options, key bindings, etc.
#

# Search path for the cd command
cdpath=(.. ~ ~/src ~/zsh)

# Use hard limits, except for a smaller stack and no core dumps
unlimit
limit stack 8192
limit core 0
limit -s

umask 022

# Set up aliases
alias mv='nocorrect mv'       # no spelling correction on mv
alias cp='nocorrect cp'       # no spelling correction on cp
alias mkdir='nocorrect mkdir' # no spelling correction on mkdir
alias j=jobs
alias pu=pushd
alias po=popd
alias h=history
alias grep=egrep
alias ll='ls -l'
alias la='ls -a'
alias df='df -k'
alias cls=clear

# List only directories and symbolic
# links that point to directories
alias lsd='ls -ld *(-/DN)'

# List only file beginning with "."
alias lsa='ls -ld .*'

# Shell functions
setenv() { export $1=$2 }  # csh compatibility

manpath=( /usr/man /usr/share/catman /usr/share/man /usr/local/man )
export MANPATH

# Filename suffixes to ignore during completion
fignore=(.o .c~ .old .pro)

# Set prompts
PROMPT='%m %# '    # default prompt
RPROMPT=' %~'     # prompt for right side of screen

MAILCHECK=300
HISTSIZE=200
DIRSTACKSIZE=20

watch=(notme)                   # watch for everybody but me
LOGCHECK=300                    # check every 5 min for login/logout activity
WATCHFMT='%n %a %l from %m at %t.'

# Set/unset  shell options
setopt   notify globdots correct pushdtohome cdablevars autolist
setopt   autocd recexact longlistjobs
setopt   autoresume histignoredups pushdsilent noclobber
setopt   autopushd pushdminus extendedglob rcquotes mailwarning
unsetopt autoparamslash

alias ls='/bin/ls -F'
alias d='ls -lF'
alias sc='source ~/.zshrc'

^ permalink raw reply	[relevance 2%]

* Re: new module
  @ 1996-12-25  2:28  4% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1996-12-25  2:28 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

Here are some pieces from Zefram's files.c:

>       + static char buf[PATH_MAX * 2];
>       + static char rbuf[PATH_MAX];
[...]
>       + dorm(char *nam, char *arg, char *ops)
[...]
>       + 		if(arg != buf)
>       + 		    strcpy(buf, arg);

You see I do not like this kind of code.  It works but it makes the code
more difficult to maintain.  buf is a static variable and sometimes arg and
buf is the same.  It is very easy to forget about that and it can cause you
headaches to track down a problem caused by this.  And it is almost
impossible to debug this if you call an other function which also happens
to use buf.  In files.c I do not see what's against using automatic
variable buffers.

There is one more argument against static buffers besides the clarity of
the code.  Zsh code must be as re-entrant as possible as a signal handler
can be called at any time.  E.g. while you busily doing an rm -rf foo a
signal may come and it may call an other rm (that probably violates POSIX
btw.).

I know that static buffers are used in some other places.  The result of
unmeta is in a static buffer if the string contained a metafied character.
But in other parts of the code this static buffer used immediately after
the unmeta call.

>       + 		*pos++ = '/';
>       + 		while((fn = zreaddir(d, 1))) {
>       + 		    if(ztrlen(fn) > space) {
>       + 			pos[-1] = 0;
>       + 			zwarnnam(nam, "%s: %e", buf, ENAMETOOLONG);
>       + 			err = 1;
>       + 			continue;
>       + 		    }
>       + 		    strcpy(pos, fn);

There are two problems with this code.  First it cannot remove a directory
hierarchy if it has too deep subdirectories.  That's quite bad when you use
it to clean up directories.  A user who wants to save his files from
automatic deletion can hide it deeply in a subdirectory.

The other problem if that when such an rm runs from root's cron ro clean up
/tmp it can be exploited to remove anything on the filesystem.  Any
component of a long filename can be replaced with a symlink while rm is
working which can be used to delete any tree on the system.

The right way to do that is to change into the directory we want to remove,
and stat . to make sure that the chdir did no go over a symlink.

Note that it is a more general problem: find ... -exec rm {} \; scripts are
always dangerous and can be exploited using some symlink trickery.
Therefore an option to rm which disables symlinks would be very useful
(which would allow rm -l symlink but not rm -l symlink/file).  If
implemented correctly, rm -lf <some_complicated_zsh_glob_pattern> would be
a safe operation.  Sine rm is a builtin long argument list is no longer a
problem.

E.g. when you type rm foo/bar the right procedure is:

lstat(foo), if a real directory, chpwd(foo), stat(.) and compare with the
previous lstat(foo), if not the same fail.  And now you can delete bar.

And to rm /foo/bar you have to chpwd(/) first.
Of couse a shell-builtin implementation should save pwd first and go back
after the operation is completed.

Btw. I've just noticed that rm -r in files.c uses stat() instead of lstat()
hence it follows symlinks happily :-(.

Zoltan


^ permalink raw reply	[relevance 4%]

* keeping up with the competition
@ 1996-12-25  6:36  7% Richard Coleman
  0 siblings, 0 replies; 200+ results
From: Richard Coleman @ 1996-12-25  6:36 UTC (permalink / raw)
  To: zsh-workers

Bash 2.0 has just been released.  It has a bunch of
new features.  We should check it out and see if it
has any features we want to implement in zsh.  I'll attach
the release announcement so everyone can see.

rc



		And what rough beast,
			its hour come round at last,
		slouches towards Bethlehem to be born?
					-- Yeats
				
The first open release of bash-2.0 is now available with the URL

ftp://slc2.ins.cwru.edu/pub/dist/bash-2.0.tar.gz

This tar file does not include the formatted documentation
(postscript, dvi, html, and nroffed versions of the manual pages);
that may be retrieved with the URL

ftp://slc2.ins.cwru.edu/pub/dist/bash-doc-2.0.tar.gz

When unpacking the documentation, make sure to extract the tar
file in the bash-2.0 source directory. 

These files will soon be available for anonymous FTP from the
usual GNU archives. 

No diffs from bash-2.0-beta3 are available.

The file NEWS lists the major new features and changes of note
from the last full release, bash-1.14.7.  A copy is appended to
this announcement. 

The file CHANGES lists the changes from bash-2.0-beta3.  A copy
is also appended.

The bash-2.0 FAQ is in doc/FAQ.  This has undergone considerable
change since it was last posted.  Please read it and send any
comments to chet@po.cwru.edu.

Bug reports concerning bash may be sent to bug-bash@prep.ai.mit.edu.
There is a `bashbug' program in the distribution, built at the same
time as bash, that should be used to report bugs. 

A new release of the standalone readline library will appear within
two weeks.  An announcement will be made when it is available.

Chet

+=========== NEWS ===========+
This is a terse description of the new features added to bash-2.0 since
the release of bash-1.14.7.  As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.

1.  New Features in Bash

a.  There is a new invocation option, -D, that dumps translatable strings
    in a script.

b.  The `long' invocation options must now be prefixed with `--'.

c.  New long invocation options:  --dump-strings, --help, --verbose

d.  The `nolineediting' invocation option was renamed to `noediting'.

e.  The `nobraceexpansion' and `quiet' long invocation options were removed.

f.  The `--help' and `--version' long options now work as the GNU coding
    standards specify.

g.  If invoked as `sh', bash now enters posix mode after reading the
    startup files, and reads and executes commands from the file named
    by $ENV if interactive (as POSIX.2 specifies).  A login shell invoked
    as `sh' reads $ENV after /etc/profile and ~/.profile.

h.  There is a new reserved word, `time', for timing pipelines, builtin
    commands, and shell functions.  It uses the value of the TIMEFORMAT
    variable as a format string describing how to print the timing
    statistics.

i.  The $'...' quoting syntax expands ANSI-C escapes in ... and leaves the
    result single-quoted.

j.  The $"..." quoting syntax performs locale-specific translation of ...
    and leaves the result double-quoted.

k.  LINENO now works correctly in functions.

l.  New variables: DIRSTACK, PIPESTATUS, BASH_VERSINFO, HOSTNAME, SHELLOPTS,
    MACHTYPE.  The first three are array variables.

m.  The BASH_VERSION and BASH_VERSINFO variables now include the shell's
    `release status' (alpha[N], beta[N], release).

n.  Some variables have been removed:  MAIL_WARNING, notify, history_control,
    command_oriented_history, glob_dot_filenames, allow_null_glob_expansion,
    nolinks, hostname_completion_file, noclobber, no_exit_on_failed_exec, and
    cdable_vars.  Most of them are now implemented with the new `shopt'
    builtin; others were already implemented by `set'.

o.  Bash now uses some new variables:  LC_ALL, LC_MESSAGES, LC_CTYPE,
    LC_COLLATE, LANG, GLOBIGNORE, HISTIGNORE.

p.  The shell now supports integer-indexed arrays of unlimited length,
    with a new compound assignment syntax and changes to the appropriate
    builtin commands (declare/typeset, read, readonly, etc.).  The array
    index may be an arithmetic expression.

q.  ${!var}: indirect variable expansion, equivalent to eval \${$var}.

r.  ${paramter:offset[:length]}: variable substring extraction.

s.  ${parameter/pattern[/[/]string]}: variable pattern substitution.

t.  The $[...] arithmetic expansion syntax is no longer supported, in
    favor of $((...)).

u.  Aliases can now be expanded in shell scripts with a shell option
    (shopt expand_aliases).

v.  History and history expansion can now be used in scripts with
    set -o history and set -H.

w.  All builtins now return an exit status of 2 for incorrect usage.

x.  Interactive shells resend SIGHUP to all running or stopped children
    if (and only if) they exit due to a SIGHUP.

y.  New prompting expansions: \a, \e, \H, \T, \@, \v, \V.

z.  Variable expansion in prompt strings is now controllable via a shell
    option (shopt promptvars).

aa. Bash now defaults to using command-oriented history.

bb. The history file ($HISTFILE) is now truncated to $HISTFILESIZE after
    being written.

cc. The POSIX.2 conditional arithmetic evaluation syntax (expr ? expr : expr)
    has been implemented.

dd. Each builtin now accepts `--' to signify the end of the options, except
    as documented (echo, etc.).

ee. All builtins use -p to display values in a re-readable format where
    appropriate, except as documented (echo, type, etc.).

ff. The `alias' builtin has a new -p option.

gg. Changes to the `bind' builtin:
	o has new options: -psPSVr.
	o the `-d' option was renamed to `-p'
	o the `-v' option now dumps variables; the old `-v' is now `-P'

hh. The `bye' synonym for `exit' was removed.

ii. The -L and -P options to `cd' and `pwd' have been documented.

jj. The `cd' builtin now does spelling correction on the directory name
    by default.  This is settable with a shell option (shopt cdspell).

kk. The `declare' builtin has new options: -a, -F, -p.

ll. The `dirs' builtin has new options: -c, -p, -v.

mm. The new `disown' builtin removes jobs from the shell's jobs table
    or inhibits the resending of SIGHUP when the shell receives a
    SIGHUP.

nn. The `echo' builtin has a new escape character: \e.

oo. The `enable' builtin can now load new builtins dynamically from shared
    objects on systems with the dlopen/dlsym interface.  There are a number
    of examples in the examples/loadables directory.  There are also
    new options: -d, -f, -s, -p.

pp. The `-all' option to `enable' was removed in favor of `-a'.

qq. The `exec' builtin has new options: -l, -c, -a.

rr. The `hash' builtin has a new option: -p.

ss. The `history' builtin has new options: -c, -p, -s.

tt. The `jobs' builtin has new options: -r, -s.

uu. The `kill' builtin has new options: -n signum, -l signame.

vv. The `pushd' and `popd' builtins have a new option: -n.

ww. The `read' builtin has new options: -p prompt, -e, -a.

xx. The `readonly' builtin has a new -a option, and the -n option was removed.

yy. Changes to the `set' builtin:
	o new options: -B, -o keyword, -o onecmd, -o history
	o options removed: -l, -d, -o nohash
	o options changed: +o, -h, -o hashall
	o now displays variables in a format that can be re-read as input

zz. The new `shopt' builtin controls shell optional behavior previously
    done by setting and unsetting certain shell variables.

aaa. The `test' builtin has new operators: -o option, s1 == s2, s1 < s2,
     and s1 > s2, where s1 and s2 are strings.

bbb. There is a new trap, DEBUG, executed after every simple command.

ccc. The `trap' builtin has a new -p option.

ddd. The `ulimit' builtin has a new -l option on 4.4BSD-based systems.

eee. The PS1, PS2, PATH, and IFS variables may now be unset.

fff. The restricted shell mode has been expanded and is now documented.

ggg. Security improvements:
	o functions are not imported from the environment if running setuid
	  or with -p
	o no startup files are sourced if running setuid or with -p

hhh. The documentation has been overhauled:  the texinfo manual was
     expanded, and HTML versions of the man page and texinfo manual
     are included.

iii. Changes to Posix mode:
	o Command lookup now finds special builtins before shell functions.
	o Failure of a special builtin causes a non-interactive shell to
	  exit.  Failures are defined in the POSIX.2 specification.
	o If the `cd' builtin finds a directory to change to using $CDPATH,
	  the value assigned to PWD when `cd' completes does not contain
	  any symbolic links.
	o A non-interactive shell exits if a variable assignment error
	  occurs when no command name follows the assignment statements.
	o A non-interactive shell exits if the interation variable in a
	  `for' statement or the selection variable in a `select' statement
	  is read-only or another variable assignment error occurs.
	o The `<>' redirection operator now opens a file for both stdin and
	  stdout by default, not just when in posix mode.
	o Assignment statements preceding special builtins now persist in
	  the shell's environment when the builtin completes.

     Posix mode is now completely POSIX.2-compliant (modulo bugs).  When
     invoked as sh, bash should be completely POSIX.2-compliant.

jjj. The default value of PS1 is now "\s-\v\$ ".

kkk. The ksh-like ((...)) arithmetic command syntax has been implemented.
     This is exactly equivalent to `let "..."'.

lll. Integer constants have been extended to base 64.

mmm. The `ulimit' builtin now sets both hard and soft limits and reports the
     soft limit by default.

2.  New Features in Readline

a.  New variables:  enable-keypad, input-meta (new name for meta-flag),
    mark-directories, visible-stats (now documented), disable-completion,
    comment-begin.

b.  New bindable commands:  kill-region, copy-region-as-kill,
    copy-backward-word, copy-forward-word, set-mark, exchange-point-and-mark,
    character-search, character-search-backward, insert-comment,
    glob-expand-word, glob-list-expansions, dump-variables, dump-macros.

c.  New emacs keybindings:  delete-horizontal-space (M-\),
    insert-completions (M-*), possible-completions (M-=).

d.  The history-search-backward and history-search-forward commands were
    modified to be the same as previous-line and next-line if point is at
    the start of the line.

e.  More file types are available for the visible-stats mode.

3.  Changes of interest in the Bash implementation

a.  There is a new autoconf-based configuration mechanism.

b.  More things have been moved from Posix mode to standard shell behavior.

c.  The trace output (set -x) now inserts quotes where necessary so it can
    be reused as input.

d.  There is a compile-time option for a system-wide interactive shell
    startup file (disabled by default).

e.  The YACC grammar is smaller and tighter, and all 66 shift-reduce
    conflicts are gone.  Several parsing bugs have been fixed.

f.  Builtin option parsing has been regularized (using internal_getopt()),
    with the exception of `echo', `type', and `set'.

g.  Builtins now return standard usage messages constructed from the
    `short doc' used by the help builtin.

h.  Completion now quotes using backslashes by default, but honors
    user-supplied quotes.

i.  The GNU libc malloc is available as a configure-time option.

j.  There are more internationalization features; bash uses gettext if
    it is available.  The $"..." translation syntax uses the current
    locale and gettext.

k.  There is better reporting of job termination when the shell is not
    interactive.

l.  The shell is somewhat more efficient: it uses a little less memory and
    makes fewer system calls.

4.  Changes of interest in the Readline implementation

a.  There is now support for readline `callback' functions.

b.  There is now support for user-supplied input, redisplay, and terminal
    preparation functions.

c.  Most of the shell-specific code in readline has been generalized or
    removed.

d.  Most of the annoying redisplay bugs have been fixed, notably the problems
    with incremental search and excessive redrawing when special characters
    appear in the prompt string.

e.  There are new library functions and variables available to application
    writers, most having to do with completion and quoting.

f.  The NEWLINE character (^J) is now treated as a search terminator by the
    incremental search functions.


+========== CHANGES ==========+
This document details the changes between this version, bash-2.0-release,
and the previous version, bash-2.0-beta3.

1.  Changes to Bash

a.  Fix to the `getopts' builtin so that it does the right thing when a
    required option argument is not present.

b.  The completion code now updates the common prefix of matched names
    after FIGNORE processing is done, since any names that were removed
    may have changed the common prefix.

c.  Fixed a bug that made messages in MAILPATH entries not work correctly.

d.  Fixed a serious documentation error in the description of the new
    ${parameter:offset[:length]} expansion.

e.  Fixes to make parameter substring expansion ({$param:offset[:length]})
    work when within double quotes.

f.  Fixes to make ^A (CTLESC) survive an unquoted expansion of positional
    parameters.

g.  Corrected a misspelling of `unlimited' in the output of `ulimit'.

h.  Fixed a bug that caused executable scripts without a leading `#!' to
    occasionally pick up the wrong set of positional parameters.

i.  Linux systems now have a working `ulimit -v', using RLIMIT_AS.

j.  Updated config.guess so that many more machine types are recognized.

k.  Fixed a bug with backslash-quoted slashes in the ${param/pat[/sub]}
    expansion.

l.  If the shell is named `-su', and `-c command' is supplied, read and
    execute the login shell startup files even though the shell is not
    interactive.  This is to support the `-' option to `su'.

2.  Changes to Readline

a.  Fixed a bug that caused a numeric argument of 1024 to be ignored when
    inserting text.

b.  Fixed the display code so that the numeric argument is displayed as it's
    being entered.

c.  Fixed the numeric argument reading code so that `M-- command' is
    equivalent to `M--1 command', as the prompt implies.

3.  New Features in Bash

a.  `ulimit' now sets both hard and soft limits and reports the soft limit
    by default (when neither -H nor -S is specified).  This is compatible
    with versions of sh and ksh that implement `ulimit'.

b.  Integer constants have been extended to base 64.

4.  New Features in Readline

a.  The `home' and `end' keys are now bound to beginning-of-line and
    end-of-line, respectively, if the corresponding termcap capabilities
    are present.

------------------------------------------------------------------------------
This document details the changes between this version, bash-2.0-beta3,
and the previous version, bash-2.0-beta2.

1.  Changes to Bash

a.  System-specific changes for: AIX 4.2, SCO 3.2v[45], HP-UX.

b.  When in POSIX mode, variable assignments preceding a special builtin
    persist in the shell environment after the builtin completes.

c.  Changed all calls to getwd() to getcwd().  Improved check for systems
    where the libc getcwd() calls popen(), since that breaks on some
    systems when job control is being used.

d.  Fixed a bug that caused seg faults when executing scripts with the
    execute bit set but without a leading `#!'.

e.  The environment passed to executed commands is never sorted.

f.  A bug was fixed in the code that expands ${name[@]} to the number of
    elements in an array variable.

g.  A bug was fixed in the array compound assignment code ( A=( ... ) ).

h.  Window size changes now correctly propagate down to readline if
    the shopt `checkwinsize' option is enabled.

i.  A fix was made in the code that expands to the length of a variable
    value (${#var}).

j.  A fix was made to the command builtin so that it did not turn on the
    `no fork' flag inappropriately.

k.  A fix was made to make `set -n' work more reliably.

l.  A fix was made to the job control initialization code so that the
    terminal process group is set to the shell's process group if the
    shell changes its own process group.

2.  Changes to Readline

a.  System-specific changes for: SCO 3.2v[45].

b.  The behavior of the vi-mode `.' when redoing an `i' command was changed
    to insert the text previously inserted by the `i' command rather than
    simply entering insert mode.

3.  New features in Bash

a.  There is a new version of the autoload function package, in
    examples/functions/autoload.v2, that uses arrays and provides more
    functionality.

b.  Support for LC_COLLATE and locale-specific sorting of the results of
    pathname expansion if strcoll() is available.

4.  New Features in Readline

a.  Support for locale-specific sorting of completion possibilities if
    strcoll() is available.

------------------------------------------------------------------------------
This document details the changes between this version, bash-2.0-beta2,
and the previous version, bash-2.0-beta1.

1.  Changes to Bash

a.  `pushd -' is once again equivalent to `pushd $OLDPWD'.

b.  OS-specific changes for: SCO 3.2v[45].

c.  A change was made to the fix for the recently-reported security hole
    when reading characters with octal value 255 to make it work better on
    systems with restartable system calls when not using readline.

d.  Some changes were made to the test suite so that it works if you
    configure bash with --enable-usg-echo-default.

e.  A fix was made to the parsing of conditional arithmetic expressions.

f.  Illegal arithmetic bases now cause an arithmetic evaluation error rather
    than being silently reset.

g.  Multiple arithmetic bases now cause an arithmetic evaluation error
    instead of being ignored.

h.  A fix was made to the evaluation of ${param?word} to conform to POSIX.2.

i.  A bug that sometimes caused array indices to be evaluated twice (which
    would cause errors when they contained assignment statements) was fixed.

j.  `ulimit' was rewritten to avoid problems with getrlimit(2) returning
    unsigned values and to simplify the code.

k.  A bug in the command-oriented-history code that caused it to sometimes
    put semicolons after right parens inappropriately was fixed.

l.  The values inserted into the prompt by the \w and \W escape sequences
    are now quoted to prevent further expansion.

m.  An interactive shell invoked as `sh' now reads and executes commands
    from the file named by $ENV when it starts up.  If it's a login shell,
    it does this after reading /etc/profile and ~/.profile.

n.  The file named by $ENV is never read by non-interactive shells.

2.  Changes to Readline

a.  A few changes were made to hide some macros and functions that should not
    be public.

b.  An off-by-one error that caused seg faults in the history expansion code
    was fixed.

3.  New Features in Bash

a.  The ksh-style ((...)) arithmetic command was implemented.  It is exactly
    identical to let "...".  This is controlled by a new option to configure,
    `--enable-dparen-arithmetic', which is on by default.

b.  There is a new #define available in config.h.top: SYS_BASH_LOGOUT.  If
    defined to a filename, bash reads and executes commands from that file
    when a login shell exits.  It's commented out by default.

c.  `ulimit' has a `-l' option that reports the maximum amount of data that
    may be locked into memory on 4.4BSD-based systems.

------------------------------------------------------------------------------
This document details the changes between this version, bash-2.0-beta1,
and the previous version, bash-2.0-alpha4.

1.  Changes to Bash

a.  A bug that sometimes caused traps to be ignored on signals the
    shell treats specially was fixed.

b.  The internationalization code was changed to track the values of
    LC_* variables and call setlocale() as appropriate.  The TEXTDOMAIN
    and TEXTDOMAINDIR variables are also tracked; changes cause calls
    to textdomain() and bindtextdomain(), if available.

c.  A bug was fixed that sometimes caused double-quoted strings to be
    parsed incorrectly.

d.  Changes were made so that the siglist code compiles correctly on
    Solaris 2.5.

e.  Added `:' to the set of characters that cause word breaks for the
    completion code so that pathnames in assignments to $PATH can be
    completed.

f.  The `select' command was fixed to print $PS3 to stderr.

g.  Fixed an error in the manual page section describing the effect that
    setting and unsetting GLOBIGNORE has on the setting of the `dotglob'
    option.

h.  The time conversion code now uses CLK_TCK rather than CLOCKS_PER_SEC
    on systems without gettimeofday() and resources.

i.  The getopt static variables are now initialized each time a subshell
    is started, so subshells using `getopts' work right.

j.  A sign-extension bug that caused a possible security hole was fixed.

k.  The parser now reads characters between backquotes within a double-
    quoted string as a single word, so double quotes in the backquoted
    string don't terminate the enclosing double-quoted string.

l.  A bug that caused `^O' to work incorrectly when typed as the first
    thing to an interactive shell was fixed.

m.  A rarely-exercised off-by-one error in the code that quotes variable
    values was fixed.

n.  Some memory and file descriptor leaks encountered when running a
    shell script that is executable but does not have a leading `#!'
    were plugged.

2.  Changes to Readline

a.  A bug that sometimes caused incorrect results when trying to read
    typeahead on systems without FIONREAD was fixed.

3.  New Features in Bash

a.  The command timing code now uses the value of the TIMEFORMAT variable
    to format and display timing statistics.

b.  The `time' reserved word now accepts a `-p' option to force the
    POSIX.2 output format.

c.  There are a couple of new and updated scripts to convert csh startup
    files to bash format.

d.  There is a new builtin array variable: BASH_VERSINFO.  The various
    members hold the parts of the version information in BASH_VERSION,
    plus the value of MACHTYPE.

4.  New Features in Readline

a.  Setting LANG to `en_US.ISO8859-1' now causes readline to enter
    eight-bit mode.

------------------------------------------------------------------------------
This document details the changes between this version, bash-2.0-alpha4,
and the previous version, bash-2.0-alpha3.

1.  Changes to Bash

a.  There is better detection of rsh connections on Solaris 2.

b.  Assignments to read-only variables preceding a command name are now
    variable assignment errors.  Variable assignment errors cause
    non-interactive shells running in posix mode to exit.

c.  The word tokenizer was rewritten to handle nested quotes and pairs
    ('', "", ``, ${...}, $(...), $[...], $'...', $"...", <(...), >(...))
    correctly.  Some of the parameter expansion code was updated as a
    consequence.

d.  A fix was made to `test' when given three arguments so that a binary
    operator is checked for first, before checking that the first argument
    is `!'.

e.  2''>/dev/null is no longer equivalent to 2>/dev/null.

f.  Parser error messages were regularized, and in most cases the name of
    the shell script being read by a non-interactive shell is not printed
    twice.

g.  A fix was made to the completion code so that it no longer removes the
    text the user typed in some cases.

h.  The special glibc `getopt' environment variable is no longer put into
    the environment on machines with small values of ARG_MAX.

i.  The expansion of ${...} now follows the POSIX.2 rules for finding the
    closing `}'.

j.  The shell no longer displays spurious status messages for background
    jobs in shell scripts that complete successfully when the script is
    run from a terminal.

k.  `shopt -o' now correctly updates $SHELLOPTS.

l.  A bug that caused the $PATH searching code to return a non-executable
    file even when an executable file with the same name appeared later in
    $PATH was fixed.

m.  The shell now does tilde expansions on unquoted `:~' in assignment
    statements when not in posix mode.

n.  Variable assignment errors when a command consists only of assignments
    now cause non-interactive shells to exit when in posix mode.

o.  If the variable in a `for' or `select' command is read-only, or not a
    legal shell identifier, a variable assignment error occurs.

p.  `test' now handles `-a' and `-o' as binary operators when three arguments
    are supplied, and correctly parses `( word )' as equivalent to `word'.

q.  `test' was fixed so that file names of the form /dev/fd/NN mean the same
    thing on all systems, even Linux.

r.  Fixed a bug in the globbing code that caused patterns with multiple
    consecutive `*'s to not be matched correctly.

s.  Fixed a bug that caused $PS2 to not be printed when an interactive shell
    not using readline is reading a here document.

t.  Fixed a bug that caused history expansion to be performed inappropriately
    when a single-quoted string spanned more than one line.

u.  `getopts' now checks that the variable name passed by the user as the
    second argument is a legal shell identifier and that the variable is
    not read-only.

v.  Fixed `getopts' to obey POSIX.2 rules for setting $OPTIND when it
    encounters an error.

w.  Fixed `set' to display variable values in a form that can be re-read.

x.  Fixed a bug in the code that keeps track of whether or not local variables
    have been declared at the current level of function nesting.

y.  Non-interactive shells in posix mode now exit if the name in a function
    declaration is not a legal identifier.

z.  The job control code now ignores stopped children when the shell is not
    interactive.

aa. The `cd' builtin no longer attempts spelling correction on the directory
    name if the shell is not interactive, regardless of the setting of the
    `cdspell' option.

bb. Some OS-specific changes were made for SCO 3.2v[45] and AIX 4.2.

cc. `time' now prints its output to stderr, as POSIX.2 specifies.

2.  Fixes to Readline

a.  After printing possible completions, all lines of a multi-line prompt
    are redisplayed.

b.  Some changes were made to the terminal handling code in rltty.c to
    work around AIX 4.2 bugs.

3.  New Features in Bash

a.  There is a new loadable builtin: sprintf, with calling syntax
		sprintf var format [args]
    This provides an easy way to simulate ksh left- and right-justified
    variable values.

b.  The expansions of \h and \H in prompt strings were swapped.  \h now
    expands to the hostname up to the first `.', as in bash-1.14.

4.  New Features in Readline

a.  The bash-1.14 behavior when ^M is typed while doing an incremental
    search was restored.  ^J may now be used to terminate the search without
    accepting the line.

b.  There is a new bindable variable: disable-completion.  This inhibits
    word completion and causes the completion character to be inserted as
    if it had been bound to self-insert.

------------------------------------------------------------------------------
This document details the changes between this version, bash-2.0-alpha3,
and the previous version, bash-2.0-alpha2.

There is now a file `COMPAT' included in the distribution that lists the
user-visible incompatibilities between 1.14 and 2.0.

1. Changes to Bash

a. Some work was done so that word splitting of the rhs of assignment
   statements conforms more closely to historical practice.

b. A couple of errant memory frees were fixed.

c. A fix was made to the test builtin so it recognizes `<' and `>' as
   binary operators.

d. The GNU malloc in lib/malloc/malloc.c now scrambles memory as it's
   allocated and freed.  This is to catch callers that refer to freed
   memory or assume something about newly-allocated memory.

e. Fixed a problem with conversion to 12-hour time in the prompt
   expansion code.

f. Fixed a problem with configure's argument parsing order.  Now you can
   correctly turn on specific options after using --enable-minimal-config.

g. The configure script now automatically disables the use of GNU malloc
   on systems where it's appropriate (better than having people read the
   NOTES file and do it manually).

h. There are new prompt expansions (\v and \V) to insert version information
   into the prompt strings.

i. The default prompt string now includes the version number.

j. Most of the builtins that take no options were changed to use the
   internal getopt so they can produce proper error messages for -?
   and incorrect options.

k. Some system-specific changes were made for SVR4.2 and Solaris 2.5.

l. Bash now uses PATH_MAX instead of MAXPATHLEN and NAME_MAX instead of
   MAXNAMLEN.

m. A couple of problems caused by uninitialized variables were fixed.

n. There are a number of new loadable builtin examples: logname, basename,
   dirname, tty, pathchk, tee, head, and rmdir.  All of these conform to
   POSIX.2.

o. Bash now notices changes in TZ and calls tzset() if present, so
   changing TZ will alter the time printed by prompt expansions.

p. The source was reorganized a bit so I don't have to wait so long for
   some files to compile, and to facilitate the creation of a `shell
   library' at some future point.

q. Bash no longer turns off job control if called as `sh', since the
   POSIX.2 spec includes job control as a standard feature.

r. `bash -o posix' now works as intended.

s. Fixed a problem with the completion code: when completing a filename
   that contained globbing characters, if show-all-if-ambiguous was set,
   the completion code would remove the user's text.

t. Fixed ulimit so that (hopefully) the full range of limits is available
   on HPUX systems.

u. A new `shopt' option (`hostcomplete') enables and disables hostname
   completion.

v. The shell no longer attempts to save the history on an abort(),
   which is usually called by programming_error().

w. The `-s' option to `fc' was changed to echo the command to be executed
   to stderr instead of stdout.

x. If the editor invoked by `fc -e' exits with a non-zero status, no
   commands are executed.

y. Fixed a bug that made the shopt `histverify' option work incorrectly.

z. There is a new variable `MACHTYPE' whose value is the GNU-style
   `cpu-company-system' system description as set by configure.  (The
   values of MACHTYPE and HOSTTYPE should really be swapped.)

aa. The `ulimit' builtin now allows the maximum virtual memory size to be
    set via setrlimit(2) if RLIMIT_VMEM is defined.

bb. `bash -nc 'command'' no longer runs `command'.

2. Changes to Readline

a. Fixed a typo in the code that checked for FIONREAD in input.c.

b. Fixed a bug in the code that outputs keybindings, so things like C-\
   are quoted properly.

c. Fixed a bug in the inputrc file parsing code to handle the problems
   caused by inputrc files created from the output of `bind -p' in
   previous versions of bash.  The problem was due to the bug fixed
   in item b above.

d. Readline no longer turns off the terminal's meta key, and turns it on
   once the first time it's called.

------------------------------------------------------------------------------
This file documents the changes between this version, bash-2.0-alpha2,
and the previous version, bash-2.0-alpha.

1. Changes to Bash

a. The shell no longer thinks directories are executable.

b. `disown' has a new option, `h', which inhibits the resending of SIGHUP
   but does not remove the job from the jobs table.

c. The varargs functions in error.c now use ANSI-C `stdarg' if available.

d. The build process now treats the `build version' in .build as local to
   the build directory, so different versions built from the same source
   tree have different `build versions'.

e. Some problems with the grammar have been fixed. (It used `list' in a few
   productions where `compound_list' was needed.  A `list' must be terminated
   with a newline or semicolon; a `compound_list' need not be.)

f. A fix was made to keep `wait' from hanging when waiting for all background
   jobs.

g. `bash --help' now writes its output to stdout, like the GNU Coding Standards
   specify, and includes the machine type (the value of MACHTYPE).

h. `bash --version' now prints more information and exits successfully, like
   the GNU Coding Standards specify.

i. The output of `time' and `times' now prints fractional seconds with three
   places after the decimal point.

j. A bug that caused process substitutions to screw up the pipeline printed
   by `jobs' was fixed.

k. Fixes were made to the code that implements $'...' and $"..." so they
   work as documented.

l. The process substitution code now opens named pipes for reading with
   O_NONBLOCK to avoid hanging.

m. Fixes were made to the trap code so the shell cleans up correctly if the
   trap command contains a `return' and we're executing a function or
   sourcing a script with `.'.

n. Fixes to doc/Makefile.in so that it doesn't try to remake all of the
   documentation (ps, dvi, etc.) on a `make install'.

o. Fixed an auto-increment error that caused bash -c args to sometimes dump
   core.

p. Fixed a bug that caused $HISTIGNORE to fail when the history line
   contained globbing characters.

2. Changes to Readline

a. There is a new string variable, rl_library_version, available for use by
   applications.  The current value is "2.1".

b. A bug encountered when expand-tilde was enabled and file completion was
   attempted on a word beginning with `~/' was fixed.

c. A slight change was made to the incremental search termination behavior.
   ESC still terminates the search, but if input is pending or arrives
   within 0.1 seconds (on systems with select(2)), it is used as a prefix
   character.  This is intented to allow users to terminate searches with
   the arrow keys and get the behavior they expect.
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

Chet Ramey, Case Western Reserve University	Internet: chet@po.CWRU.Edu


^ permalink raw reply	[relevance 7%]

* Fail to build zsh-3.1.0 on Solaris 2.x with bundled make
@ 1996-12-27  0:55  4% KIMURA Yasuhiro / 木村康浩 
  0 siblings, 0 replies; 200+ results
From: KIMURA Yasuhiro / 木村康浩  @ 1996-12-27  0:55 UTC (permalink / raw)
  To: zsh-workers

Hello Maintainers.

I failed to make zsh-3.1.0 on Solaris 2.x. This may be a problem of
autoconf or OS-buldled make command itself, but I report it
anyway. Since I'm not a subscriber, please ask directly to me if you
have any question.

Version of zsh
==============

3.1.0

Description of problem
======================

Make of zsh-3.1.0 fails on Solaris 2.x when

1. Using OS-bundled make command(i.e /usr/ccs/bin/make).

2. configuring with --enable-dynamic option.

If GNU make is used instead, make successfully finishes.

Environment
===========

This problem happens on following environment.

Japanese Solaris 2.3 for SPARC

Log of 'configure' and 'make'
=============================

Following is a complete log of

% which make; ./configure --enable-dynamic ; make

----------------------------------------------------------------------
/usr/ccs/bin/make
creating cache ./config.cache
configuring for zsh 3.1.0
checking host system type... sparc-sun-solaris2.3
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking whether gcc needs -traditional... no
checking for working const... yes
checking for gcc option to accept ANSI C... 
checking for function prototypes... yes
checking size of long... 4
checking if signed to unsigned casting is broken... no
checking if the compiler supports variable-lenth arrays... yes
checking whether make sets ${MAKE}... yes
checking for a BSD compatible install... /usr/local/gnu/bin/install -c
checking for mawk... no
checking for gawk... no
checking for nawk... nawk
checking for dirent.h that defines DIR... yes
checking for opendir in -ldir... no
checking for ANSI C header files... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether stat file-mode macros are broken... no
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/time.h... yes
checking for sys/times.h... yes
checking for sys/select.h... yes
checking for termcap.h... no
checking for termio.h... yes
checking for termios.h... yes
checking for sys/param.h... yes
checking for sys/filio.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for limits.h... yes
checking for fcntl.h... yes
checking for libc.h... no
checking for sys/utsname.h... yes
checking for sys/resource.h... yes
checking for locale.h... yes
checking for errno.h... yes
checking for stdlib.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for conflicts in sys/time.h and sys/select.h... no
checking ut_host in struct utmp... no
checking ut_host in struct utmpx... yes
checking POSIX termios... yes
checking TIOCGWINSZ in termios.h... yes
checking for sys/ptem.h... yes
checking for tgetent in -ltermcap... yes
checking for getdomainname... no
checking for getdomainname in -lnsl... yes
checking for dlopen in -ldl... yes
checking if an include file defines ospeed... no
checking if you must define ospeed... yes
checking if tgetent accepts NULL... yes
checking return type of signal handlers... void
checking for pid_t... yes
checking for off_t... yes
checking for mode_t... yes
checking for uid_t in sys/types.h... yes
checking for size_t... yes
checking for sigset_t... yes
checking for struct timezone... yes
checking whether getpgrp takes no argument... yes
checking for strftime... yes
checking for waitpid... yes
checking for select... yes
checking for tcsetpgrp... yes
checking for tcgetattr... yes
checking for strstr... yes
checking for lstat... yes
checking for getlogin... yes
checking for setpgid... yes
checking for gettimeofday... yes
checking for gethostname... yes
checking for mkfifo... yes
checking for wait3... no
checking for difftime... yes
checking for sigblock... no
checking for sigsetmask... no
checking for sigrelse... yes
checking for sighold... yes
checking for killpg... no
checking for sigaction... yes
checking for getrlimit... yes
checking for sigprocmask... yes
checking for setuid... yes
checking for seteuid... yes
checking for setreuid... no
checking for setresuid... no
checking for strerror... yes
checking for nis_list... yes
checking for initgroups... yes
checking for dlopen... yes
checking for dlerror... yes
checking for dlsym... yes
checking for dlclose... yes
checking for working strcoll... yes
checking what style of signals to use... POSIX_SIGNALS
checking where signal.h is located... /usr/include/sys/signal.h
checking where the RLIMIT macros are located... /usr/include/sys/resource.h
checking for /dev/fd filesystem... yes
checking for RFS superroot directory... no
checking for NIS... yes
checking for NIS+... no
checking where utmp is located... /etc/utmp
checking where wtmp is located... /etc/wtmp
checking if typeahead needs FIONREAD... no
checking for brk() prototype in <unistd.h>... yes
checking for sbrk() prototype in <unistd.h>... yes
checking for ioctl prototype in <sys/ioctl.h>... no
checking if named FIFOs work... yes
checking if echo in /bin/sh interprets escape sequences... yes
checking if your system use ELF binaries... yes
checking if your dlsym() needs a leading underscore... no
updating cache ./config.cache
creating ./config.status
creating Makefile
creating Src/Makefile
creating Src/Zle/Makefile
creating Src/Modules/Makefile
creating Doc/Makefile
creating Etc/Makefile
creating Misc/Makefile
creating Util/Makefile
creating Functions/Makefile
creating StartupFiles/Makefile
creating config.h

zsh configuration
-----------------
zsh version           : 3.1.0
host operating system : solaris2.3
source code location  : .
compiler              : gcc
compiler flags        :  -Wall -Wno-implicit -Wmissing-prototypes -O2
binary install path   : /usr/local/bin
man page install path : /usr/local/man
info install path     : /usr/local/info

cd Src && make CC='gcc' CPPFLAGS='' DEFS='-DHAVE_CONFIG_H'  CFLAGS='-Wall -Wno-implicit -Wmissing-prototypes -O2' LDFLAGS='' LIBS='-ldl -lnsl  -ltermcap'  prefix='/usr/local' exec_prefix='/usr/local' bindir='/usr/local/bin'  libdir='/usr/local/lib' infodir='/usr/local/info' mandir='/usr/local/man' manext='1'
sed -n -f ./makepro.sed builtin.c > builtin.pro
sed -n -f ./makepro.sed compat.c > compat.pro
sed -n -f ./makepro.sed cond.c > cond.pro
sed -n -f ./makepro.sed exec.c > exec.pro
sed -n -f ./makepro.sed glob.c > glob.pro
sed -n -f ./makepro.sed hashtable.c > hashtable.pro
sed -n -f ./makepro.sed hist.c > hist.pro
sed -n -f ./makepro.sed init.c > init.pro
sed -n -f ./makepro.sed input.c > input.pro
sed -n -f ./makepro.sed jobs.c > jobs.pro
sed -n -f ./makepro.sed lex.c > lex.pro
sed -n -f ./makepro.sed linklist.c > linklist.pro
sed -n -f ./makepro.sed loop.c > loop.pro
sed -n -f ./makepro.sed main.c > main.pro
sed -n -f ./makepro.sed math.c > math.pro
sed -n -f ./makepro.sed mem.c > mem.pro
sed -n -f ./makepro.sed module.c > module.pro
sed -n -f ./makepro.sed params.c > params.pro
sed -n -f ./makepro.sed parse.c > parse.pro
sed -n -f ./makepro.sed prompt.c > prompt.pro
sed -n -f ./makepro.sed signals.c > signals.pro
sed -n -f ./makepro.sed subst.c > subst.pro
sed -n -f ./makepro.sed text.c > text.pro
sed -n -f ./makepro.sed utils.c > utils.pro
sed -n -f ./makepro.sed watch.c > watch.pro
nawk -f ./signames.awk /usr/include/sys/signal.h > signames.h
nawk -f ./rlimits.awk /usr/include/sys/resource.h > rlimits.h
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o builtin.o builtin.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o compat.o compat.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o cond.o cond.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o exec.o exec.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o glob.o glob.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o hashtable.o hashtable.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o hist.o hist.c
( for mod in `cat ./modules-bltin`; do \
    echo "DOMOD(boot_$mod)"; \
done ) > bltinmods.list
Updated `zshpaths.h'.
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o init.o init.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o input.o input.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o jobs.o jobs.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o lex.o lex.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o linklist.o linklist.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o loop.o loop.c
loop.c: In function `execfor':
loop.c:41: warning: `val' might be used uninitialized in this function
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o math.o math.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o mem.o mem.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o module.o module.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o params.o params.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o parse.o parse.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o prompt.o prompt.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o signals.o signals.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o subst.o subst.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o text.o text.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o utils.o utils.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o watch.o watch.c
gcc -c -I.. -I. -I. -IModules -IZle -I./Zle  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2  -o main.o main.c
gcc   -o zsh builtin.o compat.o cond.o exec.o glob.o hashtable.o  hist.o init.o input.o jobs.o lex.o linklist.o loop.o math.o mem.o  module.o params.o parse.o prompt.o signals.o subst.o text.o  utils.o watch.o  main.o -ldl -lnsl  -ltermcap
sed -n -f ./../makepro.sed example.c > example.pro
make: Fatal error: Don't know how to make target `example.so'
Current working directory /tmp/zsh-3.1.0/Src/Modules
*** Error code 1
make: Fatal error: Command failed for target `Modules'
Current working directory /tmp/zsh-3.1.0/Src
*** Error code 1
make: Fatal error: Command failed for target `Src'
----------------------------------------------------------------------

---
KIMURA Yasuhiro // yasu@isl.rdc.toshiba.co.jp
Reserch Lab. III    Communication and Information System Labs.
Research and Developement Center    TOSHIBA CORPORATION


^ permalink raw reply	[relevance 4%]

* Zsh signal handling
@ 1997-01-09  0:57  6% Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1997-01-09  0:57 UTC (permalink / raw)
  To: Zsh hacking and development

As you probably know the most buggy part of zsh is its signal handling
code.

First signals can be lost because zsh waits for child processes with
sigsuspend(~SIGCHILD) which means that all signals are blocked while
executing external commands.  That's why zsh executes a handler even if
only the childs receives a signal.  One related note: I guess that zsh will
not work on systems that have neither waitpid() nor wait3().  On these
systems it tries to use wait() and calls wait() in the SIGCHLD handler in a
loop until wait() fails.  This practically means that zsh do not exit the
SIGCHLD handler as long as any child is running.  With normal scripts this
does not cause any problem but it is quite problematic when there are
background jobs.  But perhaps we cannot do anything better on these
systems.  Perhaps there are no such systems out there.

The other big problem is that shell traps are called from the signal
handler which means that a signal handler can execute anything.  This of
course violates every standard and it is very dangerous since it assumes
that every function used by the shell either in the shell's code itself or
in the system's libc is reentrant.  A better implementation would be to
keep a count for each signal which is increased each time when that signal
is received and and act according to these counts in the normal execution
process.  POSIX says that when a signal is received while the shell is
waiting for the execution of a foreground command, the trap for that signal
is not executed until the command terminated.  If more than one signal is
received during that time, the order of execution of the traps is
unspecified.  Note that as I mentioned above zsh currently completely
ignores signals received while waiting for a foreground job.

We also have to find a way to handle child reaping in the SIGCHLD handler.
The current handler used and modifies the job table that's why we need to
block child signals quite often and do complicated pipe synchronizations.
The handler could place the child statistics to a queue independet from the
job table which can be processed in the normal execution flow.

One minor bug: zsh always resets the signal mask on startup which POSIX
says that the signal mask inherited from the parent should be passed down
to child processes except that SIGINT and SIGQUIT are always blocked for
asynchrous processes.

The pending signals can be checked and processed after each foregroung
pipelone termination.  Here we have to handle untrapped INT signals quiting
from any loops and shell functions.

Time consuming builtins can occasionally check the SIGINT count and can
terminate safely on interrupt.  A lot of code can be simplified as we do
not have to worry any more about unexpectedly changed static and global
variables.  execsave()/execrestore() can be removed.

Of course this means that large parts of jobs.c/signals.c/exec.c have to be
rewritten.  Unfortunately this code is quite hard to understand and
probably noone knows exactly how this works in zsh.  There may be many
compatibility problems here.  I think it would be quite important to fix
this area, since this is really the most buggy part in zsh.  Many
developers may think that zle_tricky.c/lex.c/subst.c/parse.c are more buggy
and ununderstandable but I do not agree here, but that's perhaps because I
worked a lot on these and I may undenstand it better than others.  But in
exec.c/jobs.c/signals.c there are code pieces which I do not understand at
all (but I did not try it very hard so it is probably just a question of
time).  I'd be glad if one would volunteer to start this cleanup.  I'll not
have much time for hacking in february so I will not start it now.

Zoltan


^ permalink raw reply	[relevance 6%]

* Re: vi-goto-column
  @ 1997-01-14 14:05  6% ` Zoltan Hidvegi
  1997-01-14 14:24  0%   ` vi-goto-column Zefram
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1997-01-14 14:05 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

Peter Stephenson wrote:
> The behaviour of vi-goto-column has changed: it now won't go to the
> last column, i.e. the space after all the characters.  This was
> presumably introduced by some mistaken analogy with vi, where there is
> no space at the end of the line after the last inserted character.  In

In vi you cannot put the cursor after the last character and it does not
matter wether it is a space or not.  Zsh just does the same.

The patch below will probably does what you want but vi fans may oppose
this patch.  POSIX.2 upe specifies the requirements for vi mode, but
unfortunately I do not have this document so I do not know how this should
behave.  Bash behaves like zsh so I think the current behaviour
(ie. without the patch below) is correct.

Zoltan


*** Src/Zle/zle_move.c	1997/01/12 00:46:43	3.1.1.5
--- Src/Zle/zle_move.c	1997/01/14 13:46:03
***************
*** 181,188 ****
  	cs = x + zmult;
      else
  	cs = y + zmult;
!     if (cs >= y)
! 	cs = y - 1;
      if (cs < x)
  	cs = x;
  }
--- 181,188 ----
  	cs = x + zmult;
      else
  	cs = y + zmult;
!     if (cs > y)
! 	cs = y;
      if (cs < x)
  	cs = x;
  }


^ permalink raw reply	[relevance 6%]

* Re: vi-goto-column
  1997-01-14 14:05  6% ` vi-goto-column Zoltan Hidvegi
@ 1997-01-14 14:24  0%   ` Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1997-01-14 14:24 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: Z Shell workers mailing list

Zoltan Hidvegi wrote:
>The patch below will probably does what you want but vi fans may oppose
>this patch.  POSIX.2 upe specifies the requirements for vi mode, but
>unfortunately I do not have this document so I do not know how this should
>behave.  Bash behaves like zsh so I think the current behaviour
>(ie. without the patch below) is correct.

This patch is correct.  After any command has been executed, ZLE will
move the cursor back one column if it is at the very end of a line in
vi command mode, so for vi users the visible behaviour is not changed
by this patch.

-zefram


^ permalink raw reply	[relevance 0%]

* Order of field splitting in zsh
@ 1997-01-16 14:07  8% Andrej Borsenkow
  1997-01-16 15:55  8% ` Zoltan Hidvegi
  0 siblings, 1 reply; 200+ results
From: Andrej Borsenkow @ 1997-01-16 14:07 UTC (permalink / raw)
  To: Zsh workers mailing list


POSIX.2 defines the following order of expansions in sh:

1. tilde expansion, parameter expansion, command substitution, arithmetic
expansion
2. field splitting (_after_ the above)
3. pathname expansion (globbing)
4. qoute removal.

It seems, that zsh (even if invoked as sh) does field splitting on result
of command substitution  _immidiately_ after getting the value. The
example is:

% sh #where sh is linked to zsh
% args a$(echo a b)b${IFS::=:}
3
aa
bb
%

(the third being null string). If I understand POSIX specs right, it
should give _two_ arguments ('aa bb' and empty).

This example is obviously artificial; I fail currently to state if it can
be a problem in real life or not. (Note, that ${var::=val} is illegal in
POSIX; I use it to just demonstrate order of substitutions).

greetings

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------



^ permalink raw reply	[relevance 8%]

* Re: Order of field splitting in zsh
  1997-01-16 14:07  8% Order of field splitting in zsh Andrej Borsenkow
@ 1997-01-16 15:55  8% ` Zoltan Hidvegi
  1997-01-22 15:58  0%   ` Andrej Borsenkow
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1997-01-16 15:55 UTC (permalink / raw)
  To: borsenkow.msk; +Cc: zsh-workers

Andrej Borsenkow wrote:
> 
> POSIX.2 defines the following order of expansions in sh:
> 
> 1. tilde expansion, parameter expansion, command substitution, arithmetic
> expansion
> 2. field splitting (_after_ the above)
> 3. pathname expansion (globbing)
> 4. qoute removal.
> 
> It seems, that zsh (even if invoked as sh) does field splitting on result
> of command substitution  _immidiately_ after getting the value. The
> example is:
> 
> % sh #where sh is linked to zsh
> % args a$(echo a b)b${IFS::=:}
> 3
> aa
> bb
> %
> 
> (the third being null string). If I understand POSIX specs right, it
> should give _two_ arguments ('aa bb' and empty).
> 
> This example is obviously artificial; I fail currently to state if it can
> be a problem in real life or not. (Note, that ${var::=val} is illegal in
> POSIX; I use it to just demonstrate order of substitutions).

You are right but that can only cause problems when IFS changes in step
one, and under POSIX it can only happen when it was set to the empty string
previously.  I checked AT&T ksh and pdksh:

% ksh
$ args () { for i; do echo $i; done ; }
$ IFS=
$ args $(echo a b c)${IFS:=' '}
a b c
$ args $(echo a b c)${IFS:=' '}
a
b
c

As you see ksh behaves like zsh.  Bash behaves as POSIX requires.  But I do
not think it is a real problem, and the fix would just complicate the code
unnecessarily.  Note that both ksh I tested claims POSIX compilance.

Zoltan


^ permalink raw reply	[relevance 8%]

* Re: Order of field splitting in zsh
  1997-01-16 15:55  8% ` Zoltan Hidvegi
@ 1997-01-22 15:58  0%   ` Andrej Borsenkow
  0 siblings, 0 replies; 200+ results
From: Andrej Borsenkow @ 1997-01-22 15:58 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: zsh-workers

On Thu, 16 Jan 1997, Zoltan Hidvegi wrote:

> Andrej Borsenkow wrote:
> > 
> > POSIX.2 defines the following order of expansions in sh:
> > 
> > 1. tilde expansion, parameter expansion, command substitution, arithmetic
> > expansion
> > 2. field splitting (_after_ the above)
> > 3. pathname expansion (globbing)
> > 4. qoute removal.
> > 
> > It seems, that zsh (even if invoked as sh) does field splitting on result
> > of command substitution  _immidiately_ after getting the value. The
> > example is:
> > 
...
> 
> You are right but that can only cause problems when IFS changes in step
> one, and under POSIX it can only happen when it was set to the empty string
> previously.  I checked AT&T ksh and pdksh:
> 
...
> 
> As you see ksh behaves like zsh.  Bash behaves as POSIX requires.  But I do
> not think it is a real problem, and the fix would just complicate the code
> unnecessarily.  Note that both ksh I tested claims POSIX compilance.
> 

There is more simple case:

% ./sh (where sh -> /bin/zsh)
% args $(echo 'a ')$(echo 'b')
                ^ note blank here (or any IFS white space)
1
ab
% /bin/ksh
% args $(echo 'a ')$(echo 'b')
2
a
b
% 

The same with /bin/sh (well, my /bin/sh doesn't understand $(...) but with
`...` it behaves like ksh).

greetings

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------





^ permalink raw reply	[relevance 0%]

* compiling zsh 3.10 on Solaris 2.4 for dynamically loaded modules
@ 1997-01-27 17:43  5% Anthony Iano-Fletcher
  0 siblings, 0 replies; 200+ results
From: Anthony Iano-Fletcher @ 1997-01-27 17:43 UTC (permalink / raw)
  To: Zsh-workers

Hi
	Im trying to compile zsh 3.1.0 with dynamically loaded binary
modules (a wonderful idea) for Solaris 2.4. Has anyone got this to work
and is it meant to work on Solaris yet?

I use

	./configure --enable-dynamic
 
and I get the following edited results...

	....
	checking for dlopen... yes
	checking for dlerror... yes
	checking for dlsym... yes
	checking for dlclose... yes
	....
	checking if your dlsym() needs a leading underscore... failed

This failure, I guess, turns off the dynamic option and I get a non-dynamic
zsh. When I try to lie and build a zsh with dynamic loading then it
will read the zle.so library but fail soon after.

Here is the output of truss......
 
open("/tmp/lib/zsh/3.1.0/zle", O_RDONLY)	= 3
fstat(3, 0xDFFFEF4C)				= 0
mmap(0x00000000, 4096, PROT_READ|PROT_EXEC, MAP_SHARED, 3, 0) = 0xDF7B0000
mmap(0x00000000, 319488, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0xDF580000
munmap(0xDF5BB000, 61440)			= 0
mmap(0xDF5CA000, 5784, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 237568) = 0xDF5CA000
open("/dev/zero", O_RDONLY)			= 4
mmap(0xDF5CC000, 5016, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 4, 0) = 0xDF5CC000
close(3)					= 0
mprotect(0xDF580000, 239338, PROT_READ|PROT_WRITE|PROT_EXEC) = 0
munmap(0xDF5CA000, 13208)			= 0
munmap(0xDF580000, 239338)			= 0
close(4)					= 0
munmap(0xDF7B0000, 4096)			= 0
zsh: failed to load module: zle
write(2, " z s h :   f a i l e d  ".., 32)	= 32
getuid()					= 11916 [11916]
argo% write(2, " a r g o %  ", 6)			= 6
read(0, 0xDF6C432C, 1024)			= 0
time()						= 854386460
getpid()					= 1133 [1132]
lseek(0, 0, SEEK_CUR)				= 768892
_exit(0)


Any suggestions? All this was done with a minimal environment in case it
made a difference but it didn't.

			thanks in advance,

				Anthony.



----------------------- full output of configure. --------------

creating cache ./config.cache
configuring for zsh 3.1.0
checking host system type... sparc-sun-solaris2.4
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking whether gcc needs -traditional... no
checking for working const... yes
checking for gcc option to accept ANSI C... 
checking for function prototypes... yes
checking size of long... 4
checking if signed to unsigned casting is broken... no
checking if the compiler supports variable-lenth arrays... yes
checking whether make sets ${MAKE}... yes
checking for a BSD compatible install... /usr/local/bin/ginstall -c
checking for mawk... no
checking for gawk... gawk
checking for dirent.h that defines DIR... yes
checking for opendir in -ldir... no
checking for ANSI C header files... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether stat file-mode macros are broken... no
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/time.h... yes
checking for sys/times.h... yes
checking for sys/select.h... yes
checking for termcap.h... no
checking for termio.h... yes
checking for termios.h... yes
checking for sys/param.h... yes
checking for sys/filio.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for limits.h... yes
checking for fcntl.h... yes
checking for libc.h... no
checking for sys/utsname.h... yes
checking for sys/resource.h... yes
checking for locale.h... yes
checking for errno.h... yes
checking for stdlib.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for conflicts in sys/time.h and sys/select.h... no
checking ut_host in struct utmp... no
checking ut_host in struct utmpx... yes
checking POSIX termios... yes
checking TIOCGWINSZ in termios.h... yes
checking for sys/ptem.h... yes
checking for tgetent in -ltermcap... yes
checking for getdomainname... no
checking for getdomainname in -lnsl... yes
checking for dlopen in -ldl... yes
checking if an include file defines ospeed... no
checking if you must define ospeed... yes
checking if tgetent accepts NULL... yes
checking return type of signal handlers... void
checking for pid_t... yes
checking for off_t... yes
checking for mode_t... yes
checking for uid_t in sys/types.h... yes
checking for size_t... yes
checking for sigset_t... yes
checking for struct timezone... yes
checking whether getpgrp takes no argument... yes
checking for strftime... yes
checking for waitpid... yes
checking for select... yes
checking for tcsetpgrp... yes
checking for tcgetattr... yes
checking for strstr... yes
checking for lstat... yes
checking for getlogin... yes
checking for setpgid... yes
checking for gettimeofday... yes
checking for gethostname... yes
checking for mkfifo... yes
checking for wait3... no
checking for difftime... yes
checking for sigblock... no
checking for sigsetmask... no
checking for sigrelse... yes
checking for sighold... yes
checking for killpg... no
checking for sigaction... yes
checking for getrlimit... yes
checking for sigprocmask... yes
checking for setuid... yes
checking for seteuid... yes
checking for setreuid... no
checking for setresuid... no
checking for strerror... yes
checking for nis_list... yes
checking for initgroups... yes
checking for dlopen... yes
checking for dlerror... yes
checking for dlsym... yes
checking for dlclose... yes
checking for working strcoll... yes
checking what style of signals to use... POSIX_SIGNALS
checking where signal.h is located... /usr/include/sys/signal.h
checking where the RLIMIT macros are located... /usr/include/sys/resource.h
checking for /dev/fd filesystem... yes
checking for RFS superroot directory... no
checking for NIS... no
checking for NIS+... no
checking where utmp is located... /etc/utmp
checking where wtmp is located... /etc/wtmp
checking if typeahead needs FIONREAD... no
checking for brk() prototype in <unistd.h>... yes
checking for sbrk() prototype in <unistd.h>... yes
checking for ioctl prototype in <sys/ioctl.h>... no
checking if named FIFOs work... yes
checking if echo in /bin/sh interprets escape sequences... yes
checking if your system use ELF binaries... yes
checking if your dlsym() needs a leading underscore... failed
updating cache ./config.cache
creating ./config.status
creating Makefile
creating Src/Makefile
creating Src/Zle/Makefile
creating Src/Modules/Makefile
creating Doc/Makefile
creating Etc/Makefile
creating Misc/Makefile
creating Util/Makefile
creating Functions/Makefile
creating StartupFiles/Makefile
creating config.h
config.h is unchanged

zsh configuration
-----------------
zsh version           : 3.1.0
host operating system : solaris2.4
source code location  : .
compiler              : gcc
compiler flags        :  -Wall -Wno-implicit -Wmissing-prototypes -O2
binary install path   : /usr/local/bin
man page install path : /usr/local/man
info install path     : /usr/local/info


^ permalink raw reply	[relevance 5%]

* Re: Short loops?
  @ 1997-02-26 17:26  6% ` Zoltan T. Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan T. Hidvegi @ 1997-02-26 17:26 UTC (permalink / raw)
  To: schaefer; +Cc: Zsh workers list

Bart Schaefer wrote:
> The doc ought to get changed, then.  The two entries for `while' (and
> similarly for all the "short" variants) read:
>
> `while LIST do LIST done'
> `while LIST { LIST }'
>
> The first and second uses of LIST both require either a newline or a
> trailing semicolon; the fourth use of LIST may have a newline or a
> semicolon or not, without affecting the result; and the third use
> requires not only that there NOT be a newline or semicolon, but also
> that the list ends with a [[ ]] (( )) ( ) or { } construct.

No.  No one of the above four LIST require any trailing semicolons or
newlines.  As decribed in the manual, reserved words like do, done, { are
only recognized in command position.  If you write while true { ... } then
{ is not in command position, it is simply an argument to true.  Words are
in command position after a newline or a semicolon or after )) or ]] or
after do, then, {, } etc.  Zsh has to know that { is not a simple argument
to a command, but a reserved word.  The { echo } case works and seems to be
an exception to this rule but is really a pathologic special case handled
explicitely in lex.c and it only works if ignorebraces is not set.  This
syntax worked in bash-1.14 but it no longer works in bash-2.0 because it
violates POSIX.  When ignorebraces is set (e.g. in sh mode) the following
is perfectly valid:

while true { echo foo }
do
        ...
done

Here true is invoked with four arguments: {, echo, foo and }.

Zoltan


^ permalink raw reply	[relevance 6%]

* ZLE special parameters
@ 1997-03-22 16:36  2% Zefram
  1997-03-24  9:54  0% ` Peter Stephenson
  0 siblings, 1 reply; 200+ results
From: Zefram @ 1997-03-22 16:36 UTC (permalink / raw)
  To: zsh-workers

-----BEGIN PGP SIGNED MESSAGE-----

This patch adds some special parameters for user-defined widget functions.
The parameters are created in a nested scope, and removed after the
widget returns.  I had to add an unset method to the parameter type,
because these special parameters need to behave differently depending on
whether they are being explicitly unset or merely going out of scope.
The behaviour of all previously existing special parameters remains
unchanged, but I think maybe some could take advantage of the new
facility.

Incidentally, if I read the unset code correctly, a parameter created
within a function using typeset can actually be removed by a nested
function using unset, although it can't be removed by the function itself.
Is this POSIX behaviour, desirable, neither or both?  I added an exception
that special parameters can never be removed except by going out of
scope; I don't think there are any parameters other than the ones this
patch adds that are affected.

As an example of the things that can be done with these parameters,
try out this widget:

function increment {
  integer n=${(M)LBUFFER%%[0-9]#}${(M)RBUFFER##[0-9]#}
  RBUFFER=${RBUFFER##[0-9]#} 
  LBUFFER=${LBUFFER%%[0-9]#}$((n+1)) 
}

 -zefram

begin 644 zle_params.gz
M'XL(""K;,S,"`WIL95]P87)A;7,`[#U;>]NVDL_NKT#<GH2T*5ND)%_D)F<=
M6TZ]GWQ9V=Z>IMO/2U.0Q88B59*R+3?9W[XS`X`$*<J7.&F3GOI!(0E@,'<,
M@`&RM+3$=B-O]6TR7+T-^,HT6K`W-]=7ZXU5>X,YC79KK=U87[!7UKZIU6KS
MJCH.JT.]S79KXYNEXA^^LTW'LNL-1N^,Q?PBFH1]ED;,97U_,.`Q#U-V[?<O
M>;K"V.G03]C(?<<3E@ZY_,[<*]</W(N`,W[%0W8]Y"'`\M.$39*)&[#0'7$V
M=!-VP:$XYGT^\$/>7X%*WSQC9PF/:_*3A)@P-^9,?9LD?GC)_C=-#:"-U0;F
M"XNY@*0_&@=\!/CQ/D`"\,F0!P$;3$(O]:,P`7Q_!%1T3`%[?L.]"32QZ+L7
MQ3%/QE'8ASX`2A%$L3[VZ;DA&_-X$,4CQOM^BI@94<PB`!:;S)4]`Z1]ZBWF
M7C0"'/M`1SIT4R"F@MID&$V"/@NC%-ATQ8EA"6*3NC%U<>VG0^+`BOD"@2?<
M2XV3%#!RXS[[48`QOT$!<3:(@B"ZQF:`@,L"/TE9-&`N$(8D)ZJ9[-U"YJ',
MA]R/D>GN)$C9A4\L29@?,CYR/1![U.=8]\IG2!,VP4_4%K[Y(5"6TB?21U2L
MYCJ#Q]I7HEB'__:*M2P4BQBW*T%ERK7,/-`)?F,HO2ETB>55#+=`-J2*.4\K
M.&HA=."`Y`EP9`I(QR.0L:@I-8XTA4^IKALD$8LGH6"1Z@\`&:`G].EBX@=I
M#108^%C`54H>Y22$;XJZ4%5U!'#V_!!L9DKRG$KTW!$`((&AD`C"VVX'6J-&
M2U*Q!*B\F`*,F+NH`-0BX6FJNDW&W/.!NK$;@TA2'B>@E8D7^Q?8DH/](@8Y
MS_-Z%L&/8K.Z$(F!$N!24MD+ZK\;7+O31+,NH%OJ<2X1H"D%0%@?U0>JH%"@
M808UFJ2)WR<&@%SV!X)/I&=)-.)*@%=N,.$`2:MN"96E$E3FE(_&4>S&?C"%
MCES/XTGB`V*$!*`&"A#S=!*'`.:Z9'F92?$;<`Q"0:I)!Q(&8$>$(0`*(@_5
MRXO&T$_@O^-Z70\$AT)$LO,NI-JD!K4UI8B$,0$-!G+^2LCD]=G>7J>''Z@$
MVL@OS$B@K1N;IB'DQ,`H_!@]!AA'"$8;$2>%@@G%$NSUR?"O8S]-D041*29J
MP21.0,-C<-/@A)DKU#)!WQ@-!J!U8*EA`"P57+\FES`&Q@)`)10!2?8&3QHE
M.V>]DZ,")?(+,WS`^))KI(C^%`4",8N<C!]6$$5>WR?)8&'LAI>(1AV'">CG
MNV\ESZ1;!C\_%<[;%Q+_#0<!5;<K*R/ZVRFJ%/`2"D?1%=?0T4E6=BLU+,&!
M3^"2LU78-`*AT0M;N>-Q'(UC'S0$A-=7Y%9RKSNK"-VYF@`*F!:A"9$%/D]4
MYP$?E!C,QE%"#,&N,SUQP80N0T+:8E$(ED6@*KJ@T60<N)X:BRK5ZH*GUUR:
M7LBOB><9);(5BT"SL*"GR4)C1F^6&;TG,2/V+X=_.C<4T3/<4&PJ<P-T1KJ+
MN9'<[&"KPK8O)\K#Z<-)[*WBH+WB93..>I/5Z^U&O=UJP>2DY5`T6%$/9R:M
M=GVCW5RKG)G8&XVZ!3]K:G*RP.#/'S##&(_82V8<H[LVA==.W8O:*Z`S!,0,
M]0689IKL^7-LN_`,6M5>#0(7J'W.C@_.3XX[._O;7:CQ.U70BE^R_X,*O<[V
M[M%A]Z<MB"47%B9`>4J0S\<C@&6QNKFEL/J`#_@C7I#B''T9`G]QZ-]%095`
MG);=L)R6D\T6V9(<PHW`35)X--$N,3P7GR\XA+/"T9;"7V@JVE^[>2"\PA[Q
MM[0*`'[_ID8OQ$HV'FU)_+VA&P.2Q,.EI1OXB=SX\JH.;#\\ZW95-1B^V`V&
M#2D,4F"LZA$,^C8:0ZS6IV=)G&K5]<-W7;(VM#GD;MYE@EU-5,VKR.^S)>IA
M$$*)[&(0%O!,(!R!WI*?CXY/ST_VWW9^T?&++B`2>9<`YN)ABY1+B<)1RO4%
MB.)/9OWG9GNU1:RU0`R;=N:B%H#86QY'T/`VC?N3L2$_S%@:&.5QIW>PW>T>
M[0#WGHE"(@P:4X!)1"XLK"X1LME8DY4Q"$>]LD!Q&CT%>0-7$XQ@03H2=M[N
M);(\`&;BFV%N81<X^89Q!,<L-9:("/D*XG*<):CPD8L0']0+9BQI'$UE%Q]8
M=_ODE.@AER.Z@XE[L+Q,Q$<3Z'@"HUH,07?,Z5O^FG,L_R:8ADI)B$(A=#B!
M`1-?(2JT,Q=VFPQBSF>:%L"CAA3PJM6P$O@0I%\10S%6B7!%LS8KJ+`D8`.`
MNA[Z,*,R#-0=0ZBFR<"U([O)O6=B,,EWU]3`\.AQ@=&00)2P5RPGRS01Z)P!
M2W8G^96(+Q_PYY:^9-A!+_XMCP:&8#E3ZF)2$VR@ZY,P2.0CA-&I<C6DK7.4
MB;S&`HZ',+7#@4L.9(B=_`)PZYG99`89%1WA6A,L<#U;:'J<!2ISHRD<\8KF
M@X;Y)2DLA(L::H0R57XJ_U3\-G2388I"61F6@CBGU6YB$.>L9T%<566,Y)KM
ME@WU*]WD1MW:6,^"ALQ#T\A4<-K&$AJ3;;)SP\`/IG!-B9SF/V`8RL<#`<LI
MP[I\'"P<"SQTPM@69HXX;;YP$XY+2@.?!Q1?I\-2VYI&9=]-7=E^DM"R$.(P
M`#_],#IX>"6;HP6)Q4,(UL,K/XY"7%"S,*CD-^,H1M<TV]P=<3&(A&)%H+@T
MJ4-"Z\S;BZ`*3%A1#\1*7S`0"VIB]5`8MDX]J(H0N0I.OA*1+^MHD?L<A`2,
M6&&A,DB05#@7Z!.UY^N6?N4FDVUM9@Y`KLR="Y_V\R_L)?JM;\7:+#O9.S3^
M9;+7/4/($"1AYA*0XZEI0AW3U)J]T9HI9<C:9?6?9?7WCW<[>[:Q;;VV=JQ=
M<)T8G%K;%LR;]@]/.V\ZO??Y'.O]K@6`L89I(7X[IH7]O38MNVY1P])/'4<8
MV<7BMXL6&^/F!YD]1+N3($C$HS9+,RVM2:?7.SR"9CR.P^CAS=[L[T*C2U_U
M!$]Y"ZA^NG]P?-0[9>\%A)/3WO[.:6<78-"&#0E)FNQ?24A)VI?&7"&OKTY4
ME4LE]0:0MJDL+,/MC'KADZP;?'Q@/SF8T].?]G>['8"4IE._'_#[R2P+T:D4
MXLG.=G=[G@SA88=^08+W69EC+)Z=='J'VP>()6[UH+>3:*K7*KK?SZ$:`-8`
M4A^"G0?*%%H,(3!#M4Z@9?8LFV?O55A(`U12E";XEY#B7$NL_Y6E66FC=M.R
MG7K!1J&;<R0Q"_H?(!-PI_X`I,*Z.^<PV=9DU-TAH"BD>P0$CV>')YW3@K4%
MG@AX\!E&^DOQ4K>$AU\R7]\IL>[VX9M%7*6.)0V!&U[F-%!W!?X*](M-O'-7
M)SQOE).\<]3M;I]VA,%(ENH&\R6P-..8T/^,L6@%.6<?;`Q_-&LKM;=A6W8K
M6_G]%K<P!OI#V5<T9WBF#=F*_1H#"ZJ8"4OP#,)HB$TEV^P':6336'P&#'B.
M"XACF`E86L%W6#":EC__4]7'U5.]H+M_V*$Q_GD`Y(51H?#XF+SS\[$"5V9$
MBYSFWCW12]%C[GTTW2UC$<1X=G!X@DAY43`9A2(K`"!)EFIUD;031=D=]8Z.
M3_</B<YL=58@-UOUY(?N?Z/N/4^&P54P6Z_,G[4[C.M./4%&:8HBO%;.KP>Q
M:PT$^*.0WW6U^-;OM_V"Z@H<GH+3.K"[NRO1@FF7PBPK/#[=[KU1L@#8A5($
MMG-`;9$YWJBOH@MIP=)9?AX++GF^N^SX@5'YUVC()2[L?3SU_Q;F?+?2%`SH
M86/F)[/J$F8%V_Y(W#Z#=5>.UVN.9:]M%*)-:']RW#LZ.#XE>8[C:#1."^#K
M6*"6RZOXMC$[`]A]?[=/1,:!XD:A&^NL4Y_F><:=,N,VP!1VC[=/?R!+Z(_=
M=&BQ1?&PB,OJEE9S;__-X5$/IP_/!_YE"&$@U)5/LY45U($$.M!@DNN4S-3C
MS#^:F255O)^CL^KXI;"T4E_7URQ[PRGH*\`Y.-H]ZW;.%;11U)\$_%S"U-X6
M[Y\)SAWG-O?FR&&[U]O^J13CYUT4-1SX7G0-XL-#M+N(C,#%+*%6-Q53-HW%
M)3%,T<J<Q00.6O%_5!63&DL>ZVK\Y?.XI/AW,_INI?]#.*UVU8!SR8H7A8/\
MU,8ZJ]OM9J/M-!;LE<UL2VVV)FZH-=H-N^W8U7D'&U8CFXMYX'F\-&@OO`WX
MJGQ9B:"@SX,TPF4*492]4B&$!NT%^@Y/YRH/;"5BZA.N<6BO[_ATY([AP_]0
M.I'ZC-EP6JV1GWCZ:W3%M=>8#V*>#&>`8';HY52KF,:^]T[_,$G]0$?NRB<@
M3`-R'<5]H(PVA8$]3:7F7SY[BDV$.E5R;89?)39^/->4TLK./5UG;538=@M/
M&C7R?>"9FB*=KU%OUS>K=1:DXBBM)2G1AV8A/6[W^.STQ+#!\;P^>]-F0)'(
MNA6)%R(G@F$R!&T^11/*(0?W@+O=BV9QKWM+[/(O,TJ-DVZ!]OJ5C]C*TMW$
MOR+'7.:1?9BSBE<')VH[CKZ=K:>?J9V_Q^;YX;['W!S##P+PZA([HXU'-T]5
M%SMV5$A/Z"T!5!&20I#"=^8&(E]`R]K*=ONP#I0C+;5L"Q,W@V9I*V0C9@MJ
MF)>2IZ5\_U+/2Q$)"A`/Q<8B'HRH42*N2@EILW_@6BLV#EV5K4*K?/5UP7)M
M._ESLMQB]N?CNGCA-^/[V/]GL+M:XQW4^&:V<BTA_B-I4ZX/.)V4]\N0H)JP
MIMS&1+(>ZA**:$XV*]+S+"-(9?@E8.W>$.1Z<'[ZTW$G;TP95#(+$/?5L^BY
MC;*E>B`1<%.XD4_2I5&:TFJDDRBVIGBDU-B]K_&'.R35^1<&,A`?*4GQ\$I*
M!D8<>#'41STM*/\F+(!$T,@LX&DBT-PA487*N/4929BS&]($DEIKNA^E[#$Z
MKN&G8@6?,EC!('#/)Q7'UQ#%D.,)(3>>:JD6`R:[Q#JH1<K-"4S)JA[H&S(X
M0M9%JR9`RD4HZ4O.$O=R"T0TM+>7+W-3-=G[]V0+0H&U[.WW+[/U^8(,:WEG
MHM^<`L&T"B*`!G-+8VONOV@,'<"DE5$RE_1G0MD:9.^%[)VO2C)%C2Z)1Y/'
M*TT>F&:/1O\(Z<U-R#>+IO?YQ%5M6&MH6&N;>:`%9M:"3^M-7:(Y.FBMA(SQ
M@YL,#^$)9"`1P;(R&M0W<749JV1G5[(\6(C7)N4!4SOL-8J2-,!S7`&_I&Q:
MJ+^$N5=+^<G(@>]E*6!TEN=QZ>C+`C=ZHJ%Y68OZ2N,R#<7+H(K+#QAJ()@L
MC3-,'V.T04+%H%H+,;8PI@\LE2V$VBYGSKK",2Q3!1&=[&F,QUPWD?&/9X$P
M68Q.Z,V+7"HUR$'7[+2R`3^(Z`2SMGZ=L5`$,<_TZ'D);2B\A!D[HH[9CZ5@
M2D<WT=&]Y"&/4?#RZ*;"76JQT]Q$M%I*BY^"UF3ETR!6S3\T-V<M.Q1`&LCT
ME7--!0FI&QWA"@:"=[QY(*YX2/=MMU.+>2!3U8M,7*LC;MFAI"?A)KGX2;"K
MYN0:#$7.NE/BI+:M<2>V<C@N\!+]^',F=U+D"(3U;M@KYIAJ`@F&,LH/4YUV
M>@?GAV"^1S^*_.X`#/IWR=!U&U%<+S'T8U$4+/V$2%;S%5<"G7RYE<!A`UH;
MN`&!.ELJ1YZ<$17>P4_:;WH,HB<_0$@YR\P-9&:>./R1>.E,?#IFU1S<0`YN
MYAS\,!MN/,V0RTY''(\EN))9F\BL/&7S?A0>;Z]W(5'-ETV8JS?R"V6D.6@[
M9YHYB!S0@CW(XV._83PH<T1+`XDD4LXREG[+`CUJ="-G3(VZ@WALE,SRZ7AH
M(\>]F,Q)I`&Q->PL'5H`SW";/Y#)$X8`>NENUJ":/TNT*)0-,8J-/,-6$\J&
M#>K;R)=4GH[$+%_N1J.:-PYJC[:T+3K`H\MQ_,!17K9Y>O@!7;K30@2;F5ZC
M@=K5V"BR[PEX/BT>J<:TFL--&/\;S;62?6J[*C-V46D82_UQ&N<GW#1VES1`
M5'SV4@Q["V@JA*XHR/2Q"2%3HV67S/43H26X^UC$JOF'L5TCWUC/#*>P^WJ7
MZ&]_C?S06)IEG,5>M%_,K/CFRXMY'P_W7P\2TRSITHW)QC?LGZ+K9!SXJ7%C
ML=+,]^QP_[_..B9KL]$[`4@NE`G98LC96&_,^)JGL4P(]8]CVHP2?3ZV52=T
MH.6NY99;6MPC;RM4&>,DO/*!'(),'S6SI52>TJ(&3/?Q.!/+M0_QO0%D%A<S
M9N;[N2(-`JUT+;?23XB"DN:=2%3R9;,%L]7-UKJVWK'9VK2<>CW3N(7DY[Y_
MF=1JOZ!4X9%]S^RZ"5V]J+]@RPR_M.D7D_#APXOM%UN"C-67=&`K7TR2$V^U
M]!$7MP7HB&9;;5>Y+%"GJ?',%%U8PKTHII-7X,>U^X;D`H@X3467F_@)G<4F
MB.#1>\1J<3M:`2(/O2"B>XGD54;70]\;,@51W@!V@3>"1#%>OB4N`0FA]R01
MJR_%`Z8F]&8<(@&QQ?81D_"=)884N4CCAG@<FHZ/7?%X&H5XI1K@G1\((PSY
M#2B^YZ?!=,5\T%*-.MZO[E32D*+C?-HR3?$F@,*!>0&2ME6T\_7+Q?/*Q?/O
M:LU%/\$N/A4/L2_K7BE2O>4*T0'>5J@#+G6EXD2T)G)-UER)N7KMJBB?(NDZ
M4V1PIO#,]\@RCA3/OF>?/_+X.Z+#?IT`*G0I47:"\K%'X)=Q:O;X:U&6Q1QN
M_BEX66'NU2?+V69%8I;7W1YQ&K[$W2<=B/^0;<7?)L/2$6N[W6JUF\Z"O=+<
MR/;A9ZLUVXUFVZZ^4V<=IF<;=2?WE>)#YBGSY7[$-@LXR1N5EA`%9S$\)0$6
M#CMK9YUG[F'3+JI0QUT7Y$`+@Z!H+"^&&X!6>C#?1*]%(2ZC=5E:1S5+C4$N
M\]KB!AGX*FHK5FU-U98FQWC!R)RF:GW*R'-]S7F'7#=@3K617XZCB#*67/T4
ML9EO3-`(J4>E?Y\U_[BSYC;HL)/?L_0(QF?N;QRAJ&-TQ[/[&+/J_["3XF*%
M_N^#X)J-M.K61K[IJQ+R\MVS!</^_GO;-E$FRG6HJSES"53KL08M3R$4`!V3
MKGB)Q%66>-FDE*IRO_<!S!,=!<`&8>BY(0*$X`JX'%Z*H3'?D1<WIV4`G^D`
M:1]'P&J:V91?[/,!6V6B&EYN.Y1[?H;\!F^FME^[T6H`2[-3HW^S5+`4D<.;
M@3%-7CKV>V^2^"@9J/$:,^H.W'>`3<!7_##/H-MD-@S;Z^WZ!MZDTLQ&[GD-
M9/*GTVZLSSGLC1N\V6%O9*I8$:+8;!Q':91.QW3-[W'OZ/0([ZG1<QBA!LLR
M&-6+S%]4KY2WF+U@UB*^8+IAEK>H2E5ZHGJ7R8G9JTA*5*\B)5$'=N5GA92,
MB"_(93M[PH1-?,XS-.%-41Y=_,K1%0$3D>*WW<[1Z_\\*=.L45R@5Z-6H[5$
M:9'.`I4%&G4*"_1IU$4"Q]TJ)'4LBVCJ>.J(EC$MH5K$M8AL`=LBNCJ^A/#.
M$=B]0%A(1DEH)1=0_E3%E*Q3@'9T^D.G)\%I2;?:,U631^*%KN?AZ9^JZS+I
M]?&JKZ#EZO\UJ7Z6DOQ0.RB2&_U9=B#Q?IQ5%''/D?]"K$(?;FYG;N&B*6++
MQH&F41AH9JO2$-.JGB8VP.P:=2V%B#[8V4G[;_W0"R8P3"[J!K0X6R*MJ:)$
MFM4BQ,C%DMS&9EMI!C=;F%M?15EFBHME#@KTO0HVXDS;V2RSL:J^TVXVV\WJ
MLQIX4V?+UGA)'_*M-_TZOE%RF2>Q#S@?RXOHY#[W[V)%8V;MJ^+V.JJ(5SH"
MQJ+$4)#[43+$.8X1B,RC+..9VLR[;`Z*\$BM-^IGM\H5;HMEJWU^M8K1UDKA
M;^%T.&$G?,S8.G/J;5R=J#/@76N&K]F)@A,W90<P!0$>V8VV[<@6U=%075OW
MM1RUDH$K:&*U\KO]_G?T)%[UCEB-[NZ?O2E>JT]):^AAF9@"TLK-;3(4_\G#
M6W$%Y(K68"<:3\6MU(9G(MI.#7&':=0D8'MN`++JBYK;>.<XUL0+IQ,>7_&^
M#NB8QV`^B?S/(H8\YCB;C]V0_LL(=?Q!W0;O7H+^T.0-UW=EJ5Q3]CT>BJEF
M'$W=()VB:B46S6\3;H&+&D__O[FKZ6W<!J+G_`O!*`J[5A=[WNP>`FRP6V!;
M!&Y[Z260)7\0D"55LI(X1?][Y\T,*5)FM$Y.O1BR2`Z'Y%`DAS/S4FRLS?8D
M(:\+@_WVNF>EI>E4DUQOCX\,'R`X'EXF+@M7C0?J/5;M6*61*X0-=5:=A%33
MMTV-JFE"/A@'8<&QU=>P?,Q=+])A@/AW(;5=U&O513_6/&[4+\V^0V#V#0D.
M@O8S9D2#4.%C5OQ._J6B"AA<Y$A#B4+^."6J8O^+]O^?H5.L&^[B+VW=-SBB
ME'S0459JMFZ"C)RXM85I:7F&+L`^J:3A54ZMKHYXYH,&C<_?/7``LE*H%=DA
MVVT`UV!8MX^QUCCE.'&?=2_'QR=)*NJ\!X^L(4B%%F.GF&W8--NA\;:QNI=!
M5;+BP4"55&\'$TT:N\ZL36FHI<1)U^=[93@0X,NKLS:?@-N`7.5E9@Z#N#Q"
M^T>=`Z&5SSIUB6!#X*Q8FH,Y:FAWU`&H$0CC4,QQ?]BT.%;2\4VX!UM;<ZP`
MCL`2RN-G\AY6+BJE`BGANEHEV`HN)J8:1%,U`,E(9AGL7&=0\)A.)E2L+X30
M1/^39-;KTNPRJXW22A.L0#3ILRK?Z!!W?8,#>)KT34%;8X"$5'ND@V;'0B9S
M5%1'G3=.>N/@?"-_NZ>/XGA5?K>?N4L.4?0,6EQ+H8/0Y:(4HR+6X2JB%/-S
M4J9[C;Q_'D'.RRRO=N>YXR0U7/]`$IK>("NK?G?G6>/TRM?Q6%[$9/LZHFV4
MJ+?68353I4]R=[.Z^?7VC]O5[Q^"Y6P"%D:O=V1QP>6E#Y#"V$M,H^VK"I^D
M".!0`)&T\J!OL$PI],U!J5!JY])HBJZ-0)_PDDQ-M_,N9-)OC*`JX%)`H2-@
M+"A8*MI3%E)%EV:&+4%^BUN2C#$CKFD_\?%3\H-FQ:-BD`B);[9.KTI,/$Q0
MXMW"5+R$U"%$5J\A$D&XB$U;B:PX3UPXQB$&*KVFI,4@4:J]M3O#T?4A*XKU
M#=36.%]?APKO0=VM45;#Y-UT\I2Z?'25@<M5QR='H73,_@,7473C+$T&<WQZ
M1E@.]Y58R(N=]X)O_=SG2;;`R;_I0%;&7LGJI4]JR<H(>&3MB^^2_>;8C7!;
M.G:5;'DQNZLINNV8;GLI77<RD(?QKUA"7,=NJ\-3Q_CB?BQ\/STWW@TJK<'S
MYT84`D+@.GENV#-F@Z?E4N^+[=TV#M_\V1)+$YLWY5(078F):'USM*JKX<K8
M]YCD(]#(:`!<945Q?G6=VNC?MDZ1X*N1$<&5;Y#,7%G)OA)7$^=I8CFV5^(Q
MI\:E`GU8AQ-<F/LS?AR!E2M47V=;=N>5=5%8O45%"NV&0H,G2\13,N`H^PY'
MDRQE/DMOXTEGZX@K\R)7LBEXF24MR5N%BQF*N)PCK_,Y7\8LB71%'N)*\VJ`
M+6G\B/H!B(""6A:@_>C2.*)C]+C`2$&\;C.$%BM1.:O;3.\54*B`40\5\QRS
MAKLB.''1MI?VZKO:.YR(/<A<[(^,XK85]>)=Q.+'VPK1O^%#-.V<9;9S?7/E
M^7,-/JRN2T/RPWH0L_\+R#_IY.LK:FJV/<%L[\>RE*D-$Q#X$\S=BV.;-R=K
MR[M`6IH\!98E^H](YQWL4TIGEI+#/*8L!^,C=G2`OY@DB)YEW"2UGEPFN_-&
M^6U1(R5M1<AA2<=.VAO>W'^]O;G[_.?==,_)"A?Q8@D[+OF8O%\X]M_;9JF#
M!OM=:.-'#0^:_73."OMY+;VM^E1[\VZR+>4E8B"O3OXFJ-Q4WBK%<A)(R0FL
M0U(VU6+<+J3-:'FF-+]C/&%*?H8P+!._]&%S@(YTCBR2E";ZG'<80B[D9X<D
MROB>TH`4BU)0BTV1D1C^!S([(7?E&P4/G%\N>.W_<[`^10?+]KZ.SV@(+NW8
2]DT=&\I$M(O_`S*[$C9->@``
`
end

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: ascii

iQCVAwUBMzPbYXD/+HJTpU/hAQGhDAP9HHle4GH5i//G6rQAgrXcXYKln3FNB4cM
twxxLYVCp0mipgmTEDi11qS5bLmTvcCnpUQMlypSZAEnqKrbDhmqNlonoSv0rVb9
kcIIw9ATOi1jCJMHAF/vqlAoZHwvcJFsgdjn6Tf0Mw3NkF8JlnlPP9dlahZ5NRWr
WJehDGyvAUY=
=1GgG
-----END PGP SIGNATURE-----


^ permalink raw reply	[relevance 2%]

* Re: -L option for ttyctl
  @ 1997-03-22 17:42  6% ` Zoltan Hidvegi
  1997-03-22 17:55  6%   ` Zefram
  1997-03-22 18:27  7%   ` Bart Schaefer
  0 siblings, 2 replies; 200+ results
From: Zoltan Hidvegi @ 1997-03-22 17:42 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

> This is an updated form of patch 719, which didn't get into the baseline
> at the time.

I still think that -L options should be changed to -p as required by POSIX.
These patches did not get into the baseline for exatly this reason.
Unfortunately -p is already used for other purposes by some builtins so it
would introduce incompatible changes :-(.

Zoltan


^ permalink raw reply	[relevance 6%]

* Re: -L option for ttyctl
  1997-03-22 17:42  6% ` Zoltan Hidvegi
@ 1997-03-22 17:55  6%   ` Zefram
  1997-03-22 18:27  7%   ` Bart Schaefer
  1 sibling, 0 replies; 200+ results
From: Zefram @ 1997-03-22 17:55 UTC (permalink / raw)
  To: Zoltan Hidvegi

Zoltan Hidvegi wrote:
>I still think that -L options should be changed to -p as required by POSIX.

I never heard of that.  I think we should provide -p on those builtins
that POSIX requires it on, and the zsh traditional -L on everything.

-zefram


^ permalink raw reply	[relevance 6%]

* Re: -L option for ttyctl
  1997-03-22 17:42  6% ` Zoltan Hidvegi
  1997-03-22 17:55  6%   ` Zefram
@ 1997-03-22 18:27  7%   ` Bart Schaefer
  1997-03-22 18:55  6%     ` Zefram
  1 sibling, 1 reply; 200+ results
From: Bart Schaefer @ 1997-03-22 18:27 UTC (permalink / raw)
  To: Zoltan Hidvegi, zsh-workers

On Mar 22, 12:42pm, Zoltan Hidvegi wrote:
} 
} I still think that -L options should be changed to -p as required by POSIX.
} These patches did not get into the baseline for exatly this reason.
} Unfortunately -p is already used for other purposes by some builtins so it
} would introduce incompatible changes :-(.

Perhaps it's time for `emulate posix'.

-- 
Bart Schaefer                             Brass Lantern Enterprises
http://www.well.com/user/barts            http://www.nbn.com/people/lantern


^ permalink raw reply	[relevance 7%]

* Re: -L option for ttyctl
  1997-03-22 18:27  7%   ` Bart Schaefer
@ 1997-03-22 18:55  6%     ` Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1997-03-22 18:55 UTC (permalink / raw)
  To: schaefer; +Cc: Z Shell workers mailing list

Bart Schaefer wrote:
>Perhaps it's time for `emulate posix'.

I thought "emulate sh" was supposed to be emulating the POSIX shell.

-zefram


^ permalink raw reply	[relevance 6%]

* Re: ZLE special parameters
  1997-03-22 16:36  2% ZLE special parameters Zefram
@ 1997-03-24  9:54  0% ` Peter Stephenson
  0 siblings, 0 replies; 200+ results
From: Peter Stephenson @ 1997-03-24  9:54 UTC (permalink / raw)
  To: Zsh hackers list

Zefram wrote:
> Incidentally, if I read the unset code correctly, a parameter created
> within a function using typeset can actually be removed by a nested
> function using unset, although it can't be removed by the function itself.
> Is this POSIX behaviour, desirable, neither or both?

This is probably wrong.  There was an exchange between Bart and me
about funny things with typeset and local variables some time ago.  It
needs rewriting.

I'm getting a core dump with the increment function: it's quite
possible I've missed some necessary intermediate patch, though; the
number pending is rather large at the moment.

% zle -N increment
% bindkey \^xi increment
% echo 38

Hitting ^xi twice gives a core dump.  Any modification of LBUFFER
seems to do this.  It's coming in makezleparams(); createparam() is
returning a NULL because the (oldpm && !(oldpm->flags & PM_UNSET))
test failed.  Oddly enough, it's always when zp->name is BUFFER even
if I only change LBUFFER.  Even if I am missing a patch, I worry about
relying on the parameter not already existing at this point.

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


^ permalink raw reply	[relevance 0%]

* local parameters
@ 1997-03-26 17:46  6% Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1997-03-26 17:46 UTC (permalink / raw)
  To: zsh-workers

function foo {
  integer argv=1
}

drops core.  So do nested calls to user-defined widgets, if you have
the ZLE parameter patch (3014) applied.  This all appears to be related
to some code in createparam() and bin_typeset() that dislikes creating
parameters with the same name as existing special parameters.  I'd like
to rewrite that code to work correctly, but first can someone tell me
why the code currently treats that case specially?  What does POSIX say
about hiding special parameters?

-zefram


^ permalink raw reply	[relevance 6%]

* Re: fchdir not implemented in NeXTSTEP/OPENSTEP
  @ 1997-03-28  6:28  6% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1997-03-28  6:28 UTC (permalink / raw)
  To: cgf; +Cc: zsh-workers

> In article <199703280022.TAA07810@uni.BLaCKSMITH.com>,
> Leo Turetsky  <leo@BLaCKSMITH.com> wrote:
> >Hi! I've been trying to compile zsh 3.1.1 for NeXTSTEP 3.3 and/or OPENSTEP  
> >4.1. Everything compiles cleanly except for two lines which call the function  
> >fchdir. NeXTSTEP/OPENSTEP do not implement the fchdir system call...
> 
> I just joined this mailing list to research this very problem.
> 
> fchdir is also not implemented on Ultrix, SCO v3.2, and AIX 3.2.5, as far
> as I can tell.  I tried scanning the archives for patches that might
> rectify this, but possibly I missed something.

I also noticed this as I now have to use AIX 3.2.5 at work (but it will be
upgraded to 4.1.? till June).  I made some ugly dirty hacks to circumvent
the problem.  I do not have the patch here at home, but I'll post it
tomorrow.

I thought that fchdir was a standard function, mandated by POSIX.1.
Anyway, an OS which calls itself Unix and does not have fchdir is really
broken in my opinion.  Fortunately AIX 4.x already has this.

Zoltan


^ permalink raw reply	[relevance 6%]

* local parameters
@ 1997-03-30 21:29  2% Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1997-03-30 21:29 UTC (permalink / raw)
  To: zsh-workers

-----BEGIN PGP SIGNED MESSAGE-----

This patch fixes handling of local parameters to match ksh.  This is
based on experimentation with pdksh.  The new semantics are that unset
will always delete the parameter node, revealing the parameter in the
outer scope if there is one.  Also, a local parameter can have the same
name as (and therefore hide) a special parameter.

To match ksh, "export" and "typeset -x" are no longer completely
equivalent.  The difference is that "typeset -x" always creates a local
parameter, just like the other uses of "typeset", whereas "export" acts on
an existing parameter if possible, and will otherwise create a parameter
in the global scope.  (Actually, zsh used to forbid exporting local
variables at all, although the code in params.c handles it just fine.)

Special parameters still behave differently from ksh.  In ksh, special
parameter values seem to be obtained each time they are required by
looking up the name, with the effect that special parameters such as
PATH can be given a temporary local value.  If it turns out that POSIX
requires this behaviour, a lot of zsh code will have to change.

In zsh, special parameters are still special: in an exception to the
normal behaviour, they are not deleted when unset.  Consequently, local
special parameters (currently only the ZLE ones) will irreversibly
hide any parameter of the same name in an outer scope.  Furthermore,
to avoid certain problems that have become apparent, changing of the
type of special parameters is forbidden.

This patch really ought to go into 3.0.  I think one or two hunks depend
on changes made in the ZLE parameters patch (3014), but it should be
perfectly safe to just update those bits of code to the state this
patch would leave them in without using anything else from that patch.
The call of unsetparam_pm() that appears in context in this patch should
*not* be changed unless all the relevant parts of 3014 are applied.

 -zefram

 *** Doc/Zsh/builtins.yo	1997/03/29 23:37:14	1.15
 --- Doc/Zsh/builtins.yo	1997/03/29 23:47:42
 ***************
 *** 396,402 ****
   item(tt(export) [ var(name)[tt(=)var(value)] ... ])(
   The specified var(name)s are marked for automatic export
   to the environment of subsequently executed commands.
 ! tt(export) is equivalent to tt(typeset -x).
   )
   findex(false)
   cindex(doing nothing, unsuccessfully)
 --- 396,405 ----
   item(tt(export) [ var(name)[tt(=)var(value)] ... ])(
   The specified var(name)s are marked for automatic export
   to the environment of subsequently executed commands.
 ! Equivalent to tt(typeset -x), except that no parameter will be created
 ! to hide an existing one in an outer scope.
 ! If a parameter specified does not
 ! already exist, it is created in the global scope.
   )
   findex(false)
   cindex(doing nothing, unsuccessfully)
 *** Doc/Zsh/guide.yo	1997/03/29 23:37:15	1.9
 --- Doc/Zsh/guide.yo	1997/03/29 23:37:32
 ***************
 *** 83,88 ****
 --- 83,89 ----
   
   Parameters
   
 + menu(Local Parameters)
   menu(Array Parameters)
   menu(Positional Parameters)
   menu(Parameters Set By The Shell)
 *** Doc/Zsh/params.yo	1997/03/29 23:37:15	1.7
 --- Doc/Zsh/params.yo	1997/03/29 23:38:09
 ***************
 *** 20,31 ****
   If the integer attribute, tt(-i), is set for var(name),
   the var(value) is subject to arithmetic evaluation.
   startmenu()
   menu(Array Parameters)
   menu(Positional Parameters)
   menu(Parameters Set By The Shell)
   menu(Parameters Used By The Shell)
   endmenu()
 ! texinode(Array Parameters)(Positional Parameters)()(Parameters)
   sect(Array Parameters)
   The value of an array parameter may be assigned by writing:
   
 --- 20,50 ----
   If the integer attribute, tt(-i), is set for var(name),
   the var(value) is subject to arithmetic evaluation.
   startmenu()
 + menu(Local Parameters)
   menu(Array Parameters)
   menu(Positional Parameters)
   menu(Parameters Set By The Shell)
   menu(Parameters Used By The Shell)
   endmenu()
 ! texinode(Local Parameters)(Array Parameters)()(Parameters)
 ! sect(Local Parameters)
 ! Shell function executions delimit scopes for shell parameters.
 ! (Parameters are dynamically scoped.)  The tt(typeset) builtin, and its
 ! alternative forms tt(declare), tt(integer), tt(local) and tt(readonly)
 ! (but not tt(export)), can be used to declare a parameter as being local
 ! to the innermost scope.
 ! 
 ! When a parameter is read or assigned to, the
 ! innermost existing parameter of that name is used.  (That is, the
 ! local parameter hides any less-local parameter.)  However, assigning
 ! to a non-existent parameter, or declaring a new parameter with tt(export),
 ! causes it to be created in the em(outer)most scope.
 ! 
 ! Local parameters disappear when their scope ends.
 ! tt(unset) can be used to delete a parameter while it is still in scope; this
 ! will reveal the next outer parameter of the same name.  However, em(special)
 ! parameters are still special when unset.
 ! texinode(Array Parameters)(Positional Parameters)(Local Parameters)(Parameters)
   sect(Array Parameters)
   The value of an array parameter may be assigned by writing:
   
 *** Src/builtin.c	1997/03/29 23:37:23	1.73
 --- Src/builtin.c	1997/03/29 23:53:05
 ***************
 *** 1299,1306 ****
       roff = off;
   
       /* Sanity checks on the options.  Remove conficting options. */
 -     if ((on | off) & PM_EXPORTED)
 - 	func = BIN_EXPORT;
       if (on & PM_INTEGER)
   	off |= PM_RIGHT_B | PM_LEFT | PM_RIGHT_Z | PM_UPPER | PM_ARRAY;
       if (on & PM_LEFT)
 --- 1299,1304 ----
 ***************
 *** 1400,1421 ****
   	    returnval = 1;
   	    continue;
   	}
 - 	if ((pm = (Param) paramtab->getnode(paramtab, asg->name))) {
 - 	    if (pm->flags & PM_SPECIAL) {
 - 		func = 0;
 - 		on = (PM_TYPE(pm->flags) == PM_INTEGER) ?
 - 		    (on &= ~(PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z | PM_UPPER)) :
 - 		    (on & ~PM_INTEGER);
 - 		off &= ~PM_INTEGER;
 - 	    }
 - 	    if (pm->level) {
 - 		if ((on & PM_EXPORTED) && !(on &= ~PM_EXPORTED) && !off)
 - 		    return 1;
 - 	    }
 - 	}
   	bit = 0;    /* flag for switching int<->not-int */
 ! 	if (pm && !(pm->flags & PM_UNSET) && ((((locallevel == pm->level) || func == BIN_EXPORT)
 ! 		&& !(bit = ((off & pm->flags) | (on & ~pm->flags)) & PM_INTEGER)) || (pm->flags & PM_SPECIAL))) {
   	    /* if no flags or values are given, just print this parameter */
   	    if (!on && !roff && !asg->value) {
   		paramtab->printnode((HashNode) pm, 0);
 --- 1398,1409 ----
   	    returnval = 1;
   	    continue;
   	}
   	bit = 0;    /* flag for switching int<->not-int */
 ! 	if ((pm = (Param)paramtab->getnode(paramtab, asg->name)) &&
 ! 	    (((pm->flags & PM_SPECIAL) && pm->level == locallevel) ||
 ! 	     (!(pm->flags & PM_UNSET) &&
 ! 	      ((locallevel == pm->level) || func == BIN_EXPORT) &&
 ! 	      !(bit = ((off & pm->flags) | (on & ~pm->flags)) & PM_INTEGER)))) {
   	    /* if no flags or values are given, just print this parameter */
   	    if (!on && !roff && !asg->value) {
   		paramtab->printnode((HashNode) pm, 0);
 ***************
 *** 1423,1435 ****
   	    }
   	    if ((pm->flags & PM_RESTRICTED) && isset(RESTRICTED)) {
   		zerrnam(name, "%s: restricted", pm->nam, 0);
   		continue;
   	    }
   	    if (PM_TYPE(pm->flags) == PM_ARRAY && (on & PM_UNIQUE) &&
   		!(pm->flags & PM_READONLY & ~off))
   		uniqarray((*pm->gets.afn) (pm));
   	    pm->flags = (pm->flags | on) & ~off;
 ! 	    if ((on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z | PM_INTEGER)) && auxlen)
   		pm->ct = auxlen;
   	    if (PM_TYPE(pm->flags) != PM_ARRAY) {
   		if (pm->flags & PM_EXPORTED) {
 --- 1411,1432 ----
   	    }
   	    if ((pm->flags & PM_RESTRICTED) && isset(RESTRICTED)) {
   		zerrnam(name, "%s: restricted", pm->nam, 0);
 + 		returnval = 1;
 + 		continue;
 + 	    }
 + 	    if((pm->flags & PM_SPECIAL) &&
 + 	       PM_TYPE(on) && PM_TYPE(on) != PM_TYPE(pm->flags)) {
 + 		zerrnam(name, "%s: cannot change type of a special parameter",
 + 		    pm->nam, 0);
 + 		returnval = 1;
   		continue;
   	    }
   	    if (PM_TYPE(pm->flags) == PM_ARRAY && (on & PM_UNIQUE) &&
   		!(pm->flags & PM_READONLY & ~off))
   		uniqarray((*pm->gets.afn) (pm));
   	    pm->flags = (pm->flags | on) & ~off;
 ! 	    if ((on & (PM_LEFT | PM_RIGHT_B | PM_RIGHT_Z | PM_INTEGER)) &&
 ! 		auxlen)
   		pm->ct = auxlen;
   	    if (PM_TYPE(pm->flags) != PM_ARRAY) {
   		if (pm->flags & PM_EXPORTED) {
 *** Src/params.c	1997/03/29 23:37:25	1.41
 --- Src/params.c	1997/03/29 23:37:32
 ***************
 *** 159,180 ****
       noerrs = 0;
   }
   
 ! /* Create a new parameter node */
   
   /**/
   Param
   createparam(char *name, int flags)
   {
 !     Param pm, oldpm, altpm;
 !     int spec;
   
       if (name != nulstring) {
   	oldpm = (Param) paramtab->getnode(paramtab, name);
 - 	spec = oldpm && (oldpm->flags & PM_SPECIAL);
   
 ! 	if ((oldpm && oldpm->level == locallevel) || spec) {
 ! 	    if (oldpm && !(oldpm->flags & PM_UNSET))
   		return NULL;
   	    if ((oldpm->flags & PM_RESTRICTED) && isset(RESTRICTED)) {
   		zerr("%s: restricted", name, 0);
   		return NULL;
 --- 159,186 ----
       noerrs = 0;
   }
   
 ! /* Create a parameter, so that it can be assigned to.  Returns NULL if the *
 !  * parameter already exists or can't be created, otherwise returns the     *
 !  * parameter node.  If a parameter of the same name exists in an outer     *
 !  * scope, it is hidden by a newly created parameter.  An already existing  *
 !  * parameter node at the current level may be `created' and returned       *
 !  * provided it is unset and not special.  If the parameter can't be        *
 !  * created because it already exists, the PM_UNSET flag is cleared.        */
   
   /**/
   Param
   createparam(char *name, int flags)
   {
 !     Param pm, oldpm;
   
       if (name != nulstring) {
   	oldpm = (Param) paramtab->getnode(paramtab, name);
   
 ! 	if (oldpm && oldpm->level == locallevel) {
 ! 	    if (!(oldpm->flags & PM_UNSET) || (oldpm->flags & PM_SPECIAL)) {
 ! 		oldpm->flags &= ~PM_UNSET;
   		return NULL;
 + 	    }
   	    if ((oldpm->flags & PM_RESTRICTED) && isset(RESTRICTED)) {
   		zerr("%s: restricted", name, 0);
   		return NULL;
 ***************
 *** 183,198 ****
   	    pm = oldpm;
   	    pm->ct = 0;
   	    oldpm = pm->old;
 - 	    pm->flags = (flags & (PM_EXPORTED | PM_LEFT | PM_RIGHT_B |
 - 				  PM_RIGHT_Z | PM_LOWER | PM_UPPER |
 - 				  PM_READONLY | PM_TAGGED | PM_UNIQUE)) |
 - 		(pm->flags & (PM_SCALAR | PM_INTEGER | PM_ARRAY | PM_SPECIAL));
 - 	    if (pm->ename &&
 - 		(altpm = (Param) paramtab->getnode(paramtab, pm->ename))) {
 - 		altpm->flags &= ~(PM_UNSET | PM_UNIQUE | PM_UPPER | PM_LEFT |
 - 				  PM_RIGHT_B | PM_RIGHT_Z | PM_LOWER |
 - 				  PM_READONLY | PM_TAGGED | PM_EXPORTED);
 - 	    }
   	} else {
   	    pm = (Param) zcalloc(sizeof *pm);
   	    if ((pm->old = oldpm)) {
 --- 189,194 ----
 ***************
 *** 203,216 ****
   	}
   
   	if (isset(ALLEXPORT) && !oldpm)
 ! 	    pm->flags |= PM_EXPORTED;
 !     } else {
   	pm = (Param) alloc(sizeof *pm);
 ! 	spec = 0;
 !     }
   
 !     if (!spec) {
 ! 	pm->flags = flags;
   	switch (PM_TYPE(flags)) {
   	case PM_SCALAR:
   	    pm->sets.cfn = strsetfn;
 --- 199,210 ----
   	}
   
   	if (isset(ALLEXPORT) && !oldpm)
 ! 	    flags |= PM_EXPORTED;
 !     } else
   	pm = (Param) alloc(sizeof *pm);
 !     pm->flags = flags;
   
 !     if(!(pm->flags & PM_SPECIAL)) {
   	switch (PM_TYPE(flags)) {
   	case PM_SCALAR:
   	    pm->sets.cfn = strsetfn;
 ***************
 *** 1139,1146 ****
   	unsetparam_pm(altpm, 1, exp);
       }
   
 !     if (locallevel >= pm->level &&
 ! 	((locallevel && locallevel == pm->level) || (pm->flags & PM_SPECIAL)))
   	return;
   
       paramtab->removenode(paramtab, pm->nam); /* remove parameter node from table */
 --- 1133,1139 ----
   	unsetparam_pm(altpm, 1, exp);
       }
   
 !     if (locallevel >= pm->level && (pm->flags & PM_SPECIAL))
   	return;
   
       paramtab->removenode(paramtab, pm->nam); /* remove parameter node from table */

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: ascii

iQCVAwUBMz2tH3D/+HJTpU/hAQHTlQP/ZoylfTupCCuzTKjpMh0v7xWAi4tFaOEW
Mvex38gTfXCLDhfFdrxNiqHDkSSw8W/w6ZgMpuYTVHHsxoTauPHyELpoEEUojl1v
NIcvXAc1Dxtn8FJDp6FQhl1/HoHvwnX+CB5CevAhaXMyrl5OqTJoOvARM6SELvue
5mUpifCebOE=
=KU1g
-----END PGP SIGNATURE-----


^ permalink raw reply	[relevance 2%]

* case fall-through
@ 1997-04-01  0:12  5% Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1997-04-01  0:12 UTC (permalink / raw)
  To: zsh-workers

-----BEGIN PGP SIGNED MESSAGE-----

This patch adds a feature from (IIRC) ksh93.  There is a new token,
`;&', which behaves like `;;' except that it allows execution to fall
through to the next branch of the case.

The gettext code for case commands was actually completely broken
before this patch.  It stopped working between 3.0.2 and 3.0.3-test1
(and between 3.1.0-test3 and 3.1.0).  The 3.0 tree ought to have the
text.c hunks of this patch applied, minus the (fairly obvious) parts
relating to this new feature.

 -zefram

 *** Doc/Zsh/grammar.yo	1997/01/29 03:24:53	1.4
 --- Doc/Zsh/grammar.yo	1997/03/31 20:17:35
 ***************
 *** 146,156 ****
   findex(case)
   cindex(case selection)
   cindex(selection, case)
 ! item(tt(case) var(word) tt(in) [ [tt(LPAR())] var(pattern) [ tt(|) var(pattern) ] ... tt(RPAR()) var(list) tt(;;) ] ... tt(esac))(
   Execute the var(list) associated with the first var(pattern)
   that matches var(word), if any.  The form of the patterns
   is the same as that used for filename generation.  See
   noderef(Filename Generation).
   )
   findex(select)
   cindex(user selection)
 --- 146,159 ----
   findex(case)
   cindex(case selection)
   cindex(selection, case)
 ! item(tt(case) var(word) tt(in) [ [tt(LPAR())] var(pattern) [ tt(|) var(pattern) ] ... tt(RPAR()) var(list) (tt(;;)|tt(;&)) ] ... tt(esac))(
   Execute the var(list) associated with the first var(pattern)
   that matches var(word), if any.  The form of the patterns
   is the same as that used for filename generation.  See
   noderef(Filename Generation).
 + If the var(list) that is executed is terminated with tt(;&) rather than
 + tt(;;), the following list is also executed.  This continues until either
 + a list is terminated with tt(;;) or the tt(esac) is reached.
   )
   findex(select)
   cindex(user selection)
 ***************
 *** 243,249 ****
   item(tt(repeat) var(word) var(sublist))(
   This is a short form of tt(repeat).
   )
 ! item(tt(case) var(word) tt({) [ [tt(LPAR())] var(pattern) [ tt(|) var(pattern) ] ... tt(RPAR()) var(list) tt(;;) ] ... tt(}))(
   An alternative form of tt(case).
   )
   item(tt(select) var(name) [ tt(in) var(word) var(term) ] var(sublist))(
 --- 246,252 ----
   item(tt(repeat) var(word) var(sublist))(
   This is a short form of tt(repeat).
   )
 ! item(tt(case) var(word) tt({) [ [tt(LPAR())] var(pattern) [ tt(|) var(pattern) ] ... tt(RPAR()) var(list) (tt(;;)|tt(;&)) ] ... tt(}))(
   An alternative form of tt(case).
   )
   item(tt(select) var(name) [ tt(in) var(word) var(term) ] var(sublist))(
 *** Src/globals.h	1997/03/31 00:52:39	1.43
 --- Src/globals.h	1997/03/31 18:59:05
 ***************
 *** 694,699 ****
 --- 694,700 ----
       "((",	/* DINPAR	     */
       "))",	/* DOUTPAR	     */
       "&|",	/* AMPERBANG	  30 */
 +     ";&",	/* SEMIAMP	     */
   };
   #else
   extern char *tokstrings[];
 *** Src/lex.c	1997/02/04 14:13:05	1.27
 --- Src/lex.c	1997/03/31 19:05:14
 ***************
 *** 215,220 ****
 --- 215,221 ----
       case NEWLIN:
       case SEMI:
       case DSEMI:
 +     case SEMIAMP:
       case AMPER:
       case AMPERBANG:
       case INPAR:
 ***************
 *** 436,447 ****
   	return NEWLIN;
       case LX1_SEMI:
   	d = hgetc();
 ! 	if (d != ';') {
 ! 	    hungetc(d);
 ! 	    lexstop = 0;
 ! 	    return SEMI;
 ! 	}
 ! 	return DSEMI;
       case LX1_AMPER:
   	d = hgetc();
   	if (d == '&')
 --- 437,449 ----
   	return NEWLIN;
       case LX1_SEMI:
   	d = hgetc();
 ! 	if(d == ';')
 ! 	    return DSEMI;
 ! 	else if(d == '&')
 ! 	    return SEMIAMP;
 ! 	hungetc(d);
 ! 	lexstop = 0;
 ! 	return SEMI;
       case LX1_AMPER:
   	d = hgetc();
   	if (d == '&')
 *** Src/loop.c	1997/03/26 09:09:23	1.12
 --- Src/loop.c	1997/03/31 19:55:55
 ***************
 *** 387,400 ****
   
       if (node) {
   	while (*p) {
 ! 	    singsub(p);
 ! 	    if (matchpat(word, *p))
   		break;
   	    p++;
   	    l++;
   	}
 - 	if (*l)
 - 	    execlist(*l, 1, cmd->flags & CFLAG_EXEC);
       }
       return lastval;
   }
 --- 387,403 ----
   
       if (node) {
   	while (*p) {
 ! 	    char *pat = *p + 1;
 ! 	    singsub(&pat);
 ! 	    if (matchpat(word, pat)) {
 ! 		do {
 ! 		    execlist(*l++, 1, **p == ';' && (cmd->flags & CFLAG_EXEC));
 ! 		} while(**p++ == '&' && *p);
   		break;
 + 	    }
   	    p++;
   	    l++;
   	}
       }
       return lastval;
   }
 *** Src/parse.c	1997/01/29 03:25:22	1.18
 --- Src/parse.c	1997/03/31 19:15:33
 ***************
 *** 472,478 ****
   
   /*
    * case	: CASE STRING { SEPER } ( "in" | INBRACE )
 ! 				{ { SEPER } STRING { BAR STRING } OUTPAR list [ DSEMI ] }
   				{ SEPER } ( "esac" | OUTBRACE )
    */
   
 --- 472,479 ----
   
   /*
    * case	: CASE STRING { SEPER } ( "in" | INBRACE )
 ! 				{ { SEPER } STRING { BAR STRING } OUTPAR
 ! 					list [ DSEMI | SEMIAMP ] }
   				{ SEPER } ( "esac" | OUTBRACE )
    */
   
 ***************
 *** 522,528 ****
   	    yylex();
   	    break;
   	}
 ! 	str = tokstr;
   	incasepat = 0;
   	incmdpos = 1;
   	for (;;) {
 --- 523,531 ----
   	    yylex();
   	    break;
   	}
 ! 	str = ncalloc(strlen(tokstr) + 2);
 ! 	*str = ';';
 ! 	strcpy(str + 1, tokstr);
   	incasepat = 0;
   	incmdpos = 1;
   	for (;;) {
 ***************
 *** 549,557 ****
   		if (str[sl - 1] != Bar) {
   		    /* POSIX allows (foo*) patterns */
   		    int pct;
 ! 		    char *s = str;
   
 ! 		    for (s = str, pct = 0; *s; s++) {
   			if (*s == Inpar)
   			    pct++;
   			if (!pct)
 --- 552,560 ----
   		if (str[sl - 1] != Bar) {
   		    /* POSIX allows (foo*) patterns */
   		    int pct;
 ! 		    char *s;
   
 ! 		    for (s = str + 1, pct = 0; *s; s++) {
   			if (*s == Inpar)
   			    pct++;
   			if (!pct)
 ***************
 *** 568,574 ****
   			if (*s == Outpar)
   			    pct--;
   		    }
 ! 		    if (*s || pct || s == str)
   			YYERRORV;
   		    break;
   		} else {
 --- 571,577 ----
   			if (*s == Outpar)
   			    pct--;
   		    }
 ! 		    if (*s || pct || s == str + 1)
   			YYERRORV;
   		    break;
   		} else {
 ***************
 *** 590,596 ****
   	    yylex();
   	    break;
   	}
 ! 	if (tok != DSEMI)
   	    YYERRORV;
   	incasepat = 1;
   	incmdpos = 0;
 --- 593,601 ----
   	    yylex();
   	    break;
   	}
 ! 	if(tok == SEMIAMP)
 ! 	    *str = '&';
 ! 	else if (tok != DSEMI)
   	    YYERRORV;
   	incasepat = 1;
   	incmdpos = 0;
 *** Src/text.c	1997/01/29 03:25:27	1.11
 --- Src/text.c	1997/03/31 20:01:13
 ***************
 *** 264,281 ****
   	    taddstr("fi");
   	    break;
   	case CCASE:
 - 	    taddstr("case ");
 - 	    taddlist(nn->args);
 - 	    taddstr(" in");
 - 	    tindent++;
 - 	    taddnl();
   	    gt2(nn->u.casecmd);
 - 	    tindent--;
 - 	    if (tnewlins)
 - 		taddnl();
 - 	    else
 - 		taddchr(' ');
 - 	    taddstr("esac");
   	    break;
   	case COND:
   	    taddstr("[[ ");
 --- 264,270 ----
 ***************
 *** 316,333 ****
   	    l = _casecmd(n)->lists;
   	    p = _casecmd(n)->pats;
   
   	    for (; *l; p++, l++) {
 - 		taddstr(*p);
 - 		taddstr(") ");
 - 		tindent++;
 - 		gt2(*l);
 - 		tindent--;
 - 		taddstr(";;");
   		if (tnewlins)
   		    taddnl();
   		else
   		    taddchr(' ');
   	    }
   	    break;
   	}
       case N_IF:
 --- 305,333 ----
   	    l = _casecmd(n)->lists;
   	    p = _casecmd(n)->pats;
   
 + 	    taddstr("case ");
 + 	    taddstr(*p++);
 + 	    taddstr(" in");
 + 	    tindent++;
   	    for (; *l; p++, l++) {
   		if (tnewlins)
   		    taddnl();
   		else
   		    taddchr(' ');
 + 		taddstr(*p + 1);
 + 		taddstr(") ");
 + 		tindent++;
 + 		gt2(*l);
 + 		tindent--;
 + 		taddstr(" ;");
 + 		taddchr(**p);
   	    }
 + 	    tindent--;
 + 	    if (tnewlins)
 + 		taddnl();
 + 	    else
 + 		taddchr(' ');
 + 	    taddstr("esac");
   	    break;
   	}
       case N_IF:
 *** Src/zsh.h	1997/03/31 07:51:13	1.56
 --- Src/zsh.h	1997/03/31 19:01:56
 ***************
 *** 116,122 ****
   
   #define SPECCHARS "#$^*()=|{}[]`<>?~;&\n\t \\\'\""
   
 ! enum shopt {
       NULLTOK,		/* 0  */
       SEPER,
       NEWLIN,
 --- 116,122 ----
   
   #define SPECCHARS "#$^*()=|{}[]`<>?~;&\n\t \\\'\""
   
 ! enum {
       NULLTOK,		/* 0  */
       SEPER,
       NEWLIN,
 ***************
 *** 148,185 ****
       DINPAR,
       DOUTPAR,
       AMPERBANG,		/* 30 */
       DOUTBRACK,
       STRING,
       ENVSTRING,
 !     ENVARRAY,
 !     ENDINPUT,		/* 35 */
       LEXERR,
   
       /* Tokens for reserved words */
       BANG,	/* !         */
       DINBRACK,	/* [[        */
 !     INBRACE,    /* {         */
 !     OUTBRACE,   /* }         */	/* 40 */
       CASE,	/* case      */
       COPROC,	/* coproc    */
       DO,		/* do        */
 !     DONE,	/* done      */
 !     ELIF,	/* elif      */ /* 45 */
       ELSE,	/* else      */
       ZEND,	/* end       */
       ESAC,	/* esac      */
 !     FI,		/* fi        */
 !     FOR,	/* for       */ /* 50 */
       FOREACH,	/* foreach   */
       FUNC,	/* function  */
       IF,		/* if        */
 !     NOCORRECT,	/* nocorrect */
 !     REPEAT,	/* repeat    */ /* 55 */
       SELECT,	/* select    */
       THEN,	/* then      */
       TIME,	/* time      */
 !     UNTIL,	/* until     */
 !     WHILE	/* while     */ /* 60 */
   };
   
   /* Redirection types.  If you modify this, you may also have to modify *
 --- 148,186 ----
       DINPAR,
       DOUTPAR,
       AMPERBANG,		/* 30 */
 +     SEMIAMP,
       DOUTBRACK,
       STRING,
       ENVSTRING,
 !     ENVARRAY,		/* 35 */
 !     ENDINPUT,
       LEXERR,
   
       /* Tokens for reserved words */
       BANG,	/* !         */
       DINBRACK,	/* [[        */
 !     INBRACE,    /* {         */	/* 40 */
 !     OUTBRACE,   /* }         */
       CASE,	/* case      */
       COPROC,	/* coproc    */
       DO,		/* do        */
 !     DONE,	/* done      */ /* 45 */
 !     ELIF,	/* elif      */
       ELSE,	/* else      */
       ZEND,	/* end       */
       ESAC,	/* esac      */
 !     FI,		/* fi        */ /* 50 */
 !     FOR,	/* for       */
       FOREACH,	/* foreach   */
       FUNC,	/* function  */
       IF,		/* if        */
 !     NOCORRECT,	/* nocorrect */ /* 55 */
 !     REPEAT,	/* repeat    */
       SELECT,	/* select    */
       THEN,	/* then      */
       TIME,	/* time      */
 !     UNTIL,	/* until     */ /* 60 */
 !     WHILE	/* while     */
   };
   
   /* Redirection types.  If you modify this, you may also have to modify *

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: ascii

iQCVAwUBM0AeeHD/+HJTpU/hAQFXhAQAivqrVvHuhTndExTzOAqiA6+ghvI6Owkl
kMKRYrQ4UoftuNmSJ1UlUfs6lFUKNMNbxXD9ejm3po0PUVZFRPx+pu83DeWUBD2b
pJcnV6Fd+h+ikhPAmqi2+USK6c1dXMtbMEKeJm0Gvh6PJimV6FLqXFK9iuczNA5H
zxtntojvDiM=
=LsIz
-----END PGP SIGNATURE-----


^ permalink raw reply	[relevance 5%]

* Re: zsh not sourcing /etc/profile?
       [not found]         ` <5itdj0$dc0@bmtlh10.bnr.ca>
@ 1997-04-14 17:42  0%       ` Richard Coleman
  1997-04-14 18:45  0%         ` Zoltan T. Hidvegi
  0 siblings, 1 reply; 200+ results
From: Richard Coleman @ 1997-04-14 17:42 UTC (permalink / raw)
  To: zsh-workers

I found this article on comp.unix.shells.  I thought I would
pass it along.

rc

> > I found out it does, yes. However, I did stumble upon some bash sillyness
> > now. One of the admins we have put something similar to the following in
> > /etc/profile:
> > case "$0" in
> >  -bash|-zsh)
> >        do stuff
> >        ;;
> >  ...
> > esac
> 
> > Now, bash seems to expand the $0 to '-bash', whereas zsh expands it to
> > (which I would think is the _correct_ expansion) '/etc/profile'. It's an
> > old bash version we use here (1.14.7(1)), so I assume this is fixed
> > already in newer versions.
> 
> On my system, HP-UX 9.05
> 
> posix-sh, ksh, and bash all return the name of the shell for $0 when
> sourcing a file.
> 
> Only zsh returns the name of the file being sourced.  I suspect the
> right behaviour is to return the shell name.  The reason for this is
> that sourcing a file does not create a new process, it should behave
> as if the file had been typed from the keyboard.  If you type the
> command "echo $0" at the prompt, it should return the shell name.
> Although I really like zsh, I think it does not have the right
> behaviour because you can't rely on $0 to determine which shell is
> interpreting the file.


^ permalink raw reply	[relevance 0%]

* Re: zsh not sourcing /etc/profile?
  1997-04-14 17:42  0%       ` zsh not sourcing /etc/profile? Richard Coleman
@ 1997-04-14 18:45  0%         ` Zoltan T. Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan T. Hidvegi @ 1997-04-14 18:45 UTC (permalink / raw)
  To: Richard Coleman; +Cc: zsh-workers

Richard Coleman wrote:
> I found this article on comp.unix.shells.  I thought I would
> pass it along.
[...]
> > posix-sh, ksh, and bash all return the name of the shell for $0 when
> > sourcing a file.
> >
> > Only zsh returns the name of the file being sourced.  I suspect the
> > right behaviour is to return the shell name.  The reason for this is
> > that sourcing a file does not create a new process, it should behave
> > as if the file had been typed from the keyboard.  If you type the
> > command "echo $0" at the prompt, it should return the shell name.
> > Although I really like zsh, I think it does not have the right
> > behaviour because you can't rely on $0 to determine which shell is
> > interpreting the file.

Under zsh this is controlled by the FUNCTION_ARGZERO option, which is set
when zsh is started as sh/ksh.

Zoltan


^ permalink raw reply	[relevance 0%]

* Re: zsh not sourcing /etc/profile?
@ 1997-04-14 19:51  0% Alain Caron
  1997-04-14 22:38  7% ` Zoltan T. Hidvegi
  0 siblings, 1 reply; 200+ results
From: Alain Caron @ 1997-04-14 19:51 UTC (permalink / raw)
  To: hzoli; +Cc: coleman, zsh-workers

In message "Re: zsh not sourcing /etc/profile?",
'hzoli@vnet.IBM.COM' writes:

>Richard Coleman wrote:
>> I found this article on comp.unix.shells.  I thought I would
>> pass it along.
>[...]
>> > posix-sh, ksh, and bash all return the name of the shell for $0 when
>> > sourcing a file.
>> >
>> > Only zsh returns the name of the file being sourced.  I suspect the
>> > right behaviour is to return the shell name.  The reason for this is
>> > that sourcing a file does not create a new process, it should behave
>> > as if the file had been typed from the keyboard.  If you type the
>> > command "echo $0" at the prompt, it should return the shell name.
>> > Although I really like zsh, I think it does not have the right
>> > behaviour because you can't rely on $0 to determine which shell is
>> > interpreting the file.
>
>Under zsh this is controlled by the FUNCTION_ARGZERO option, which is set
>when zsh is started as sh/ksh.
>
>Zoltan
>

Even there, the behaviour is not the same as ksh.

On HP-UX 9.05


under ksh:

1> echo $0
ksh
2> echo 'echo "$0"' > bar
3> . ./bar
ksh
4> function foo { echo $0 }
5> foo
foo

under zsh :
1> echo $ZSH_VERSION
3.0.2
2> echo $0
zsh
3> [[ -o function_argzero ]] && echo "yes" || echo "no"
yes
4> echo 'echo "$0"' >! bar
5> . ./bar
./bar
6> function foo { echo $0 }
7> foo
foo
8> unsetopt function_argzero
9> [[ -o function_argzero ]] && echo "yes" || echo "no"
no
10> . ./bar
zsh
11> foo
zsh
12> emulate ksh
13> . ./bar
zsh
14> foo
zsh

The behaviour shown by ksh seems, IMHO,  better than the one shown by
zsh.  The reason is that sourcing a file should have the same
behaviour as typing the text.  However, in a function, $0 is more
useful as the name of the function than the name of the shell.

Also, with emulate ksh, the behaviour of zsh is different than ksh.

Shouldn't we change the behaviour of function_argzero option to behave
more like ksh?

Regards,

Alain Caron
Nortel Technology, Montréal, Québec, Canada
email: alainc@nortel.ca


^ permalink raw reply	[relevance 0%]

* Re: zsh not sourcing /etc/profile?
  1997-04-14 19:51  0% Alain Caron
@ 1997-04-14 22:38  7% ` Zoltan T. Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan T. Hidvegi @ 1997-04-14 22:38 UTC (permalink / raw)
  To: Alain Caron; +Cc: Zsh workers list

Alain Caron wrote:
[...]
> Even there, the behaviour is not the same as ksh.
[...]
> under ksh:
> 4> function foo { echo $0 }
> 5> foo
> foo
>
> under zsh :
[...]
> 6> function foo { echo $0 }
[...]
> 12> emulate ksh
[...]
> 14> foo
> zsh

Well, POSIX requires that $0 should always be the name used to invoke the
shell.  The latest ksh claims to be POSIX conformant...  Of course it is
possible to add a new option called something like SCRIPT_ARGZERO but that
would probably just further increase the confusion.

Zoltan


^ permalink raw reply	[relevance 7%]

* POSIX.6
@ 1997-04-26 19:49 12% Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1997-04-26 19:49 UTC (permalink / raw)
  To: zsh-workers

-----BEGIN PGP SIGNED MESSAGE-----

This patch adds some new features, that make the shell aware of POSIX.1e
(POSIX.6) capability (privilege) sets.  (An implementation of POSIX.1e
is currently being developed for Linux; it is currently a bit more than
sufficient to support this code.)

The patch changes the prompt code such that a `#' prompt will be triggered
by POSIX.1e capabilities, as well as EUID zero.  This test is also made
available in the conditional syntax, as `%(!'.

The patch adds a new module, which provides a builtin `cap' with which
the shell's current capabilities can be examined and set.  This is a
crucial feature for a shell in the POSIX.1e environment.  The module also
implements the related POSIX utilities, getcap and setcap; due to the
braindead POSIX design, this actually provides significantly different
semantics from the usual situation of these being distinct programs.

 -zefram

 *** configure.in	1997/03/31 00:07:33	1.36
 --- configure.in	1997/04/26 04:13:29
 ***************
 *** 315,321 ****
   AC_CHECK_HEADERS(sys/time.h sys/times.h sys/select.h termcap.h termio.h \
   		 termios.h sys/param.h sys/filio.h string.h memory.h \
   		 limits.h fcntl.h libc.h sys/utsname.h sys/resource.h \
 ! 		 locale.h errno.h stdlib.h unistd.h)
   if test $dynamic = yes; then
     AC_CHECK_HEADERS(dlfcn.h)
   fi
 --- 315,321 ----
   AC_CHECK_HEADERS(sys/time.h sys/times.h sys/select.h termcap.h termio.h \
   		 termios.h sys/param.h sys/filio.h string.h memory.h \
   		 limits.h fcntl.h libc.h sys/utsname.h sys/resource.h \
 ! 		 locale.h errno.h stdlib.h unistd.h sys/capability.h)
   if test $dynamic = yes; then
     AC_CHECK_HEADERS(dlfcn.h)
   fi
 ***************
 *** 420,425 ****
 --- 420,427 ----
     AC_CHECK_LIB(dl, dlopen)
   fi
   
 + AC_CHECK_LIB(cap, cap_init)
 + 
   dnl ---------------------
   dnl CHECK TERMCAP LIBRARY
   dnl ---------------------
 ***************
 *** 508,514 ****
                 getlogin setpgid gettimeofday gethostname mkfifo wait3 difftime \
                 sigblock sigsetmask sigrelse sighold killpg sigaction getrlimit \
                 sigprocmask setuid seteuid setreuid setresuid setsid strerror \
 !               nis_list initgroups fchdir)
   if test $dynamic = yes; then
     AC_CHECK_FUNCS(dlopen dlerror dlsym dlclose)
   fi
 --- 510,516 ----
                 getlogin setpgid gettimeofday gethostname mkfifo wait3 difftime \
                 sigblock sigsetmask sigrelse sighold killpg sigaction getrlimit \
                 sigprocmask setuid seteuid setreuid setresuid setsid strerror \
 !               nis_list initgroups fchdir cap_init)
   if test $dynamic = yes; then
     AC_CHECK_FUNCS(dlopen dlerror dlsym dlclose)
   fi
 *** Doc/Makefile.in	1997/03/31 00:37:36	1.11
 --- Doc/Makefile.in	1997/04/26 05:43:36
 ***************
 *** 92,97 ****
 --- 92,98 ----
   Zsh/compat.yo Zsh/compctl.yo Zsh/cond.yo Zsh/exec.yo Zsh/expn.yo \
   Zsh/filelist.yo Zsh/files.yo Zsh/func.yo Zsh/grammar.yo Zsh/guide.yo \
   Zsh/index.yo Zsh/intro.yo Zsh/invoke.yo Zsh/jobs.yo Zsh/modules.yo \
 + Zsh/mod_cap.yo \
   Zsh/mod_clone.yo Zsh/mod_comp1.yo Zsh/mod_compctl.yo Zsh/mod_deltochar.yo \
   Zsh/mod_example.yo Zsh/mod_files.yo Zsh/mod_stat.yo \
   Zsh/mod_zle.yo Zsh/options.yo \
 *** Doc/Zsh/guide.yo	1997/03/30 00:49:03	1.10
 --- Doc/Zsh/guide.yo	1997/04/26 05:44:20
 ***************
 *** 104,109 ****
 --- 104,110 ----
   
   Zsh Modules
   
 + menu(The cap Module)
   menu(The clone Module)
   menu(The comp1 Module)
   menu(The compctl Module)
 *** ......................	Thu Sep  7 20:04:30 1995
 --- Doc/Zsh/mod_cap.yo	Sat Apr 26 06:52:41 1997
 ***************
 *** 0 ****
 --- 1,28 ----
 + texinode(The cap Module)(The clone Module)()(Zsh Modules)
 + sect(The cap Module)
 + The tt(cap) module is used for manipulating POSIX.1e (POSIX.6) capability
 + sets.  If the operating system does not support this interface, the
 + builtins defined by this module will do nothing.
 + The builtins in this module are:
 + 
 + startitem()
 + findex(cap)
 + cindex(capabilities, setting)
 + item(tt(cap) [ var(capabilities) ])(
 + Change the shell's process capability sets to the specified var(capabilities),
 + otherwise display the shell's current capabilities.
 + )
 + findex(getcap)
 + cindex(capabilities, getting from files)
 + item(tt(getcap) var(filename) ...)(
 + This is a built-in implementation of the POSIX standard utility.  It displays
 + the capability sets on each specified var(filename).
 + )
 + findex(setcap)
 + cindex(capabilities, setting on files)
 + item(tt(setcap) var(capabilities) var(filename) ...)(
 + This is a built-in implementation of the POSIX standard utility.  It sets
 + the capability sets on each specified var(filename) to the specified
 + var(capabilities).
 + )
 + enditem()
 *** Doc/Zsh/mod_clone.yo	1997/03/17 04:22:14	1.1
 --- Doc/Zsh/mod_clone.yo	1997/04/26 05:44:44
 ***************
 *** 1,4 ****
 ! texinode(The clone Module)(The comp1 Module)()(Zsh Modules)
   sect(The clone Module)
   The tt(clone) module makes available one builtin command:
   
 --- 1,4 ----
 ! texinode(The clone Module)(The comp1 Module)(The cap Module)(Zsh Modules)
   sect(The clone Module)
   The tt(clone) module makes available one builtin command:
   
 *** Doc/Zsh/modules.yo	1997/03/27 01:57:34	1.2
 --- Doc/Zsh/modules.yo	1997/04/26 05:45:58
 ***************
 *** 11,16 ****
 --- 11,19 ----
   .  The modules available are:
   
   startitem()
 + item(tt(cap))(
 + Builtins for manipulating POSIX.1e (POSIX.6) capability (privilege) sets.
 + )
   item(tt(clone))(
   A builtin that can clone a running shell onto another terminal.
   )
 ***************
 *** 40,45 ****
 --- 43,49 ----
   )
   enditem()
   startmenu()
 + menu(The cap Module)
   menu(The clone Module)
   menu(The comp1 Module)
   menu(The compctl Module)
 ***************
 *** 50,55 ****
 --- 54,60 ----
   menu(The stat Module)
   menu(The zle Module)
   endmenu()
 + includefile(Zsh/mod_cap.yo)\x01
   includefile(Zsh/mod_clone.yo)\x01
   includefile(Zsh/mod_comp1.yo)\x01
   includefile(Zsh/mod_compctl.yo)\x01
 *** Doc/Zsh/prompt.yo	1997/03/30 17:09:18	1.4
 --- Doc/Zsh/prompt.yo	1997/04/26 05:56:22
 ***************
 *** 124,131 ****
   Clears to end of line.
   )
   item(tt(%#))(
 ! A `tt(#)' if the shell is running as root, a `tt(%)' if not.
 ! Equivalent to `tt(%(#.#.%%))'.
   )
   item(tt(%v))(
   vindex(psvar, use of)
 --- 124,135 ----
   Clears to end of line.
   )
   item(tt(%#))(
 ! A `tt(#)' if the shell is running with privileges, a `tt(%)' if not.
 ! Equivalent to `tt(%(!.#.%%))'.
 ! The definition of `privileged', for these purposes, is that either the
 ! effective user ID is zero, or, if POSIX.1e capabilities are supported, that
 ! at least one capability is raised in either the Effective or Inheritable
 ! capability vectors.
   )
   item(tt(%v))(
   vindex(psvar, use of)
 ***************
 *** 171,176 ****
 --- 175,181 ----
   sitem(tt(S))(True if the tt(SECONDS) parameter is at least var(n).)
   sitem(tt(v))(True if the array tt(psvar) has at least var(n) elements.)
   sitem(tt(_))(True if at least var(n) shell constructs were started.)
 + sitem(tt(!))(True if the shell is running with privileges.)
   endsitem()
   )
   xitem(tt(%<)var(string)tt(<))
 *** Src/init.c	1997/03/30 18:54:12	1.49
 --- Src/init.c	1997/04/26 04:19:17
 ***************
 *** 449,455 ****
   	prompt = ztrdup("");
   	prompt2 = ztrdup("");
       } else if (emulation == EMULATE_KSH || emulation == EMULATE_SH) {
 ! 	prompt  = ztrdup(geteuid() ? "$ " : "# ");
   	prompt2 = ztrdup("> ");
       } else {
   	prompt  = ztrdup("%m%# ");
 --- 449,455 ----
   	prompt = ztrdup("");
   	prompt2 = ztrdup("");
       } else if (emulation == EMULATE_KSH || emulation == EMULATE_SH) {
 ! 	prompt  = ztrdup(privasserted() ? "# " : "$ ");
   	prompt2 = ztrdup("> ");
       } else {
   	prompt  = ztrdup("%m%# ");
 *** Src/mods.conf	1997/03/27 01:57:50	1.11
 --- Src/mods.conf	1997/04/26 04:47:48
 ***************
 *** 19,24 ****
 --- 19,25 ----
   # (This would be rather neater if we could rely on shell functions in sh.)
   #
   
 + cap:		Modules/cap.o
   example:	Modules/example.o
   files:		Modules/files.o
   clone:		Modules/clone.o
 *** Src/prompt.c	1997/03/30 17:09:23	1.11
 --- Src/prompt.c	1997/04/26 06:01:24
 ***************
 *** 210,215 ****
 --- 210,218 ----
   		case '_':
   		    test = (cmdsp >= arg);
   		    break;
 + 		case '!':
 + 		    test = privasserted();
 + 		    break;
   		default:
   		    test = -1;
   		    break;
 ***************
 *** 493,499 ****
   		break;
   	    case '#':
   		addbufspc(1);
 ! 		*bp++ = (geteuid())? '%' : '#';
   		break;
   	    case 'v':
   		if (!arg)
 --- 496,502 ----
   		break;
   	    case '#':
   		addbufspc(1);
 ! 		*bp++ = privasserted() ? '#' : '%';
   		break;
   	    case 'v':
   		if (!arg)
 *** Src/system.h	1997/03/31 00:07:41	1.15
 --- Src/system.h	1997/04/26 04:21:52
 ***************
 *** 415,420 ****
 --- 415,424 ----
   # endif
   #endif
   
 + #ifdef HAVE_SYS_CAPABILITY_H
 + # include <sys/capability.h>
 + #endif
 + 
   /* DIGBUFSIZ is the length of a buffer which can hold the -LONG_MAX-1 *
    * converted to printable decimal form including the sign and the     *
    * terminating null character. Below 0.30103 > lg 2.                  */
 *** Src/utils.c	1997/03/31 07:51:11	1.73
 --- Src/utils.c	1997/04/26 04:39:19
 ***************
 *** 3525,3530 ****
 --- 3525,3562 ----
       return -1;
   }
   
 + /* Check whether the shell is running with privileges in effect.  *
 +  * This is the case if EITHER the euid is zero, OR (if the system *
 +  * supports POSIX.1e (POSIX.6) capability sets) the process'      *
 +  * Effective or Inheritable capability sets are non-empty.        */
 + 
 + /**/
 + int
 + privasserted(void)
 + {
 +     if(!geteuid())
 + 	return 1;
 + #ifdef HAVE_CAP_INIT
 +     {
 + 	cap_t caps = cap_get_proc();
 + 	if(caps) {
 + 	    /* POSIX doesn't define a way to test whether a capability set *
 + 	     * is empty or not.  Typical.  I hope this is conforming...    */
 + 	    cap_flag_value_t val;
 + 	    cap_value_t n;
 + 	    for(n = 0; !cap_get_flag(caps, n, CAP_EFFECTIVE, &val); n++)
 + 		if(val ||
 + 		   (!cap_get_flag(caps, n, CAP_INHERITABLE, &val) && val)) {
 + 		    cap_free(&caps);
 + 		    return 1;
 + 		}
 + 	    cap_free(&caps);
 + 	}
 +     }
 + #endif /* HAVE_CAP_INIT */
 +     return 0;
 + }
 + 
   #ifdef DEBUG
   
   /**/
 *** Src/Modules/Makefile.in	1997/03/29 14:22:10	1.21
 --- Src/Modules/Makefile.in	1997/04/26 04:48:32
 ***************
 *** 105,118 ****
   ../signames.h ../system.h ../zsh.h ../ztype.h ../../config.h
   
   # generated prototypes
 ! PROTO = example.pro files.pro clone.pro sched.pro stat.pro
   
   # target modules
 ! MODULES = example.so files.so clone.so sched.so stat.so
   
   # object files
 ! OBJS = example.o files.o clone.o sched.o stat.o
 ! DOBJS = example..o files..o clone..o sched..o stat..o
   
   ALLOBJS = $(OBJS) $(DOBJS)
   
 --- 105,118 ----
   ../signames.h ../system.h ../zsh.h ../ztype.h ../../config.h
   
   # generated prototypes
 ! PROTO = cap.pro example.pro files.pro clone.pro sched.pro stat.pro
   
   # target modules
 ! MODULES = cap.so example.so files.so clone.so sched.so stat.so
   
   # object files
 ! OBJS = cap.o example.o files.o clone.o sched.o stat.o
 ! DOBJS = cap..o example..o files..o clone..o sched..o stat..o
   
   ALLOBJS = $(OBJS) $(DOBJS)
   
 ***************
 *** 133,138 ****
 --- 133,139 ----
   
   $(PROTO): ../makepro.sed
   
 + cap.so: cap..o
   example.so: example..o
   files.so: files..o
   clone.so: clone..o
 *** .....................	Thu Sep  7 20:04:30 1995
 --- Src/Modules/cap.c	Sat Apr 26 06:17:17 1997
 ***************
 *** 0 ****
 --- 1,151 ----
 + /*
 +  * $Id$
 +  *
 +  * cap.c - POSIX.1e (POSIX.6) capability set manipulation
 +  *
 +  * This file is part of zsh, the Z shell.
 +  *
 +  * Copyright (c) 1997 Andrew Main
 +  * All rights reserved.
 +  *
 +  * Permission is hereby granted, without written agreement and without
 +  * license or royalty fees, to use, copy, modify, and distribute this
 +  * software and to distribute modified versions of this software for any
 +  * purpose, provided that the above copyright notice and the following
 +  * two paragraphs appear in all copies of this software.
 +  *
 +  * In no event shall Andrew Main or the Zsh Development Group be liable
 +  * to any party for direct, indirect, special, incidental, or consequential
 +  * damages arising out of the use of this software and its documentation,
 +  * even if Andrew Main and the Zsh Development Group have been advised of
 +  * the possibility of such damage.
 +  *
 +  * Andrew Main and the Zsh Development Group specifically disclaim any
 +  * warranties, including, but not limited to, the implied warranties of
 +  * merchantability and fitness for a particular purpose.  The software
 +  * provided hereunder is on an "as is" basis, and Andrew Main and the
 +  * Zsh Development Group have no obligation to provide maintenance,
 +  * support, updates, enhancements, or modifications.
 +  *
 +  */
 + 
 + #include "zsh.h"
 + 
 + #include "cap.pro"
 + 
 + #ifdef HAVE_CAP_INIT
 + 
 + static int
 + bin_cap(char *nam, char **argv, char *ops, int func)
 + {
 +     int ret = 0;
 +     cap_t caps;
 +     if(*argv) {
 + 	caps = cap_from_text(*argv);
 + 	if(!caps) {
 + 	    zwarnnam(nam, "invalid capability string", NULL, 0);
 + 	    return 1;
 + 	}
 + 	if(cap_set_proc(caps)) {
 + 	    zwarnnam(nam, "can't change capabilites: %e", NULL, errno);
 + 	    ret = 1;
 + 	}
 +     } else {
 + 	char *result;
 + 	ssize_t length;
 + 	caps = cap_get_proc();
 + 	if(caps)
 + 	    result = cap_to_text(caps, &length);
 + 	if(!caps || !result) {
 + 	    zwarnnam(nam, "can't get capabilites: %e", NULL, errno);
 + 	    ret = 1;
 + 	} else
 + 	    puts(result);
 +     }
 +     cap_free(&caps);
 +     return ret;
 + }
 + 
 + static int
 + bin_getcap(char *nam, char **argv, char *ops, int func)
 + {
 +     int ret = 0;
 + 
 +     do {
 + 	char *result;
 + 	ssize_t length;
 + 	cap_t caps = cap_get_file(*argv);
 + 	if(caps)
 + 	    result = cap_to_text(caps, &length);
 + 	if (!caps || !result) {
 + 	    zwarnnam(nam, "%s: %e", *argv, errno);
 + 	    ret = 1;
 + 	} else
 + 	    printf("%s %s\n", *argv, result);
 + 	cap_free(&caps);
 +     } while(*++argv);
 +     return ret;
 + }
 + 
 + static int
 + bin_setcap(char *nam, char **argv, char *ops, int func)
 + {
 +     cap_t caps;
 +     int ret = 0;
 + 
 +     caps = cap_from_text(*argv++);
 +     if(!caps) {
 + 	zwarnnam(nam, "invalid capability string", NULL, 0);
 + 	return 1;
 +     }
 + 
 +     do {
 + 	if(cap_set_file(*argv, caps)) {
 + 	    zwarnnam(nam, "%s: %e", *argv, errno);
 + 	    ret = 1;
 + 	}
 +     } while(*++argv);
 +     cap_free(&caps);
 +     return ret;
 + }
 + 
 + #else /* !HAVE_CAP_INIT */
 + 
 + static int
 + bin_notavail(char *nam, char **argv, char *ops, int func)
 + {
 +     zwarnnam(nam, "not available on this system", NULL, 0);
 +     return 1;
 + }
 + 
 + # define bin_cap    bin_notavail
 + # define bin_getcap bin_notavail
 + # define bin_setcap bin_notavail
 + 
 + #endif /* !HAVE_CAP_INIT */
 + 
 + /* module paraphernalia */
 + 
 + static struct binlist bintab[] = {
 +     { "cap",    0, bin_cap,    0,  1, 0, NULL, NULL, 0 },
 +     { "getcap", 0, bin_getcap, 1, -1, 0, NULL, NULL, 0 },
 +     { "setcap", 0, bin_setcap, 2, -1, 0, NULL, NULL, 0 },
 + };
 + 
 + /**/
 + int BOOT(
 + boot_cap)(Module m)
 + {
 +     return !addbuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
 + }
 + 
 + #ifdef MODULE
 + 
 + /**/
 + int CLEANUP(
 + cleanup_cap)(Module m)
 + {
 +     deletebuiltins(m->nam, bintab, sizeof(bintab)/sizeof(*bintab));
 +     return 0;
 + }
 + #endif

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: ascii

iQCVAwUBM2IpYnD/+HJTpU/hAQFT5QP/ZRgcrTZX95f2d4jP0H23zfS3QXuy9wmY
oveB4nn2eopCRjTAU5Uhrq9X0LCojfJZrnfBKgOkCwxC1fmRgNXdS8q24Nz2Ej4p
qFM/3B1zPkH9DgIl9hHn81NPTjiWF9IUGSiRErpexYOFCEoiAfc6LaFSCCwS9Wdv
zrEPfjPW794=
=Jdca
-----END PGP SIGNATURE-----


^ permalink raw reply	[relevance 12%]

* Re: test patches
  @ 1997-05-09 20:40  7% ` Zefram
  1997-05-09 21:04  7%   ` Zoltan T. Hidvegi
  0 siblings, 1 reply; 200+ results
From: Zefram @ 1997-05-09 20:40 UTC (permalink / raw)
  To: Zoltan T. Hidvegi; +Cc: zefram, zsh-workers

Zoltan T. Hidvegi wrote:
>You are right, but if I want to tell people that here is zsh, just link it
>to sh and use it, they will complain that it brakes this and that.

Having brace expansion on in sh mode potentially breaks some programs that
depend on POSIX.  We do intend zsh to be a POSIX conformant sh, don't we?

>                         And some Linux developers simply tell you, that if
>/bin/sh is not bash, then your Linux system is broken anyway.

Anyone that tells you that is mistaken.  Even the Linux kernel Makefiles
don't assume that /bin/sh is bash.

-zefram


^ permalink raw reply	[relevance 7%]

* Re: test patches
  1997-05-09 20:40  7% ` Zefram
@ 1997-05-09 21:04  7%   ` Zoltan T. Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan T. Hidvegi @ 1997-05-09 21:04 UTC (permalink / raw)
  To: Zefram; +Cc: Zsh workers list

Zefram wrote:
> Having brace expansion on in sh mode potentially breaks some programs that
> depend on POSIX.  We do intend zsh to be a POSIX conformant sh, don't we?

Yes.  Unfortunately I do not have the final POSIX.2, just an early draft.
bash, pdksh and ksh93 also intend to be POSIX conformant, and they all have
brace expansion by default.

> >                         And some Linux developers simply tell you, that if
> >/bin/sh is not bash, then your Linux system is broken anyway.
>
> Anyone that tells you that is mistaken.  Even the Linux kernel Makefiles
> don't assume that /bin/sh is bash.

You do not have to convice me, I was probably the first who started using
zsh as /bin/sh more than two years ago.  There was a long thread about
related issues in the Debian development mailing list (which I do not read,
I just saw this thread on the web mirror of the list), and there I saw
posts expressing such opimions.  The thread was about the bash-2.0 upgrade,
and mostly concerned about the broken ((foo); bar) syntax in bash-2.0
(which will be fixed in the next bash as well as the next zsh release).

Zoltan


^ permalink raw reply	[relevance 7%]

* [[ -x file ]]
@ 1997-05-11 17:51  6% Zefram
  1997-05-12  1:04  9% ` Zoltan Hidvegi
  0 siblings, 1 reply; 200+ results
From: Zefram @ 1997-05-11 17:51 UTC (permalink / raw)
  To: zsh-workers

The ChangeLog for 3.1.2-test1:
#	* Src/cond.c: [[ -x file ]] does stat for privileged users

I think this is a bad idea.  access(, X_OK) is the right way to test for
executability.  The new test gets it wrong over NFS with root squash,
and on directories with no execute bits set (which *are* executable to
the super-user).  Furthermore, with POSIX.1e capabilities, it is one
specific capability (well, two, CAP_DAC_READ_SEARCH for directories and
CAP_DAC_EXECUTE for files) that overrides normal DAC, whereas the new
code tests for *any* capability being set.

What was the reason for this change?

-zefram


^ permalink raw reply	[relevance 6%]

* Re: [[ -x file ]]
  1997-05-11 17:51  6% [[ -x file ]] Zefram
@ 1997-05-12  1:04  9% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1997-05-12  1:04 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

> The ChangeLog for 3.1.2-test1:
> #	* Src/cond.c: [[ -x file ]] does stat for privileged users
> 
> I think this is a bad idea.  access(, X_OK) is the right way to test for
> executability.  The new test gets it wrong over NFS with root squash,
> and on directories with no execute bits set (which *are* executable to
> the super-user).  Furthermore, with POSIX.1e capabilities, it is one
> specific capability (well, two, CAP_DAC_READ_SEARCH for directories and
> CAP_DAC_EXECUTE for files) that overrides normal DAC, whereas the new
> code tests for *any* capability being set.
> 
> What was the reason for this change?

access(, X_OK) simply does not work for root, it is always true, regardless
of permissions or NFS root squash.  Both ksh93 and bash does stat (ksh93
usually use access, but uses stat if it has provileges).  But you are right
that I should check if it is a directory.  I do not have POSIX.1e.  Either
send a fix using the correct POSIX.1e calls, or point me to a
documentation.  access(, X_OK) might work on an OS other than Linux, but I
seem to remember someone complaining about this using some other OS so it
seems to be a general problem.  The other problem with access is that it
uses the real instead of the effective user user/group ids.  It would be
rather complicated to fix that since this means that we need to chechk the
owner and group of the file, and compare that with the effective uid/gid
and the list of additional groups the process has )-:.

My non-current posix docs say:

    -x file      True if file exists and is executable.  True shall
                 indicate only that the execute flag is on.  If file is a
                 directory, true indicates that file can be searched.

As you can see, it does not mention real/effective ids.  Ksh93 consequently
uses the effective privileges for -x.  Bash uses stat only, and returns
false if no executable bit is set, even for root and directories.  pdksh
use access only.  This means that the three POSIX shell I have behave three
different way in this case, and ksh93 seems to be the most correct.  It
would be helpfull if someone with the latest POSIX docs can clarify this.
Note that this also affects the -r, -w, -a flags.

Zoltan


^ permalink raw reply	[relevance 9%]

* Warning: patch-2.2 and zsh-3.1.2 patch
@ 1997-05-12 10:51  6% Andrej Borsenkow
  1997-05-12 18:14  6% ` Zoltan T. Hidvegi
  0 siblings, 1 reply; 200+ results
From: Andrej Borsenkow @ 1997-05-12 10:51 UTC (permalink / raw)
  To: Zsh workers mailing list

Probably of some interest: I had problems with new patch 2.2. First, it
rejects plain -p option (without operand); second, if given patch
_without_ -p option at all, it cannot find any file with pathname.

patch -p0 seems to work. I don't remember, if -p0 was legal option in
earlier versions of patch, but if yes, please, add it to your shell
script. 

As a side note, our shell doesn't like 
     echo $errors hunk(s) failed.
line. It complaints "syntax error: `(' unexpected". It is claimed to be
POSIX-compliant.

greetings

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------



^ permalink raw reply	[relevance 6%]

* Re: Warning: patch-2.2 and zsh-3.1.2 patch
  1997-05-12 10:51  6% Warning: patch-2.2 and zsh-3.1.2 patch Andrej Borsenkow
@ 1997-05-12 18:14  6% ` Zoltan T. Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan T. Hidvegi @ 1997-05-12 18:14 UTC (permalink / raw)
  To: borsenkow.msk

Andrej Borsenkow wrote:
> Probably of some interest: I had problems with new patch 2.2. First, it
> rejects plain -p option (without operand); second, if given patch

That's bad.  I've been using using patch -p for ages.

> _without_ -p option at all, it cannot find any file with pathname.

Yes, you should not use it without -p.  It can patch the wrong Makefile.in
and other bad things can happen.

> patch -p0 seems to work. I don't remember, if -p0 was legal option in
> earlier versions of patch, but if yes, please, add it to your shell
> script.

Yes, -p0 was always legal, but I was always lazy to write this redundant
zero.  And I'm sure that I'll keep forgetting this well after I upgrade my
patch program.

> As a side note, our shell doesn't like
>      echo $errors hunk(s) failed.
> line. It complaints "syntax error: `(' unexpected". It is claimed to be
> POSIX-compliant.

Which is OK, since no other POSIX/Bourne shell can parse that line.  I did
not notice this since when I tested this, the patch did not fail and this
line was never executed.

Zoltan


^ permalink raw reply	[relevance 6%]

* Re: stopping "wait" in (sub)script ?
  @ 1997-05-16  7:11  5% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1997-05-16  7:11 UTC (permalink / raw)
  To: Zsh hacking and development

I wrote:
> No.  The problem is that $(...) does not enter the new process to the
> process table.  $(<...) does not fork, so it is not surprising that it
> works.  The problem is that `cat ss` forks, and does an entersubsh after
> the fork().  When a process terminates the SIGCHLD handler calls
> update_job, which should reattach the terminal, but it does not do that
> since the terminated job was not in the process table so update_job() is
> not even called :-(.

I checked bash, ksh and pdksh, and all run command substituion in the same
process group as the shell.  This is logical, since a command substitution
cannot be backgrounded, and it solvs all the problems I described above,
plus some more.  The patch below should be applied on the top of my
previous patch (it does not depend on it, it just fixes an other bug).
What's also fix is:

% trap 'echo TERM' TERM
% echo `sh -c 'kill -TERM $$'`
TERM

As you see, the TERM trap is executed although the sell did not receive the
term signal, only the command substitution process terminated.  This
happened with all signals, not just SIGTERM (funny that bash has the same
bug, although only with the INT signal).

In most places where MONITOR is unset the terminal signals are set to
defaul.  This does not seems to be necessary here.  This copies the ksh93
behavious (pdksh and bash simply hangs when ^Z is pressed during command
substitution).  I have no idea why zsh need to change the SIGPIPE handler
when MONITOR is changed.  Anyone who knows better, please explain.  I also
wonder if we should add these signal changes to dosetopt() when MONITOR is
(un)set.  Examining ksh, pdksh and bash it seems that an interactive shell
should get a new process group and attach the terminal to this process
group on startup and it shoud restore its original process group and
reattach the terminal to this process group upon exit or before exec.  Any
comments about this?  It would be helpful if someone could look up the
relevant informations from POSIX 2a UPE.

Zoltan


*** Src/signals.c	1997/05/08 07:16:47	3.1.2.4
--- Src/signals.c	1997/05/16 05:05:35
***************
*** 422,434 ****
  	    for (;;) {
  		if (pid == *procsubpid) {
  		    *procsubpid = 0;
! 		    if (WIFSIGNALED(status)) {
  			*procsubval = (0200 | WTERMSIG(status));
! 			if (WTERMSIG(status) == SIGINT)
! 			    kill(getpid(), SIGINT);
! 			else if (sigtrapped[WTERMSIG(status)])
! 			    dotrap(WTERMSIG(status));
! 		    } else
  			*procsubval = WEXITSTATUS(status);
  		    times(&shtms);
  		    goto cont;
--- 422,430 ----
  	    for (;;) {
  		if (pid == *procsubpid) {
  		    *procsubpid = 0;
! 		    if (WIFSIGNALED(status))
  			*procsubval = (0200 | WTERMSIG(status));
! 		    else
  			*procsubval = WEXITSTATUS(status);
  		    times(&shtms);
  		    goto cont;
*** Src/exec.c	1997/05/09 05:36:44	3.1.2.8
--- Src/exec.c	1997/05/16 06:31:45
***************
*** 2109,2116 ****
      child_unblock();
      zclose(pipes[0]);
      redup(pipes[1], 1);
      entersubsh(Z_SYNC, 1, 0);
-     signal_ignore(SIGTSTP);
      execlist(list, 0, 1);
      close(1);
      _exit(lastval);
--- 2109,2116 ----
      child_unblock();
      zclose(pipes[0]);
      redup(pipes[1], 1);
+     opts[MONITOR] = 0;
      entersubsh(Z_SYNC, 1, 0);
      execlist(list, 0, 1);
      close(1);
      _exit(lastval);
***************
*** 2233,2240 ****
  
      /* pid == 0 */
      redup(fd, 1);
      entersubsh(Z_SYNC, 1, 0);
-     signal_ignore(SIGTSTP);
      execlist(list, 0, 1);
      close(1);
      _exit(lastval);
--- 2233,2240 ----
  
      /* pid == 0 */
      redup(fd, 1);
+     opts[MONITOR] = 0;
      entersubsh(Z_SYNC, 1, 0);
      execlist(list, 0, 1);
      close(1);
      _exit(lastval);


^ permalink raw reply	[relevance 5%]

* Re: exporting arrays
  @ 1997-06-05  6:18  7% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1997-06-05  6:18 UTC (permalink / raw)
  To: Bernd Eggink; +Cc: zsh-workers

> "ar" shows up in the list, but in the following 'zsh'-invocation it is
> unset. Is this intentional? I didn't find any  restrictions mentioned in
> the manual.

The restriction is in Unix.  The contents of an environment variable is
always a plain null-terminated string on Unix.  It is possible to hack
something as a workaround, but there is no prefect solution as far as I
know.  Neither bash not ksh exports arrays.  More precisely ksh93 does
export arrays but only the first array element gets into the enviromnet
(which is consistent since without subscritps a ksh array behaves like a
variable with the first array element as its value).

Exported functions has similar problems (just try foo='() {' bash to
see what I meen).  Probably that's why ksh93 does not have exported
functions and POSIX does not require it.

The foo()=... encoding to put functions into the environment seems to be
more reasonable and does not have the problem mentioned above.  It was even
included in some early POSIX drafts.  I wonder why doesn't bash use that
method instead of this ambiguous foo='() { ...' encoding.

Zoltan


^ permalink raw reply	[relevance 7%]

* Re: incorrect behavior of zsh under su on SUNOS-4.1.3
  @ 1997-06-09 16:09  6% ` Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1997-06-09 16:09 UTC (permalink / raw)
  To: bluen; +Cc: zsh-workers

Juergen Peter "bluen wrote:
>what many programs do to spawn a shell or a subshell,
>zsh_name (the variable in the sourcecode) is set to argv[0] of the
>spawning program.

zsh_name is set to zsh's argv[0], which is whatever the execing program
wants it to be.

>This looks quite ok for me (at least for most programs), but when the
>shell-spawning program is /bin/su (or /usr/5bin/su) of SunOS, this
>prevents the shell from reading its initialisation files (/etc/zshenv
>and so on),

Opinion: this behaviour of su is broken.  It should set argv[0]
conventionally -- the shell has no need to know it is being run by su.

>	if zsh_name is set to something different than zsh (or -zsh),
>	always set it to "zsh", so that init files are read for every
>	subshell in the ususal way.

No, there's a reason why zsh_name gets set to argv[0].  zsh will emulate
ksh or POSIX sh if argv[0] (and therefore zsh_name) are set to "ksh" or
"sh".  If zsh_name were always "zsh", there wouldn't be any point in it
being a variable.

-zefram


^ permalink raw reply	[relevance 6%]

* Re: no $USER when root
  @ 1997-06-22  2:55  6%   ` Stefan Monnier
  0 siblings, 0 replies; 200+ results
From: Stefan Monnier @ 1997-06-22  2:55 UTC (permalink / raw)
  To: zsh-workers

Zoltan Hidvegi <hzoli@ny.frontiercomm.net> writes:
> > Sorry is this is old news to you all, but I just realized that when I am  
> > logged in as root there is no $USER variable set.
> USER is not set by zsh, it should be set by login or su or xdm or whatever.

Also, IIRC, the official POSIX envvar for that is LOGNAME rather than USER.
Or am I blowing hot air ?


        Stefan


^ permalink raw reply	[relevance 6%]

* Re: Completion bug introduced in 3.0.3
  @ 1997-07-02  6:55  5% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1997-07-02  6:55 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Zsh hacking and development, Ingo.Wilken

> On Jul 2, 12:51am, Zoltan Hidvegi wrote:
> } Subject: Re: Completion bug introduced in 3.0.3
> }
> } > Another thing:  I use a TCL script that sets its stdout stream to
> } > non-blocking.  This somehow affects zsh, as all interactive commands
> } > started after the TCL script (like "ftp" or "more") immediately terminate
> 
> I meant to mention this before ...
> 
> It's an extremely bad idea for any program to set a tty device for non-
> blocking I/O.  This doesn't "somehow affect zsh," it affects the modes
> of the file descriptor associated with the tty; which happens to be a
> dup of the one zsh continues using for future processes, and therefore
> it affects those processes as well.

Perhaps I have a different tclsh, which resets the mode when it exits.  But
this can be tested with this little C program (nonblock.c):

#include <unistd.h>
#include <fcntl.h>

int
main(int argc, char *argv[])
{
    fcntl(0, F_SETFL, O_NONBLOCK);
    exit(0);
}

It sets stdin, but on a terminal this is the same as stdout.  Bash, ksh
and pdksh does seem to reset stdin on startup and before each prompt if
-s (shinstdin in zsh) is set, zsh doesn't.  POSIX says that blocking
input should be set on shell startup, but it does not seems to be
necessary to reset blocking mode after every application.  But blocking
mode should always be set when stdin is used, not only when shinstdin is
set.  Bash violates this:

nonblock; bash -c 'read foo; echo $foo'

does not set blocking read.  AT&T ksh93 does set blocking read here.
pdksh too, but pdksh always sets blocking mode, regardless of the use of
stdin.

Here is the relevant part of the standard (from www.rdg.opengroup.org):

    The standard input will be used only if one of the following is true: 

      o The -s option is specified. 

      o The -c option is not specified and no operands are specified. 

      o The script executes one or more commands that require input from
        standard input (such as a read command that does not redirect its
        input). 

    [...]

    If the standard input to sh is a FIFO or terminal device and is set to
    non-blocking reads, then sh will enable blocking reads on standard
    input. This will remain in effect when the command completes.  (This
    concerns an instance of sh that has been invoked, probably by a
    C-language program, with standard input that has been opened using the
    O_NONBLOCK flag; see open() in the XSH specification. If the shell did
    not reset this flag, it would immediately terminate because no input
    data would be available yet and that would be considered the same as
    end-of-file.)

I think that the AT&T ksh behaviour is the most conforming and most
logical one.

Zoltan


^ permalink raw reply	[relevance 5%]

* non-blocking reads
@ 1997-07-03  8:28  5% Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1997-07-03  8:28 UTC (permalink / raw)
  To: Zsh hacking and development

The included patch inplements the POSIX.2 required stdin blocking:

    [...]
    The standard input will be used only if one of the following is true: 

      o The -s option is specified. 

      o The -c option is not specified and no operands are specified. 

      o The script executes one or more commands that require input from
        standard input (such as a read command that does not redirect its
        input). 

    [...]

    If the standard input to sh is a FIFO or terminal device and is set to
    non-blocking reads, then sh will enable blocking reads on standard
    input. This will remain in effect when the command completes.  (This
    concerns an instance of sh that has been invoked, probably by a
    C-language program, with standard input that has been opened using the
    O_NONBLOCK flag; see open() in the XSH specification. If the shell did
    not reset this flag, it would immediately terminate because no input
    data would be available yet and that would be considered the same as
    end-of-file.)

The implementation really checks for non-regular file on stdin instead of
a FIFO or terminal since, for example in case of rsh, stdin can be a
socket and the blocking is still desirable.  It also modifies read so
that without the -r option backslash removes the special meaning of the
next character, as described in POSIX and in ksh(1).

The patch should be applied to both of zsh-3.0.4 and zsh-3.1.2.

Zoltan


*** Src/builtin.c	1997/06/16 05:11:38	3.1.3.1
--- Src/builtin.c	1997/07/03 08:04:33
***************
*** 2718,2724 ****
  bin_read(char *name, char **args, char *ops, int func)
  {
      char *reply, *readpmpt;
!     int bsiz, c = 0, gotnl = 0, al = 0, first, nchars = 1;
      int haso = 0;	/* true if /dev/tty has been opened specially */
      int isem = !strcmp(term, "emacs");
      char *buf, *bptr, *firstarg, *zbuforig;
--- 2718,2724 ----
  bin_read(char *name, char **args, char *ops, int func)
  {
      char *reply, *readpmpt;
!     int bsiz, c = 0, gotnl = 0, al = 0, first, nchars = 1, bslash;
      int haso = 0;	/* true if /dev/tty has been opened specially */
      int isem = !strcmp(term, "emacs");
      char *buf, *bptr, *firstarg, *zbuforig;
***************
*** 2767,2793 ****
      } else if (ops['u'] && !ops['p']) {
  	/* -u means take input from the specified file descriptor. *
  	 * -up means take input from the coprocess.                */
! 	for (readfd = 0; readfd < 10; ++readfd)
! 	    if (ops[readfd + '0'])
! 		break;
! 	if (readfd == 10)
! 	    readfd = 0;
      } else if (ops['p'])
  	readfd = coprocin;
!     else {
! 	/* last resort: take input from plain old stdin */
! 	attachtty((jobtab[thisjob].gleader) ? jobtab[thisjob].gleader : mypgrp);
  	readfd = 0;
! #if 0
! 	  else if (isset(SHINSTDIN) && unset(INTERACTIVE)) {
! 	    /* use stdout or stderr, if either is a tty */
! 	    if (isatty(1))
! 		readfd = 1;
! 	    else if (isatty(2))
! 		readfd = 2;
! 	}
! #endif
!     }
      /* handle prompt */
      if (firstarg) {
  	for (readpmpt = firstarg;
--- 2767,2778 ----
      } else if (ops['u'] && !ops['p']) {
  	/* -u means take input from the specified file descriptor. *
  	 * -up means take input from the coprocess.                */
! 	for (readfd = 9; readfd && !ops[readfd + '0']; --readfd);
      } else if (ops['p'])
  	readfd = coprocin;
!     else
  	readfd = 0;
! 
      /* handle prompt */
      if (firstarg) {
  	for (readpmpt = firstarg;
***************
*** 2874,2895 ****
      zbuforig = zbuf = (!ops['z']) ? NULL :
  	(nonempty(bufstack)) ? (char *) getlinknode(bufstack) : ztrdup("");
      first = 1;
      while (*args || (ops['A'] && !gotnl)) {
  	buf = bptr = (char *)zalloc(bsiz = 64);
  	/* get input, a character at a time */
! 	for (;;) {
! 	    if (gotnl)
! 		break;
  	    c = zread();
  	    /* \ at the end of a line indicates a continuation *
  	     * line, except in raw mode (-r option)            */
! 	    if (!ops['r'] && c == '\n' && bptr != buf && bptr[-1] == '\\') {
! 		bptr--;
  		continue;
  	    }
  	    if (c == EOF || c == '\n')
  		break;
! 	    if (isep(c)) {
  		if (bptr != buf || (!iwsep(c) && first)) {
  		    first |= !iwsep(c);
  		    break;
--- 2859,2879 ----
      zbuforig = zbuf = (!ops['z']) ? NULL :
  	(nonempty(bufstack)) ? (char *) getlinknode(bufstack) : ztrdup("");
      first = 1;
+     bslash = 0;
      while (*args || (ops['A'] && !gotnl)) {
  	buf = bptr = (char *)zalloc(bsiz = 64);
  	/* get input, a character at a time */
! 	while (!gotnl) {
  	    c = zread();
  	    /* \ at the end of a line indicates a continuation *
  	     * line, except in raw mode (-r option)            */
! 	    if (bslash && c == '\n') {
! 		bslash = 0;
  		continue;
  	    }
  	    if (c == EOF || c == '\n')
  		break;
! 	    if (!bslash && isep(c)) {
  		if (bptr != buf || (!iwsep(c) && first)) {
  		    first |= !iwsep(c);
  		    break;
***************
*** 2897,2902 ****
--- 2881,2889 ----
  		first |= !iwsep(c);
  		continue;
  	    }
+ 	    bslash = c == '\\' && !bslash && !ops['r'];
+ 	    if (bslash)
+ 		continue;
  	    first = 0;
  	    if (imeta(c)) {
  		*bptr++ = Meta;
***************
*** 2964,2987 ****
      }
      buf = bptr = (char *)zalloc(bsiz = 64);
      /* any remaining part of the line goes into one parameter */
      if (!gotnl)
  	for (;;) {
  	    c = zread();
  	    /* \ at the end of a line introduces a continuation line, except in
  	    raw mode (-r option) */
! 	    if (!ops['r'] && c == '\n' && bptr != buf && bptr[-1] == '\\') {
! 		bptr--;
  		continue;
  	    }
  	    if (c == EOF || (c == '\n' && !zbuf))
  		break;
! 	    if (isep(c) && bptr == buf)
  		if (iwsep(c))
  		    continue;
  		else if (!first) {
  		    first = 1;
  		    continue;
  		}
  	    if (imeta(c)) {
  		*bptr++ = Meta;
  		*bptr++ = c ^ 32;
--- 2951,2978 ----
      }
      buf = bptr = (char *)zalloc(bsiz = 64);
      /* any remaining part of the line goes into one parameter */
+     bslash = 0;
      if (!gotnl)
  	for (;;) {
  	    c = zread();
  	    /* \ at the end of a line introduces a continuation line, except in
  	    raw mode (-r option) */
! 	    if (bslash && c == '\n') {
! 		bslash = 0;
  		continue;
  	    }
  	    if (c == EOF || (c == '\n' && !zbuf))
  		break;
! 	    if (!bslash && isep(c) && bptr == buf)
  		if (iwsep(c))
  		    continue;
  		else if (!first) {
  		    first = 1;
  		    continue;
  		}
+ 	    bslash = c == '\\' && !bslash && !ops['r'];
+ 	    if (bslash)
+ 		continue;
  	    if (imeta(c)) {
  		*bptr++ = Meta;
  		*bptr++ = c ^ 32;
***************
*** 3028,3034 ****
  static int
  zread(void)
  {
!     char cc;
  
      /* use zbuf if possible */
      if (zbuf)
--- 3019,3025 ----
  static int
  zread(void)
  {
!     char cc, i;
  
      /* use zbuf if possible */
      if (zbuf)
***************
*** 3039,3050 ****
  	    return zbuf++, STOUC(*zbuf++ ^ 32);
  	else
  	    return (*zbuf) ? STOUC(*zbuf++) : EOF;
!     /* read a character from readfd */
!     if (read(readfd, &cc, 1) != 1)
! 	/* on EOF, return EOF */
! 	return EOF;
!     /* return the character read */
!     return STOUC(cc);
  }
  
  /* holds lexer for par_cond():  normally yylex(), testlex() for bin_test() */
--- 3030,3049 ----
  	    return zbuf++, STOUC(*zbuf++ ^ 32);
  	else
  	    return (*zbuf) ? STOUC(*zbuf++) : EOF;
!     for (i = 2; i--;) {
! 	/* read a character from readfd */
! 	switch (read(readfd, &cc, 1)) {
! 	case 1:
! 	    /* return the character read */
! 	    return STOUC(cc);
! 	case -1:
! 	    if (errno == EWOULDBLOCK && readfd == 0 && setblock_stdin())
! 		continue;
! 	    break;
! 	}
! 	break;
!     }
!     return EOF;
  }
  
  /* holds lexer for par_cond():  normally yylex(), testlex() for bin_test() */
*** Src/init.c	1997/06/05 04:44:57	3.1.3.0
--- Src/init.c	1997/07/03 08:05:10
***************
*** 53,60 ****
      for (;;) {
  	freeheap();
  	errflag = 0;
! 	if (interact && isset(SHINSTDIN))
! 	    preprompt();
  	hbegin();		/* init history mech        */
  	intr();			/* interrupts on            */
  	lexinit();              /* initialize lexical state */
--- 53,63 ----
      for (;;) {
  	freeheap();
  	errflag = 0;
! 	if (isset(SHINSTDIN)) {
! 	    setblock_stdin();
! 	    if (interact)
! 		preprompt();
! 	}
  	hbegin();		/* init history mech        */
  	intr();			/* interrupts on            */
  	lexinit();              /* initialize lexical state */
*** Src/utils.c	1997/06/06 06:13:24	3.1.3.1
--- Src/utils.c	1997/07/03 08:04:43
***************
*** 1050,1055 ****
--- 1050,1073 ----
  
  /**/
  int
+ setblock_stdin(void)
+ {
+ #ifdef O_NONBLOCK
+     struct stat st;
+     long mode;
+ 
+     if (!fstat(0, &st) && !S_ISREG(st.st_mode)) {
+ 	mode = fcntl(0, F_GETFL);
+ 	if (mode != -1 && (mode & O_NONBLOCK) &&
+ 	    !fcntl(0, F_SETFL, mode & ~O_NONBLOCK))
+ 	    return 1;
+     }
+ #endif
+     return 0;
+ }
+ 
+ /**/
+ int
  getquery(char *valid_chars)
  {
      char c, d;


^ permalink raw reply	[relevance 5%]

* Re: RC_EXPAND_PARAM bug
  @ 1997-08-01 13:17  4% ` Andrej Borsenkow
  0 siblings, 0 replies; 200+ results
From: Andrej Borsenkow @ 1997-08-01 13:17 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: Andrew Main, zsh-workers

On Wed, 30 Jul 1997, Bart Schaefer wrote:

> 
> I think the beta16-and-earlier cartesian product was reasonable and gave
> consistent results.  However, I encourage a warning in the doc that the
> results are not the same as for rc and that mixing ${^x} and ${^^x} in
> the same word may not behave in the way one expects. 
> 

There is probably one more alternative, but let me first explain how I
understand the problem.

/bin/sh (and POSIX sh) rules are based on textual substitution. They are
very simple and consist of well defined steps:
  1. break line into sequence of substitutions
  2. evaluate each of them
  3. concatenate results
  4. break result in words with field splitting

ZSH coompicates it by adding arrays. They can still fit in above scheme,
if we define what $array means. ZSH defines it as "$array[@]" which is
quite acceptable (I don't speak about implementation; I understand, arrays
are actually implemented as lists internally).

RC_EXAPND_PRAMS is based on absolutely different assumption. Original
implementation (rc) operates on _lists_, and is using _binary operator_
and not plain substitution/concatenation. The '$a$b' in rc is just
shorthand for '$a^$b' where `^' is binary opereator (wether pairwise or
cartesian product doesn't actually matters). rc just cannot have our
problems, because it is driven by usual operator precednce rules.

Both implemetations (pre-beta16 and current) actually do the following:

  - break word into ^- and non-^-parts
  - do substitutions on non-^-parts (and on nested substitions in
    ^-parts) based on traditional (textual) rules
  - convert results into lists (implicit field-splitting)
  - combine the lists

They differ just in how lists are combined:

   pre-beta16 treats `^' as ternary operator:
     xx$^ayy -> xx^$a^yy (in rc notation)
   current treats `^' as binary operator with right precedence:
     xx$^ayy -> xx($a^y)

Both is acceptable as long as it is documented ;)

Correct me, if I am wrong.

Now, if the above rules are explicitly stated in ZSH docs it is
enough. It will enable users to understand what's really going on, which
is very hard to do now ;-} I suggest, that zshexpn(1) explicitly states
this additional step and how it works (FAQ could then give some examples).

The same holds true for brace expansion as well (which is currently done
differently from RC_EXPNAD_PARAM).

Oh, I almost forgot my proposal ...

  - get rid of ^ as subst modifier
  - use explicit operator notation; something like
     ${prefix^suffix}, where prefix and suffix are expanded, converted
     to lists and combined. The result is then stuffed in replaced 
     string in usual manner (as if it were array - which by the way it is
     ;)
    We could include operator precedence so that
     ${xxx^yyy^zzz} could be used.

I am not shure if current grammar permits use of `^' in this case, but I
still like the idea ...

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------



^ permalink raw reply	[relevance 4%]

* Re: Parsing change between 3.0.2 and 3.0.4?
  @ 1997-08-25  4:20  6% ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1997-08-25  4:20 UTC (permalink / raw)
  To: Josef Sachs; +Cc: zsh-workers

> Was there some change in parsing between 3.0.2 and 3.0.4 that causes me
> to get this error message:
> parse error near `\n'
> when sourcing a file containing this:
> [ "${(M)TERM#xterm}" = xterm ] && \
>   {stty -istrip -ixon ; function chpwd {print -Pn "\e]2;%m: $PWD\C-g"}}

Yes, there were some brace related changes since 3.0.2 since
IGNORE_BRACES did not work properly in some cases.  Now the closing brace
has to be followed by a blank or one of ; | &

[ "${(M)TERM#xterm}" = xterm ] && \
  {stty -istrip -ixon ; function chpwd {print -Pn "\e]2;%m: $PWD\C-g"} }

But the proper syntax required by POSIX is

[ "${(M)TERM#xterm}" = xterm ] && \
  { stty -istrip -ixon ; function chpwd {print -Pn "\e]2;%m: $PWD\C-g";};}

That works even if IGNORE_BRACES is set.  I'd strongly recommend using
this syntax.

Zoltan


^ permalink raw reply	[relevance 6%]

* Problem Installing Z Shell on HPUX 10.20
@ 1997-10-27 13:41  4% David Chamont
  0 siblings, 0 replies; 200+ results
From: David Chamont @ 1997-10-27 13:41 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 737 bytes --]

Hi all,

I met some problems installing Z Shell on HPUX 10.20, and
did not find a way to cope with it. I have a working version
of "sed", and the problem does not seem to be linked to it.
I joined to this message the output of "configure", which I
called "configure.log", the additional "config.log" produced
by "configure", and the output of the "make" command, which I
called "make.log".

I would be happy if someone has already solved the problem
or could help in any way. If you have some suggestion, please
reply to my address (chamont@polhp3.in2p3.fr), since I am
not registered in the zsh-worker list.

Thanks.
David.

====================================
http://polhp5.in2p3.fr:8000/~chamont
====================================

[-- Attachment #2: configure.log --]
[-- Type: text/plain, Size: 4668 bytes --]

creating cache ./config.cache
configuring for zsh 3.0.4
checking host system type... hppa1.1-hp-hpux10.20
checking for gcc... gcc
checking whether the C compiler (gcc  ) works... yes
checking whether the C compiler (gcc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether gcc accepts -g... yes
checking how to run the C preprocessor... gcc -E
checking whether gcc needs -traditional... no
checking for working const... yes
checking for gcc option to accept ANSI C... 
checking for function prototypes... yes
checking size of long... 4
checking if the compiler supports union initialisation... yes
checking if signed to unsigned casting is broken... no
checking whether make sets ${MAKE}... yes
checking for a BSD compatible install... /opt/imake/bin/install -c
checking for mawk... no
checking for gawk... gawk
checking for dirent.h that defines DIR... yes
checking for opendir in -ldir... no
checking for ANSI C header files... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether stat file-mode macros are broken... no
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/time.h... yes
checking for sys/times.h... yes
checking for sys/select.h... no
checking for termcap.h... no
checking for termio.h... yes
checking for termios.h... yes
checking for sys/param.h... yes
checking for sys/filio.h... no
checking for string.h... yes
checking for memory.h... yes
checking for limits.h... yes
checking for fcntl.h... yes
checking for libc.h... no
checking for sys/utsname.h... yes
checking for sys/resource.h... yes
checking for locale.h... yes
checking for errno.h... yes
checking for stdlib.h... yes
checking for unistd.h... yes
checking ut_host in struct utmp... yes
checking POSIX termios... yes
checking TIOCGWINSZ in termios.h... yes
checking for sys/ptem.h... no
checking for tgetent in -ltermcap... yes
checking for getdomainname... yes
checking if an include file defines ospeed... no
checking if you must define ospeed... no
checking if tgetent accepts NULL... yes
checking return type of signal handlers... void
checking for pid_t... yes
checking for off_t... yes
checking for mode_t... yes
checking for uid_t in sys/types.h... yes
checking for size_t... yes
checking for sigset_t... yes
checking for struct timezone... yes
checking whether getpgrp takes no argument... yes
checking for working strcoll... yes
checking for strftime... yes
checking for waitpid... yes
checking for select... yes
checking for tcsetpgrp... yes
checking for tcgetattr... yes
checking for strstr... yes
checking for lstat... yes
checking for getlogin... yes
checking for setpgid... yes
checking for gettimeofday... yes
checking for gethostname... yes
checking for mkfifo... yes
checking for wait3... yes
checking for difftime... yes
checking for sigblock... yes
checking for sigsetmask... yes
checking for sigrelse... yes
checking for sighold... yes
checking for killpg... yes
checking for sigaction... yes
checking for getrlimit... yes
checking for sigprocmask... yes
checking for setuid... yes
checking for seteuid... no
checking for setreuid... yes
checking for setresuid... yes
checking for strerror... yes
checking for nis_list... no
checking for initgroups... yes
checking what style of signals to use... POSIX_SIGNALS
checking where signal.h is located... /usr/include/sys/signal.h
checking where the RLIMIT macros are located... /usr/include/sys/resource.h
checking if rlim_t is quad_t... no
checking if the rlim_t is unsigned... yes
checking for rlim_t... yes
checking for /dev/fd filesystem... no
checking for RFS superroot directory... no
checking for NIS... yes
checking for NIS+... no
checking where utmp is located... /etc/utmp
checking where wtmp is located... /etc/wtmp
checking if typeahead needs FIONREAD... no
checking for brk() prototype in <unistd.h>... yes
checking for sbrk() prototype in <unistd.h>... yes
checking for ioctl prototype in <sys/ioctl.h>... yes
checking if named FIFOs work... yes
checking if echo in /bin/sh interprets escape sequences... yes
updating cache ./config.cache
creating ./config.status
creating Makefile
creating Src/Makefile
creating Doc/Makefile
creating Etc/Makefile
creating Misc/Makefile
creating Util/Makefile
creating Functions/Makefile
creating StartupFiles/Makefile
creating config.h

zsh configuration
-----------------
zsh version           : 3.0.4
host operating system : hpux10.20
source code location  : .
compiler              : gcc
compiler flags        :  -Wall -Wno-implicit -Wmissing-prototypes -O2
binary install path   : /usr/local/bin
man page install path : /usr/local/man
info install path     : /usr/local/info


[-- Attachment #3: config.log --]
[-- Type: text/plain, Size: 18719 bytes --]

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

configure:577: checking host system type
configure:795: checking for gcc
configure:872: checking whether the C compiler (gcc  ) works
configure:886: gcc -o conftest    conftest.c  1>&5
configure:906: checking whether the C compiler (gcc  ) is a cross-compiler
configure:911: checking whether we are using GNU C
configure:920: gcc -E conftest.c
configure:935: checking whether gcc accepts -g
configure:985: checking how to run the C preprocessor
configure:1006: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1046: checking whether gcc needs -traditional
configure:1091: checking for working const
configure:1145: gcc -c  -Wall -Wno-implicit -Wmissing-prototypes -O2  conftest.c 1>&5
configure: In function `main':
configure:1119: warning: unused variable `s'
configure:1139: warning: unused variable `foo'
configure:1107: warning: unused variable `zero'
configure:1101: warning: unused variable `x'
configure:1118: warning: `t' might be used uninitialized in this function
configure:1136: warning: `b' might be used uninitialized in this function
configure:1165: checking for gcc option to accept ANSI C
configure:1193: gcc -c  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c 1>&5
configure:1214: checking for function prototypes
configure:1227: checking size of long
configure:1246: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  1>&5
configure:1238: warning: return-type defaults to `int'
configure:1266: checking if the compiler supports union initialisation
configure:1278: gcc -c  -Wall -Wno-implicit -Wmissing-prototypes -O2  conftest.c 1>&5
configure:1299: checking if signed to unsigned casting is broken
configure:1311: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  1>&5
configure:1308: warning: return-type defaults to `int'
configure: failed program was:
#line 1307 "configure"
#include "confdefs.h"
main(){return((int)(unsigned char)((char) -1) == 255);}
configure:1334: checking whether make sets ${MAKE}
configure:1370: checking for a BSD compatible install
configure:1423: checking for mawk
configure:1423: checking for gawk
configure:1456: checking for dirent.h that defines DIR
configure:1469: gcc -c  -Wall -Wno-implicit -Wmissing-prototypes -O2  conftest.c 1>&5
configure: In function `main':
configure:1465: warning: unused variable `dirp'
configure:1494: checking for opendir in -ldir
configure:1513: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c -ldir   1>&5
collect2: ld returned 1 exit status
/usr/bin/ld: Can't find library for -ldir
configure: failed program was:
#line 1502 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char opendir();

int main() {
opendir()
; return 0; }
configure:1577: checking for ANSI C header files
configure:1590: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1657: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  1>&5
configure:1681: checking whether time.h and sys/time.h may both be included
configure:1695: gcc -c  -Wall -Wno-implicit -Wmissing-prototypes -O2  conftest.c 1>&5
configure: In function `main':
configure:1691: warning: unused variable `tp'
configure:1716: checking whether stat file-mode macros are broken
configure:1772: checking for sys/wait.h that is POSIX.1 compatible
configure:1793: gcc -c  -Wall -Wno-implicit -Wmissing-prototypes -O2  conftest.c 1>&5
configure:1820: checking for sys/time.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1820: checking for sys/times.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1820: checking for sys/select.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1826: sys/select.h: No such file or directory
configure: failed program was:
#line 1825 "configure"
#include "confdefs.h"
#include <sys/select.h>
configure:1820: checking for termcap.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1826: termcap.h: No such file or directory
configure: failed program was:
#line 1825 "configure"
#include "confdefs.h"
#include <termcap.h>
configure:1820: checking for termio.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1820: checking for termios.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1820: checking for sys/param.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1820: checking for sys/filio.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1826: sys/filio.h: No such file or directory
configure: failed program was:
#line 1825 "configure"
#include "confdefs.h"
#include <sys/filio.h>
configure:1820: checking for string.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1820: checking for memory.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1820: checking for limits.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1820: checking for fcntl.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1820: checking for libc.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1826: libc.h: No such file or directory
configure: failed program was:
#line 1825 "configure"
#include "confdefs.h"
#include <libc.h>
configure:1820: checking for sys/utsname.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1820: checking for sys/resource.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1820: checking for locale.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1820: checking for errno.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1820: checking for stdlib.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1820: checking for unistd.h
configure:1830: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:1894: checking ut_host in struct utmp
configure:1907: gcc -c  -Wall -Wno-implicit -Wmissing-prototypes -O2  conftest.c 1>&5
configure: In function `main':
configure:1903: warning: statement with no effect
configure:1969: checking POSIX termios
configure:1984: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  1>&5
configure:2000: checking TIOCGWINSZ in termios.h
configure:2013: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  1>&5
configure: In function `main':
configure:2009: warning: unused variable `x'
configure:2068: checking for sys/ptem.h
configure:2078: gcc -E  conftest.c >/dev/null 2>conftest.out
configure:2074: sys/ptem.h: No such file or directory
configure: failed program was:
#line 2073 "configure"
#include "confdefs.h"
#include <sys/ptem.h>
configure:2110: checking for tgetent in -ltermcap
configure:2129: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c -ltermcap   1>&5
configure:2154: checking for getdomainname
configure:2182: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2261: checking if an include file defines ospeed
configure:2279: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure: In function `main':
configure:2275: `ospeed' undeclared (first use this function)
configure:2275: (Each undeclared identifier is reported only once
configure:2275: for each function it appears in.)
configure: failed program was:
#line 2266 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if HAVE_TERMIOS_H
#include <termios.h>
#endif
#if HAVE_TERMCAP_H
#include <termcap.h>
#endif
int main() {
ospeed = 0;
; return 0; }
configure:2295: checking if you must define ospeed
configure:2307: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
collect2: ld returned 1 exit status
/usr/bin/ld: Unsatisfied symbols:
   ospeed (data)
configure: failed program was:
#line 2300 "configure"
#include "confdefs.h"

int main() {
extern short ospeed; ospeed = 0;
; return 0; }
configure:2339: checking if tgetent accepts NULL
configure:2351: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2348: warning: return-type defaults to `int'
configure:2374: checking return type of signal handlers
configure:2396: gcc -c  -Wall -Wno-implicit -Wmissing-prototypes -O2  conftest.c 1>&5
configure: In function `main':
configure:2392: warning: unused variable `i'
configure:2415: checking for pid_t
configure:2448: checking for off_t
configure:2481: checking for mode_t
configure:2514: checking for uid_t in sys/types.h
configure:2548: checking for size_t
configure:2582: checking for sigset_t
configure:2595: gcc -c  -Wall -Wno-implicit -Wmissing-prototypes -O2  conftest.c 1>&5
configure: In function `main':
configure:2591: warning: unused variable `tempsigset'
configure:2616: checking for struct timezone
configure:2628: gcc -c  -Wall -Wno-implicit -Wmissing-prototypes -O2  conftest.c 1>&5
configure: In function `main':
configure:2624: warning: unused variable `dummy_tz'
configure:2649: checking whether getpgrp takes no argument
configure:2712: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2673: warning: return-type defaults to `int'
configure:2736: checking for working strcoll
configure:2754: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2747: warning: return-type defaults to `int'
configure:2785: checking for strftime
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for waitpid
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for select
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for tcsetpgrp
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for tcgetattr
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for strstr
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for lstat
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for getlogin
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for setpgid
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for gettimeofday
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for gethostname
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for mkfifo
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for wait3
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for difftime
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for sigblock
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for sigsetmask
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for sigrelse
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for sighold
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for killpg
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for sigaction
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for getrlimit
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for sigprocmask
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for setuid
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for seteuid
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
collect2: ld returned 1 exit status
/usr/bin/ld: Unsatisfied symbols:
   seteuid (code)
configure: failed program was:
#line 2790 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char seteuid(); below.  */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char seteuid();

int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_seteuid) || defined (__stub___seteuid)
choke me
#else
seteuid();
#endif

; return 0; }
configure:2785: checking for setreuid
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for setresuid
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for strerror
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2785: checking for nis_list
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
collect2: ld returned 1 exit status
/usr/bin/ld: Unsatisfied symbols:
   nis_list (code)
configure: failed program was:
#line 2790 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char nis_list(); below.  */
#include <assert.h>
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char nis_list();

int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_nis_list) || defined (__stub___nis_list)
choke me
#else
nis_list();
#endif

; return 0; }
configure:2785: checking for initgroups
configure:2813: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2840: checking what style of signals to use
configure:2873: checking where signal.h is located
configure:2890: checking where the RLIMIT macros are located
configure:2916: checking if rlim_t is quad_t
configure:2933: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2930: warning: return-type defaults to `int'
configure: failed program was:
#line 2924 "configure"
#include "confdefs.h"

#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include <sys/resource.h>
main(){struct rlimit r;exit(sizeof(r.rlim_cur) <= sizeof(long));}
configure:2956: checking if the rlim_t is unsigned
configure:2973: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:2970: warning: return-type defaults to `int'
configure:2998: checking for rlim_t
configure:3015: gcc -c  -Wall -Wno-implicit -Wmissing-prototypes -O2  conftest.c 1>&5
configure: In function `main':
configure:3011: warning: unused variable `l'
configure:3036: checking for /dev/fd filesystem
configure:3054: checking for RFS superroot directory
configure:3070: checking for NIS
configure:3087: checking for NIS+
configure:3105: checking where utmp is located
configure:3123: checking where wtmp is located
configure:3141: checking if typeahead needs FIONREAD
configure:3162: checking for brk() prototype in <unistd.h>
configure:3175: gcc -c  -Wall -Wno-implicit -Wmissing-prototypes -O2  conftest.c 1>&5
configure:3169: conflicting types for `brk'
/usr/include/sys/unistd.h:346: previous declaration of `brk'
configure: In function `main':
configure:3171: warning: unused variable `i'
configure: failed program was:
#line 3167 "configure"
#include "confdefs.h"
#include <unistd.h>
double brk();
int main() {
int i;
; return 0; }
configure:3196: checking for sbrk() prototype in <unistd.h>
configure:3209: gcc -c  -Wall -Wno-implicit -Wmissing-prototypes -O2  conftest.c 1>&5
configure:3203: conflicting types for `sbrk'
/usr/include/sys/unistd.h:368: previous declaration of `sbrk'
configure: In function `main':
configure:3205: warning: unused variable `i'
configure: failed program was:
#line 3201 "configure"
#include "confdefs.h"
#include <unistd.h>
double sbrk();
int main() {
int i;
; return 0; }
configure:3232: checking for ioctl prototype in <sys/ioctl.h>
configure:3245: gcc -c  -Wall -Wno-implicit -Wmissing-prototypes -O2  conftest.c 1>&5
configure:3239: conflicting types for `ioctl'
/usr/include/sys/ioctl.h:28: previous declaration of `ioctl'
configure: In function `main':
configure:3241: warning: unused variable `i'
configure: failed program was:
#line 3237 "configure"
#include "confdefs.h"
#include <sys/ioctl.h>
   int ioctl(double x);
int main() {
int i;
; return 0; }
configure:3267: checking if named FIFOs work
configure:3306: gcc -o conftest  -Wall -Wno-implicit -Wmissing-prototypes -O2   conftest.c  -ltermcap 1>&5
configure:3280: warning: return-type defaults to `int'
configure:3328: checking if echo in /bin/sh interprets escape sequences

[-- Attachment #4: make.log --]
[-- Type: text/plain, Size: 1987 bytes --]

cd Src && make CC='gcc' CPPFLAGS='' DEFS='-DHAVE_CONFIG_H' CFLAGS='-Wall -Wno-implicit -Wmissing-prototypes -O2' LDFLAGS='' LIBS='-ltermcap' prefix='/usr/local' exec_prefix='/usr/local' bindir='/usr/local/bin' infodir='/usr/local/info' mandir='/usr/local/man' manext='1'
/u3/chamont/tmp/zsh-3.0.4/Src
make[1]: Entering directory `/disk3/users/chamont/zsh-3.0.4/Src'
gcc -c -I.. -I. -I.  -DHAVE_CONFIG_H -Wall -Wno-implicit -Wmissing-prototypes -O2 builtin.c
In file included from system.h:61,
                 from zsh.h:36,
                 from builtin.c:32:
/usr/include/pwd.h:29: parse error before `int32_t'
/usr/include/pwd.h:29: warning: no semicolon at end of struct or union
/usr/include/pwd.h:31: parse error before `}'
/usr/include/pwd.h:67: parse error before `int32_t'
/usr/include/pwd.h:67: warning: no semicolon at end of struct or union
/usr/include/pwd.h:69: parse error before `}'
/usr/include/pwd.h:80: warning: parameter names (without types) in function declaration
In file included from /usr/include/sys/stat.h:25,
                 from system.h:64,
                 from zsh.h:36,
                 from builtin.c:32:
/usr/include/sys/_stat_body.h:22: parse error before `blkcnt_t'
/usr/include/sys/_stat_body.h:22: warning: no semicolon at end of struct or union
/usr/include/sys/_stat_body.h:23: parse error before `:'
/usr/include/sys/_stat_body.h:24: parse error before `:'
/usr/include/sys/_stat_body.h:25: parse error before `:'
/usr/include/sys/_stat_body.h:53: parse error before `}'
builtin.c: In function `bin_cd':
builtin.c:998: storage size of `st1' isn't known
builtin.c:998: storage size of `st2' isn't known
builtin.c:998: warning: unused variable `st2'
builtin.c:998: warning: unused variable `st1'
builtin.c: In function `bin_dot':
builtin.c:4666: storage size of `st' isn't known
builtin.c:4666: warning: unused variable `st'
make[1]: *** [builtin.o] Error 1
make[1]: Leaving directory `/disk3/users/chamont/zsh-3.0.4/Src'
make: *** [Src] Error 2

^ permalink raw reply	[relevance 4%]

* Re: Bizarre Solaris problem
  @ 1997-11-20 15:18  5% ` Anthony Heading
  0 siblings, 0 replies; 200+ results
From: Anthony Heading @ 1997-11-20 15:18 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

Peter wrote:
> Anthony Heading wrote:
> > Haha!  A quick update in case anyone is thinking about this.
> > 
> > The problem I've just tracked down to process limits.  csh is
> > initialising with the maxmimum number of file descriptors set to 64
> > (indeed the value of OPEN_MAX and supposedly the maximum limit
> > therefore for RLIMIT_NOFILE).
> > 
> > getrlimit(), however,  believes that the maximum number of file
> > descriptors is 1024, and zsh is bumping the limit up to that value.
> > This appears to confuse the 4.1.3 gethostbyname().
> 
> We saw this business apropos of something else a while ago.  OPEN_MAX
> is actually not the maximum limit, since it's run-time configurable
> under Solaris 2.  So presumably the difference that's causing the OS bug
> to show up is because csh is too old-fashioned to care.  Unless there's
> some reason for not following getrlimit() if all those descriptors aren't
> needed.

Not sure.

For my particular problem, Sun have been good enough to acknowledge this
as a bug in 2.5.1, and tell me it's fixed in the 2.6 Sun4 libraries.
(Exactly why one fixes the libraries, rather than have the kernel cap
the process limits to SunOS4 maxima when executing those binaries I
don't quite understand, but nevermind...)

Unless I've got this wrong (and I've got a cold at the moment so the
powers of analysis are somewhat below peak), zsh is displaying a
certain amount of youthful exuberance in widening the process limits
out to their hard stops.  No other shells appear to do this, instead
happily inheriting and reflecting the soft limits from their parents.

Now this is a matter of little practical import, mostly because few
people ever worry about these limits, and an extra line or lack of
it in .zshenv is not a big deal.  But after some thought, the
semantics seem undesirable:

 - it destroys information for little gain;
 - it's different from everyone else;
 - it potentially prevents implementation optimizations.

I know very little about POSIX and Unix standards and stuff, but if the
concept of hard and soft process limits are defined there, I'd doubt
that a shell is mandated to throw away the soft ones.

A


^ permalink raw reply	[relevance 5%]

* Re: PATCH: zsh 3.x: <..> ranges in globbing
  @ 1998-01-12 16:16  6% ` Andrej Borsenkow
  0 siblings, 0 replies; 200+ results
From: Andrej Borsenkow @ 1998-01-12 16:16 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh hackers list, zsh

On Mon, 12 Jan 1998, Peter Stephenson wrote:

> 
> You should probably note that <100->0foo won't match 1000foo, since
> the 1000 gets swallowed up before the shell even knows it's going
> to have to match another digit next. This is a much more difficult
> problem requiring backtracking.  I could make a special case so that
> simple things like this work, but expressions like <100->(0|bar)foo would
> require much more fiddling.  (Of course, <100-999>0foo works now.)

I am not sure, that it is right thing. The <m-n> can (always?) be
rewritten using plain extended regular expression. In particular, <100->
is the same as

  [1-9][0-9][0-9]|[1-9][0-9]{3,}

given file foo with
100foo
1000foo

at my system I get

egrep '([1-9][0-9][0-9]|[1-9][0-9]{3,})0foo' foo
=> 1000foo

egrep '([1-9][0-9][0-9]|[1-9][0-9]{3,})foo' foo
=> 100foo
   1000foo

X/OPEN (and presumably POSIX and Unix 95) also require BRE and ERE to
match the longest possible string - in case of 1000foo the longest
possible is the whole word :-)

Actually, what about replacing "ad hoc" code in ZSH by direct translation
into normal regexp? It will probably be faster (who knows) and will give
ZSH full power to support i18n - wich is currently not (portably)
possible. I think, that <m-n> globbing is the only non-trivial part - all
others are pretty sraightforward.

-------------------------------------------------------------------------
Andrej Borsenkow 		Fax:   +7 (095) 252 01 05
SNI ITS Moscow			Tel:   +7 (095) 252 13 88

NERV:  borsenkow.msk		E-Mail: borsenkow.msk@sni.de
-------------------------------------------------------------------------



^ permalink raw reply	[relevance 6%]

* PATCH: build script fixes
@ 1998-01-16 10:16  4% Andrew Main
  0 siblings, 0 replies; 200+ results
From: Andrew Main @ 1998-01-16 10:16 UTC (permalink / raw)
  To: zsh-workers

-----BEGIN PGP SIGNED MESSAGE-----

Those script fixes:

Src/mkmodindex.sh:
	* Use sed instead of a dodgy glob pattern.
Src/mkmakemod.sh:
	* I was using double quotes inside backquotes inside double
	  quotes in a couple of places, which IIRC POSIX leaves undefined.
	  It's definitely a bad idea.
	* Don't trust the $top_srcdir inherited from the Makefile;
	  use pwd to get it without links.  NOTE: zsh, even in sh mode,
	  will report a pathname including links.  I think this is a
	  bug that needs to be fixed.
Src/makepro.awk:
	* Quote `=' and `{' in regexps.  Other potential metacharacters
	  are `}', `<' and `>'; I've left these unquoted in case quoting
	  them might make them metacharacters in some awks.

I'll be on holiday all next week, so I won't be able to respond to any
feedback until the following week (1998-01-26).

 -zefram

 *** Src/makepro.awk	1997/06/14 00:25:36	1.2
 --- Src/makepro.awk	1998/01/16 01:10:21
 ***************
 *** 50,56 ****
   	if(line ~ /\/\*/)
   	    continue
   	# If it is a function definition, note so.
 ! 	if(line ~ /\) *{.*$/) #}
   	    isfunc = 1
   	if(sub(/ *[{;].*$/, "", line)) #}
   	    break
 --- 50,56 ----
   	if(line ~ /\/\*/)
   	    continue
   	# If it is a function definition, note so.
 ! 	if(line ~ /\) *\{.*$/) #}
   	    isfunc = 1
   	if(sub(/ *[{;].*$/, "", line)) #}
   	    break
 ***************
 *** 91,97 ****
   	# initialiser.
   	dcltor = substr(line, 1, RLENGTH-1)
   	line = substr(line, RLENGTH+1)
 ! 	sub(/=.*$/, "", dcltor)
   	match(dcltor, /^([^_0-9A-Za-z]| const )*/)
   	dcltor = substr(dcltor, 1, RLENGTH) "@+" substr(dcltor, RLENGTH+1)
   	match(dcltor, /^.*@\+[_0-9A-Za-z]+/)
 --- 91,97 ----
   	# initialiser.
   	dcltor = substr(line, 1, RLENGTH-1)
   	line = substr(line, RLENGTH+1)
 ! 	sub(/\=.*$/, "", dcltor)
   	match(dcltor, /^([^_0-9A-Za-z]| const )*/)
   	dcltor = substr(dcltor, 1, RLENGTH) "@+" substr(dcltor, RLENGTH+1)
   	match(dcltor, /^.*@\+[_0-9A-Za-z]+/)
 ***************
 *** 101,107 ****
   	sub(/@-.*$/, "", dnam)
   
   	# Put parens etc. back
 ! 	gsub(/@{/, " _((", dcltor)
   	gsub(/@}/, "))", dcltor)
   	gsub(/@</, "(", dcltor)
   	gsub(/@>/, ")", dcltor)
 --- 101,107 ----
   	sub(/@-.*$/, "", dnam)
   
   	# Put parens etc. back
 ! 	gsub(/@\{/, " _((", dcltor)
   	gsub(/@}/, "))", dcltor)
   	gsub(/@</, "(", dcltor)
   	gsub(/@>/, ")", dcltor)
 *** Src/mkmakemod.sh	1998/01/11 14:57:22	1.2
 --- Src/mkmakemod.sh	1998/01/16 01:06:53
 ***************
 *** 93,99 ****
       echo "##### ===== DEFINITIONS ===== #####"
       echo
       echo "makefile = ${the_makefile}"
 !     echo "dir_top = `echo $the_subdir | sed 's,[^/][^/]*,..,g'`"
       echo "subdir = $the_subdir"
       echo
   
 --- 93,99 ----
       echo "##### ===== DEFINITIONS ===== #####"
       echo
       echo "makefile = ${the_makefile}"
 !     echo "dir_top = "`echo $the_subdir | sed 's,[^/][^/]*,..,g'`
       echo "subdir = $the_subdir"
       echo
   
 ***************
 *** 137,143 ****
   		;;
   	esac
       done
 !     all_subdirs="`echo "$all_subdirs" | sed "s' $the_subdir/' 'g"`"
       echo "MODOBJS =$all_modobjs"
       echo "MODULES =$all_modules"
       echo "MDDS    =$all_mdds"
 --- 137,143 ----
   		;;
   	esac
       done
 !     all_subdirs=`echo "$all_subdirs" | sed "s' $the_subdir/' 'g"`
       echo "MODOBJS =$all_modobjs"
       echo "MODULES =$all_modules"
       echo "MDDS    =$all_mdds"
 ***************
 *** 306,317 ****
       # config.status requires the pathname for the .in file to be relative
       # to the top of the source tree.  As we have it in the build tree, it
       # is necessary to construct an appropriate pathname.
 ! 
 !     case $top_srcdir in
 ! 	/*) sdir=$top_srcdir ;;
 ! 	*) sdir=`pwd`/$top_srcdir; sdir=`echo $sdir | sed "$sed_normalise"` ;;
 !     esac
 !     top_builddir=`echo $sdir | sed 's,[^/][^/]*,..,g;s,^/,,'``pwd`
   
       CONFIG_FILES=$the_subdir/${the_makefile}:$top_builddir/$the_subdir/${the_makefile}.in CONFIG_HEADERS= ./config.status
   
 --- 306,312 ----
       # config.status requires the pathname for the .in file to be relative
       # to the top of the source tree.  As we have it in the build tree, it
       # is necessary to construct an appropriate pathname.
 !     top_builddir=`(cd $top_srcdir; pwd) | sed 's,[^/][^/]*,..,g;s,^/,,'``pwd`
   
       CONFIG_FILES=$the_subdir/${the_makefile}:$top_builddir/$the_subdir/${the_makefile}.in CONFIG_HEADERS= ./config.status
   
 *** Src/mkmodindex.sh	1997/06/17 15:59:54	1.1
 --- Src/mkmodindex.sh	1998/01/16 01:00:08
 ***************
 *** 15,22 ****
       ( set $dir/*.mdd; test -f $1 ) || continue
       dosubs=false
       for mod in `echo '' $dir/*.mdd '' | sed 's, [^ ]*/, ,g;s,\.mdd , ,g'`; do
 ! 	case "$mod@ $module_list " in
 ! 	    *[^_0-9A-Za-z]*@*)
   		echo >&2 "WARNING: illegally named module \`$mod' in $dir"
   		echo >&2 "         (ignoring it)"
   		;;
 --- 15,22 ----
       ( set $dir/*.mdd; test -f $1 ) || continue
       dosubs=false
       for mod in `echo '' $dir/*.mdd '' | sed 's, [^ ]*/, ,g;s,\.mdd , ,g'`; do
 ! 	case `echo "$mod@ $module_list " | sed 's,^.*[^_0-9A-Za-z].*@,@@,'` in
 ! 	    @@*)
   		echo >&2 "WARNING: illegally named module \`$mod' in $dir"
   		echo >&2 "         (ignoring it)"
   		;;

-----BEGIN PGP SIGNATURE-----
Version: 2.6.3ia
Charset: ascii

iQEVAwUBNL63c5mk9GeOHh7BAQHdCwf9HFbp/oUPdpK+CkvkVJVVp769rmVgsKvN
sfV0EVeFhU9Lplr5X4jBlNK3BZSv/Ny/cskGSEZGitoC4gWaACH1UEllqRc2nObG
IHQ80uKXoZYg/GE19dY90FMz9wP7s0runcZQdFHv0RyQI6CjR+5PDY+uk0Rppf8g
x6WdpM2XlYRraBudYW2M7J6jOknlSCWFYR0qRZwfMazxayKIjE9jeI4IXvWbpAir
MHKcFiPz4NL5ztKk8QMSOLPtN9VV/cGbF7WhN3fYb0qKwiAaEZhPPqSdXvTLw6Pp
6vz4cGHFpk1Scb4YT1IrFK0Mb+jHWyAW4k/ae6PnLITzxK/xVPHjBg==
=9ZvJ
-----END PGP SIGNATURE-----


^ permalink raw reply	[relevance 4%]

* Re: PATCH: zsh-3.1.2-zefram3: 12 hour clock in prompts
  @ 1998-01-16 14:27  7% ` Andrew Main
  1998-01-16 14:48  0%   ` Peter Stephenson
  0 siblings, 1 reply; 200+ results
From: Andrew Main @ 1998-01-16 14:27 UTC (permalink / raw)
  To: pws; +Cc: zsh-workers

pws@ibmth.difi.unipi.it wrote:
>It looks (as I mentioned before) as if someone has rationalised the %l
>strftime sequence to do the same as in strftime(), i.e. print a space
>before a number less than 10 in an hour given in 12-hour format.

Hmm.

ztrftime() is disgusting.  I'd really like to strip it down to what POSIX
requires date(1) to handle (and make it really POSIX conformant) -- to
hell with existing users, it's used almost purely for prompts.  Then do
what should have been done with strftime() from the start: add flags to
the % sequences to specify the type of fill.  What do people think?

-zefram


^ permalink raw reply	[relevance 7%]

* Re: PATCH: zsh-3.1.2-zefram3: 12 hour clock in prompts
  1998-01-16 14:27  7% ` Andrew Main
@ 1998-01-16 14:48  0%   ` Peter Stephenson
  0 siblings, 0 replies; 200+ results
From: Peter Stephenson @ 1998-01-16 14:48 UTC (permalink / raw)
  To: Zsh hackers list

Andrew Main wrote:
> ztrftime() is disgusting.  I'd really like to strip it down to what POSIX
> requires date(1) to handle (and make it really POSIX conformant) -- to
> hell with existing users, it's used almost purely for prompts.  Then do
> what should have been done with strftime() from the start: add flags to
> the % sequences to specify the type of fill.  What do people think?

I don't think it's really long enough to worry about.  We can only
ended up re-implementing the whole of strftime(), which is even more
to worry about.  It would have been nice to have had fills handled properly,
but that's too late to do in any kind of compatible way.  Also, every
time something in zsh gets stripped down it's usually the bits I was
using that disappear (unless I'm doing it myself).  I use print -P
sometimes to format dates and times and it's inconvenient to find out
bits of the system's strftime() are not implemented (some date's don't
take +fmt).

-- 
Peter Stephenson <pws@ifh.de>       Tel: +39 50 911239
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy


^ permalink raw reply	[relevance 0%]

* Re: shared libs in zsh-3.1.2-zefram3
  @ 1998-01-29 13:38  5% ` Andrei Tcherepanov
  0 siblings, 0 replies; 200+ results
From: Andrei Tcherepanov @ 1998-01-29 13:38 UTC (permalink / raw)
  To: Andrew Main; +Cc: zsh-workers

Andrew Main wrote:
> 
> Andrei Tcherepanov wrote:
> >after applying patch to scripts I did
> >CC='cc -native -Qn -s' ./configure --enable-dynamic
> >gmake
> >
> >It does not build ANY *.so files !!! e.g. it make all modules
> >static.
> 
> This suggests that the configure tests failed to create working shared
> libraries.  (I'm rather suspicious about putting "-s" into $CC -- it go
> in $LDFLAGS, and it is there by default -- but I don't think that should
> make any difference on Solaris.)  What did configure output?
> 
> -zefram

so I did run configure one more

the output is

: 135 hey; rm config.cache 
: 136 hey; CC='cc -native -Qn' ./configure --enable-dynamic 
creating cache ./config.cache
configuring for zsh 3.1.2-zefram3
checking host system type... sparc-sun-solaris2.5.1
checking for gcc... cc -native -Qn
checking whether the C compiler (cc -native -Qn  ) works... yes
checking whether the C compiler (cc -native -Qn  ) is a cross-compiler... no
checking whether we are using GNU C... no
checking how to run the C preprocessor... cc -native -Qn -E
checking for working const... yes
checking for cc -native -Qn option to accept ANSI C... 
checking whether to use prototypes... yes
checking size of long... 4
checking for working alloca.h... yes
checking for alloca... yes
checking if the compiler supports union initialisation... yes
checking if signed to unsigned casting is broken... no
checking if the compiler supports variable-lenth arrays... no
checking whether make sets ${MAKE}... yes
checking for a BSD compatible install... ./install-sh -c
checking for mawk... no
checking for gawk... gawk
checking for yodl... no
checking for dirent.h that defines DIR... yes
checking for opendir in -ldir... no
checking for ANSI C header files... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether stat file-mode macros are broken... no
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/time.h... yes
checking for sys/times.h... yes
checking for sys/select.h... yes
checking for termcap.h... no
checking for termio.h... yes
checking for termios.h... yes
checking for sys/param.h... yes
checking for sys/filio.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for limits.h... yes
checking for fcntl.h... yes
checking for libc.h... no
checking for sys/utsname.h... yes
checking for sys/resource.h... yes
checking for locale.h... yes
checking for errno.h... yes
checking for stdlib.h... yes
checking for unistd.h... yes
checking for sys/capability.h... no
checking for dlfcn.h... yes
checking for conflicts in sys/time.h and sys/select.h... no
checking ut_host in struct utmp... no
checking ut_host in struct utmpx... yes
checking POSIX termios... yes
checking TIOCGWINSZ in termios.h... yes
checking for sys/ptem.h... yes
checking for tgetent in -ltermcap... yes
checking for getdomainname... no
checking for getdomainname in -lnsl... yes
checking for dlopen in -ldl... yes
checking for cap_init in -lcap... no
checking if an include file defines ospeed... no
checking if you must define ospeed... yes
checking if tgetent accepts NULL... yes
checking return type of signal handlers... void
checking for pid_t... yes
checking for off_t... yes
checking for mode_t... yes
checking for uid_t in sys/types.h... yes
checking for size_t... yes
checking for sigset_t... yes
checking for struct timezone... yes
checking whether getpgrp takes no argument... yes
checking for working strcoll... yes
checking for memcpy... yes
checking for memmove... yes
checking for strftime... yes
checking for waitpid... yes
checking for select... yes
checking for tcsetpgrp... yes
checking for tcgetattr... yes
checking for strstr... yes
checking for lstat... yes
checking for getlogin... yes
checking for setpgid... yes
checking for gettimeofday... yes
checking for gethostname... yes
checking for mkfifo... yes
checking for wait3... yes
checking for difftime... yes
checking for sigblock... no
checking for sigsetmask... no
checking for sigrelse... yes
checking for sighold... yes
checking for killpg... yes
checking for sigaction... yes
checking for getrlimit... yes
checking for sigprocmask... yes
checking for setuid... yes
checking for seteuid... yes
checking for setreuid... yes
checking for setresuid... no
checking for setsid... yes
checking for strerror... yes
checking for nis_list... yes
checking for initgroups... yes
checking for fchdir... yes
checking for cap_init... no
checking for dlopen... yes
checking for dlerror... yes
checking for dlsym... yes
checking for dlclose... yes
checking what style of signals to use... POSIX_SIGNALS
checking where signal.h is located... /usr/include/sys/signal.h
checking where the RLIMIT macros are located... /usr/include/sys/resource.h
checking if rlim_t is quad_t... no
checking if the rlim_t is unsigned... yes
checking for rlim_t... yes
checking for /dev/fd filesystem... /dev/fd
checking for RFS superroot directory... no
checking for NIS... no
checking for NIS+... no
checking where utmp is located... /etc/utmp
checking where wtmp is located... /etc/wtmp
checking if typeahead needs FIONREAD... no
checking for brk() prototype in <unistd.h>... yes
checking for sbrk() prototype in <unistd.h>... yes
checking for ioctl prototype in <sys/ioctl.h>... no
checking if named FIFOs work... yes
checking if echo in /bin/sh interprets escape sequences... yes
checking if your system use ELF binaries... yes
checking if your dlsym() needs a leading underscore... no
checking if name clashes in shared objects are OK... yes
checking for working RTLD_GLOBAL... yes
checking whether symbols in the executable are available... yes
checking whether executables can be stripped... yes
checking whether libraries can be stripped... yes
updating cache ./config.cache
creating ./config.status
creating Makefile
creating Src/Makefile
creating Doc/Makefile
creating Etc/Makefile
creating Misc/Makefile
creating Util/Makefile
creating Functions/Makefile
creating StartupFiles/Makefile
creating config.h
config.h is unchanged
 
zsh configuration
-----------------
zsh version             : 3.1.2-zefram3
host operating system   : solaris2.5.1
source code location    : .
compiler                : cc -native -Qn
compiler flags          :  -O
executable linker flags :   -s 
module linker flags     :   -s -G
binary install path     : /usr/local/bin
man page install path   : /usr/local/man
info install path       : /usr/local/info


I did not found any occurrence of PIC flag anywhere in config.log
(but may be it cannot be found in it -- just info),
so it may be does not check it.



-- 
Thanks,
  Andrei ( tandr@ptc.com )


^ permalink raw reply	[relevance 5%]

* PATCH: NO_CLOBBER
@ 1998-04-23  9:13  5% Andrew Main
  0 siblings, 0 replies; 200+ results
From: Andrew Main @ 1998-04-23  9:13 UTC (permalink / raw)
  To: zsh-workers

-----BEGIN PGP SIGNED MESSAGE-----

Looks like someone got too clever, and decided that NO_CLOBBER shouldn't
stop you opening a FIFO.  Sounds sort of reasonable, but it is more
complicated than necessary and incompatible with ksh (and POSIX).
NO_CLOBBER should mean that a successful write redirection guarantees
that you've created a regular file, and anything you write to it isn't
going anywhere else.

The bug that was observed yesterday was caused by the second open()
attempt overwriting the correct errno.  This was introduced in 3.1.0 in
an attempt to fix a race condition in the 3.0 code.  By correcting the
overall behaviour, this bug disappears.

 *** Src/exec.c	1997/07/04 19:12:03	1.68
 --- Src/exec.c	1998/04/22 20:57:40
 ***************
 *** 1006,1025 ****
   static int
   clobber_open(struct redir *f)
   {
 !     struct stat buf;
 !     int fd;
   
 !     if (isset(CLOBBER) || IS_CLOBBER_REDIR(f->type))
 ! 	return open(unmeta(f->name), O_WRONLY | O_CREAT | O_TRUNC, 0666);
 !     if ((fd = open(unmeta(f->name), O_WRONLY | O_CREAT | O_EXCL, 0666)) >= 0)
 ! 	return fd;
 !     if ((fd = open(unmeta(f->name), O_WRONLY)) < 0)
 ! 	return fd;
 !     if (!fstat(fd, &buf) && !S_ISREG(buf.st_mode))
 ! 	return fd;
 !     close(fd);
 !     errno = EEXIST;
 !     return -1;
   }
   
   /* size of buffer for tee and cat processes */
 --- 1006,1015 ----
   static int
   clobber_open(struct redir *f)
   {
 !     int oflags = O_WRONLY | O_CREAT |
 ! 	((unset(CLOBBER) && !IS_CLOBBER_REDIR(f->type)) ? O_EXCL : O_TRUNC);
   
 !     return open(unmeta(f->name), oflags, 0666);
   }
   
   /* size of buffer for tee and cat processes */

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
Charset: ascii

iQEVAwUBNT5b85mk9GeOHh7BAQELTAf/RuTLGSP89Eofwb5zVBeJkEHWpebmVLeG
T8x2r4fAF67H0/3QGJrWkzv8yRiAurJ8jgFxap/G0zh3KWeRJsOxkfDvHdZryCZc
EIhDdD3lGP5AzT57RKIYWkpG2FU2oRzYXjH6JjSjTmRLpXRvqv5Io/Z9l5P9WCXv
jV4Wu6G88/8OXE0LwD4F+FkW/hBt/wF1J/1HjGYBLEgwn20sf4sRCUukh9v7Xjzg
kdq0NYJ5N2/4msuR3h+qRpzHCXHZ1mG0nCV3Jy0zW11/2BI7yFIhHeqT2nnsRMLZ
IKeMPdwxpaU9PRaP2Cr4sWhvj+WqKjZ+MD8bYtK9KN8/QhCkQHAdqw==
=mrVi
-----END PGP SIGNATURE-----


^ permalink raw reply	[relevance 5%]

* Re: PATCH: NO_CLOBBER
  @ 1998-04-23 18:44  7% ` Andrew Main
  0 siblings, 0 replies; 200+ results
From: Andrew Main @ 1998-04-23 18:44 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh-workers

Peter Stephenson wrote:
>  /etc/zshrc: file exists: /dev/null [243]

Ah, sorry, it appears that I misremebered POSIX, and it's actually ksh
that's got it wrong.  POSIX.2 clase 3.7.2: "Output redirection using the >
format shall fail if the noclobber option is set ... and the file named
... exists and is a regular file.".  So don't use that patch; I'll send
a better one tomorrow.

-zefram


^ permalink raw reply	[relevance 7%]

* PATCH: POSIX file mode macros
@ 1998-04-27  9:24 10% Andrew Main
  0 siblings, 0 replies; 200+ results
From: Andrew Main @ 1998-04-27  9:24 UTC (permalink / raw)
  To: zsh-workers

-----BEGIN PGP SIGNED MESSAGE-----

This patch makes zsh use the POSIX S_I* macros for permission bits in all
cases, rather than the usual octal values.  However, where an octal value
is read from or output to the user, the standard octal values are used
(as required by POSIX for chmod), with a portable conversion function.

There were also a coule of places testing bit S_IXUSR, which should have
been S_IXUGO.

 -zefram

 *** Src/cond.c	1998/04/26 13:56:32	1.15
 --- Src/cond.c	1998/04/26 15:31:54
 ***************
 *** 95,102 ****
   	return (doaccess(c->left, W_OK));
       case 'x':
   	if (privasserted()) {
 ! 	    unsigned short mode = dostat(c->left);
 ! 	    return (mode & 0111) || S_ISDIR(mode);
   	}
   	return doaccess(c->left, X_OK);
       case 'z':
 --- 95,102 ----
   	return (doaccess(c->left, W_OK));
       case 'x':
   	if (privasserted()) {
 ! 	    mode_t mode = dostat(c->left);
 ! 	    return (mode & S_IXUGO) || S_ISDIR(mode);
   	}
   	return doaccess(c->left, X_OK);
       case 'z':
 ***************
 *** 185,191 ****
   
   
   /**/
 ! static unsigned short
   dostat(char *s)
   {
       struct stat *statp;
 --- 185,191 ----
   
   
   /**/
 ! static mode_t
   dostat(char *s)
   {
       struct stat *statp;
 ***************
 *** 199,205 ****
   /* pem@aaii.oz; needed since dostat now uses "stat" */
   
   /**/
 ! static unsigned short
   dolstat(char *s)
   {
       if (lstat(unmeta(s), &st) < 0)
 --- 199,205 ----
   /* pem@aaii.oz; needed since dostat now uses "stat" */
   
   /**/
 ! static mode_t
   dolstat(char *s)
   {
       if (lstat(unmeta(s), &st) < 0)
 *** Src/glob.c	1998/04/26 15:14:50	1.46
 --- Src/glob.c	1998/04/26 15:37:58
 ***************
 *** 1323,1329 ****
       else if(S_ISLNK(filemode))
   	return '@';
       else if(S_ISREG(filemode))
 ! 	return (filemode & 0111) ? '*' : ' ';
       else if(S_ISSOCK(filemode))
   	return '=';
       else
 --- 1323,1329 ----
       else if(S_ISLNK(filemode))
   	return '@';
       else if(S_ISREG(filemode))
 ! 	return (filemode & S_IXUGO) ? '*' : ' ';
       else if(S_ISSOCK(filemode))
   	return '=';
       else
 ***************
 *** 2655,2661 ****
   static int
   qualflags(struct stat *buf, long mod)
   {
 !     return buf->st_mode & mod;
   }
   
   /* mode matches number supplied exactly  */
 --- 2655,2661 ----
   static int
   qualflags(struct stat *buf, long mod)
   {
 !     return mode_to_octal(buf->st_mode) & mod;
   }
   
   /* mode matches number supplied exactly  */
 ***************
 *** 2664,2670 ****
   static int
   qualeqflags(struct stat *buf, long mod)
   {
 !     return (buf->st_mode & 07777) == mod;
   }
   
   /* regular executable file? */
 --- 2664,2670 ----
   static int
   qualeqflags(struct stat *buf, long mod)
   {
 !     return mode_to_octal(buf->st_mode) == mod;
   }
   
   /* regular executable file? */
 ***************
 *** 2673,2679 ****
   static int
   qualiscom(struct stat *buf, long mod)
   {
 !     return S_ISREG(buf->st_mode) && (buf->st_mode & S_IXUSR);
   }
   
   /* size in required range? */
 --- 2673,2679 ----
   static int
   qualiscom(struct stat *buf, long mod)
   {
 !     return S_ISREG(buf->st_mode) && (buf->st_mode & S_IXUGO);
   }
   
   /* size in required range? */
 *** Src/system.h	1998/04/26 15:14:52	1.21
 --- Src/system.h	1998/04/26 15:20:29
 ***************
 *** 517,522 ****
 --- 517,579 ----
   # define S_ISSOCK(m) ((void)(m), 0)
   #endif
   
 + /* file mode permission bits */
 + 
 + #ifndef S_ISUID
 + # define S_ISUID 04000
 + #endif
 + #ifndef S_ISGID
 + # define S_ISGID 02000
 + #endif
 + #ifndef S_ISVTX
 + # define S_ISVTX 01000
 + #endif
 + #ifndef S_IRUSR
 + # define S_IRUSR 00400
 + #endif
 + #ifndef S_IWUSR
 + # define S_IWUSR 00200
 + #endif
 + #ifndef S_IXUSR
 + # define S_IXUSR 00100
 + #endif
 + #ifndef S_IRGRP
 + # define S_IRGRP 00040
 + #endif
 + #ifndef S_IWGRP
 + # define S_IWGRP 00020
 + #endif
 + #ifndef S_IXGRP
 + # define S_IXGRP 00010
 + #endif
 + #ifndef S_IROTH
 + # define S_IROTH 00004
 + #endif
 + #ifndef S_IWOTH
 + # define S_IWOTH 00002
 + #endif
 + #ifndef S_IXOTH
 + # define S_IXOTH 00001
 + #endif
 + #ifndef S_IRWXU
 + # define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
 + #endif
 + #ifndef S_IRWXG
 + # define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
 + #endif
 + #ifndef S_IRWXO
 + # define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
 + #endif
 + #ifndef S_IRUGO
 + # define S_IRUGO (S_IRUSR|S_IRGRP|S_IROTH)
 + #endif
 + #ifndef S_IWUGO
 + # define S_IWUGO (S_IWUSR|S_IWGRP|S_IWOTH)
 + #endif
 + #ifndef S_IXUGO
 + # define S_IXUGO (S_IXUSR|S_IXGRP|S_IXOTH)
 + #endif
 + 
   #ifndef HAVE_LSTAT
   # define lstat stat
   #endif
 *** Src/utils.c	1998/04/25 18:14:34	1.89
 --- Src/utils.c	1998/04/26 15:35:34
 ***************
 *** 3634,3637 ****
       fprintf(stderr, "%s\n", message);
       fflush(stderr);
   }
 ! #endif
 --- 3634,3671 ----
       fprintf(stderr, "%s\n", message);
       fflush(stderr);
   }
 ! 
 ! #endif /* DEBUG */
 ! 
 ! /**/
 ! int
 ! mode_to_octal(mode_t mode)
 ! {
 !     int m = 0;
 ! 
 !     if(mode & S_ISUID)
 ! 	m |= 04000;
 !     if(mode & S_ISGID)
 ! 	m |= 02000;
 !     if(mode & S_ISVTX)
 ! 	m |= 01000;
 !     if(mode & S_IRUSR)
 ! 	m |= 00400;
 !     if(mode & S_IWUSR)
 ! 	m |= 00200;
 !     if(mode & S_IXUSR)
 ! 	m |= 00100;
 !     if(mode & S_IRGRP)
 ! 	m |= 00040;
 !     if(mode & S_IWGRP)
 ! 	m |= 00020;
 !     if(mode & S_IXGRP)
 ! 	m |= 00010;
 !     if(mode & S_IROTH)
 ! 	m |= 00004;
 !     if(mode & S_IWOTH)
 ! 	m |= 00002;
 !     if(mode & S_IXOTH)
 ! 	m |= 00001;
 !     return m;
 ! }
 *** Src/Modules/files.c	1998/04/26 13:56:42	1.21
 --- Src/Modules/files.c	1998/04/26 15:34:53
 ***************
 *** 297,304 ****
   	    nicezputs(nam, stderr);
   	    fputs(": replace `", stderr);
   	    nicezputs(q, stderr);
 ! 	    fprintf(stderr, "', overriding mode %04lo? ",
 ! 		(unsigned long) (st.st_mode & 07777));
   	    fflush(stderr);
   	    if(!ask())
   		return 0;
 --- 297,304 ----
   	    nicezputs(nam, stderr);
   	    fputs(": replace `", stderr);
   	    nicezputs(q, stderr);
 ! 	    fprintf(stderr, "', overriding mode %04o? ",
 ! 		mode_to_octal(st.st_mode));
   	    fflush(stderr);
   	    if(!ask())
   		return 0;
 ***************
 *** 406,413 ****
   	    nicezputs(nam, stderr);
   	    fputs(": remove `", stderr);
   	    nicezputs(arg, stderr);
 ! 	    fprintf(stderr, "', overriding mode %04lo? ",
 ! 		(unsigned long) (st.st_mode & 07777));
   	    fflush(stderr);
   	    if(!ask())
   		return 0;
 --- 406,413 ----
   	    nicezputs(nam, stderr);
   	    fputs(": remove `", stderr);
   	    nicezputs(arg, stderr);
 ! 	    fprintf(stderr, "', overriding mode %04o? ",
 ! 		mode_to_octal(st.st_mode));
   	    fflush(stderr);
   	    if(!ask())
   		return 0;
 *** Src/Modules/stat.c	1998/04/26 13:56:43	1.10
 --- Src/Modules/stat.c	1998/04/26 15:28:26
 ***************
 *** 78,102 ****
   	else if (S_ISSOCK(mode))
   	    *pm = 's';
   
 ! 	/* too much hassle using macros for the following which should be
 ! 	 * standardish.
 ! 	 */
 ! 	ioff = 1;
 ! 	for (itest = 64; itest > 0; itest /= 8) {
 ! 	    if (mode & (4*itest))
 ! 		pm[ioff] = 'r';
 ! 	    if (mode & (2*itest))
 ! 		pm[ioff+1] = 'w';
 ! 	    if (mode & itest)
 ! 		pm[ioff+2] = 'x';
 ! 	    ioff += 3;
 ! 	}
 ! 	if (mode & 04000)	/* setuid */
 ! 	    pm[3] = (pm[3] == 'x') ? 's' : 'S';
 ! 	if (mode & 02000)	/* setgid */
 ! 	    pm[6] = (pm[6] == 'x') ? 's' : 'S';
 ! 	if (mode & 01000)	/* sticky bit */
 ! 	    pm[9] = (pm[9] == 'x') ? 't' : 'T';
   
   	strcat(outbuf, pm);
   	if (flags & STF_RAW)
 --- 78,107 ----
   	else if (S_ISSOCK(mode))
   	    *pm = 's';
   
 ! 	if(mode & S_IRUSR)
 ! 	    pm[1] = 'r';
 ! 	if(mode & S_IWUSR)
 ! 	    pm[2] = 'w';
 ! 	if(mode & S_IXUSR)
 ! 	    pm[3] = 'x';
 ! 	if(mode & S_IRGRP)
 ! 	    pm[4] = 'r';
 ! 	if(mode & S_IWGRP)
 ! 	    pm[5] = 'w';
 ! 	if(mode & S_IXGRP)
 ! 	    pm[6] = 'x';
 ! 	if(mode & S_IROTH)
 ! 	    pm[7] = 'r';
 ! 	if(mode & S_IWOTH)
 ! 	    pm[8] = 'w';
 ! 	if(mode & S_IXOTH)
 ! 	    pm[9] = 'x';
 ! 	if (mode & S_ISUID)
 ! 	    pm[3] = (mode & S_IXUSR) ? 's' : 'S';
 ! 	if (mode & S_ISGID)
 ! 	    pm[6] = (mode & S_IXGRP) ? 's' : 'S';
 ! 	if (mode & S_ISVTX)
 ! 	    pm[9] = (mode & S_IXOTH) ? 't' : 'T';
   
   	strcat(outbuf, pm);
   	if (flags & STF_RAW)
 *** Src/Zle/zle_tricky.c	1998/04/26 13:56:45	1.44
 --- Src/Zle/zle_tricky.c	1998/04/26 15:29:52
 ***************
 *** 2091,2097 ****
   		}
   		if (all ||
   		    (dirs && S_ISDIR(buf.st_mode)) ||
 ! 		    (execs && S_ISREG(buf.st_mode) && (buf.st_mode&S_IXUSR))) {
   		    /* If we want all files or the file has the right type... */
   		    if (*psuf) {
   			/* We have to test for a path suffix. */
 --- 2091,2097 ----
   		}
   		if (all ||
   		    (dirs && S_ISDIR(buf.st_mode)) ||
 ! 		    (execs && S_ISREG(buf.st_mode) && (buf.st_mode&S_IXUGO))) {
   		    /* If we want all files or the file has the right type... */
   		    if (*psuf) {
   			/* We have to test for a path suffix. */

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
Charset: ascii

iQEVAwUBNUNafJmk9GeOHh7BAQGpPgf/czyhnxMGu54DkKN06jlFj6Oe9+tDQpkP
0RGHGaaB1G509bNuLNGImSx1kNP7Ys56K9pHa+oUDqnpSzpoG3YL35OBFA9aSFkh
kE4ecH1+VB3i4+czFLnj81dNB3nMBbtJhIXSme4MJqaoUheoaI0IGqCuW9OVHr3y
23nHqmqpXYO1U2e90o9WFuwjuRyt/d+gvqyER1zlcsSr245POZ7hDfWHHw6ph/G6
S+N54PWy1tU4q4FYVYvh+8dt+tOoOz6EZBcFqqm4cusMmSTE2xWjHOJZFrS2x6sV
+8klmqZ4Ypn93FrXn5YvhhgkRdVlb6GMwdlP/k8s63WsIahpRGKe9g==
=H7IV
-----END PGP SIGNATURE-----


^ permalink raw reply	[relevance 10%]

* PATCH: optional file types
@ 1998-04-27  9:22  2% Andrew Main
  0 siblings, 0 replies; 200+ results
From: Andrew Main @ 1998-04-27  9:22 UTC (permalink / raw)
  To: zsh-workers

-----BEGIN PGP SIGNED MESSAGE-----

zsh currently doesn't compile on systems that don't support symbolic
links.  This patch should fix that.  With this patch, the S_IS* macros are
used in all cases instead of S_IF*, and dummy S_IS* macros are defined
for file types not supported on the current system.  This means that
there is no need for conditional compilation to protect code relating
to non-standard file types.  readlink() is also given a dummy definition.

I'd like the stat module (and hence zls) to support all possible file
types.  Therefore, if your system has any file types not currently in
the list in system.h, please post to zsh-workers, listing for each such
file type

	* the relevant S_IS* and S_IF* macro names
	* the full name of the file type
	* the identifying letter used by the native ls in -l mode
	* the identifying character used by the native ls in -F mode

The information for S_ISMPB, S_ISMPC, S_ISNWK, S_ISOFD and S_ISOFL is
incomplete, so anyone on the relevant systems please let us know about
these also.

 -zefram

 *** configure.in	1998/03/23 22:28:47	1.49
 --- configure.in	1998/04/26 12:49:08
 ***************
 *** 535,541 ****
                 getlogin setpgid gettimeofday gethostname mkfifo wait3 difftime \
                 sigblock sigsetmask sigrelse sighold killpg sigaction getrlimit \
                 sigprocmask setuid seteuid setreuid setresuid setsid strerror \
 !               nis_list initgroups fchdir cap_init)
   if test $dynamic = yes; then
     AC_CHECK_FUNCS(dlopen dlerror dlsym dlclose)
   fi
 --- 535,541 ----
                 getlogin setpgid gettimeofday gethostname mkfifo wait3 difftime \
                 sigblock sigsetmask sigrelse sighold killpg sigaction getrlimit \
                 sigprocmask setuid seteuid setreuid setresuid setsid strerror \
 !               nis_list initgroups fchdir cap_init readlink)
   if test $dynamic = yes; then
     AC_CHECK_FUNCS(dlopen dlerror dlsym dlclose)
   fi
 *** Src/cond.c	1997/06/17 15:59:43	1.14
 --- Src/cond.c	1998/04/26 11:16:48
 ***************
 *** 88,98 ****
       case 's':
   	return ((st = getstat(c->left)) && !!(st->st_size));
       case 'S':
 - #ifdef S_ISSOCK
   	return (S_ISSOCK(dostat(c->left)));
 - #else
 - 	return 0;   /* some versions of SCO are missing S_ISSOCK */
 - #endif
       case 'u':
   	return (!!(dostat(c->left) & S_ISUID));
       case 'w':
 --- 88,94 ----
 *** Src/glob.c	1998/04/25 17:17:48	1.44
 --- Src/glob.c	1998/04/26 11:48:31
 ***************
 *** 934,970 ****
   			/* Toggle matching of symbolic links */
   			sense ^= 2;
   			break;
 - #ifdef S_IFLNK
   		    case '@':
   			/* Match symbolic links */
 ! 			func = qualmode;
 ! 			data = S_IFLNK;
   			break;
 - #endif
 - #ifdef S_IFSOCK
   		    case Equals:
   		    case '=':
   			/* Match sockets */
 ! 			func = qualmode;
 ! 			data = S_IFSOCK;
   			break;
 - #endif
 - #ifdef S_IFIFO
   		    case 'p':
   			/* Match named pipes */
 ! 			func = qualmode;
 ! 			data = S_IFIFO;
   			break;
 - #endif
   		    case '/':
   			/* Match directories */
 ! 			func = qualmode;
 ! 			data = S_IFDIR;
   			break;
   		    case '.':
   			/* Match regular files */
 ! 			func = qualmode;
 ! 			data = S_IFREG;
   			break;
   		    case '%':
   			/* Match special files: block, *
 --- 934,959 ----
   			/* Toggle matching of symbolic links */
   			sense ^= 2;
   			break;
   		    case '@':
   			/* Match symbolic links */
 ! 			func = qualislnk;
   			break;
   		    case Equals:
   		    case '=':
   			/* Match sockets */
 ! 			func = qualissock;
   			break;
   		    case 'p':
   			/* Match named pipes */
 ! 			func = qualisfifo;
   			break;
   		    case '/':
   			/* Match directories */
 ! 			func = qualisdir;
   			break;
   		    case '.':
   			/* Match regular files */
 ! 			func = qualisreg;
   			break;
   		    case '%':
   			/* Match special files: block, *
 ***************
 *** 972,978 ****
   			if (*s == 'b')
   			    s++, func = qualisblk;
   			else if (*s == 'c')
 ! 			    s++, func = qualischar;
   			else
   			    func = qualisdev;
   			break;
 --- 961,967 ----
   			if (*s == 'b')
   			    s++, func = qualisblk;
   			else if (*s == 'c')
 ! 			    s++, func = qualischr;
   			else
   			    func = qualisdev;
   			break;
 ***************
 *** 1323,1353 ****
   char
   file_type(mode_t filemode)
   {
 !     switch (filemode & S_IFMT) {/* screw POSIX */
 !     case S_IFDIR:
   	return '/';
 ! #ifdef S_IFIFO
 !     case S_IFIFO:
   	return '|';
 ! #endif
 !     case S_IFCHR:
 ! 	return '%';
 !     case S_IFBLK:
 ! 	return '#';
 ! #ifdef S_IFLNK
 !     case S_IFLNK:
 ! 	return /* (access(pbuf, F_OK) == -1) ? '&' :*/ '@';
 ! #endif
 ! #ifdef S_IFSOCK
 !     case S_IFSOCK:
   	return '=';
 ! #endif
 !     default:
 ! 	if (filemode & 0111)
 ! 	    return '*';
 ! 	else
 ! 	    return ' ';
 !     }
   }
   
   /* check to see if str is eligible for brace expansion */
 --- 1312,1333 ----
   char
   file_type(mode_t filemode)
   {
 !     if(S_ISBLK(filemode))
 ! 	return '#';
 !     else if(S_ISCHR(filemode))
 ! 	return '%';
 !     else if(S_ISDIR(filemode))
   	return '/';
 !     else if(S_ISFIFO(filemode))
   	return '|';
 !     else if(S_ISLNK(filemode))
 ! 	return '@';
 !     else if(S_ISREG(filemode))
 ! 	return (filemode & 0111) ? '*' : ' ';
 !     else if(S_ISSOCK(filemode))
   	return '=';
 !     else
 ! 	return '?';
   }
   
   /* check to see if str is eligible for brace expansion */
 ***************
 *** 2603,2610 ****
   static int
   qualisdev(struct stat *buf, long junk)
   {
 !     junk = buf->st_mode & S_IFMT;
 !     return junk == S_IFBLK || junk == S_IFCHR;
   }
   
   /* block special file? */
 --- 2583,2589 ----
   static int
   qualisdev(struct stat *buf, long junk)
   {
 !     return S_ISBLK(buf->st_mode) || S_ISCHR(buf->st_mode);
   }
   
   /* block special file? */
 ***************
 *** 2613,2639 ****
   static int
   qualisblk(struct stat *buf, long junk)
   {
 !     junk = buf->st_mode & S_IFMT;
 !     return junk == S_IFBLK;
   }
   
   /* character special file? */
   
   /**/
   static int
 ! qualischar(struct stat *buf, long junk)
   {
 !     junk = buf->st_mode & S_IFMT;
 !     return junk == S_IFCHR;
   }
   
 ! /* file type is requested one */
   
   /**/
   static int
 ! qualmode(struct stat *buf, long mod)
   {
 !     return (buf->st_mode & S_IFMT) == mod;
   }
   
   /* given flag is set in mode */
 --- 2592,2652 ----
   static int
   qualisblk(struct stat *buf, long junk)
   {
 !     return S_ISBLK(buf->st_mode);
   }
   
   /* character special file? */
   
   /**/
   static int
 ! qualischr(struct stat *buf, long junk)
 ! {
 !     return S_ISCHR(buf->st_mode);
 ! }
 ! 
 ! /* directory? */
 ! 
 ! /**/
 ! static int
 ! qualisdir(struct stat *buf, long junk)
 ! {
 !     return S_ISDIR(buf->st_mode);
 ! }
 ! 
 ! /* FIFO? */
 ! 
 ! /**/
 ! static int
 ! qualisfifo(struct stat *buf, long junk)
 ! {
 !     return S_ISFIFO(buf->st_mode);
 ! }
 ! 
 ! /* symbolic link? */
 ! 
 ! /**/
 ! static int
 ! qualislnk(struct stat *buf, long junk)
 ! {
 !     return S_ISLNK(buf->st_mode);
 ! }
 ! 
 ! /* regular file? */
 ! 
 ! /**/
 ! static int
 ! qualisreg(struct stat *buf, long junk)
   {
 !     return S_ISREG(buf->st_mode);
   }
   
 ! /* socket? */
   
   /**/
   static int
 ! qualissock(struct stat *buf, long junk)
   {
 !     return S_ISSOCK(buf->st_mode);
   }
   
   /* given flag is set in mode */
 ***************
 *** 2660,2666 ****
   static int
   qualiscom(struct stat *buf, long mod)
   {
 !     return (buf->st_mode & (S_IFMT | S_IEXEC)) == (S_IFREG | S_IEXEC);
   }
   
   /* size in required range? */
 --- 2673,2679 ----
   static int
   qualiscom(struct stat *buf, long mod)
   {
 !     return S_ISREG(buf->st_mode) && (buf->st_mode & S_IXUSR);
   }
   
   /* size in required range? */
 *** Src/system.h	1998/01/09 22:58:31	1.19
 --- Src/system.h	1998/04/26 13:30:32
 ***************
 *** 418,461 ****
   
   /* If your stat macros are broken, we will *
    * just undefine them.                     */
 ! #ifdef  STAT_MACROS_BROKEN
 ! # ifdef S_ISBLK
 ! #  undef S_ISBLK
 ! # endif
 ! # ifdef S_ISCHR
 ! #  undef S_ISCHR
 ! # endif
 ! # ifdef S_ISDIR
 ! #  undef S_ISDIR
 ! # endif
 ! # ifdef S_ISFIFO
 ! #  undef S_ISFIFO
 ! # endif
 ! # ifdef S_ISLNK
 ! #  undef S_ISLNK
 ! # endif
 ! # ifdef S_ISMPB
 ! #  undef S_ISMPB
 ! # endif
 ! # ifdef S_ISMPC
 ! #  undef S_ISMPC
 ! # endif
 ! # ifdef S_ISNWK
 ! #  undef S_ISNWK
 ! # endif
 ! # ifdef S_ISREG
 ! #  undef S_ISREG
 ! # endif
 ! # ifdef S_ISSOCK
 ! #  undef S_ISSOCK
 ! # endif
   #endif  /* STAT_MACROS_BROKEN.  */
   
   /* If you are missing the stat macros, we *
    * define our own                         */
   #ifndef S_IFMT
   # define S_IFMT 0170000
   #endif
   #if !defined(S_ISBLK) && defined(S_IFBLK)
   # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
   #endif
 --- 418,446 ----
   
   /* If your stat macros are broken, we will *
    * just undefine them.                     */
 ! 
 ! #ifdef STAT_MACROS_BROKEN
 ! # undef S_ISBLK
 ! # undef S_ISCHR
 ! # undef S_ISDIR
 ! # undef S_ISFIFO
 ! # undef S_ISLNK
 ! # undef S_ISMPB
 ! # undef S_ISMPC
 ! # undef S_ISNWK
 ! # undef S_ISOFD
 ! # undef S_ISOFL
 ! # undef S_ISREG
 ! # undef S_ISSOCK
   #endif  /* STAT_MACROS_BROKEN.  */
   
   /* If you are missing the stat macros, we *
    * define our own                         */
 + 
   #ifndef S_IFMT
   # define S_IFMT 0170000
   #endif
 + 
   #if !defined(S_ISBLK) && defined(S_IFBLK)
   # define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK)
   #endif
 ***************
 *** 465,492 ****
   #if !defined(S_ISDIR) && defined(S_IFDIR)
   # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
   #endif
 - #if !defined(S_ISREG) && defined(S_IFREG)
 - # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
 - #endif
   #if !defined(S_ISFIFO) && defined(S_IFIFO)
   # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
   #endif
   #if !defined(S_ISLNK) && defined(S_IFLNK)
   # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
   #endif
 ! #if !defined(S_ISSOCK) && defined(S_IFSOCK)
 ! # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
 ! #endif
 ! #if !defined(S_ISMPB) && defined(S_IFMPB)        /*   V7  */
   # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
   # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
   #endif
   #if !defined(S_ISNWK) && defined(S_IFNWK)        /* HP/UX */
   # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
   #endif
   
   #ifndef HAVE_LSTAT
 ! # define lstat(X,Y) stat(X,Y)
   #endif
   
   #ifndef F_OK          /* missing macros for access() */
 --- 450,529 ----
   #if !defined(S_ISDIR) && defined(S_IFDIR)
   # define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
   #endif
   #if !defined(S_ISFIFO) && defined(S_IFIFO)
   # define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO)
   #endif
   #if !defined(S_ISLNK) && defined(S_IFLNK)
   # define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
   #endif
 ! #if !defined(S_ISMPB) && defined(S_IFMPB)        /* V7 */
   # define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB)
 + #endif
 + #if !defined(S_ISMPC) && defined(S_IFMPC)        /* V7 */
   # define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC)
   #endif
   #if !defined(S_ISNWK) && defined(S_IFNWK)        /* HP/UX */
   # define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK)
   #endif
 + #if !defined(S_ISOFD) && defined(S_IFOFD)        /* Cray */
 + # define S_ISOFD(m) (((m) & S_IFMT) == S_IFOFD)
 + #endif
 + #if !defined(S_ISOFL) && defined(S_IFOFL)        /* Cray */
 + # define S_ISOFL(m) (((m) & S_IFMT) == S_IFOFL)
 + #endif
 + #if !defined(S_ISREG) && defined(S_IFREG)
 + # define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
 + #endif
 + #if !defined(S_ISSOCK) && defined(S_IFSOCK)
 + # define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK)
 + #endif
 + 
 + /* We will pretend to have all file types on any system. */
 + 
 + #ifndef S_ISBLK
 + # define S_ISBLK(m) ((void)(m), 0)
 + #endif
 + #ifndef S_ISCHR
 + # define S_ISCHR(m) ((void)(m), 0)
 + #endif
 + #ifndef S_ISDIR
 + # define S_ISDIR(m) ((void)(m), 0)
 + #endif
 + #ifndef S_ISFIFO
 + # define S_ISFIFO(m) ((void)(m), 0)
 + #endif
 + #ifndef S_ISLNK
 + # define S_ISLNK(m) ((void)(m), 0)
 + #endif
 + #ifndef S_ISMPB
 + # define S_ISMPB(m) ((void)(m), 0)
 + #endif
 + #ifndef S_ISMPC
 + # define S_ISMPC(m) ((void)(m), 0)
 + #endif
 + #ifndef S_ISNWK
 + # define S_ISNWK(m) ((void)(m), 0)
 + #endif
 + #ifndef S_ISOFD
 + # define S_ISOFD(m) ((void)(m), 0)
 + #endif
 + #ifndef S_ISOFL
 + # define S_ISOFL(m) ((void)(m), 0)
 + #endif
 + #ifndef S_ISREG
 + # define S_ISREG(m) ((void)(m), 0)
 + #endif
 + #ifndef S_ISSOCK
 + # define S_ISSOCK(m) ((void)(m), 0)
 + #endif
   
   #ifndef HAVE_LSTAT
 ! # define lstat stat
 ! #endif
 ! 
 ! #ifndef HAVE_READLINK
 ! # define readlink(PATH, BUF, BUFSZ) \
 !     ((void)(PATH), (void)(BUF), (void)(BUFSZ), errno = ENOSYS, -1)
   #endif
   
   #ifndef F_OK          /* missing macros for access() */
 *** Src/Modules/files.c	1997/06/17 16:00:22	1.20
 --- Src/Modules/files.c	1998/04/26 11:14:34
 ***************
 *** 292,300 ****
   		return 0;
   	    doit = 1;
   	} else if((flags & MV_ASKNW) &&
 - #ifdef S_ISLNK
   		!S_ISLNK(st.st_mode) &&
 - #endif
   		access(qbuf, W_OK)) {
   	    nicezputs(nam, stderr);
   	    fputs(": replace `", stderr);
 --- 292,298 ----
 ***************
 *** 403,411 ****
   	    if(!ask())
   		return 0;
   	} else if(!ops['f'] &&
 - #ifdef S_ISLNK
   		!S_ISLNK(st.st_mode) &&
 - #endif
   	    	access(rp, W_OK)) {
   	    nicezputs(nam, stderr);
   	    fputs(": remove `", stderr);
 --- 401,407 ----
 *** Src/Modules/stat.c	1997/06/17 16:00:22	1.9
 --- Src/Modules/stat.c	1998/04/26 12:19:24
 ***************
 *** 55,88 ****
   	int ioff, itest;
   	char pm[11] = "?---------";
   
 - #ifdef S_ISBLK
   	if (S_ISBLK(mode))
   	    *pm = 'b';
 ! #endif
 ! #ifdef S_ISCHR
 ! 	if (S_ISCHR(mode))
   	    *pm = 'c';
 ! #endif
 ! #ifdef S_ISREG
 ! 	if (S_ISREG(mode))
 ! 	    *pm = '-';
 ! #endif
 ! #ifdef S_ISDIR
 ! 	if (S_ISDIR(mode))
   	    *pm = 'd';
 ! #endif
 ! #ifdef S_ISFIFO
 ! 	if (S_ISFIFO(mode))
   	    *pm = 'p';
 ! #endif
 ! #ifdef S_ISLNK
 ! 	if (S_ISLNK(mode))
   	    *pm = 'l';
 ! #endif
 ! #ifdef S_ISSOCK
 ! 	if (S_ISSOCK(mode))
   	    *pm = 's';
 - #endif
   
   	/* too much hassle using macros for the following which should be
   	 * standardish.
 --- 55,82 ----
   	int ioff, itest;
   	char pm[11] = "?---------";
   
   	if (S_ISBLK(mode))
   	    *pm = 'b';
 ! 	else if (S_ISCHR(mode))
   	    *pm = 'c';
 ! 	else if (S_ISDIR(mode))
   	    *pm = 'd';
 ! 	else if (S_ISFIFO(mode))
   	    *pm = 'p';
 ! 	else if (S_ISLNK(mode))
   	    *pm = 'l';
 ! 	else if (S_ISMPC(mode))
 ! 	    *pm = 'm';
 ! 	else if (S_ISNWK(mode))
 ! 	    *pm = 'n';
 ! 	else if (S_ISOFD(mode))
 ! 	    *pm = 'M';
 ! 	else if (S_ISOFL(mode))
 ! 	    *pm = 'M';
 ! 	else if (S_ISREG(mode))
 ! 	    *pm = '-';
 ! 	else if (S_ISSOCK(mode))
   	    *pm = 's';
   
   	/* too much hassle using macros for the following which should be
   	 * standardish.
 ***************
 *** 182,195 ****
   statlinkprint(struct stat *sbuf, char *outbuf, char *fname)
   {
       int num;
 ! #ifdef S_ISLNK
       /* fname is NULL if we are looking at an fd */
       if (fname && S_ISLNK(sbuf->st_mode) &&
    	(num = readlink(fname, outbuf, PATH_MAX)) > 0) {
   	/* readlink doesn't terminate the buffer itself */
   	outbuf[num] = '\0';
       }
 - #endif
   }
   
   
 --- 176,188 ----
   statlinkprint(struct stat *sbuf, char *outbuf, char *fname)
   {
       int num;
 ! 
       /* fname is NULL if we are looking at an fd */
       if (fname && S_ISLNK(sbuf->st_mode) &&
    	(num = readlink(fname, outbuf, PATH_MAX)) > 0) {
   	/* readlink doesn't terminate the buffer itself */
   	outbuf[num] = '\0';
       }
   }
   
   
 *** Src/Zle/zle_tricky.c	1998/04/04 16:21:06	1.43
 --- Src/Zle/zle_tricky.c	1998/04/26 13:23:46
 ***************
 *** 2090,2098 ****
   			continue;
   		}
   		if (all ||
 ! 		    (dirs && (buf.st_mode & S_IFMT) == S_IFDIR) ||
 ! 		    (execs && ((buf.st_mode & (S_IFMT | S_IEXEC))
 ! 		      == (S_IFREG | S_IEXEC)))) {
   		    /* If we want all files or the file has the right type... */
   		    if (*psuf) {
   			/* We have to test for a path suffix. */
 --- 2090,2097 ----
   			continue;
   		}
   		if (all ||
 ! 		    (dirs && S_ISDIR(buf.st_mode)) ||
 ! 		    (execs && S_ISREG(buf.st_mode) && (buf.st_mode&S_IXUSR))) {
   		    /* If we want all files or the file has the right type... */
   		    if (*psuf) {
   			/* We have to test for a path suffix. */
 ***************
 *** 3424,3430 ****
   			fsuf, psuf);
   	    }
   	    /* And do the stat. */
 ! 	    if (!ztat(p, &buf, 0) && (buf.st_mode & S_IFMT) == S_IFDIR) {
   		/* It is a directory, so add the slash. */
   		havesuff = 1;
   		inststrlen("/", 1, 1);
 --- 3423,3429 ----
   			fsuf, psuf);
   	    }
   	    /* And do the stat. */
 ! 	    if (!ztat(p, &buf, 0) && S_ISDIR(buf.st_mode)) {
   		/* It is a directory, so add the slash. */
   		havesuff = 1;
   		inststrlen("/", 1, 1);

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
Charset: ascii

iQEVAwUBNUM/R5mk9GeOHh7BAQHHYgf8DAQWhskEjLvQ7tQ8y28gu5QpOMKaWyDf
+Td8Bs7F5qoYUWmPWoJi7wOQJ84DjEQ06k9ySaGQWg24Mr3uksog6KiEE5FNCkLv
2qWHYjCj8aPN5KpVdQBr6T3q1qg3MsutWMPswE8hS+7tiX/wxqcwbFWc4qDNZeCl
n8tIcvcCsEkDWq+aC276c1A/paWQike+n2hNCz8+ytJjyOGanijYyOE0CrpDjX0x
Nkwqs+l/LNCGvZrTqCY2p+NXHy7weDIjEW5DKyyfq5Dm0ZVbH9r4G9747r3VPutv
9Er+v/KBFDNxTtyxUnaErZNEs6QqC3T+nEyulIxXnw29kbIP985geA==
=VT1d
-----END PGP SIGNATURE-----


^ permalink raw reply	[relevance 2%]

* Re: zsh vs. ksh coproc redirection semantics
  @ 1998-05-07  8:27  6% ` Andrew Main
  0 siblings, 0 replies; 200+ results
From: Andrew Main @ 1998-05-07  8:27 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zefram, zsh-workers

Bart Schaefer wrote:
>That doesn't address the issue of how to close the coproc input in the
>basic zsh model.  Is "coproc exit" really going to be the approved way?

That's a separate issue.  I think the best solution is tied into access
to file descriptors above 9: make the coprocess fds be 10 and 11, and
then you can do (ignoring for the moment the single digit restriction of
the syntax) "10>&- 11>&-" to close them.  ">&p" would be shorthand for
">&10", and so on.

What syntax to use for these fds is another issue altogether.  We're
seriously short of special characters, and I don't see a good syntax
that's compatible with POSIX.  (The best I see is to put ">;" preceding
the multi-digit version of the normal syntax.)  OTOH, it would probably
be reasonably easy to simply allow multi-digit fd numbers with an option,
enabled by default only in zsh mode.

-zefram


^ permalink raw reply	[relevance 6%]

* PATCH: set blocking read on stdin
@ 1998-05-08  6:23  5% Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1998-05-08  6:23 UTC (permalink / raw)
  To: Zsh hacking and development

This patch sets blocking read on stdin when the shell reads commands from
there or when it is used by the read builtin.  This is required by POSIX.

Zoli


*** Src/builtin.c.orig	Fri May  8 01:04:12 1998
--- Src/builtin.c	Fri May  8 01:15:15 1998
*************** bin_read(char *name, char **args, char *
*** 3175,3181 ****
  static int
  zread(void)
  {
!     char cc;
  
      /* use zbuf if possible */
      if (zbuf)
--- 3175,3181 ----
  static int
  zread(void)
  {
!     char cc, retry = 0;
  
      /* use zbuf if possible */
      if (zbuf)
*************** zread(void)
*** 3186,3197 ****
  	    return zbuf++, STOUC(*zbuf++ ^ 32);
  	else
  	    return (*zbuf) ? STOUC(*zbuf++) : EOF;
!     /* read a character from readfd */
!     if (read(readfd, &cc, 1) != 1)
! 	/* on EOF, return EOF */
  	return EOF;
!     /* return the character read */
!     return STOUC(cc);
  }
  
  /* holds arguments for testlex() */
--- 3186,3207 ----
  	    return zbuf++, STOUC(*zbuf++ ^ 32);
  	else
  	    return (*zbuf) ? STOUC(*zbuf++) : EOF;
!     for (;;) {
! 	/* read a character from readfd */
! 	switch (read(readfd, &cc, 1)) {
! 	case 1:
! 	    /* return the character read */
! 	    return STOUC(cc);
! 	case -1:
! 	    if (!retry && errno == EWOULDBLOCK &&
! 		readfd == 0 && setblock_stdin()) {
! 		retry = 1;
! 		continue;
! 	    }
! 	    break;
! 	}
  	return EOF;
!     }
  }
  
  /* holds arguments for testlex() */
*** Src/init.c.orig	Sat May  2 03:45:37 1998
--- Src/init.c	Fri May  8 01:15:15 1998
*************** loop(int toplevel, int justonce)
*** 88,95 ****
      for (;;) {
  	freeheap();
  	errflag = 0;
! 	if (interact && isset(SHINSTDIN))
! 	    preprompt();
  	hbegin();		/* init history mech        */
  	intr();			/* interrupts on            */
  	lexinit();              /* initialize lexical state */
--- 88,98 ----
      for (;;) {
  	freeheap();
  	errflag = 0;
! 	if (isset(SHINSTDIN)) {
! 	    setblock_stdin();
! 	    if (interact)
! 		preprompt();
! 	}
  	hbegin();		/* init history mech        */
  	intr();			/* interrupts on            */
  	lexinit();              /* initialize lexical state */
*** Src/utils.c.orig	Sat May  2 03:47:05 1998
--- Src/utils.c	Fri May  8 01:18:58 1998
*************** zstrtol(const char *s, char **t, int bas
*** 1076,1081 ****
--- 1076,1099 ----
  
  /**/
  int
+ setblock_stdin(void)
+ {
+ #ifdef O_NONBLOCK
+     struct stat st;
+     long mode;
+ 
+     if (!fstat(0, &st) && !S_ISREG(st.st_mode)) {
+ 	mode = fcntl(0, F_GETFL);
+ 	if (mode != -1 && (mode & O_NONBLOCK) &&
+ 	    !fcntl(0, F_SETFL, mode & ~O_NONBLOCK))
+ 	    return 1;
+     }
+ #endif
+     return 0;
+ }
+ 
+ /**/
+ int
  checkrmall(char *s)
  {
      fprintf(shout, "zsh: sure you want to delete all the files in ");


^ permalink raw reply	[relevance 5%]

* PATCH: misc glob fixes
@ 1998-05-09 22:17  3% Zoltan Hidvegi
  1998-05-11  9:36  6% ` Andrew Main
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1998-05-09 22:17 UTC (permalink / raw)
  To: Zsh hacking and development

This patch fixes several glob problems.

First, many systems ignore trailing slashes on filenames.  As a result */
will match all files instead of just directories as required by common
sense and the POSIX standard.  The solution is to stat/lstat/access
`filename/.' instead of `filename/'.

The next problem was introduced by patch 3285 which fixes the (-T) and
(-M) qualifier behavior.  The problem is the these will give no maches
found on a dangling symlink.

A somewhat related promlem occurs when the T or M qualifier is applied
together with some other mode qualifier.  For example *(T-/) will not
match symbolic links to directories.  That's because T will add the @ to
the ent of the symlink to mark it and the stat will be done on this
modified name.

The patch combines exists and getfullpatch into
statfullpath(const char *s, struct stat *st, int l).
This combines the current glob directory with the filename s.  l is a
flag to follow symlinks.  If st is NULL access is used instead of stat.
That's the same as before: exists used access.  access is faster on
certain filesystems.  Also some filesystems do not allow stat on a file,
although access returns success on the file.  If I remember correctly
this is true for AFS when the file is in a directory which is listable
but not readable.  * will work in such directories, but *(T) will give no
match, since if the lstat fails, it assumes that the file does not
exists.  This may be considered a bug, but it is really because AFS does
not follow the usual Unix semantics, so I do not think it should be
fixed.

All of these are already in 3.0.5

Zoli


*** Src/glob.c.orig	Sat May  9 15:06:05 1998
--- Src/glob.c	Sat May  9 16:32:32 1998
*************** static char *pptr;		/* current place in 
*** 128,142 ****
  static Comp tail;
  static int first;		/* are leading dots special? */
  
- /**/
- static int
- exists(char *s)
- {
-     char *us = unmeta(s);
- 
-     return access(us, F_OK) == 0 || readlink(us,NULL,0) == 0;
- }
- 
  /* Add a component to pathbuf: This keeps track of how    *
   * far we are into a file name, since each path component *
   * must be matched separately.                            */
--- 128,133 ----
*************** addpath(char *s)
*** 153,172 ****
      pathbuf[pathpos] = '\0';
  }
  
! /* return full path for s, which has path as *
!  * already added to pathbuf                  */
  
  /**/
! static char *
! getfullpath(char *s)
  {
!     static char buf[PATH_MAX];
  
!     DPUTS(strlen(s) + pathpos - pathbufcwd >= PATH_MAX,
! 	  "BUG: getfullpath(): pathname too long");
      strcpy(buf, pathbuf + pathbufcwd);
      strcpy(buf + pathpos - pathbufcwd, s);
!     return buf;
  }
  
  /* add a match to the list */
--- 144,174 ----
      pathbuf[pathpos] = '\0';
  }
  
! /* stat the filename s appended to pathbuf.  l should be true for lstat,    *
!  * false for stat.  If st is NULL, the file is only chechked for existance. *
!  * s == "" is treated as s == ".".  This is necessary since on most systems *
!  * foo/ can be used to reference a non-directory foo.  Returns nonzero if   *
!  * the file does not exists.                                                */
  
  /**/
! static int
! statfullpath(const char *s, struct stat *st, int l)
  {
!     char buf[PATH_MAX];
  
!     DPUTS(strlen(s) + !*s + pathpos - pathbufcwd >= PATH_MAX,
! 	  "BUG: statfullpath(): pathname too long");
      strcpy(buf, pathbuf + pathbufcwd);
      strcpy(buf + pathpos - pathbufcwd, s);
!     if (!*s) {
! 	buf[pathpos - pathbufcwd] = '.';
! 	buf[pathpos - pathbufcwd + 1] = '\0';
! 	l = 0;
!     }
!     unmetafy(buf, NULL);
!     if (!st)
! 	return access(buf, F_OK) && (!l || readlink(buf, NULL, 0));
!     return l ? lstat(buf, st) : stat(buf, st);
  }
  
  /* add a match to the list */
*************** static void
*** 176,245 ****
  insert(char *s, int checked)
  {
      struct stat buf, buf2, *bp;
      int statted = 0;
  
      if (gf_listtypes || gf_markdirs) {
  	/* Add the type marker to the end of the filename */
  	checked = statted = 1;
! 	if (gf_follow ? stat(unmetafy(getfullpath(s), NULL), &buf)
! 	    : lstat(unmetafy(getfullpath(s), NULL), &buf))
  	    return;
! 	if (gf_listtypes || S_ISDIR(buf.st_mode)) {
! 	    char *t;
  	    int ll = strlen(s);
  
! 	    t = (char *)ncalloc(ll + 2);
! 	    strcpy(t, s);
! 	    t[ll] = file_type(buf.st_mode);
! 	    t[ll + 1] = '\0';
! 	    s = t;
  	}
      }
      if (qualct || qualorct) {
  	/* Go through the qualifiers, rejecting the file if appropriate */
  	struct qual *qo, *qn;
- 	int t = 0;		/* reject file unless t is set */
  
! 	if (!statted && lstat(unmetafy(getfullpath(s), NULL), &buf))
  	    return;
! 	statted = 0;
! 	for (qo = quals; qo && !t; qo = qo->or) {
! 	    t = 1;
! 	    for (qn = qo; t && qn && qn->func; qn = qn->next) {
! 		range = qn->range;
! 		amc = qn->amc;
! 		units = qn->units;
! 		if ((qn->sense & 2) && !statted) {
! 		    /* If (sense & 2), we're following links */
! 		    if (!S_ISLNK(buf.st_mode) ||
! 			stat(unmetafy(getfullpath(s), NULL), &buf2))
! 			memcpy(&buf2, &buf, sizeof(buf));
! 		    statted = 1;
! 		}
! 		bp = (qn->sense & 2) ? &buf2 : &buf;
! 		/* Reject the file if the function returned zero *
! 		 * and the sense was positive (sense == 0), or   *
! 		 * vice versa.                                   */
! 		if (!(!!((qn->func) (bp, qn->data)) ^
! 		      (qn->sense & 1))) {
! 		    t = 0;
! 		    break;
! 		}
  	    }
  	}
! 	if (!t)
! 	    return;
!     } else if (!checked && !exists(getfullpath(s)))
  	return;
  
!     s = dyncat(pathbuf, s);
      if (colonmod) {
  	/* Handle the remainder of the qualifer:  e.g. (:r:s/foo/bar/). */
! 	char *cm2 = colonmod;
! 
! 	modify(&s, &cm2);
      }
!     *matchptr++ = s;
      if (++matchct == matchsz) {
  	matchbuf = (char **)realloc((char *)matchbuf,
  				    sizeof(char **) * (matchsz *= 2));
--- 178,248 ----
  insert(char *s, int checked)
  {
      struct stat buf, buf2, *bp;
+     char *news = s;
      int statted = 0;
  
      if (gf_listtypes || gf_markdirs) {
  	/* Add the type marker to the end of the filename */
+ 	mode_t mode;
  	checked = statted = 1;
! 	if (statfullpath(s, &buf, 1))
  	    return;
! 	mode = buf.st_mode;
! 	if (gf_follow) {
! 	    if (!S_ISLNK(mode) || statfullpath(s, &buf2, 0))
! 		memcpy(&buf2, &buf, sizeof(buf));
! 	    statted = 2;
! 	    mode = buf2.st_mode;
! 	}
! 	if (gf_listtypes || S_ISDIR(mode)) {
  	    int ll = strlen(s);
  
! 	    news = (char *)ncalloc(ll + 2);
! 	    strcpy(news, s);
! 	    news[ll] = file_type(mode);
! 	    news[ll + 1] = '\0';
  	}
      }
      if (qualct || qualorct) {
  	/* Go through the qualifiers, rejecting the file if appropriate */
  	struct qual *qo, *qn;
  
! 	if (!statted && statfullpath(s, &buf, 1))
  	    return;
! 	qo = quals;
! 	for (qn = qo; qn && qn->func;) {
! 	    range = qn->range;
! 	    amc = qn->amc;
! 	    units = qn->units;
! 	    if ((qn->sense & 2) && statted != 2) {
! 		/* If (sense & 2), we're following links */
! 		if (!S_ISLNK(buf.st_mode) || statfullpath(s, &buf2, 0))
! 		    memcpy(&buf2, &buf, sizeof(buf));
! 		statted = 2;
  	    }
+ 	    bp = (qn->sense & 2) ? &buf2 : &buf;
+ 	    /* Reject the file if the function returned zero *
+ 	     * and the sense was positive (sense&1 == 0), or *
+ 	     * vice versa.                                   */
+ 	    if ((!((qn->func) (bp, qn->data)) ^ qn->sense) & 1) {
+ 		/* Try next alternative, or return if there are no more */
+ 		if (!(qo = qo->or))
+ 		    return;
+ 		qn = qo;
+ 		continue;
+ 	    }
+ 	    qn = qn->next;
  	}
!     } else if (!checked && statfullpath(s, NULL, 1))
  	return;
  
!     news = dyncat(pathbuf, news);
      if (colonmod) {
  	/* Handle the remainder of the qualifer:  e.g. (:r:s/foo/bar/). */
! 	s = colonmod;
! 	modify(&news, &s);
      }
!     *matchptr++ = news;
      if (++matchct == matchsz) {
  	matchbuf = (char **)realloc((char *)matchbuf,
  				    sizeof(char **) * (matchsz *= 2));
*************** scanner(Complist q)
*** 315,321 ****
  	/* It's a straight string to the end of the path section. */
  	int l = strlen(c->str);
  
! 	if (l + pathpos - pathbufcwd >= PATH_MAX) {
  	    int err;
  
  	    if (l >= PATH_MAX)
--- 318,324 ----
  	/* It's a straight string to the end of the path section. */
  	int l = strlen(c->str);
  
! 	if (l + !l + pathpos - pathbufcwd >= PATH_MAX) {
  	    int err;
  
  	    if (l >= PATH_MAX)
*************** scanner(Complist q)
*** 335,341 ****
  
  	    if (!errflag && !(q->closure && !strcmp(c->str, "."))) {
  		addpath(c->str);
! 		if (!closure || exists(pathbuf))
  		    scanner((q->closure) ? q : q->next);
  		pathbuf[pathpos = oppos] = '\0';
  	    }
--- 338,344 ----
  
  	    if (!errflag && !(q->closure && !strcmp(c->str, "."))) {
  		addpath(c->str);
! 		if (!closure || statfullpath("", NULL, 1))
  		    scanner((q->closure) ? q : q->next);
  		pathbuf[pathpos = oppos] = '\0';
  	    }
*************** scanner(Complist q)
*** 391,399 ****
  			/* if matching multiple directories */
  			struct stat buf;
  
! 			if ((q->follow ?
! 			     stat(unmeta(getfullpath(fn)), &buf) :
! 			     lstat(unmeta(getfullpath(fn)), &buf)) == -1) {
  			    if (errno != ENOENT && errno != EINTR &&
  				errno != ENOTDIR && !errflag) {
  				zerr("%e: %s", fn, errno);
--- 394,400 ----
  			/* if matching multiple directories */
  			struct stat buf;
  
! 			if (statfullpath(fn, &buf, !q->follow)) {
  			    if (errno != ENOENT && errno != EINTR &&
  				errno != ENOTDIR && !errflag) {
  				zerr("%e: %s", fn, errno);


^ permalink raw reply	[relevance 3%]

* Re: PATCH: misc glob fixes
  1998-05-09 22:17  3% PATCH: misc glob fixes Zoltan Hidvegi
@ 1998-05-11  9:36  6% ` Andrew Main
  1998-05-11 15:49  6%   ` Zoltan Hidvegi
  0 siblings, 1 reply; 200+ results
From: Andrew Main @ 1998-05-11  9:36 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: zsh-workers

Zoltan Hidvegi wrote:
>First, many systems ignore trailing slashes on filenames.  As a result */
>will match all files instead of just directories as required by common
>sense and the POSIX standard.  The solution is to stat/lstat/access
>`filename/.' instead of `filename/'.

But "filename/." can't be statted if the directory is not searchable
by the zsh process, whereas POSIX would require the glob to succeed.
It would be better to stat "filename/" and test that the result has
type directory.

-zefram


^ permalink raw reply	[relevance 6%]

* Re: PATCH: misc glob fixes
  1998-05-11  9:36  6% ` Andrew Main
@ 1998-05-11 15:49  6%   ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1998-05-11 15:49 UTC (permalink / raw)
  To: Andrew Main; +Cc: zsh-workers

Zefram wrote:
> Zoltan Hidvegi wrote:
> >First, many systems ignore trailing slashes on filenames.  As a result */
> >will match all files instead of just directories as required by common
> >sense and the POSIX standard.  The solution is to stat/lstat/access
> >`filename/.' instead of `filename/'.
> 
> But "filename/." can't be statted if the directory is not searchable
> by the zsh process, whereas POSIX would require the glob to succeed.
> It would be better to stat "filename/" and test that the result has
> type directory.

Actually I'm not sure about that.  POSIX requites that pathname
components other than the last component should be searchable.  You
can think filename/ as two components, the second component is empty.

I tested many shells (various old Korn and Bourne shells) and none of
them matches unsearchable directories with */

Also note that on Linux you need search permission on filename in
order to stat filename/, so on Linux sometimes you are not allowed to
stat filename/ while you are allowed to stat filename.  The same is
true for the good old Ultrix 4.2, and perhaps other systems.  On these
systems the patch has no effect on the shell behavior.  I think the
shell should behave the same way on all systems, and it should behave
like sh and ksh, so I think that the patch implements the correct
behavior.

Zoli


^ permalink raw reply	[relevance 6%]

* PWD parameter
@ 1998-05-24  4:44  4% Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1998-05-24  4:44 UTC (permalink / raw)
  To: Zsh hacking and development

The standard does not mention PWD or OLDPWD in the descriprion of the
shell special parameters, they are only mentioned for the `cd' command:

     The cd utility will change the working directory of the current
     shell execution environment; see Shell Execution Environment .  If
     the current working directory is successfully changed, it will save
     an absolute pathname of the old working directory in the environment
     variable OLDPWD and it will save an absolute pathname of the new
     working directory in the environment variable PWD .

This means that PWD is nothing special for the shell, it is just set by
cd.  But between cd's the user is free to use it.  And many scripts in
fact do assign PWD, but they always set it to the current directory.  For
example some configure scripts have this:

# if PWD already has a value, it is probably wrong.
if [ -n "$PWD" ]; then PWD=`pwd`; fi

On zsh PWD is read-only so the shell will complain, although the script
does not terminate.  Also zsh did not export OLDPWD as required above by
the standard.  The quoted standard is `The Single UNIX (r) Specification'
from OpenGroup, I'm not sure that POSIX has these requirements.

The patch is for 3.0.5, it does not work for 3.1.3, I'll post a patch for
that later.

Zoltan


*** Src/builtin.c.orig	Mon Aug 25 22:40:43 1997
--- Src/builtin.c	Sat May 23 23:29:36 1998
***************
*** 986,991 ****
--- 986,1024 ----
  
  /* cd, chdir, pushd, popd */
  
+ /**/
+ void
+ set_pwd_env(void)
+ {
+     Param pm;
+ 
+     pm = (Param) paramtab->getnode(paramtab, "PWD");
+     if (pm && PM_TYPE(pm->flags) != PM_SCALAR) {
+ 	pm->flags &= ~PM_READONLY;
+ 	unsetparam_pm(pm, 0);
+     }
+ 
+     pm = (Param) paramtab->getnode(paramtab, "OLDPWD");
+     if (pm && PM_TYPE(pm->flags) != PM_SCALAR) {
+ 	pm->flags &= ~PM_READONLY;
+ 	unsetparam_pm(pm, 0);
+     }
+ 
+     setsparam("PWD", ztrdup(pwd));
+     setsparam("OLDPWD", ztrdup(oldpwd));
+ 
+     pm = (Param) paramtab->getnode(paramtab, "PWD");
+     if (!(pm->flags & PM_EXPORTED)) {
+ 	pm->flags |= PM_EXPORTED;
+ 	pm->env = addenv("PWD", pwd);
+     }
+     pm = (Param) paramtab->getnode(paramtab, "OLDPWD");
+     if (!(pm->flags & PM_EXPORTED)) {
+ 	pm->flags |= PM_EXPORTED;
+ 	pm->env = addenv("PWD", pwd);
+     }
+ }
+ 
  /* The main pwd changing function.  The real work is done by other     *
   * functions.  cd_get_dest() does the initial argument processing;     *
   * cd_do_chdir() actually changes directory, if possible; cd_new_pwd() *
***************
*** 1023,1028 ****
--- 1056,1062 ----
  	    chdir(unmeta(pwd));
  	}
      }
+     set_pwd_env();
      return 0;
  }
  
*** Src/hashtable.h.orig	Tue Jun  3 02:01:01 1997
--- Src/hashtable.h	Sat May 23 23:05:11 1998
***************
*** 144,154 ****
  IPDEF5("OPTIND", &zoptind, intvarsetfn),
  IPDEF5("SHLVL", &shlvl, intvarsetfn),
  
- #define IPDEF6(A,B) {NULL,A,PM_SCALAR|PM_READONLY|PM_SPECIAL,BR(NULL),SFN(nullsetfn),BR(strvargetfn),0,(void *)B,NULL,NULL,NULL,0}
- IPDEF6("PWD", &pwd),
- 
  #define IPDEF7(A,B) {NULL,A,PM_SCALAR|PM_SPECIAL,BR(NULL),BR(strvarsetfn),BR(strvargetfn),0,(void *)B,NULL,NULL,NULL,0}
- IPDEF7("OLDPWD", &oldpwd),
  IPDEF7("OPTARG", &zoptarg),
  IPDEF7("NULLCMD", &nullcmd),
  IPDEF7("POSTEDIT", &postedit),
--- 144,150 ----
*** Src/params.c.orig	Thu May 14 23:32:24 1998
--- Src/params.c	Sat May 23 23:23:56 1998
***************
*** 135,145 ****
  	    pm->flags |= PM_EXPORTED;
  	    pm->env = addenv("HOME", home);
  	}
- 	pm = (Param) paramtab->getnode(paramtab, "PWD");
- 	if (!(pm->flags & PM_EXPORTED)) {
- 	    pm->flags |= PM_EXPORTED;
- 	    pm->env = addenv("PWD", pwd);
- 	}
  	pm = (Param) paramtab->getnode(paramtab, "LOGNAME");
  	if (!(pm->flags & PM_EXPORTED)) {
  	    pm->flags |= PM_EXPORTED;
--- 135,140 ----
***************
*** 152,157 ****
--- 147,153 ----
  	pm->env = addenv("SHLVL", buf);
  
  	/* Add the standard non-special parameters */
+ 	set_pwd_env();
  	setsparam("MACHTYPE", ztrdup(MACHTYPE));
  	setsparam("OSTYPE", ztrdup(OSTYPE));
  	setsparam("TTY", ztrdup(ttystrname));


^ permalink raw reply	[relevance 4%]

* Re: can't build 3.1.4 under NeXTStep (LONG)
  @ 1998-06-01 16:31  4% ` Timothy J Luoma
  0 siblings, 0 replies; 200+ results
From: Timothy J Luoma @ 1998-06-01 16:31 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

	Author:        Zefram <zefram@tao.co.uk>
	Original-Date: Mon, 1 Jun 1998 17:28:36 +0100 (BST)
	Message-ID:    <199806011628.RAA14459@taos.demon.co.uk>

> >library flags             : -ltermcap
>
> Odd that this doesn't include -lc.

I'll take your word for that, as I don't know what it means :-)


> >$ make
> >Make: Makefile: Must be a separator on line 37.  Stop.
> >zsh: 24884 exit 1     make
> >$
> >
> >
> >Line 37 is merely:
> >
> >all: config.h
>
> Could you post the whole Makefile, please?

Sure.... I'll even post the configure.output

./configure --host=i386-next-nextstep3
creating cache ./config.cache
configuring for zsh 3.1.4
checking host system type... i386-next-nextstep3
checking for gcc... no
checking for cc... cc
checking whether the C compiler (cc  ) works... yes
checking whether the C compiler (cc  ) is a cross-compiler... no
checking whether we are using GNU C... yes
checking whether cc accepts -g... yes
checking how to run the C preprocessor... cc -E
checking whether cc needs -traditional... no
checking for working const... yes
checking for cc option to accept ANSI C...
checking whether to use prototypes... yes
checking for working alloca.h... no
checking for alloca... yes
checking if the compiler supports union initialisation... yes
checking if signed to unsigned casting is broken... no
checking if the compiler supports variable-lenth arrays... yes
checking whether make sets ${MAKE}... yes
checking for a BSD compatible install... /usr/local/gnu/bin/ginstall -c
checking for mawk... no
checking for gawk... gawk
checking for yodl... no
checking for dirent.h that defines DIR... no
checking for sys/ndir.h that defines DIR... no
checking for sys/dir.h that defines DIR... yes
checking for opendir in -lx... no
checking for ANSI C header files... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether stat file-mode macros are broken... no
checking for sys/wait.h that is POSIX.1 compatible... no
checking for sys/time.h... yes
checking for sys/times.h... yes
checking for sys/select.h... no
checking for termcap.h... no
checking for termio.h... no
checking for termios.h... yes
checking for sys/param.h... yes
checking for sys/filio.h... no
checking for string.h... yes
checking for memory.h... yes
checking for limits.h... yes
checking for fcntl.h... yes
checking for libc.h... yes
checking for sys/utsname.h... yes
checking for sys/resource.h... yes
checking for locale.h... yes
checking for errno.h... yes
checking for stdlib.h... yes
checking for unistd.h... yes
checking for sys/capability.h... no
checking for utmp.h... yes
checking for utmpx.h... no
checking for sys/types.h... yes
checking POSIX termios... no
checking TIOCGWINSZ in sys/ioctl.h... yes
checking for sys/ptem.h... no
checking for printf in -lc... no
checking for tgetent in -ltermcap... yes
checking for yp_all... yes
checking for cap_init in -lcap... no
checking if an include file defines ospeed... no
checking if you must define ospeed... no
checking if tgetent accepts NULL... no
checking return type of signal handlers... void
checking for pid_t... no
checking for off_t... yes
checking for mode_t... no
checking for uid_t in sys/types.h... yes
checking for size_t... yes
checking for sigset_t... no
checking for struct timezone... yes
checking for struct utmp... yes
checking for struct utmpx... no
checking ut_host in struct utmp... yes
checking ut_host in struct utmpx... no
checking whether getpgrp takes no argument... no
checking for working strcoll... no
checking for memcpy... yes
checking for memmove... yes
checking for strftime... yes
checking for waitpid... no
checking for select... yes
checking for tcsetpgrp... no
checking for tcgetattr... no
checking for strstr... yes
checking for lstat... yes
checking for getlogin... yes
checking for setpgid... no
checking for gettimeofday... yes
checking for gethostname... yes
checking for mkfifo... no
checking for wait3... yes
checking for difftime... yes
checking for sigblock... yes
checking for sigsetmask... yes
checking for sigrelse... no
checking for sighold... no
checking for killpg... yes
checking for sigaction... no
checking for getrlimit... yes
checking for sigprocmask... no
checking for setuid... yes
checking for seteuid... yes
checking for setreuid... yes
checking for setresuid... no
checking for setsid... no
checking for strerror... yes
checking for nis_list... no
checking for initgroups... yes
checking for fchdir... no
checking for cap_init... no
checking for readlink... yes
checking what style of signals to use... BSD_SIGNALS
checking where signal.h is located... /usr/include/bsd/sys/signal.h
checking where the RLIMIT macros are located... /usr/include/bsd/sys/resource.h
checking if rlim_t is quad_t... no
checking if the rlim_t is unsigned... no
checking for rlim_t... no
checking for /dev/fd filesystem... no
checking for RFS superroot directory... no
checking for NIS... no
checking for NIS+... no
checking for utmp file... /etc/utmp
checking for wtmp file... /usr/adm/wtmp

checking for utmpx file... no
checking for wtmpx file... no
checking if typeahead needs FIONREAD... no
checking for brk() prototype in <unistd.h>... no
checking for sbrk() prototype in <unistd.h>... no

checking for ioctl prototype in <sys/ioctl.h>... no
checking if named FIFOs work... yes
checking if echo in /bin/sh interprets escape sequences... yes
updating cache ./config.cache

creating ./config.status
creating Makefile
creating Doc/Makefile

creating Etc/Makefile
creating Src/Makefile
creating config.h

zsh configuration

-----------------
zsh version               : 3.1.4
host operating system     : i386-next-nextstep3
source code location      : .

compiler                  : cc
executable compiler flags :  -Wall -Wno-implicit -Wmissing-prototypes -O2
executable linker flags   :   -s
library flags             : -ltermcap

binary install path       : /usr/local/bin
man page install path     : /usr/local/man
info install path         : /usr/local/info


HERE'S the Makefile, with the disclaimer comments omitted for space:


subdir = .
dir_top = .
SUBDIRS = Doc Etc Src

@@defs.mk@@

# ========== DEPENDENCIES FOR BUILDING ==========

# default target
all: config.h
	@for subdir in Src Doc; do \
	  (cd $$subdir && $(MAKE) $(MAKEDEFS) $@) || exit 1; \
	done; \

check test:
	@echo zsh test suite not available yet

# prepare module configuration
prep:
	@cd Src && $(MAKE) $(MAKEDEFS) $@

META-FAQ: FORCE
	@cd Doc && $(MAKE) $(MAKEDEFS) ../META-FAQ

# ========== DEPENDENCIES FOR INSTALLING ==========

# install/uninstall everything
install: install.bin install.modules install.man install.info
uninstall: uninstall.bin uninstall.modules uninstall.man uninstall.info

# install/uninstall just the binary
install.bin uninstall.bin:
	@cd Src && $(MAKE) $(MAKEDEFS) $@

# install/uninstall just the modules
install.modules uninstall.modules:
	@cd Src && $(MAKE) $(MAKEDEFS) $@

# install/uninstall just the man pages
install.man uninstall.man:
	@cd Doc && $(MAKE) $(MAKEDEFS) $@

# install/uninstall just the info pages
install.info uninstall.info:
	@cd Doc && $(MAKE) $(MAKEDEFS) $@

# ========== DEPENDENCIES FOR CLEANUP ==========

@@clean.mk@@

distclean-here:
	rm -f Makefile config.h config.status config.log config.cache stamp-h

realclean-here:
	cd $(sdir) && rm -f config.h.in stamp-h.in configure

# ========== DEPENDENCIES FOR MAINTENANCE ==========

@@config.mk@@

config: config.h

config.status: configure Src/version.h
	./config.status --recheck

configure: configure.in aclocal.m4 aczsh.m4
	cd $(sdir) && autoconf

config.h: stamp-h
stamp-h: config.h.in config.status
	cd $(dir_top) && \
	  CONFIG_FILES= CONFIG_HEADERS=$(subdir)/config.h ./config.status

config.h.in: stamp-h.in
stamp-h.in: configure.in acconfig.h aclocal.m4 aczsh.m4
	cd $(sdir) && autoheader
	echo > $@

# ========== DEPENDENCIES FOR DISTRIBUTION ==========

DISTNAME = zsh-$(VERSION)

targz-src: $(DISTNAME).tar.gz
$(DISTNAME).tar.gz: FORCE
	@$(sdir_top)/Util/mkdisttree.sh $(DISTNAME) $(sdir_top) $(dir_top) SRC \
	    $(MAKE) $(MAKEDEFS)
	tar cf - $(DISTNAME) | gzip -9 > $@
	rm -rf $(DISTNAME)

targz-doc: $(DISTNAME)-doc.tar.gz
$(DISTNAME)-doc.tar.gz: FORCE
	@$(sdir_top)/Util/mkdisttree.sh $(DISTNAME) $(sdir_top) $(dir_top) DOC \
	    $(MAKE) $(MAKEDEFS)
	tar cf - $(DISTNAME) | gzip -9 > $@
	rm -rf $(DISTNAME)

FORCE:







^ permalink raw reply	[relevance 4%]

* Re: User-defined zle widgets and built-in widget failure
  @ 1998-06-09 18:01  5% ` Zefram
  1998-06-09 19:12  5%   ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Zefram @ 1998-06-09 18:01 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

Bart Schaefer wrote:
>I'd like to write a widget that modifies BUFFER, calls a built-in widget,
>and then if that built-in widget fails, restores the previous BUFFER and
>CURSOR.
>
>Unfortunately, failure of "zle whatever" isn't detectable; "zle" always
>sets $? to zero.

Failure internally is recorded by the feep flag.  If that is set at
the end of the main loop, a beep is emitted and the flag reset.  All we
need to do is make that flag visible to widgets.  Like a lot of other
ZLE things, this is one of the things I had a fairly concrete plan for
when my spare time suddenly disappeared last year.

The mechanism I planned is that each thingy will include a single-bit
flag, which can be tested and modified using the zle builtin.  Then all
you do to test for error is "if zle -F feep; ...", where the value of
"F" has yet to be determined.  Other thingies would have flags attached
similarly.  Or a more general possibility would be thingy array variables
accessible via thingy names, or possibly by more magic parameter names
(though I'd want to do a proper namespace separation, e.g., ${zle.feep}).

That reminds me, more generally I'd like to move the zsh-specific
parameter names to completely separate names that can't conflict
with POSIX parameter names.  If we have ${zsh.module_path} instead of
$module_path, then this can be available regardless of the name used to
invoke zsh.  What do people think?

-zefram


^ permalink raw reply	[relevance 5%]

* Re: User-defined zle widgets and built-in widget failure
  1998-06-09 18:01  5% ` Zefram
@ 1998-06-09 19:12  5%   ` Bart Schaefer
  1998-06-09 20:02  3%     ` Zefram
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 1998-06-09 19:12 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

On Jun 9,  7:01pm, Zefram wrote:
} Subject: Re: User-defined zle widgets and built-in widget failure
}
} The mechanism I planned is that each thingy will include a single-bit
} flag, which can be tested and modified using the zle builtin.  Then all
} you do to test for error is "if zle -F feep; ...", where the value of
} "F" has yet to be determined.

I think we should tie the most common cases to standard scripting concepts;
e.g., failure should be a nonzero $?, and the numeric value of $? should
indicate the reason for failure.  It shouldn't be necessary to invoke "zle"
multiple times to find out this kind of basic information; further, it
makes it obvious how a widget writer sets the value, i.e., with "return".

} Or a more general possibility would be thingy array variables
} accessible via thingy names

Just how many thingys are we talking about here?

I suggest defining one array variable $ZLE (or whatever name you want),
and define the meanings of the array positions.  E.g., ZLE could be
equivlent to ($BUFFER $CURSOR $LBUFFER $RBUFFER) in the current scheme;
instead of BUFFER="the text here" you'd say ZLE[1]="the text here".
(I don't think you should literally do that, because the buffer chunks
are best accessed directly as scalars, but for purposes of example ...)

} (though I'd want to do a proper namespace separation, e.g., ${zle.feep}).

You're creeping dangerously close to Perl associative arrays, there.
Unless we're talking about a huge amount of data, just use numbered
positions in an array with a "sufficiently unique" name.

} That reminds me, more generally I'd like to move the zsh-specific
} parameter names to completely separate names that can't conflict
} with POSIX parameter names.  If we have ${zsh.module_path} instead of
} $module_path, then this can be available regardless of the name used to
} invoke zsh.  What do people think?

I think I'd rather not have to rewrite my .z* scripts again.  How much
"moving" are we talking about?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[relevance 5%]

* Re: User-defined zle widgets and built-in widget failure
  1998-06-09 19:12  5%   ` Bart Schaefer
@ 1998-06-09 20:02  3%     ` Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1998-06-09 20:02 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zefram, zsh-workers

Bart Schaefer wrote:
>I think we should tie the most common cases to standard scripting concepts;
>e.g., failure should be a nonzero $?, and the numeric value of $? should
>indicate the reason for failure.  It shouldn't be necessary to invoke "zle"
>multiple times to find out this kind of basic information; further, it
>makes it obvious how a widget writer sets the value, i.e., with "return".

Good points.  I think that's worth handling as a special case, even
though there are many other bits of state that will need a more
complete mechanism.  This special case can be defined pretty well:
zle returns non-zero iff the feep flag is set at the time of return,
and the feep flag is set on return from a user-defined widget iff the
function returns non-zero.

>} Or a more general possibility would be thingy array variables
>} accessible via thingy names
>
>Just how many thingys are we talking about here?

I was thinking about a general array mechanism, using thingies to make
pushing them onto the zle stack particularly efficient.  However, it
would essentially be duplicating the existing array parameter mechanism,
so I'd rather use what we've already got.

>I suggest defining one array variable $ZLE (or whatever name you want),
>and define the meanings of the array positions.  E.g., ZLE could be
>equivlent to ($BUFFER $CURSOR $LBUFFER $RBUFFER) in the current scheme;
>instead of BUFFER="the text here" you'd say ZLE[1]="the text here".

Yuck.  This arbitrary index issue is one of the things I dislike about
Perl (the stat() interface, specifically).  Let's stick to names.  And,
of course, separate parameters is the only way to handle array values,
since we don't have nested arrays.

>} (though I'd want to do a proper namespace separation, e.g., ${zle.feep}).
>
>You're creeping dangerously close to Perl associative arrays, there.

I don't see that as an associative array.  It's just a structured
namespace for parameters.

>Unless we're talking about a huge amount of data, just use numbered
>positions in an array with a "sufficiently unique" name.

Really, we're talking about *arbitrary* amounts of data.  Non-builtin
widgets whould be able to store their own data in the same manner as
the standard widgets, and ideally be able to keep that data out of the
way of normal user variables.

>I think I'd rather not have to rewrite my .z* scripts again.  How much
>"moving" are we talking about?

Actually, I don't anticipate permanently removing names established
in 3.0.  An option, on by default in zsh mode, would enable the current
names.  Those that take the time to rewrite their .z* scripts can then
disable the current names, and get a parameter namespace as clean as
possible.  Of course, the POSIX-mandated parameters have to retain their
current names in any case, but all the zsh extensions could be renamed.

If we *don't* introduce a proper namespace scheme, I hate to think what
will happen when modules gain the ability to define special parameters.


This is probably a good time to talk about what I've been doing for the
past year.  (Standard disclaimer applies.)  I work for Tao Systems Ltd.,
which is in the business of writing a rather interesting portable OS
called Elate.  One of the main features of this OS is that each utility
and each library function is dynamically loaded, in a shareable manner
-- the equivalent under Unix would be to put every library function in
a separate shared library, though of course it's much more efficient
in Elate.

Among other things, I was assigned to design and write the standard
Elate shell.  (There are many zsh fans here.)  I have had the opportunity
to write a shell that has really clean syntax and consistent behaviour,
initially without any pressure to make the shell practically usable.
(It finished up pretty usable *and* clean, because I had the time to
achieve both aims.)  I also had the opportunity to establish many of
the conventions for this shell environment.  Having experimented with
a lot of my shell ideas on this project, I think some of them are worth
trying to get into zsh in some form.

One of the conventions I established was that all environment variables,
except for strictly user-generated ones, have structured names.
For example, the equivalent of the Unix "PATH" variable is called
"shell.path".  The equivalent of "LOCALE" is called "user.locale".
This means that scripts, or the user at the shell prompt, can use *any*
alphanumeric variable name, without any risk of colliding with anyone
else's variables, now or in the future.  And utility writers have a
guaranteed way to define variables special to a particular utility
without clashing with anyone else's variables, so there's none of this
"MAILFILE" nonsense.

What I like most about this convention is that, as the shell writer, I
can invent new special variables without colliding with anyone else.  If I
add a feature like zsh's $WATCH, I can call the parameter "shell.watch",
and there is no problem even if an existing script happened to call a
variable "watch", which is not an unlikely occurrence.

Another feature worth examining is the design of the command line editor.
I actually designed it to be much like I wanted ZLE to be.  The key
feature is that the editor is almost entirely written in shell code --
the only builtin code written for it is (1) the display updating code and
(2) an interface to the parser (for completion).  The buffer is actually
stored in shell variables ("sle.lbuffer" et al), and so is trivially
manipulable by user-defined editor functions.  In fact, user-defined
editing functions are precisely on level footing with the standard
functions, because *all* of them are simply shell functions.

I'm not suggesting that we go to that extreme with ZLE -- there is an
enormous performance hit in doing the simplest editing actions in shell
functions, and completion suffers somewhat -- but I do want to achieve
three basic aims:

	(1) as little as possible should be built into the base zle module

	(2) built-in widgets should use the same interfaces as
	    user-defined ones, so that they behave *as if* they were
	    shell functions

	(3) as much of the ZLE state as possible should be directly
	    manipulable by user-defined widgets

My experience with the Elate shell has shown that building in nothing
(even the ability to run the various types of commands is dynamically
loaded), and doing as much as possible without inventing new mechanisms,
makes a shell very easily extensible, and very radically configurable
for any specific purpose.

-zefram


^ permalink raw reply	[relevance 3%]

* Re: Variable namespaces, goals for ZLE, etc.
  @ 1998-06-10 10:55  6% ` Zefram
  1998-06-10 17:37  8%   ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Zefram @ 1998-06-10 10:55 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

Bart Schaefer wrote:
>
>} If we *don't* introduce a proper namespace scheme, I hate to think what
>} will happen when modules gain the ability to define special parameters.
>
>I don't expect it'd be any worse than the current situation with external
>programs having to come up with names for their environment variables.
>If you can explain why a namespace like "zsh." is better than a simple
>convention like "ZSH_", I'm willing to be persuaded.

The advantage of a "zsh." prefix is that *nothing* currently relies
on such a variable name existing or behaving in any particular manner,
whereas "ZSH_" names are defined by POSIX to have no special semantics.
I think it is reasonable for a script, for any shell, to be able to define
parameters with any name, including "_" characters, without having to
worry about whether (a future version of) the shell will attach unwanted
semantics to the variable name.  Of course, we can't do anything about
"PATH", etc., but we *can* get zsh-specific variables out of the way,
making zsh more reliably usable as a scripting language.

-zefram


^ permalink raw reply	[relevance 6%]

* Re: Variable namespaces, goals for ZLE, etc.
  1998-06-10 10:55  6% ` Zefram
@ 1998-06-10 17:37  8%   ` Bart Schaefer
  1998-06-10 18:01  5%     ` Zefram
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 1998-06-10 17:37 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

On Jun 10, 11:55am, Zefram wrote:
} Subject: Re: Variable namespaces, goals for ZLE, etc.
}
} The advantage of a "zsh." prefix is that *nothing* currently relies
} on such a variable name existing or behaving in any particular manner,
} whereas "ZSH_" names are defined by POSIX to have no special semantics.

Are there any "available" names in the POSIX space?

The problem with introducing an incompatible syntax in order to escape
POSIX is that you can't reliably export variables with the new names.
I've used versions of sh that would mangle the environment and/or issue
warning messages if there were any strings present where the stuff to
the left of the `=' contained characters other than [A-Z][a-z][0-9]_.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[relevance 8%]

* Re: Variable namespaces, goals for ZLE, etc.
  1998-06-10 17:37  8%   ` Bart Schaefer
@ 1998-06-10 18:01  5%     ` Zefram
  0 siblings, 0 replies; 200+ results
From: Zefram @ 1998-06-10 18:01 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zefram, zsh-workers

Bart Schaefer wrote:
>Are there any "available" names in the POSIX space?

Depends what you mean by "available".  POSIX lists "the special
parameters" as being "*", "@", "#", "?", "-", "$", "!" and "0"; by
implication, all other parameters have the semantics of normal variables.
It lists "IFS", "PATH", "PPID" et al as normal variables that are either
set or read by the shell, but does not permit them to have any weird
semantics beyond those it defines.  It is arguable that the shell can
modify its behaviour based on the values of other variables, but it
certainly isn't permitted to make variables with normal names behave as
special variables.

>The problem with introducing an incompatible syntax in order to escape
>POSIX is that you can't reliably export variables with the new names.

You can export anything.  Whether other utilities accept anything unusual
is, admittedly, a more complicated issue.

>I've used versions of sh that would mangle the environment and/or issue
>warning messages if there were any strings present where the stuff to
>the left of the `=' contained characters other than [A-Z][a-z][0-9]_.

We could do a configure test for that.  Perhaps if the local sh does
complain, we could import/export using munged names starting with
"__ZSH__" or something like that.  Within zsh, the variable name "__ZSH__"
would still be legal, it would just be exported under a different name.
Alternatively, we keep things simple, and just don't import/export
special variables on platforms that really can't handle it -- there
can't be many of them, surely?

-zefram


^ permalink raw reply	[relevance 5%]

* Re: Zsh 2.6 and Y2K status
  @ 1998-07-02 15:37  5% ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 1998-07-02 15:37 UTC (permalink / raw)
  To: Chan Sean, 'zsh-workers@math.gatech.edu '

On Jul 2,  3:58pm, Chan Sean wrote:
} Subject: Zsh 2.6 and Y2K status
}
} On behalf of my client WMC Resources Ltd. I need to know if ZSH is Y2K
} compliant. May I know where I can find such information??

You can confirm the following by looking at the source code yourself if
necessary; there's no other definitive reference:

Zsh uses UNIX/POSIX time_t, timeval, and tm data types for internal date
manipulations.  These types either do not store year values at all (for
example, time_t is measured in seconds since midnight, Jan 1, 1970) or
store them as integer types and NOT as pairs of digits.  Thus there can
be no overflows at year 2000.  On some unix systems, time_t is a 32-bit
value and will overflow during the year 2038, but more modern systems use
a 64-bit time_t.

The only input and output of dates that zsh performs is optional history
time-stamping.  This is performed using time_t values converted to long
integers, which are either 32 or 64 bits, see above.

Note, however, that zsh does provide facilities for formatted date output,
so it's possible that scripts written for zsh might employ 2-digit years.
Shell scripts should always be considered separate programs and therefore
evaluated individually.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[relevance 5%]

* Re: 'LC_COLLATE=de ls [A-Z]*' expands to 'every file' including lowercase
  @ 1998-07-08  6:40  6% ` Zoltan Hidvegi
  1998-07-08 11:02  5%   ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1998-07-08  6:40 UTC (permalink / raw)
  To: Zsh hacking and development

> I'd vote in favor of removing HAVE_STRCOLL from matchonce() in glob.c.

According to the standard:

   LC_COLLATE 
         This variable determines the behaviour of range expressions,
         equivalence classes and multi-character collating elements
         within pattern matching.

Of course the standard also requires POSIX character classes, so instead
of [a-z] you are supposed to use [[:lower:]], but unfortunately the later
is not supported yet.

Zoli


^ permalink raw reply	[relevance 6%]

* Re: 'LC_COLLATE=de ls [A-Z]*' expands to 'every file' including lowercase
  1998-07-08  6:40  6% ` Zoltan Hidvegi
@ 1998-07-08 11:02  5%   ` Bart Schaefer
  1998-07-08 15:36  7%     ` Zoltan Hidvegi
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 1998-07-08 11:02 UTC (permalink / raw)
  To: Zoltan Hidvegi, Zsh hacking and development

On Jul 8,  1:40am, Zoltan Hidvegi wrote:
} Subject: Re: 'LC_COLLATE=de ls [A-Z]*' expands to 'every file' including l
}
} > I'd vote in favor of removing HAVE_STRCOLL from matchonce() in glob.c.
} 
} According to the standard:
} 
}    LC_COLLATE 
}          This variable determines the behaviour of range expressions,
}          equivalence classes and multi-character collating elements
}          within pattern matching.

Which standard, specifically?

This is a case where that standard is harmfully flying in the face of
common sense.  Of course LC_COLLATE ought to apply to POSIX character
classes once those are supported, and ought to apply to the collation
of any resulting ordered list.  But to have it apply to the characters
within ranges like [A-Z] will cause the simplest shell scripts to go
completely haywire; we'll have to start putting "local LC_COLLATE=C"
or some such at the top of every autoloaded function, along with all
the "emulate -R" and "setopt localoptions" junk that's already there.

Standards are not meant to be followed blindly.  That's why the IETF,
for example, has a collection of rules for interpreting MUST, SHOULD,
MAY, etc. when they appear in IETF documents.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[relevance 5%]

* PATCH: 4.1.4: POSIX ranges
@ 1998-07-08 13:36 11% Peter Stephenson
  1998-07-12 16:26 13% ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Peter Stephenson @ 1998-07-08 13:36 UTC (permalink / raw)
  To: Zsh hackers list

Somebody was complaining about the lack of these.  See the manual page
change.

I implemented the look up of 'alnum', 'alpha' etc. in the trivial way:
firstly because setting up a hash table uses even more code and
memory, secondly because the corresponding isalnum() etc. are usually
macros rather than functions so are untableable.  I'm hoping there
aren't too many underendowed ctype macro sets out there, or we're
going to have to add a configure test.

As usual with zsh, there were some extra issues buried in there.

First, the guarantees in the manual page that []...] would match a
literal ']' and [^]...] wouldn't, were being upheld by a test in
lex.c, instead of the globbing code.  This had the effect that
e.g. [...[] didn't work.  I've moved the test to where I think it
should be in glob.c: this means that all ]'s, even not preceeded by a
[, get tokenised.  The globbing code is supposed to be able to cope
with this sort of thing.

Second, the tokenise() code --- on the fly tokenisation for
substituted variables that should turn into glob patterns, and so on
--- was also getting its paws onto ['s and ]'s and trying to second
guess the globbing code.  As above, I've simply made the routine
blindly tokenise every unquoted [ and ] it comes across.

In both cases, if anyone knows somewhere where tokenising an unquoted
[ or ] is definitely wrong, say.  As far as I know, the only
difference is that glob() will be called unnecessarily a few times and
will harmlessly untokenise the bracket in question.

By the way, I haven't touched this, but what's happened to
nobadpattern?

% setopt nobadpattern
% [[ [ = [ ]]
zsh: bad pattern: [

Is it really not supposed to work inside tests?  Maybe it's safer that
way.

*** Doc/Zsh/expn.yo.range	Mon Jun 15 09:52:33 1998
--- Doc/Zsh/expn.yo	Wed Jul  8 12:23:06 1998
***************
*** 735,740 ****
--- 735,756 ----
  can be specified by separating two characters by a `tt(-)'.
  A `tt(-)' or `tt(])' may be matched by including it as the
  first character in the list.
+ There are also several named classes of characters, in the form
+ `tt([:)var(name)(tt:])' with the following meanings:  `tt([:alnum:])'
+ alphanmueric, `tt([:alpha:])' alphabetic,
+ `tt([:cntrl:])' control character, `tt([:digit:])' decimal
+ digit, `tt([:graph:])' printing character expect space,
+ `tt([:lower:])' lowercase letter, `tt([:print:])' printable character,
+ `tt([:punct:])' printing character neither alphanumeric nor space,
+ `tt([:space:])' whitespace character, `tt([:upper:])' uppercase letter, 
+ `tt([:xdigit:])' hexadecimal digit.  These use the macros provided by
+ the operating system to test for the given character combinations,
+ including any modifications due to local language settings:  see
+ manref(ctype)(3).  Note that the square brackets are additional
+ to those enclosing the whole set of characters, so to test for a
+ single alphanumeric character you need `tt([[:alnum:]])'.  Named
+ character sets can be used alongside other types,
+ e.g. `tt([[:alpha:]0-9])'.
  )
  xitem(tt([^)...tt(]))
  item(tt([!)...tt(]))(
*** Misc/globtests.range	Sat Apr 25 19:09:19 1998
--- Misc/globtests	Wed Jul  8 15:26:52 1998
***************
*** 1,6 ****
  #!/usr/local/bin/zsh -f
  
! setopt extendedglob
  unsetopt kshglob
  
  failed=0
--- 1,6 ----
  #!/usr/local/bin/zsh -f
  
! setopt extendedglob badpattern
  unsetopt kshglob
  
  failed=0
***************
*** 95,99 ****
--- 95,107 ----
  f foob          (^foo)b*
  t foobb         (^foo)b*
  f zsh           ^z*
+ t a%1X          [[:alpha:][:punct:]]#[[:digit:]][^[:lower:]]
+ f a%1           [[:alpha:][:punct:]]#[[:digit:]][^[:lower:]]
+ t [:            [[:]#
+ t :]            []:]#
+ t :]            [:]]#
+ t [             [[]
+ t ]             []]
+ t []            [^]]]
  EOT
  print "$failed tests failed."
*** Src/glob.c.range	Mon May 11 09:43:29 1998
--- Src/glob.c	Wed Jul  8 15:25:05 1998
***************
*** 633,641 ****
  		return NULL;
  	} else if (*pptr == Inbrack) {
  	    /* Character set: brackets had better match */
! 	    while (*++pptr && *pptr != Outbrack)
! 		if (itok(*pptr))
  		    *pptr = ztokens[*pptr - Pound];
  	    if (*pptr != Outbrack)
  		return NULL;
  	} else if (itok(*pptr) && *pptr != Star && *pptr != Quest)
--- 633,655 ----
  		return NULL;
  	} else if (*pptr == Inbrack) {
  	    /* Character set: brackets had better match */
! 	    if (pptr[1] == Outbrack)
! 		*++pptr = ']';
! 	    else if ((pptr[1] == Hat || pptr[1] == '^' || pptr[1] == '!') &&
! 		     pptr[2] == Outbrack)
! 		*(pptr += 2) = ']';
! 	    while (*++pptr && *pptr != Outbrack) {
! 		if (itok(*pptr)) {
! 		    /* POSIX classes: make sure it's a real one, *
! 		     * leave the Inbrack tokenised if so.        */
! 		    char *nptr;
! 		    if (*pptr == Inbrack && pptr[1] == ':'
! 			&& (nptr = strchr(pptr+2, ':')) && 
! 			*++nptr == Outbrack)
! 			pptr = nptr;
  		    *pptr = ztokens[*pptr - Pound];
+ 		}
+ 	    }
  	    if (*pptr != Outbrack)
  		return NULL;
  	} else if (itok(*pptr) && *pptr != Star && *pptr != Quest)
***************
*** 2192,2197 ****
--- 2206,2293 ----
  
  /**/
  static int
+ posix_range(char **patptr, int ch)
+ {
+     /* Match POSIX ranges, which correspond to ctype macros,  *
+      * e.g. [:alpha:] -> isalpha.  It just doesn't seem worth * 
+      * the palaver of creating a hash table for this.           */
+     char *start = *patptr;
+     int len;
+ 
+     /* we made sure in parsecomp() there was a ':' to search for */
+     *patptr = strchr(start, ':');
+     len = *patptr++ - start;
+ 
+     if (!strncmp(start, "alpha", len))
+ 	return isalpha(ch);
+     if (!strncmp(start, "alnum", len))
+ 	return isalnum(ch);
+     if (!strncmp(start, "cntrl", len))
+ 	return iscntrl(ch);
+     if (!strncmp(start, "digit", len))
+ 	return isdigit(ch);
+     if (!strncmp(start, "graph", len))
+ 	return isgraph(ch);
+     if (!strncmp(start, "lower", len))
+ 	return islower(ch);
+     if (!strncmp(start, "print", len))
+ 	return isprint(ch);
+     if (!strncmp(start, "punct", len))
+ 	return ispunct(ch);
+     if (!strncmp(start, "space", len))
+ 	return isspace(ch);
+     if (!strncmp(start, "upper", len))
+ 	return isupper(ch);
+     if (!strncmp(start, "xdigit", len))
+ 	return isxdigit(ch);
+     return 0;
+ }
+ 
+ /**/
+ static void
+ rangematch(char **patptr, int ch, int rchar)
+ {
+     /* Check for a character in a [...] or [^...].  The [ *
+      * and optional ^ have already been skipped.          */
+ 
+     char *pat = *patptr;
+ #ifdef HAVE_STRCOLL
+     char l_buf[2], r_buf[2], ch_buf[2];
+ 
+     ch_buf[0] = ch;
+     l_buf[1] = r_buf[1] = ch_buf[1] = '\0';
+ #endif
+ 
+ #define PAT(X) (pat[X] == Meta ? pat[(X)+1] ^ 32 : untok(pat[X]))
+ #define PPAT(X) (pat[(X)-1] == Meta ? pat[X] ^ 32 : untok(pat[X]))
+ 
+     for (pat++; *pat != Outbrack && *pat;
+ 	 *pat == Meta ? pat += 2 : pat++) {
+ 	if (*pat == Inbrack) {
+ 	    /* Inbrack can only occur inside a range if we found [:...:]. */
+ 	    pat += 2;
+ 	    if (posix_range(&pat, ch))
+ 		break;
+ 	} else if (*pat == '-' && pat[-1] != rchar &&
+ 		   pat[1] != Outbrack) {
+ #ifdef HAVE_STRCOLL
+ 	    l_buf[0] = PPAT(-1);
+ 	    r_buf[0] = PAT(1);
+ 	    if (strcoll(l_buf, ch_buf) <= 0 &&
+ 		strcoll(ch_buf, r_buf) <= 0)
+ #else
+ 		if (PPAT(-1) <= ch && PAT(1) >= ch)
+ #endif
+ 		    break;
+ 	} else if (ch == PAT(0))
+ 	    break;
+     }
+ 
+     *patptr = pat;
+ }
+ 
+ /**/
+ static int
  matchonce(Comp c)
  {
      char *pat = c->str;
***************
*** 2304,2341 ****
  	}
  	if (*pat == Inbrack) {
  	    /* Match groups of characters */
- #define PAT(X) (pat[X] == Meta ? pat[(X)+1] ^ 32 : untok(pat[X]))
- #define PPAT(X) (pat[(X)-1] == Meta ? pat[X] ^ 32 : untok(pat[X]))
  	    char ch;
- #ifdef HAVE_STRCOLL
- 	    char l_buf[2], r_buf[2], ch_buf[2];
- 
- 	    l_buf[1] = r_buf[1] = ch_buf[1] = '\0';
- #endif
  
  	    if (!*pptr)
  		break;
  	    ch = *pptr == Meta ? pptr[1] ^ 32 : *pptr;
- #ifdef HAVE_STRCOLL
- 	    ch_buf[0] = ch;
- #endif
  	    if (pat[1] == Hat || pat[1] == '^' || pat[1] == '!') {
  		/* group is negated */
! 		pat[1] = Hat;
! 		for (pat += 2; *pat != Outbrack && *pat;
! 		     *pat == Meta ? pat += 2 : pat++)
! 		    if (*pat == '-' && pat[-1] != Hat && pat[1] != Outbrack) {
! #ifdef HAVE_STRCOLL
! 			l_buf[0] = PPAT(-1);
! 			r_buf[0] = PAT(1);
! 			if (strcoll(l_buf, ch_buf) <= 0 &&
! 			    strcoll(ch_buf, r_buf) <= 0)
! #else
! 			if (PPAT(-1) <= ch && PAT(1) >= ch)
! #endif
! 			    break;
! 		    } else if (ch == PAT(0))
! 			break;
  		DPUTS(!*pat, "BUG: something is very wrong in doesmatch()");
  		if (*pat != Outbrack)
  		    break;
--- 2400,2414 ----
  	}
  	if (*pat == Inbrack) {
  	    /* Match groups of characters */
  	    char ch;
  
  	    if (!*pptr)
  		break;
  	    ch = *pptr == Meta ? pptr[1] ^ 32 : *pptr;
  	    if (pat[1] == Hat || pat[1] == '^' || pat[1] == '!') {
  		/* group is negated */
! 		*++pat = Hat;
! 		rangematch(&pat, ch, Hat);
  		DPUTS(!*pat, "BUG: something is very wrong in doesmatch()");
  		if (*pat != Outbrack)
  		    break;
***************
*** 2344,2364 ****
  		continue;
  	    } else {
  		/* pattern is not negated (affirmed? asserted?) */
! 		for (pat++; *pat != Outbrack && *pat;
! 		     *pat == Meta ? pat += 2 : pat++)
! 		    if (*pat == '-' && pat[-1] != Inbrack &&
! 			       pat[1] != Outbrack) {
! #ifdef HAVE_STRCOLL
! 			l_buf[0] = PPAT(-1);
! 			r_buf[0] = PAT(1);
! 			if (strcoll(l_buf, ch_buf) <= 0 &&
! 			    strcoll(ch_buf, r_buf) <= 0)
! #else
! 			if (PPAT(-1) <= ch && PAT(1) >= ch)
! #endif
! 			    break;
! 		    } else if (ch == PAT(0))
! 			break;
  		DPUTS(!pat || !*pat, "BUG: something is very wrong in doesmatch()");
  		if (*pat == Outbrack)
  		    break;
--- 2417,2423 ----
  		continue;
  	    } else {
  		/* pattern is not negated (affirmed? asserted?) */
! 		rangematch(&pat, ch, Inbrack);
  		DPUTS(!pat || !*pat, "BUG: something is very wrong in doesmatch()");
  		if (*pat == Outbrack)
  		    break;
***************
*** 2461,2480 ****
  	    }
  	    bslash = 1;
  	    continue;
- 	case '[':
- 	    if (bslash) {
- 		s[-1] = Bnull;
- 		break;
- 	    }
- 	    t = s;
- 	    if (*++s == '^' || *s == '!')
- 		s++;
- 	    while (*s && *++s != ']');
- 	    if (!*s)
- 		return;
- 	    *t = Inbrack;
- 	    *s = Outbrack;
- 	    break;
  	case '<':
  	    if (isset(SHGLOB))
  		break;
--- 2520,2525 ----
***************
*** 2502,2507 ****
--- 2547,2554 ----
  	case ')':
  	    if (isset(SHGLOB))
  		break;
+ 	case '[':
+ 	case ']':
  	case '*':
  	case '?':
  	    for (t = ztokens; *t; t++)
*** Src/lex.c.range	Wed Jul  8 14:20:46 1998
--- Src/lex.c	Wed Jul  8 15:22:14 1998
***************
*** 876,902 ****
  	    }
  	    break;
  	case LX2_INBRACK:
- 	    add(c);
  	    if (!in_brace_param)
  		brct++;
! 	    c = hgetc();
! 	    if (c == '!' || c == '^') {
! 		add(c);
! 		c = hgetc();
! 	    }
! 	    if (c == ']')
! 		break;
! 	    if (lexstop)
! 		goto brk;
! 	    intpos = 0;
! 	    continue;
  	case LX2_OUTBRACK:
  	    if (!in_brace_param)
  		brct--;
! 	    if (brct < 0) {
  		brct = 0;
- 		break;
- 	    }
  	    c = Outbrack;
  	    break;
  	case LX2_INPAR:
--- 876,890 ----
  	    }
  	    break;
  	case LX2_INBRACK:
  	    if (!in_brace_param)
  		brct++;
! 	    c = Inbrack;
! 	    break;
  	case LX2_OUTBRACK:
  	    if (!in_brace_param)
  		brct--;
! 	    if (brct < 0)
  		brct = 0;
  	    c = Outbrack;
  	    break;
  	case LX2_INPAR:

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 50 844536
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy


^ permalink raw reply	[relevance 11%]

* Re: 'LC_COLLATE=de ls [A-Z]*' expands to 'every file' including lowercase
  1998-07-08 11:02  5%   ` Bart Schaefer
@ 1998-07-08 15:36  7%     ` Zoltan Hidvegi
  1998-07-08 17:24  7%       ` Bart Schaefer
  0 siblings, 1 reply; 200+ results
From: Zoltan Hidvegi @ 1998-07-08 15:36 UTC (permalink / raw)
  To: Zsh hacking and development

> } According to the standard:
> } 
> }    LC_COLLATE 
> }          This variable determines the behaviour of range expressions,
> }          equivalence classes and multi-character collating elements
> }          within pattern matching.
> 
> Which standard, specifically?

POSIX 1003.2 and X Open Single Unix Spcification Version 2.  It says:

     (7)  A range expression represents the set of collating elements that
          fall between two elements in the current collation sequence,
          inclusively.  It shall be expressed as the starting point and
          the ending point separated by a hyphen (-).

          Range expressions shall not be used in Strictly Conforming
          POSIX.2 Applications because their behavior is dependent on the
          collating sequence.  Range expressions shall be supported by
          conforming implementations.

Zoli


^ permalink raw reply	[relevance 7%]

* PATCH: 4.1.4: POSIX ranges, supplementary
@ 1998-07-08 16:49  9% Peter Stephenson
  0 siblings, 0 replies; 200+ results
From: Peter Stephenson @ 1998-07-08 16:49 UTC (permalink / raw)
  To: Zsh hackers list

Sorry.  You'll find that ']' has all kinds of unexpected properties
until you apply this additional patch.

*** Src/glob.c.range2	Wed Jul  8 15:25:05 1998
--- Src/glob.c	Wed Jul  8 18:46:07 1998
***************
*** 2216,2222 ****
  
      /* we made sure in parsecomp() there was a ':' to search for */
      *patptr = strchr(start, ':');
!     len = *patptr++ - start;
  
      if (!strncmp(start, "alpha", len))
  	return isalpha(ch);
--- 2216,2222 ----
  
      /* we made sure in parsecomp() there was a ':' to search for */
      *patptr = strchr(start, ':');
!     len = (*patptr)++ - start;
  
      if (!strncmp(start, "alpha", len))
  	return isalpha(ch);

-- 
Peter Stephenson <pws@ibmth.df.unipi.it>       Tel: +39 50 844536
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy


^ permalink raw reply	[relevance 9%]

* Re: 'LC_COLLATE=de ls [A-Z]*' expands to 'every file' including lowercase
  1998-07-08 15:36  7%     ` Zoltan Hidvegi
@ 1998-07-08 17:24  7%       ` Bart Schaefer
  1998-07-08 19:35  0%         ` Zoltan Hidvegi
  0 siblings, 1 reply; 200+ results
From: Bart Schaefer @ 1998-07-08 17:24 UTC (permalink / raw)
  To: Zsh hacking and development

On Jul 8, 10:36am, Zoltan Hidvegi wrote:
} Subject: Re: 'LC_COLLATE=de ls [A-Z]*' expands to 'every file' including l
}
} > Which standard, specifically?
} 
} POSIX 1003.2 and X Open Single Unix Spcification Version 2.

Well, yes, but I meant which volume.  Commands and Utilities?

} It says:
} 
}           Range expressions shall not be used in Strictly Conforming
}           POSIX.2 Applications because their behavior is dependent on the
}           collating sequence.  Range expressions shall be supported by
}           conforming implementations.

I just love it when committees do stuff like that.  What does it mean for
a shell to "support" but "not use" range expressions?

I still think that in this case the cure is worse than the disease.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[relevance 7%]

* Re: 'LC_COLLATE=de ls [A-Z]*' expands to 'every file' including lowercase
  1998-07-08 17:24  7%       ` Bart Schaefer
@ 1998-07-08 19:35  0%         ` Zoltan Hidvegi
  0 siblings, 0 replies; 200+ results
From: Zoltan Hidvegi @ 1998-07-08 19:35 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

> On Jul 8, 10:36am, Zoltan Hidvegi wrote:
> } Subject: Re: 'LC_COLLATE=de ls [A-Z]*' expands to 'every file' including l
> }
> } > Which standard, specifically?
> } 
> } POSIX 1003.2 and X Open Single Unix Spcification Version 2.
> 
> Well, yes, but I meant which volume.  Commands and Utilities?

Base Definitions -> Regular Expressions.  Commands and Utilities ->
Shell Command Language refers to regular expressions describing range
patterns.  Which means that you should not be surprised when sed and
grep start matching lower case letters with [A-Z].  And if you ever
port zsh to some EBCDIC machine, you'd probably want to use the
collate order.  But it looks like the GNU regexp library does not use
the collate order for ranges, neither does bash, actually, I haven't
found anything which uses the collate order for ranges, so it is
probably OK to make zsh non-conforming here.

Zoli


^ permalink raw reply	[relevance 0%]

* Re: PATCH: 4.1.4: POSIX ranges
  1998-07-08 13:36 11% PATCH: 4.1.4: POSIX ranges Peter Stephenson
@ 1998-07-12 16:26 13% ` Bart Schaefer
  0 siblings, 0 replies; 200+ results
From: Bart Schaefer @ 1998-07-12 16:26 UTC (permalink / raw)
  To: Peter Stephenson, Zsh hackers list

On Jul 8,  3:36pm, Peter Stephenson wrote:
} Subject: PATCH: 4.1.4: POSIX ranges
                  ^
		  3

} By the way, I haven't touched this, but what's happened to
} nobadpattern?
} 
} % setopt nobadpattern
} % [[ [ = [ ]]
} zsh: bad pattern: [
} 
} Is it really not supposed to work inside tests?

That complains in 3.0.5, too, but does not in 3.0.0 (which doesn't care
whether nobadpattern is set -- it never warns inside tests).

There are 13 places in zsh that print "bad pattern".  9 of them, all in
builtin.c, print a space between the word "pattern" and the following ":"
(consistent, aren't we), so they aren't involved above.  3 of the others
are in glob.c, the last is in options.c (in 3.0.5, it's in builtin.c).

Of those 13 places, only one is preceded by "if (unset(BADPATTERN))".
That one is in glob.c and follows a call to parsepat(); the other 12 all
follow calls to parsereg().  The 10 cases NOT in glob.c are implementing
the "-m" flag to various commands such as "setopt" (which happens to be
the one that doesn't print " :").

There are 7 other uses of parsereg() that don't print a warning, but no
other use of parsepat().

However, I can't figure out why 3.0.0 doesn't produce a "bad pattern"
on [[ [ = [ ]].  It's calling matchpat(), just as does 3.0.5 and later,
and matchpat() is one of the places in glob.c that prints the warning
(this is true as far back as 3.0.0 if not farther).

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[relevance 13%]

Results 1-200 of ~2000   | reverse | sort options + mbox downloads above
-- links below jump to the message on this page --
     [not found]     <7461.199506041454@stone.dcs.warwick.ac.uk>
1995-06-04 17:28  7% ` kill problem on Ultrix Marek Andricik
     [not found]     <26983.9506231110@pyro.swan.ac.uk>
1995-06-28 19:16  5% ` Z-Shell Frequently-Asked Questions (monthly posting) Zoltan Hidvegi
1995-07-06 19:04     Serious HP-UX problem ! Shell hangs ! Zoltan Hidvegi
1995-07-06 22:45  6% ` Richard Coleman
1995-07-07 11:30  0%   ` P.Stephenson
1995-07-07 13:58  0%   ` chen
1995-07-07 20:05  0%     ` Zoltan Hidvegi
1995-07-09  4:28  5% A couple of queries Zefram
1995-07-09  4:53  5% ` Richard Coleman
1995-07-09  5:47  7%   ` Zefram
1995-08-30 14:34     zshexpn(1) doc suggestion P.Stephenson
1995-09-22 22:42  3% ` size glob qualifier patch Thorsten Meinecke
1995-10-26  6:26  3% ZSH's future [longish] ? Mark Borges
1995-10-26 15:13  6% ` Zoltan Hidvegi
1995-10-26 22:44  0%   ` Mark Borges
1995-10-27  8:16 18%     ` ZSH's future - POSIX Geoff Wing
1995-10-27 22:53 18%       ` Richard Coleman
1995-10-27  8:20 18% Geoff Wing
1995-11-05 13:00     Expansion/quoting quirks Thorsten Meinecke
1995-11-06 17:25  5% ` Zoltan Hidvegi
1995-11-07 20:32  8% zsh-2.6-beta11 bug on HP-UX Sai Rama Krishna Susarla
1995-11-07 20:32  0% ` Richard Coleman
1995-11-08  9:05  0% ` Martin Steed
1996-01-03 16:23  6% build zsh 2.6-beta13 on SCO 3.2v5.0.0 problem Paul Lew
1996-02-12 12:17     zsh arg list too long Hrvoje Niksic
1996-02-13  7:32  5% ` Geoff Wing
1996-02-19 23:13  4% zsh 2.6-beta13 problem on SCO Unix 5.0v3.2 Paul Lew
1996-04-11  1:10 17% is anyone using non-POSIX signals? Richard J. Coleman
1996-04-11  5:34 16% ` Barton E. Schaefer
1996-04-11  5:47  9%   ` Richard J. Coleman
1996-04-30 15:51     IFS problem Florent Guillaume
1996-04-30 17:19  6% ` Zefram
1996-05-15  2:15     zsh-2.6-beta17 : compiling on SCO - results Peter Bray
1996-05-15 18:03  5% ` Wayne Davison
1996-05-15 23:02  7% kill-word & friends in ZLE Hrvoje Niksic
1996-05-20 17:03     8-bit patch for zle_tricky.c Bart Schaefer
1996-05-20 18:36  6% ` Zoltan Hidvegi
1996-05-20 21:09  6%   ` Zefram
1996-05-22 19:53  8% [zsh-2.6-b18] signames.awk and the backslash treatment bug Mark Borges
1996-05-22 20:06  5% zsh-2.5.03 seems to build 'out of box' on my MachTen 4.0.2 Richard Yeh
1996-05-27 23:16  6% zsh and portability Richard Coleman
1996-05-28 11:44  0% ` Zoltan Hidvegi
1996-06-06  8:46  5% zsh-2.6.b19: handling of locale probably wrong? Andrej Borsenkow
1996-06-06 14:54     Globbing in redirections Zefram
1996-06-06 16:25  7% ` Zoltan Hidvegi
1996-06-06 16:36  0%   ` Zefram
1996-06-07  7:13  6% fc bug when histNoStore J.D. Laub
1996-06-10 17:03     [ -z $FOO ] seems broken in beta13 Zefram
1996-06-10 17:18     ` Hrvoje Niksic
     [not found]       ` <hniksic@srce.hr>
1996-06-10 19:41  7%     ` Bart Schaefer
1996-06-10 17:34  6% ` Zoltan Hidvegi
1996-06-10 17:42     Is this really correct ? Hrvoje Niksic
1996-06-10 18:17  6% ` Zoltan Hidvegi
1996-06-10 18:07     Re: is this really correct gene
1996-06-10 18:33  6% ` Zoltan Hidvegi
1996-06-13  6:55     zsh.texi Bart Schaefer
1996-06-15  1:53  6% ` zsh.texi Zoltan Hidvegi
1996-06-15  7:44  0%   ` zsh.texi Zefram
1996-06-15 22:08  0%     ` <> redirection operator (was: zsh.texi) Zoltan Hidvegi
1996-06-16 13:23  6%       ` Zefram
1996-06-17 13:10  7%         ` Zoltan Hidvegi
1996-06-18 13:18 10% Compiling zsh 2.5.0 on LynxOS 2.3.0 Robin Kirkham
1996-06-21  7:30     zsh.texi commentary (actually, HTML pages commentary) Bart Schaefer
1996-06-21 12:15  5% ` Zoltan Hidvegi
1996-06-21 13:17  6% quoting bug Raymond Nijssen
1996-06-21 13:29     ` Zefram
1996-06-21 13:55  6%   ` Bruce Stephens
1996-06-21 14:03  8%     ` Zoltan Hidvegi
1996-06-21 14:24  7%       ` quoting bug, and comparisons with ksh93 Bruce Stephens
1996-06-21 14:17  6%     ` quoting bug Zefram
1996-06-21 14:30  7%       ` Zoltan Hidvegi
1996-06-21 14:43  0%       ` Hrvoje Niksic
1996-06-21 15:18  9%         ` Zefram
1996-06-21 14:48  7%       ` Chet Ramey
1996-06-21 17:16  6% read broken in beta21 Zefram
1996-06-24 11:57  7% ` Zoltan Hidvegi
1996-06-24 17:54     $BAUD is strange on Linux for 115200 Zoltan Hidvegi
1996-06-24 18:15  7% ` Janos Farkas
1996-06-26 13:51     Use of qualifiers without glob pattern? Bart Schaefer
1996-06-26 14:52  5% ` Zoltan Hidvegi
1996-06-28 16:45     zsh-3.0-pre1 released Zefram
1996-06-28 17:10  6% ` Zoltan Hidvegi
1996-06-28 17:21  0%   ` Zefram
1996-07-02 19:35     cshjunkieparen bothers me (and always has) Bart Schaefer
1996-07-04 13:14  9% ` Zoltan Hidvegi
1996-07-04 15:58  5%   ` Bart Schaefer
1996-07-11 22:11     Bug Report: Env Vars and shell functions Anthony Heading
1996-07-12 15:27  9% ` Zoltan Hidvegi
1996-07-12 16:01  6%   ` Anthony Heading
1996-07-12 17:18  9%   ` Bart Schaefer
1996-07-12 17:43  7%     ` Zoltan Hidvegi
1996-07-12 15:38     Error in zsh.texi and zshexpn.man Bart Schaefer
1996-07-12 15:53  6% ` Zoltan Hidvegi
1996-07-15  2:43     Blocking child signals Zoltan Hidvegi
1996-07-15  6:02  4% ` Bart Schaefer
1996-07-16 19:43  3% Bugfix in $0 saving Zefram
1996-07-19 18:12     Misc. unresolved stuff Bart Schaefer
1996-07-19 19:30  5% ` Zoltan Hidvegi
     [not found]     <199607191600.SAA08613@bolyai.cs.elte.hu>
     [not found]     ` <9607211853.ZM979@morgan.com>
     [not found]       ` <960721233102.ZM22696@candle.brasslantern.com>
     [not found]         ` <schaefer>
1996-07-22  6:53  8%       ` Bug in case stmt with '(' Bart Schaefer
     [not found]     <17651.199607222123@stone.dcs.warwick.ac.uk>
1996-07-23 14:08  5% ` Zoltan Hidvegi
1996-07-23 16:25  5%   ` Bart Schaefer
     [not found]         ` <schaefer@candle.brasslantern.com>
1996-07-23 20:01  0%       ` Morris M. Siegel
1996-07-23 21:55  7%         ` Bart Schaefer
1996-07-24  9:52  5%           ` Peter Stephenson
     [not found]     <199607250812.KAA18570@sgi.ifh.de>
1996-07-25 20:31  5% ` Z-Shell Frequently Asked Questions (monthly posting) Zoltan Hidvegi
1996-07-25 21:14  6%   ` Bart Schaefer
1996-07-26  8:08     Odd behavior of "trap" and "functions" in 3.0-pre2 Peter Stephenson
1996-07-26 11:56  8% ` Zoltan Hidvegi
1996-07-26 22:53     options shenanigans in pre4 Zefram
1996-07-27 21:01  6% ` Zoltan Hidvegi
1996-07-27 21:48  0%   ` Zefram
1996-07-27 19:26     zsh-3.0-pre4 released Bart Schaefer
1996-07-27 20:02  5% ` Zefram
1996-07-27 20:38  5%   ` Bart Schaefer
1996-07-29  6:49     BUG: set -n in interactive shell (3.0-xxx) Andrej Borsenkow
1996-07-31  2:40  6% ` Zefram
1996-07-29 15:59     Lethal option-related bug Peter Stephenson
1996-07-29 18:03  5% ` Zoltan Hidvegi
1996-07-30  8:19  0%   ` Peter Stephenson
1996-07-31 17:50     Something fishy in process timing Zoltan Hidvegi
1996-07-31 19:26  6% ` Richard Coleman
1996-07-31 21:11  4% Announcement draft Zoltan Hidvegi
1996-08-01  6:36  6% ` Bas V. de Bakker
1996-08-01  8:31  0%   ` Peter Stephenson
1996-08-08 15:13  6% ` sh compatibility again :-> Andrej Borsenkow
1996-08-12  2:18  0%   ` Zoltan Hidvegi
1996-08-12  4:36  5%     ` Bart Schaefer
1996-08-12  5:00  6%       ` Zefram
1996-08-12  6:01  7%         ` Bart Schaefer
1996-08-01 13:02     Procmail rejects zsh as being "broken" Zoltan Hidvegi
1996-08-01 14:44  8% ` Stephen R. van den Berg
1996-08-01 13:49     Here docs Peter Stephenson
1996-08-01 14:07  5% ` Zoltan Hidvegi
1996-08-01 17:40     More Configure problems Peter Stephenson
1996-08-01 17:55  6% ` Zoltan Hidvegi
1996-08-01 21:03  0%   ` Zoltan Hidvegi
1996-08-01 23:19  2% Spelling fixes, etc Zefram
1996-08-02  0:59     Procmail rejects zsh as being "broken" Zefram
1996-08-02  1:20  7% ` Stephen R. van den Berg
1996-08-02  8:32     More Configure problems Peter Stephenson
1996-08-02 10:03  6% ` Andrej Borsenkow
1996-08-02 13:29  0%   ` Zoltan Hidvegi
1996-08-02 12:53  8% zsh-3.0-pre5 on Alliant Concentrix 2800 Louis Granboulan
1996-08-05  6:19  5% Patches since pre3 that are not in pre6 Bart Schaefer
1996-08-05  8:18  5% Rewrite of Functions/run-help Bart Schaefer
1996-08-13 16:04     History list fix Peter Stephenson
1996-08-13 23:08  5% ` Zoltan Hidvegi
1996-08-14  1:17 10% POSIX builtins Zoltan Hidvegi
1996-08-14 20:45     Final 3.0.0 test release Richard Coleman
1996-08-15  0:32  5% ` BSD_ECHO Zoltan Hidvegi
1996-08-31 18:00  4% Installing 3.0 Andrew D. Jones Jr
1996-09-10 19:02     Is this a bug in globbing yamagata
1996-09-10 21:30  9% ` Zoltan Hidvegi
1996-09-23 18:47  6% Bug in Parsing? alain (a.) caron
1996-10-02 10:55     zsh3.0.0 bug: aliases in if-statement Peter Stephenson
1996-10-02 12:02  6% ` Zoltan Hidvegi
1996-10-03  3:19 11% Some Etc/* spell fixes Geoff Wing
     [not found]     <199610240841.QAA00731@mermaid.ucc.gu.uwa.edu.au>
1996-10-24  9:37  7% ` Mailpath notification message Zoltan Hidvegi
1996-10-25 15:42     Solaris x86? Hrvoje Niksic
1996-10-25 15:48  6% ` Scott Lipcon
1996-10-28 14:48     compatibility problem with bash? Carlos Carvalho
1996-10-29  1:29  6% ` Zoltan Hidvegi
1996-10-29 13:24  6%   ` Carlos Carvalho
1996-11-13 17:41     signal weirdness Bart Schaefer
1996-11-13 18:03  6% ` Zefram
1996-11-13 18:32  7%   ` Bart Schaefer
1996-12-02 22:33     time command bug in next headers? Robert F Tobler
1996-12-03  6:42  7% ` Richard Coleman
1996-12-03  6:40  2% Job control under IRIX [5.3/6.2] Ryan Dooley
1996-12-23 20:01     new module Zefram
1996-12-25  2:28  4% ` Zoltan Hidvegi
1996-12-25  6:36  7% keeping up with the competition Richard Coleman
1996-12-27  0:55  4% Fail to build zsh-3.1.0 on Solaris 2.x with bundled make KIMURA Yasuhiro / 木村康浩 
1997-01-09  0:57  6% Zsh signal handling Zoltan Hidvegi
1997-01-14 12:40     vi-goto-column Peter Stephenson
1997-01-14 14:05  6% ` vi-goto-column Zoltan Hidvegi
1997-01-14 14:24  0%   ` vi-goto-column Zefram
1997-01-16 14:07  8% Order of field splitting in zsh Andrej Borsenkow
1997-01-16 15:55  8% ` Zoltan Hidvegi
1997-01-22 15:58  0%   ` Andrej Borsenkow
1997-01-27 17:43  5% compiling zsh 3.10 on Solaris 2.4 for dynamically loaded modules Anthony Iano-Fletcher
1997-02-26 17:11     Short loops? Bart Schaefer
1997-02-26 17:26  6% ` Zoltan T. Hidvegi
1997-03-22 16:36  2% ZLE special parameters Zefram
1997-03-24  9:54  0% ` Peter Stephenson
1997-03-22 16:37     -L option for ttyctl Zefram
1997-03-22 17:42  6% ` Zoltan Hidvegi
1997-03-22 17:55  6%   ` Zefram
1997-03-22 18:27  7%   ` Bart Schaefer
1997-03-22 18:55  6%     ` Zefram
1997-03-26 17:46  6% local parameters Zefram
1997-03-28  3:09     fchdir not implemented in NeXTSTEP/OPENSTEP Chris Faylor
1997-03-28  6:28  6% ` Zoltan Hidvegi
1997-03-30 21:29  2% local parameters Zefram
1997-04-01  0:12  5% case fall-through Zefram
     [not found]     <5ifr3t$sub@charm.il.ft.hse.nl>
     [not found]     ` <risqi5.8t6.ln@sequeira.powernet.co.uk>
     [not found]       ` <5irn2i$b2p@charm.il.ft.hse.nl>
     [not found]         ` <5itdj0$dc0@bmtlh10.bnr.ca>
1997-04-14 17:42  0%       ` zsh not sourcing /etc/profile? Richard Coleman
1997-04-14 18:45  0%         ` Zoltan T. Hidvegi
1997-04-14 19:51  0% Alain Caron
1997-04-14 22:38  7% ` Zoltan T. Hidvegi
1997-04-26 19:49 12% POSIX.6 Zefram
1997-05-09 18:09     test patches Zoltan T. Hidvegi
1997-05-09 20:40  7% ` Zefram
1997-05-09 21:04  7%   ` Zoltan T. Hidvegi
1997-05-11 17:51  6% [[ -x file ]] Zefram
1997-05-12  1:04  9% ` Zoltan Hidvegi
1997-05-12 10:51  6% Warning: patch-2.2 and zsh-3.1.2 patch Andrej Borsenkow
1997-05-12 18:14  6% ` Zoltan T. Hidvegi
1997-05-15 15:47     stopping "wait" in (sub)script ? Zoltan Hidvegi
1997-05-16  7:11  5% ` Zoltan Hidvegi
1997-06-04 18:54     exporting arrays Bernd Eggink
1997-06-05  6:18  7% ` Zoltan Hidvegi
1997-06-09  8:40     incorrect behavior of zsh under su on SUNOS-4.1.3 Juergen Peter bluen
1997-06-09 16:09  6% ` Zefram
1997-06-21 19:30     no $USER when root Timothy J. Luoma
1997-06-21 19:37     ` Zoltan Hidvegi
1997-06-22  2:55  6%   ` Stefan Monnier
1997-07-02  6:10     Completion bug introduced in 3.0.3 Bart Schaefer
1997-07-02  6:55  5% ` Zoltan Hidvegi
1997-07-03  8:28  5% non-blocking reads Zoltan Hidvegi
1997-07-30 17:05     RC_EXPAND_PARAM bug Bart Schaefer
1997-08-01 13:17  4% ` Andrej Borsenkow
1997-08-18  1:10     Parsing change between 3.0.2 and 3.0.4? Josef Sachs
1997-08-25  4:20  6% ` Zoltan Hidvegi
1997-10-27 13:41  4% Problem Installing Z Shell on HPUX 10.20 David Chamont
1997-11-14 14:15     Bizarre Solaris problem Peter Stephenson
1997-11-20 15:18  5% ` Anthony Heading
1998-01-12 11:13     PATCH: zsh 3.x: <..> ranges in globbing Peter Stephenson
1998-01-12 16:16  6% ` Andrej Borsenkow
1998-01-16 10:16  4% PATCH: build script fixes Andrew Main
1998-01-16 13:14     PATCH: zsh-3.1.2-zefram3: 12 hour clock in prompts pws
1998-01-16 14:27  7% ` Andrew Main
1998-01-16 14:48  0%   ` Peter Stephenson
1998-01-29 13:28     shared libs in zsh-3.1.2-zefram3 Andrew Main
1998-01-29 13:38  5% ` Andrei Tcherepanov
1998-04-23  9:13  5% PATCH: NO_CLOBBER Andrew Main
1998-04-23 14:22     Peter Stephenson
1998-04-23 18:44  7% ` Andrew Main
1998-04-27  9:22  2% PATCH: optional file types Andrew Main
1998-04-27  9:24 10% PATCH: POSIX file mode macros Andrew Main
1998-05-06 20:26     zsh vs. ksh coproc redirection semantics Bart Schaefer
1998-05-07  8:27  6% ` Andrew Main
1998-05-08  6:23  5% PATCH: set blocking read on stdin Zoltan Hidvegi
1998-05-09 22:17  3% PATCH: misc glob fixes Zoltan Hidvegi
1998-05-11  9:36  6% ` Andrew Main
1998-05-11 15:49  6%   ` Zoltan Hidvegi
1998-05-24  4:44  4% PWD parameter Zoltan Hidvegi
1998-06-01 16:28     can't build 3.1.4 under NeXTStep Zefram
1998-06-01 16:31  4% ` can't build 3.1.4 under NeXTStep (LONG) Timothy J Luoma
1998-06-09 17:09     User-defined zle widgets and built-in widget failure Bart Schaefer
1998-06-09 18:01  5% ` Zefram
1998-06-09 19:12  5%   ` Bart Schaefer
1998-06-09 20:02  3%     ` Zefram
1998-06-10  6:26     Variable namespaces, goals for ZLE, etc Bart Schaefer
1998-06-10 10:55  6% ` Zefram
1998-06-10 17:37  8%   ` Bart Schaefer
1998-06-10 18:01  5%     ` Zefram
1998-07-02  7:58     Zsh 2.6 and Y2K status Chan Sean
1998-07-02 15:37  5% ` Bart Schaefer
1998-07-06 18:14     'LC_COLLATE=de ls [A-Z]*' expands to 'every file' including lowercase Bart Schaefer
1998-07-08  6:40  6% ` Zoltan Hidvegi
1998-07-08 11:02  5%   ` Bart Schaefer
1998-07-08 15:36  7%     ` Zoltan Hidvegi
1998-07-08 17:24  7%       ` Bart Schaefer
1998-07-08 19:35  0%         ` Zoltan Hidvegi
1998-07-08 13:36 11% PATCH: 4.1.4: POSIX ranges Peter Stephenson
1998-07-12 16:26 13% ` Bart Schaefer
1998-07-08 16:49  9% PATCH: 4.1.4: POSIX ranges, supplementary Peter Stephenson

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).