From 03e53c8f25a472b4d62ad5e7247b693a4864eaca Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Fri, 12 Sep 2014 15:28:51 -0700 Subject: 33143: POSIX_ARGZERO more closely matches bash et al. --- Src/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Src/init.c') diff --git a/Src/init.c b/Src/init.c index 5e92f59df..d536978b9 100644 --- a/Src/init.c +++ b/Src/init.c @@ -252,8 +252,9 @@ parseargs(char **argv, char **runscript) paramlist = znewlinklist(); if (*argv) { if (unset(SHINSTDIN)) { + posixzero = *argv; if (cmd) - argzero = posixzero = *argv; + argzero = *argv; else *runscript = *argv; opts[INTERACTIVE] &= 1; -- cgit v1.2.3 From 0c7a3d68644d9bc0449cdd1bd212fdefbbbf44ba Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sat, 20 Sep 2014 20:14:09 +0100 Subject: 33212: try to put /usr/local/share/zsh/site-functions in default fpath --- ChangeLog | 5 +++++ Src/init.c | 33 ++++++++++++++++++++++----------- Src/zsh.mdd | 3 +++ configure.ac | 13 +++++++++++++ 4 files changed, 43 insertions(+), 11 deletions(-) (limited to 'Src/init.c') diff --git a/ChangeLog b/ChangeLog index d425169db..3c5aa6126 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2014-09-20 Peter Stephenson + * 33212: Src/zsh.mdd: Src/init.c, Src/zsh.mdd, configure.ac: add + /usr/local/share/zsh/site-functions to head of fpath if not + present in configurable. Not configurable as serves as fallback + only if no handling /etc/zshenv. + * Tanu Kaskinen: 33209: Doc/Makefile.in: don't fail catastrophically when builing zsh.texi if yodl isn't available. diff --git a/Src/init.c b/Src/init.c index d536978b9..40f46a804 100644 --- a/Src/init.c +++ b/Src/init.c @@ -770,7 +770,8 @@ setupvals(void) struct timezone dummy_tz; char *ptr; int i, j; -#if defined(SITEFPATH_DIR) || defined(FPATH_DIR) || defined (ADDITIONAL_FPATH) +#if defined(SITEFPATH_DIR) || defined(FPATH_DIR) || defined (ADDITIONAL_FPATH) || defined(FIXED_FPATH_DIR) +#define FPATH_NEEDS_INIT 1 char **fpathptr; # if defined(FPATH_DIR) && defined(FPATH_SUBDIRS) char *fpath_subdirs[] = FPATH_SUBDIRS; @@ -779,11 +780,17 @@ setupvals(void) char *more_fndirs[] = ADDITIONAL_FPATH; int more_fndirs_len; # endif +# ifdef FIXED_FPATH_DIR +# define FIXED_FPATH_LEN 1 +# else +# define FIXED_FPATH_LEN 0 +# endif # ifdef SITEFPATH_DIR - int fpathlen = 1; +# define SITE_FPATH_LEN 1 # else - int fpathlen = 0; +# define SITE_FPATH_LEN 0 # endif + int fpathlen = FIXED_FPATH_LEN + SITE_FPATH_LEN; #endif int close_fds[10], tmppipe[2]; @@ -862,23 +869,27 @@ setupvals(void) manpath = mkarray(NULL); fignore = mkarray(NULL); -#if defined(SITEFPATH_DIR) || defined(FPATH_DIR) || defined(ADDITIONAL_FPATH) +#ifdef FPATH_NEEDS_INIT # ifdef FPATH_DIR # ifdef FPATH_SUBDIRS fpathlen += sizeof(fpath_subdirs)/sizeof(char *); -# else +# else /* FPATH_SUBDIRS */ fpathlen++; -# endif -# endif +# endif /* FPATH_SUBDIRS */ +# endif /* FPATH_DIR */ # if defined(ADDITIONAL_FPATH) more_fndirs_len = sizeof(more_fndirs)/sizeof(char *); fpathlen += more_fndirs_len; -# endif +# endif /* ADDITONAL_FPATH */ fpath = fpathptr = (char **)zalloc((fpathlen+1)*sizeof(char *)); +# ifdef FIXED_FPATH_DIR + *fpathptr++ = ztrdup(FIXED_FPATH_DIR); + fpathlen--; +# endif # ifdef SITEFPATH_DIR *fpathptr++ = ztrdup(SITEFPATH_DIR); fpathlen--; -# endif +# endif /* SITEFPATH_DIR */ # if defined(ADDITIONAL_FPATH) for (j = 0; j < more_fndirs_len; j++) *fpathptr++ = ztrdup(more_fndirs[j]); @@ -897,9 +908,9 @@ setupvals(void) # endif # endif *fpathptr = NULL; -#else +#else /* FPATH_NEEDS_INIT */ fpath = mkarray(NULL); -#endif +#endif /* FPATH_NEEDS_INIT */ mailpath = mkarray(NULL); watch = mkarray(NULL); diff --git a/Src/zsh.mdd b/Src/zsh.mdd index cec3edab7..9a8c923f9 100644 --- a/Src/zsh.mdd +++ b/Src/zsh.mdd @@ -73,6 +73,9 @@ zshpaths.h: Makemod $(CONFIG_INCS) @if test x$(sitefndir) != xno; then \ echo '#define SITEFPATH_DIR "'$(sitefndir)'"' >> zshpaths.h.tmp; \ fi + @if test x$(fixed_sitefndir) != x; then \ + echo '#define FIXED_FPATH_DIR "'$(fixed_sitefndir)'"' >> zshpaths.h.tmp; \ + fi @if test x$(fndir) != xno; then \ echo '#define FPATH_DIR "'$(fndir)'"' >> zshpaths.h.tmp; \ if test x$(FUNCTIONS_SUBDIRS) != x && \ diff --git a/configure.ac b/configure.ac index 37f35858f..68a2e919f 100644 --- a/configure.ac +++ b/configure.ac @@ -315,6 +315,18 @@ else sitefndir="$enableval" fi], [sitefndir=${datadir}/${tzsh_name}/site-functions]) +dnl Add /usr/local/share/zsh/site-functions if not yet present. +dnl It might be present owing to an explicit sitefndir or the install +dnl prefix if the shell is installed under the name "zsh". +if test X$sitefndir = X/usr/local/zsh/site-functions +then fixed_sitefndir='' +elif test X$ac_default_prefix != X/usr/local +then fixed_sitefndir=/usr/local/zsh/site-functions +elif test X$tzsh_name != Xzsh +then fixed_sitefndir=/usr/local/zsh/site-functions +else fixed_sitefndir='' +fi + ifdef([function_subdirs],[undefine([function_subdirs])]) AC_ARG_ENABLE(function-subdirs, AC_HELP_STRING([--enable-function-subdirs], [install functions in subdirectories])) @@ -340,6 +352,7 @@ AC_SUBST(runhelp)dnl AC_SUBST(additionalfpath)dnl AC_SUBST(fndir)dnl AC_SUBST(sitefndir)dnl +AC_SUBST(fixed_sitefndir)dnl AC_SUBST(FUNCTIONS_SUBDIRS)dnl dnl Directories for scripts such as newuser. -- cgit v1.2.3 From 60e31a45b0c015d42e9dc8ca2c991930c3f7fd66 Mon Sep 17 00:00:00 2001 From: "Barton E. Schaefer" Date: Mon, 29 Sep 2014 08:59:31 -0700 Subject: 33268: interactive shells treat SIGPIPE like SIGHUP if and only if SHTTY is disconnected --- ChangeLog | 5 +++++ Src/exec.c | 2 ++ Src/init.c | 1 + Src/signals.c | 13 +++++++++++++ 4 files changed, 21 insertions(+) (limited to 'Src/init.c') diff --git a/ChangeLog b/ChangeLog index b89f90015..3cccf62ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2014-09-28 Barton E. Schaefer + + * 33268: Src/exec.c, Src/init.c, Src/signals.c: interactive shells + treat SIGPIPE like SIGHUP if and only if SHTTY is disconnected + 2014-09-27 Barton E. Schaefer * 33256: Src/prompt.c: fix prompttrunc() counting of %{ %} spans diff --git a/Src/exec.c b/Src/exec.c index fb2739acc..fbd309580 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -1005,6 +1005,8 @@ entersubsh(int flags) signal_default(SIGTERM); if (!(sigtrapped[SIGINT] & ZSIG_IGNORED)) signal_default(SIGINT); + if (!(sigtrapped[SIGPIPE])) + signal_default(SIGPIPE); } if (!(sigtrapped[SIGQUIT] & ZSIG_IGNORED)) signal_default(SIGQUIT); diff --git a/Src/init.c b/Src/init.c index 40f46a804..6d005dce7 100644 --- a/Src/init.c +++ b/Src/init.c @@ -1134,6 +1134,7 @@ init_signals(void) winch_block(); /* See utils.c:preprompt() */ #endif if (interact) { + install_handler(SIGPIPE); install_handler(SIGALRM); signal_ignore(SIGTERM); } diff --git a/Src/signals.c b/Src/signals.c index cb2b58161..84a2609e5 100644 --- a/Src/signals.c +++ b/Src/signals.c @@ -594,6 +594,17 @@ zhandler(int sig) wait_for_processes(); break; + case SIGPIPE: + if (!handletrap(SIGPIPE)) { + if (!interact) + _exit(SIGPIPE); + else if (!isatty(SHTTY)) { + stopmsg = 1; + zexit(SIGPIPE, 1); + } + } + break; + case SIGHUP: if (!handletrap(SIGHUP)) { stopmsg = 1; @@ -897,6 +908,8 @@ removetrap(int sig) noholdintr(); } else if (sig == SIGHUP) install_handler(sig); + else if (sig == SIGPIPE && interact && !forklevel) + install_handler(sig); else if (sig && sig <= SIGCOUNT && #ifdef SIGWINCH sig != SIGWINCH && -- cgit v1.2.3