CVS commit: src/sbin/newfs

2016-03-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Apr  1 05:23:56 UTC 2016

Modified Files:
src/sbin/newfs: newfs.c

Log Message:
no need to escape


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sbin/newfs/newfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/newfs/newfs.c
diff -u src/sbin/newfs/newfs.c:1.113 src/sbin/newfs/newfs.c:1.114
--- src/sbin/newfs/newfs.c:1.113	Sat Jul 25 10:37:22 2015
+++ src/sbin/newfs/newfs.c	Fri Apr  1 05:23:56 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: newfs.c,v 1.113 2015/07/25 10:37:22 mlelstv Exp $	*/
+/*	$NetBSD: newfs.c,v 1.114 2016/04/01 05:23:56 ryo Exp $	*/
 
 /*
  * Copyright (c) 1983, 1989, 1993, 1994
@@ -78,7 +78,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)newfs.c	8.13 (Berkeley) 5/1/95";
 #else
-__RCSID("$NetBSD: newfs.c,v 1.113 2015/07/25 10:37:22 mlelstv Exp $");
+__RCSID("$NetBSD: newfs.c,v 1.114 2016/04/01 05:23:56 ryo Exp $");
 #endif
 #endif /* not lint */
 
@@ -866,7 +866,7 @@ struct help_strings {
 	{ MFS_MOUNT,	"-g groupname\tgroup name of mount point" },
 	{ BOTH,		"-h avgfpdir\taverage files per directory" },
 	{ BOTH,		"-i density\tnumber of bytes per inode" },
-	{ BOTH,		"-m minfree\tminimum free space %%" },
+	{ BOTH,		"-m minfree\tminimum free space %" },
 	{ BOTH,		"-n inodes\tnumber of inodes (overrides -i density)" },
 	{ BOTH,		"-o optim\toptimization preference (`space' or `time')"
 			},



CVS commit: src/sbin/newfs

2016-03-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Apr  1 05:23:56 UTC 2016

Modified Files:
src/sbin/newfs: newfs.c

Log Message:
no need to escape


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sbin/newfs/newfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/netinet6

2016-03-31 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Apr  1 05:11:38 UTC 2016

Modified Files:
src/sys/netinet6: ip6_input.c nd6.c nd6.h

Log Message:
Tidy up nd6_timer initialization


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/netinet6/ip6_input.c
cvs rdiff -u -r1.185 -r1.186 src/sys/netinet6/nd6.c
cvs rdiff -u -r1.69 -r1.70 src/sys/netinet6/nd6.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netinet6/ip6_input.c
diff -u src/sys/netinet6/ip6_input.c:1.155 src/sys/netinet6/ip6_input.c:1.156
--- src/sys/netinet6/ip6_input.c:1.155	Thu Feb  4 02:48:37 2016
+++ src/sys/netinet6/ip6_input.c	Fri Apr  1 05:11:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_input.c,v 1.155 2016/02/04 02:48:37 riastradh Exp $	*/
+/*	$NetBSD: ip6_input.c,v 1.156 2016/04/01 05:11:38 ozaki-r Exp $	*/
 /*	$KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.155 2016/02/04 02:48:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip6_input.c,v 1.156 2016/04/01 05:11:38 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_gateway.h"
@@ -144,7 +144,7 @@ pfil_head_t *inet6_pfil_hook;
 
 percpu_t *ip6stat_percpu;
 
-static void ip6_init2(void *);
+static void ip6_init2(void);
 static void ip6intr(void *);
 static struct m_tag *ip6_setdstifaddr(struct mbuf *, const struct in6_ifaddr *);
 
@@ -184,7 +184,7 @@ ip6_init(void)
 	frag6_init();
 	ip6_desync_factor = cprng_fast32() % MAX_TEMP_DESYNC_FACTOR;
 
-	ip6_init2(NULL);
+	ip6_init2();
 #ifdef GATEWAY
 	ip6flow_init(ip6_hashsize);
 #endif
@@ -196,13 +196,9 @@ ip6_init(void)
 }
 
 static void
-ip6_init2(void *dummy)
+ip6_init2(void)
 {
 
-	/* nd6_timer_init */
-	callout_init(_timer_ch, CALLOUT_MPSAFE);
-	callout_reset(_timer_ch, hz, nd6_timer, NULL);
-
 	/* timer for regeneranation of temporary addresses randomize ID */
 	callout_init(_tmpaddrtimer_ch, CALLOUT_MPSAFE);
 	callout_reset(_tmpaddrtimer_ch,

Index: src/sys/netinet6/nd6.c
diff -u src/sys/netinet6/nd6.c:1.185 src/sys/netinet6/nd6.c:1.186
--- src/sys/netinet6/nd6.c:1.185	Thu Feb  4 02:48:37 2016
+++ src/sys/netinet6/nd6.c	Fri Apr  1 05:11:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.c,v 1.185 2016/02/04 02:48:37 riastradh Exp $	*/
+/*	$NetBSD: nd6.c,v 1.186 2016/04/01 05:11:38 ozaki-r Exp $	*/
 /*	$KAME: nd6.c,v 1.279 2002/06/08 11:16:51 itojun Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.185 2016/02/04 02:48:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6.c,v 1.186 2016/04/01 05:11:38 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -123,10 +123,11 @@ static void nd6_slowtimo(void *);
 static int regen_tmpaddr(struct in6_ifaddr *);
 static void nd6_free(struct rtentry *, struct llentry *, int);
 static void nd6_llinfo_timer(void *);
+static void nd6_timer(void *);
 static void clear_llinfo_pqueue(struct llentry *);
 
-callout_t nd6_slowtimo_ch;
-callout_t nd6_timer_ch;
+static callout_t nd6_slowtimo_ch;
+static callout_t nd6_timer_ch;
 
 static int fill_drlist(void *, size_t *, size_t);
 static int fill_prlist(void *, size_t *, size_t);
@@ -136,24 +137,17 @@ MALLOC_DEFINE(M_IP6NDP, "NDP", "IPv6 Nei
 void
 nd6_init(void)
 {
-	static int nd6_init_done = 0;
-
-	if (nd6_init_done) {
-		log(LOG_NOTICE, "nd6_init called more than once(ignored)\n");
-		return;
-	}
 
 	/* initialization of the default router list */
 	TAILQ_INIT(_defrouter);
 
-	nd6_init_done = 1;
-
 	callout_init(_slowtimo_ch, CALLOUT_MPSAFE);
 	callout_init(_timer_ch, CALLOUT_MPSAFE);
 
 	/* start timer */
 	callout_reset(_slowtimo_ch, ND6_SLOWTIMER_INTERVAL * hz,
 	nd6_slowtimo, NULL);
+	callout_reset(_timer_ch, hz, nd6_timer, NULL);
 }
 
 struct nd_ifinfo *
@@ -592,7 +586,7 @@ out:
 /*
  * ND6 timer routine to expire default route list and prefix list
  */
-void
+static void
 nd6_timer(void *ignored_arg)
 {
 	struct nd_defrouter *next_dr, *dr;

Index: src/sys/netinet6/nd6.h
diff -u src/sys/netinet6/nd6.h:1.69 src/sys/netinet6/nd6.h:1.70
--- src/sys/netinet6/nd6.h:1.69	Mon Dec  7 06:19:13 2015
+++ src/sys/netinet6/nd6.h	Fri Apr  1 05:11:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6.h,v 1.69 2015/12/07 06:19:13 ozaki-r Exp $	*/
+/*	$NetBSD: nd6.h,v 1.70 2016/04/01 05:11:38 ozaki-r Exp $	*/
 /*	$KAME: nd6.h,v 1.95 2002/06/08 11:31:06 itojun Exp $	*/
 
 /*
@@ -352,8 +352,6 @@ extern int nd6_debug;
 
 #define nd6log(x)	do { if (nd6_debug) log x; } while (/*CONSTCOND*/ 0)
 
-extern struct callout nd6_timer_ch;
-
 /* nd6_rtr.c */
 extern int nd6_defifindex;
 extern int ip6_desync_factor;	/* seconds */
@@ -402,7 +400,6 @@ struct	rtentry *nd6_lookup(const struct 
 void nd6_setmtu(struct ifnet *);
 void nd6_llinfo_settimer(struct llentry *, time_t);
 void nd6_llinfo_settimer_locked(struct llentry *, time_t);
-void nd6_timer(void *);
 void nd6_purge(struct ifnet *, struct 

CVS commit: src/sys/netinet6

2016-03-31 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Apr  1 05:11:38 UTC 2016

Modified Files:
src/sys/netinet6: ip6_input.c nd6.c nd6.h

Log Message:
Tidy up nd6_timer initialization


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/netinet6/ip6_input.c
cvs rdiff -u -r1.185 -r1.186 src/sys/netinet6/nd6.c
cvs rdiff -u -r1.69 -r1.70 src/sys/netinet6/nd6.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/sys/net

2016-03-31 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Apr  1 02:00:14 UTC 2016

Modified Files:
src/sys/net: route.c

Log Message:
Make some global variables static


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/net/route.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/route.c
diff -u src/sys/net/route.c:1.154 src/sys/net/route.c:1.155
--- src/sys/net/route.c:1.154	Thu Mar 24 06:18:27 2016
+++ src/sys/net/route.c	Fri Apr  1 02:00:14 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.154 2016/03/24 06:18:27 ozaki-r Exp $	*/
+/*	$NetBSD: route.c,v 1.155 2016/04/01 02:00:14 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.154 2016/03/24 06:18:27 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.155 2016/04/01 02:00:14 ozaki-r Exp $");
 
 #include 
 #ifdef RTFLUSH_DEBUG
@@ -128,14 +128,14 @@ __KERNEL_RCSID(0, "$NetBSD: route.c,v 1.
 #define	rtcache_debug() 0
 #endif /* RTFLUSH_DEBUG */
 
-struct	rtstat	rtstat;
+struct rtstat		rtstat;
 
-int	rttrash;		/* routes not in table but not freed */
+static int		rttrash;	/* routes not in table but not freed */
 
-struct pool rtentry_pool;
-struct pool rttimer_pool;
+static struct pool	rtentry_pool;
+static struct pool	rttimer_pool;
 
-struct callout rt_timer_ch; /* callout for rt_timer_timer() */
+static struct callout	rt_timer_ch; /* callout for rt_timer_timer() */
 
 #ifdef RTFLUSH_DEBUG
 static int _rtcache_debug = 0;



CVS commit: src/sys/net

2016-03-31 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Apr  1 02:00:14 UTC 2016

Modified Files:
src/sys/net: route.c

Log Message:
Make some global variables static


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/net/route.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 23:11:05 UTC 2016

Modified Files:
src/bin/sh: parser.c parser.h

Log Message:
After discussions with Jilles Tjoelker (FreeBSD shell) and
following a suggestion from him, the way the fix to PR bin/50993
was implemented has changed a little.   There are three steps involved
in processing a here document, reading it, parsing it, and then
evaluating it before applying it to the correct file descriptor for
the command to use.  The third of those is not related to this
problem, and has not changed.  The bug was caused by combining the
first two steps into one (and not doing it correctly - which would be
hard that way.)  The fix is to split the first two stages into
separate events.   The original fix moved the 2nd stage (parsing)
to just immediately before the 3rd stage (evaluation.)  Jilles
pointed out some unwanted side effects from doing it that way, and
suggested moving the 2nd stage to immediately after the first.
This commit makes that change.  The effect is to revert the changes
to expand.c and parser.h (which are no longer needed) and simplify
slightly the change to parser.c. (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/bin/sh/parser.c
cvs rdiff -u -r1.20 -r1.21 src/bin/sh/parser.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 23:11:05 UTC 2016

Modified Files:
src/bin/sh: parser.c parser.h

Log Message:
After discussions with Jilles Tjoelker (FreeBSD shell) and
following a suggestion from him, the way the fix to PR bin/50993
was implemented has changed a little.   There are three steps involved
in processing a here document, reading it, parsing it, and then
evaluating it before applying it to the correct file descriptor for
the command to use.  The third of those is not related to this
problem, and has not changed.  The bug was caused by combining the
first two steps into one (and not doing it correctly - which would be
hard that way.)  The fix is to split the first two stages into
separate events.   The original fix moved the 2nd stage (parsing)
to just immediately before the 3rd stage (evaluation.)  Jilles
pointed out some unwanted side effects from doing it that way, and
suggested moving the 2nd stage to immediately after the first.
This commit makes that change.  The effect is to revert the changes
to expand.c and parser.h (which are no longer needed) and simplify
slightly the change to parser.c. (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/bin/sh/parser.c
cvs rdiff -u -r1.20 -r1.21 src/bin/sh/parser.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.114 src/bin/sh/parser.c:1.115
--- src/bin/sh/parser.c:1.114	Thu Mar 31 12:12:52 2016
+++ src/bin/sh/parser.c	Thu Mar 31 19:11:05 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.114 2016/03/31 16:12:52 christos Exp $	*/
+/*	$NetBSD: parser.c,v 1.115 2016/03/31 23:11:05 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.114 2016/03/31 16:12:52 christos Exp $");
+__RCSID("$NetBSD: parser.c,v 1.115 2016/03/31 23:11:05 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -109,7 +109,7 @@ STATIC union node *command(void);
 STATIC union node *simplecmd(union node **, union node *);
 STATIC union node *makename(void);
 STATIC void parsefname(void);
-STATIC void slurp_heredoc(char *const, int, int);
+STATIC void slurp_heredoc(char *const, const int, const int);
 STATIC void readheredocs(void);
 STATIC int peektoken(void);
 STATIC int readtoken(void);
@@ -759,7 +759,7 @@ checkend(int c, char * const eofmark, co
  */
 
 STATIC void
-slurp_heredoc(char *const eofmark, int striptabs, int sq)
+slurp_heredoc(char *const eofmark, const int striptabs, const int sq)
 {
 	int c;
 	char *out;
@@ -852,26 +852,19 @@ readheredocs(void)
 		n->narg.text = wordtext;
 		n->narg.backquote = backquotelist;
 		here->here->nhere.doc = n;
-	}
-}
-
-void
-parse_heredoc(union node *n)
-{
-	if (n->narg.type != NARG)
-		abort();
-
-	if (n->narg.text[0] == '\0')		/* nothing to do */
-		return;
-
-	setinputstring(n->narg.text, 1);
-
-	readtoken1(pgetc(), DQSYNTAX, 1);
 
-	n->narg.text = wordtext;
-	n->narg.backquote = backquotelist;
+		if (here->here->nhere.type == NHERE)
+			continue;
 
-	popfile();
+		/*
+		 * Now "parse" here docs that have unquoted eofmarkers.
+		 */
+		setinputstring(wordtext, 1);
+		readtoken1(pgetc(), DQSYNTAX, 1);
+		n->narg.text = wordtext;
+		n->narg.backquote = backquotelist;
+		popfile();
+	}
 }
 
 STATIC int

Index: src/bin/sh/parser.h
diff -u src/bin/sh/parser.h:1.20 src/bin/sh/parser.h:1.21
--- src/bin/sh/parser.h:1.20	Sun Mar 27 10:39:33 2016
+++ src/bin/sh/parser.h	Thu Mar 31 19:11:05 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.h,v 1.20 2016/03/27 14:39:33 christos Exp $	*/
+/*	$NetBSD: parser.h,v 1.21 2016/03/31 23:11:05 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -81,6 +81,5 @@ extern int whichprompt;		/* 1 == PS1, 2 
 
 union node *parsecmd(int);
 void fixredir(union node *, const char *, int);
-void parse_heredoc(union node *);
 int goodname(char *);
 const char *getprompt(void *);



CVS commit: src/external/bsd/ntp/include

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 22:49:15 UTC 2016

Modified Files:
src/external/bsd/ntp/include: config.h

Log Message:
bump stack a little


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/ntp/include/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/ntp/include

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 22:49:15 UTC 2016

Modified Files:
src/external/bsd/ntp/include: config.h

Log Message:
bump stack a little


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/bsd/ntp/include/config.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/ntp/include/config.h
diff -u src/external/bsd/ntp/include/config.h:1.14 src/external/bsd/ntp/include/config.h:1.15
--- src/external/bsd/ntp/include/config.h:1.14	Fri Jan  8 16:36:52 2016
+++ src/external/bsd/ntp/include/config.h	Thu Mar 31 18:49:14 2016
@@ -289,7 +289,7 @@
 #define DFLT_RLIMIT_MEMLOCK 32
 
 /* Default number of 4k pages for RLIMIT_STACK */
-#define DFLT_RLIMIT_STACK 50
+#define DFLT_RLIMIT_STACK 64
 
 /* Directory separator character, usually / or \\ */
 #define DIR_SEP '/'



CVS commit: src/usr.sbin/makemandb

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 20:17:58 UTC 2016

Modified Files:
src/usr.sbin/makemandb: makemandb.c

Log Message:
PR/51034: Abhinav Upadhyay: makemandb(8): Close database connection when
failed to commit


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/makemandb/makemandb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makemandb/makemandb.c
diff -u src/usr.sbin/makemandb/makemandb.c:1.32 src/usr.sbin/makemandb/makemandb.c:1.33
--- src/usr.sbin/makemandb/makemandb.c:1.32	Thu Mar 24 13:28:03 2016
+++ src/usr.sbin/makemandb/makemandb.c	Thu Mar 31 16:17:58 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: makemandb.c,v 1.32 2016/03/24 17:28:03 christos Exp $	*/
+/*	$NetBSD: makemandb.c,v 1.33 2016/03/31 20:17:58 christos Exp $	*/
 /*
  * Copyright (c) 2011 Abhinav Upadhyay 
  * Copyright (c) 2011 Kristaps Dzonsons 
@@ -17,7 +17,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: makemandb.c,v 1.32 2016/03/24 17:28:03 christos Exp $");
+__RCSID("$NetBSD: makemandb.c,v 1.33 2016/03/31 20:17:58 christos Exp $");
 
 #include 
 #include 
@@ -480,6 +480,7 @@ main(int argc, char *argv[])
 	if (errmsg != NULL) {
 		warnx("%s", errmsg);
 		free(errmsg);
+		close_db(db);
 		exit(EXIT_FAILURE);
 	}
 



CVS commit: src/usr.sbin/makemandb

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 20:17:58 UTC 2016

Modified Files:
src/usr.sbin/makemandb: makemandb.c

Log Message:
PR/51034: Abhinav Upadhyay: makemandb(8): Close database connection when
failed to commit


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/makemandb/makemandb.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/makemandb

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 20:16:58 UTC 2016

Modified Files:
src/usr.sbin/makemandb: apropos-utils.c

Log Message:
PR/51025: Abhinav Upadhyay: Remove unused includes from apropos-utils.c


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/makemandb/apropos-utils.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/makemandb

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 20:16:58 UTC 2016

Modified Files:
src/usr.sbin/makemandb: apropos-utils.c

Log Message:
PR/51025: Abhinav Upadhyay: Remove unused includes from apropos-utils.c


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/usr.sbin/makemandb/apropos-utils.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makemandb/apropos-utils.c
diff -u src/usr.sbin/makemandb/apropos-utils.c:1.21 src/usr.sbin/makemandb/apropos-utils.c:1.22
--- src/usr.sbin/makemandb/apropos-utils.c:1.21	Thu Mar 24 12:07:13 2016
+++ src/usr.sbin/makemandb/apropos-utils.c	Thu Mar 31 16:16:58 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: apropos-utils.c,v 1.21 2016/03/24 16:07:13 christos Exp $	*/
+/*	$NetBSD: apropos-utils.c,v 1.22 2016/03/31 20:16:58 christos Exp $	*/
 /*-
  * Copyright (c) 2011 Abhinav Upadhyay 
  * All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: apropos-utils.c,v 1.21 2016/03/24 16:07:13 christos Exp $");
+__RCSID("$NetBSD: apropos-utils.c,v 1.22 2016/03/31 20:16:58 christos Exp $");
 
 #include 
 #include 
@@ -50,8 +50,6 @@ __RCSID("$NetBSD: apropos-utils.c,v 1.21
 
 #include "apropos-utils.h"
 #include "manconf.h"
-#include "dist/mandoc.h"
-#include "sqlite3.h"
 
 typedef struct orig_callback_data {
 	void *data;



CVS commit: src/usr.sbin/makemandb

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 20:15:49 UTC 2016

Modified Files:
src/usr.sbin/makemandb: stopwords.txt

Log Message:
update with the final list


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/makemandb/stopwords.txt

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makemandb/stopwords.txt
diff -u src/usr.sbin/makemandb/stopwords.txt:1.2 src/usr.sbin/makemandb/stopwords.txt:1.3
--- src/usr.sbin/makemandb/stopwords.txt:1.2	Thu Mar 31 16:14:36 2016
+++ src/usr.sbin/makemandb/stopwords.txt	Thu Mar 31 16:15:49 2016
@@ -8,6 +8,7 @@
 7
 8
 9
+a's
 able
 about
 above
@@ -33,6 +34,7 @@ always
 am
 among
 amongst
+an
 and
 another
 any
@@ -50,16 +52,18 @@ appropriate
 are
 aren't
 around
-a's
+as
 aside
 ask
 asking
 associated
+at
 available
 away
 awfully
 b
 back
+be
 became
 because
 become
@@ -83,11 +87,13 @@ brief
 but
 by
 bye
+c'mon
+c's
 came
 can
+can't
 cannot
 cant
-can't
 case
 cause
 causes
@@ -95,7 +101,6 @@ certain
 certainly
 changes
 clearly
-c'mon
 come
 comes
 concerning
@@ -110,8 +115,8 @@ corresponding
 could
 couldn't
 course
-c's
 currently
+d
 definitely
 described
 despite
@@ -122,8 +127,8 @@ do
 does
 doesn't
 doing
-done
 don't
+done
 down
 downwards
 during
@@ -135,6 +140,7 @@ eight
 either
 else
 elsewhere
+end
 enough
 entirely
 especially
@@ -165,6 +171,7 @@ former
 formerly
 forth
 four
+from
 full
 further
 furthermore
@@ -195,19 +202,19 @@ have
 haven't
 having
 he
+he's
 hello
 help
 hence
 her
 here
+here's
 hereafter
 hereby
 herein
-here's
 hereupon
 hers
 herself
-he's
 hi
 high
 him
@@ -220,11 +227,12 @@ howbeit
 however
 i
 i'd
+i'll
+i'm
+i've
 ie
 if
 ignored
-i'll
-i'm
 immediate
 important
 in
@@ -245,10 +253,9 @@ isn't
 it
 it'd
 it'll
-its
 it's
+its
 itself
-i've
 j
 just
 k
@@ -263,6 +270,7 @@ knows
 l
 large
 larger
+last
 lately
 later
 latest
@@ -287,6 +295,7 @@ mainly
 many
 may
 maybe
+me
 mean
 meanwhile
 merely
@@ -444,6 +453,7 @@ sub
 such
 sure
 t
+t's
 take
 taken
 tell
@@ -454,8 +464,8 @@ thank
 thanks
 thanx
 that
-thats
 that's
+thats
 the
 their
 theirs
@@ -464,12 +474,12 @@ themselves
 then
 thence
 there
+there's
 thereafter
 thereby
 therefore
 therein
 theres
-there's
 thereupon
 these
 they
@@ -502,7 +512,6 @@ tries
 truly
 try
 trying
-t's
 turn
 twice
 two
@@ -530,6 +539,7 @@ very
 via
 viz
 vs
+w
 want
 wanted
 wants
@@ -537,35 +547,37 @@ was
 wasn't
 way
 ways
+we
 we'd
+we'll
+we're
+we've
 welcome
 well
-we'll
 went
 were
-we're
 weren't
-we've
-whatever
+what
 what's
+whatever
 when
 whence
 whenever
 where
+where's
 whereafter
 whereas
 whereby
 wherein
-where's
 whereupon
 wherever
 whether
 while
 whither
+who's
 whoever
 whole
 whom
-who's
 whose
 why
 will
@@ -574,8 +586,8 @@ wish
 with
 within
 without
-wonder
 won't
+wonder
 work
 would
 wouldn't
@@ -586,10 +598,10 @@ yet
 you
 you'd
 you'll
-your
 you're
+you've
+your
 yours
 yourself
 yourselves
-you've
 z



CVS commit: src/usr.sbin/makemandb

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 20:15:49 UTC 2016

Modified Files:
src/usr.sbin/makemandb: stopwords.txt

Log Message:
update with the final list


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/makemandb/stopwords.txt

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/makemandb

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 20:14:36 UTC 2016

Modified Files:
src/usr.sbin/makemandb: stopwords.txt

Log Message:
PR/51018: Abhinav Upadhyay: Update stopwords list for apropos(1)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/makemandb/stopwords.txt

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makemandb/stopwords.txt
diff -u src/usr.sbin/makemandb/stopwords.txt:1.1 src/usr.sbin/makemandb/stopwords.txt:1.2
--- src/usr.sbin/makemandb/stopwords.txt:1.1	Tue Feb  7 14:13:32 2012
+++ src/usr.sbin/makemandb/stopwords.txt	Thu Mar 31 16:14:36 2016
@@ -8,154 +8,383 @@
 7
 8
 9
+able
 about
+above
+according
+accordingly
+across
+actually
+after
+afterwards
 again
+against
+ain't
 all
+allow
+allows
+almost
+alone
+along
+already
 also
+although
 always
-an
+am
+among
+amongst
 and
 another
 any
+anybody
+anyhow
+anyone
+anything
+anyway
+anyways
+anywhere
+apart
+appear
+appreciate
+appropriate
 are
+aren't
 around
-as
+a's
+aside
 ask
-at
+asking
+associated
+available
+away
+awfully
 b
 back
-be
+became
 because
+become
+becomes
+becoming
 been
 before
+beforehand
+behind
+being
+believe
 below
+beside
+besides
+best
+better
 between
+beyond
+both
+brief
 but
 by
 bye
+came
 can
+cannot
+cant
+can't
 case
+cause
+causes
+certain
+certainly
+changes
+clearly
+c'mon
+come
+comes
+concerning
+consequently
+consider
+considering
 consist
+contain
+containing
+contains
+corresponding
 could
-d
+couldn't
+course
+c's
+currently
+definitely
+described
+despite
 did
+didn't
+different
+do
 does
+doesn't
+doing
+done
+don't
 down
+downwards
+during
 e
 each
 early
+edu
+eight
 either
-end
+else
+elsewhere
 enough
+entirely
+especially
+etc
 even
+ever
 every
+everybody
+everyone
+everything
+everywhere
+exactly
+example
+except
 f
 fact
 far
 few
+fifth
+first
+five
 follow
+followed
+following
+follows
+for
+former
+formerly
+forth
 four
-from
 full
 further
+furthermore
 g
 general
 get
+getting
 give
 given
+gives
+go
+goes
+going
+gone
 good
 got
+gotten
 great
+greetings
 h
 had
+hadn't
+happens
+hardly
 has
+hasn't
 have
+haven't
 having
+he
+hello
+help
+hence
+her
 here
+hereafter
+hereby
+herein
+here's
+hereupon
+hers
+herself
+he's
+hi
 high
 him
+himself
 his
+hither
+hopefully
 how
+howbeit
 however
 i
+i'd
+ie
 if
+ignored
+i'll
+i'm
+immediate
 important
 in
+inasmuch
+inc
+indeed
+indicate
+indicated
+indicates
+inner
+insofar
+instead
 interest
 into
+inward
 is
+isn't
 it
+it'd
+it'll
+its
+it's
+itself
+i've
 j
 just
 k
 keep
 keeps
+kept
 kind
 knew
 know
+known
+knows
 l
 large
 larger
-last
+lately
 later
 latest
 latter
+latterly
 least
+lest
 let
+let's
 like
+liked
 likely
+little
 long
 longer
+looking
+looks
+ltd
 m
 made
+mainly
 many
 may
-me
+maybe
+mean
+meanwhile
+merely
 might
+moreover
 most
 mostly
 much
 must
 my
+myself
 n
+name
+namely
 names
+nd
+near
+nearly
 necessary
 need
 needs
+neither
 never
+nevertheless
 new
 next
+nine
 no
+nobody
 non
+none
 noone
+nor
+normally
 not
 nothing
+novel
+now
+nowhere
 o
+obviously
 of
 off
 often
+oh
+ok
+okay
 old
 older
 on
 once
+one
+ones
 only
+onto
 or
 order
+other
+others
+otherwise
+ought
 our
+ours
+ourselves
 out
+outside
 over
+overall
+own
 p
 part
+particular
+particularly
 per
 perhaps
+placed
+please
+plus
 possible
 present
+presumably
+probably
 problem
+provides
 q
+que
 quite
+qv
 r
 rather
+rd
 really
+reasonably
+regarding
+regardless
+regards
+relatively
+respectively
 right
 room
 s
@@ -163,89 +392,204 @@ said
 same
 saw
 say
+saying
 says
 second
+secondly
 see
+seeing
 seem
 seemed
+seeming
 seems
+seen
 sees
+self
+selves
+sensible
+sent
+serious
+seriously
+seven
 several
 shall
+she
 should
+shouldn't
 side
 sides
+since
+six
 small
 smaller
 so
 some
+somebody
+somehow
+someone
 something
+sometime
+sometimes
+somewhat
+somewhere
+soon
+sorry
+specified
+specify
+specifying
 state
 states
 still
+sub
 such
 sure
 t
 take
 taken
+tell
+tends
+th
+than
+thank
+thanks
+thanx
 that
+thats
+that's
 the
 their
+theirs
 them
+themselves
 then
+thence
 there
+thereafter
+thereby
 therefore
+therein
+theres
+there's
+thereupon
 these
+they
+they'd
+they'll
+they're
+they've
 thing
 think
 thinks
+third
 this
+thorough
+thoroughly
 those
 though
 three
+through
+throughout
+thru
 thus
 to
 together
 too
 took
 toward
+towards
+tried
+tries
+truly
+try
+trying
+t's
 turn
+twice
 two
 u
+un
+under
+unfortunately
+unless
+unlikely
 until
+unto
 up
 upon
 us
 use
 used
+useful
 uses
+using
+usually
 v
+value
+various
 very
-w
+via
+viz
+vs
 want
 wanted
 wants
 was
+wasn't
 way
 ways
-we
+we'd
+welcome
 well
+we'll
 went
 were
-what
+we're
+weren't
+we've
+whatever
+what's
 when
+whence
+whenever
+where
+whereafter
+whereas
+whereby
+wherein
+where's
+whereupon
+wherever
 whether
+while
+whither
+whoever
+whole
+whom
+who's
+whose
 why
 will
 

CVS commit: src/usr.sbin/makemandb

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 20:14:36 UTC 2016

Modified Files:
src/usr.sbin/makemandb: stopwords.txt

Log Message:
PR/51018: Abhinav Upadhyay: Update stopwords list for apropos(1)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.sbin/makemandb/stopwords.txt

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/makemandb

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 20:13:37 UTC 2016

Modified Files:
src/usr.sbin/makemandb: apropos.c

Log Message:
PR/51007: Abhinav Upadhyay: apropos.c: Remove unused includes


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/makemandb/apropos.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/makemandb/apropos.c
diff -u src/usr.sbin/makemandb/apropos.c:1.17 src/usr.sbin/makemandb/apropos.c:1.18
--- src/usr.sbin/makemandb/apropos.c:1.17	Sun Dec 20 14:45:29 2015
+++ src/usr.sbin/makemandb/apropos.c	Thu Mar 31 16:13:37 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: apropos.c,v 1.17 2015/12/20 19:45:29 christos Exp $	*/
+/*	$NetBSD: apropos.c,v 1.18 2016/03/31 20:13:37 christos Exp $	*/
 /*-
  * Copyright (c) 2011 Abhinav Upadhyay 
  * All rights reserved.
@@ -31,10 +31,9 @@
  */
 
 #include 
-__RCSID("$NetBSD: apropos.c,v 1.17 2015/12/20 19:45:29 christos Exp $");
+__RCSID("$NetBSD: apropos.c,v 1.18 2016/03/31 20:13:37 christos Exp $");
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -42,7 +41,6 @@ __RCSID("$NetBSD: apropos.c,v 1.17 2015/
 #include 
 
 #include "apropos-utils.h"
-#include "sqlite3.h"
 
 typedef struct apropos_flags {
 	int sec_nums[SECMAX];



CVS commit: src/usr.sbin/makemandb

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 20:13:37 UTC 2016

Modified Files:
src/usr.sbin/makemandb: apropos.c

Log Message:
PR/51007: Abhinav Upadhyay: apropos.c: Remove unused includes


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/makemandb/apropos.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:12:09 UTC 2016

Modified Files:
src/bin/sh: parser.c

Log Message:
This is an internally visible change - no effect visible to the
user is expected. With the previous commits to parser.c, we no
longer need to handle reading here documents in the (massive)
readtoken1() function. That allows its code to be simplified and
made easier to read and understand (several goto's goto goto heaven.
RIP) (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/bin/sh/parser.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:28:23 UTC 2016

Modified Files:
src/bin/sh: version.h

Log Message:
replace with standard copyright :-)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/bin/sh/version.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/version.h
diff -u src/bin/sh/version.h:1.1 src/bin/sh/version.h:1.2
--- src/bin/sh/version.h:1.1	Thu Mar 31 12:16:35 2016
+++ src/bin/sh/version.h	Thu Mar 31 12:28:23 2016
@@ -1,32 +1,29 @@
-/*	$NetBSD: version.h,v 1.1 2016/03/31 16:16:35 christos Exp $	*/
+/*	$NetBSD: version.h,v 1.2 2016/03/31 16:28:23 christos Exp $	*/
 
 /*-
- * Copyright (c) 2016
- *  The NetBSD Foundation.  Rights and Wrongs all Irrelevant.
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
  *
- * Redistribution and use in source and binary forms, with and without
- * modification, are required provided that the following conditions
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
  * are met:
- * 1. Redistributions of source code must remove the above copyright
+ * 1. Redistributions of source code must retain the above copyright
  *notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must not reproduce the above copyright
+ * 2. Redistributions in binary form must reproduce the above copyright
  *notice, this list of conditions and the following disclaimer in the
- *small print and/or other shit provided with the distribution.
+ *documentation and/or other materials provided with the distribution.
  *
- * THIS SOFTWARE IS PROVIDED BY THE FOUNDATION AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * Should these conditions be unacceptable, go soak your big toe in a
- * bowl of lemon juice, then suck on it.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
  */
 
 /*
@@ -37,4 +34,3 @@
  * updated just because a new NetBSD release is to include this code.
  */
 #define	NETBSD_SHELL	"20160401"
-



CVS commit: src/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:28:23 UTC 2016

Modified Files:
src/bin/sh: version.h

Log Message:
replace with standard copyright :-)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/bin/sh/version.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:22:28 UTC 2016

Modified Files:
src/tests/bin/sh: t_set_e.sh

Log Message:
When embedding a command in a subshell "( ... )" avoid accidentally
producing (( (when the cmd starts with a '(' as that as a reserved
sequence (according to posix) and some shells do treat it specially.
So, force a space after the enclosing '(' to avoid the problem.
For symmetry, put a space before the concluding ')' as well, though
there is nothing special about )). (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/bin/sh/t_set_e.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/bin/sh/t_set_e.sh
diff -u src/tests/bin/sh/t_set_e.sh:1.3 src/tests/bin/sh/t_set_e.sh:1.4
--- src/tests/bin/sh/t_set_e.sh:1.3	Sun Mar 27 10:50:01 2016
+++ src/tests/bin/sh/t_set_e.sh	Thu Mar 31 12:22:27 2016
@@ -1,4 +1,4 @@
-# $NetBSD: t_set_e.sh,v 1.3 2016/03/27 14:50:01 christos Exp $
+# $NetBSD: t_set_e.sh,v 1.4 2016/03/31 16:22:27 christos Exp $
 #
 # Copyright (c) 2007 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -63,7 +63,7 @@ dcheck()
 # is thus important to test. (PR bin/29861)
 echeck()
 {
-	check1 'eval '"'($1)'" "$2" "eval '($1)'"
+	check1 'eval '"'( $1 )'" "$2" "eval '($1)'"
 }
 
 atf_test_case all



CVS commit: src/tests/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:22:54 UTC 2016

Modified Files:
src/tests/bin/sh: t_wait.sh

Log Message:
Avoid leaving turds in /tmp. (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/bin/sh/t_wait.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:22:54 UTC 2016

Modified Files:
src/tests/bin/sh: t_wait.sh

Log Message:
Avoid leaving turds in /tmp. (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/bin/sh/t_wait.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/bin/sh/t_wait.sh
diff -u src/tests/bin/sh/t_wait.sh:1.7 src/tests/bin/sh/t_wait.sh:1.8
--- src/tests/bin/sh/t_wait.sh:1.7	Sun Mar 27 10:50:40 2016
+++ src/tests/bin/sh/t_wait.sh	Thu Mar 31 12:22:54 2016
@@ -1,4 +1,4 @@
-# $NetBSD: t_wait.sh,v 1.7 2016/03/27 14:50:40 christos Exp $
+# $NetBSD: t_wait.sh,v 1.8 2016/03/31 16:22:54 christos Exp $
 #
 # Copyright (c) 2008, 2009, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -147,7 +147,7 @@ kill_body() {
 	atf_require_prog kill
 
 	s=killhelper.sh
-	z=/tmp/killhelper.$$ 
+	z=killhelper.$$ 
 	pid=
 
 	# waiting for a specific process that is not a child



CVS commit: src/tests/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:22:28 UTC 2016

Modified Files:
src/tests/bin/sh: t_set_e.sh

Log Message:
When embedding a command in a subshell "( ... )" avoid accidentally
producing (( (when the cmd starts with a '(' as that as a reserved
sequence (according to posix) and some shells do treat it specially.
So, force a space after the enclosing '(' to avoid the problem.
For symmetry, put a space before the concluding ')' as well, though
there is nothing special about )). (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/bin/sh/t_set_e.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:21:52 UTC 2016

Modified Files:
src/tests/bin/sh: t_here.sh

Log Message:
Added lots more end delimiter tests (some weird cases...). Also
use printf %s instead of echo, as there are embedded \ chars in
some of the strings, and some other (nameless) shells insist on
treating \ in the args to echo as something special... (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/bin/sh/t_here.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/bin/sh/t_here.sh
diff -u src/tests/bin/sh/t_here.sh:1.5 src/tests/bin/sh/t_here.sh:1.6
--- src/tests/bin/sh/t_here.sh:1.5	Sun Mar 27 10:52:40 2016
+++ src/tests/bin/sh/t_here.sh	Thu Mar 31 12:21:52 2016
@@ -1,4 +1,4 @@
-# $NetBSD: t_here.sh,v 1.5 2016/03/27 14:52:40 christos Exp $
+# $NetBSD: t_here.sh,v 1.6 2016/03/31 16:21:52 christos Exp $
 #
 # Copyright (c) 2007 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -88,6 +88,11 @@ check()
 		fail=true
 	fi
 
+	if $fail
+	then
+		echo >&2 "[$TEST_NUM] Full command: <<${CMD}>>"
+	fi
+
 	$fail && test -n "$TEST_ID" && {
 		TEST_FAILURES="${TEST_FAILURES}${TEST_FAILURES:+
 }${TEST_ID}[$TEST_NUM]: test of '$1' failed";
@@ -171,55 +176,56 @@ end_markers_head() {
 end_markers_body() {
 
 	reset 'end_markers'
-	for end in EOF 1 \! '$$$' "string " a\\\  '&' '' ' ' '  ' --STRING-- . '~~~' \
+	for end in EOF 1 \! '$$$' "string " a\\\ a\\\ \   '&' '' ' ' '  ' \
+	--STRING-- . '~~~' ')' '(' '#' '()' '(\)' '(\/)' '--' '\' '{' '}' \
 VERYVERYVERYVERYLONGLONGLONGin_fact_absurdly_LONG_LONG_HERE_DOCUMENT_TERMINATING_MARKER_THAT_goes_On_forever_and_ever_and_ever...
 	do
 		# check unquoted end markers
 		case "${end}" in
-		('' | *[' $

CVS commit: src/tests/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:21:52 UTC 2016

Modified Files:
src/tests/bin/sh: t_here.sh

Log Message:
Added lots more end delimiter tests (some weird cases...). Also
use printf %s instead of echo, as there are embedded \ chars in
some of the strings, and some other (nameless) shells insist on
treating \ in the args to echo as something special... (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/bin/sh/t_here.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:20:40 UTC 2016

Modified Files:
src/tests/bin/sh: t_cmdsub.sh

Log Message:
Added tests collected by Sven Mascheck
http://www.in-ulm.de/~mascheck/various/cmd-subst/
which test cases of ')' being embedded in command substitutions.
(from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/bin/sh/t_cmdsub.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/bin/sh/t_cmdsub.sh
diff -u src/tests/bin/sh/t_cmdsub.sh:1.2 src/tests/bin/sh/t_cmdsub.sh:1.3
--- src/tests/bin/sh/t_cmdsub.sh:1.2	Sun Mar 27 10:53:17 2016
+++ src/tests/bin/sh/t_cmdsub.sh	Thu Mar 31 12:20:39 2016
@@ -1,4 +1,4 @@
-# $NetBSD: t_cmdsub.sh,v 1.2 2016/03/27 14:53:17 christos Exp $
+# $NetBSD: t_cmdsub.sh,v 1.3 2016/03/31 16:20:39 christos Exp $
 #
 # Copyright (c) 2016 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -519,6 +519,116 @@ u_nested_backticks_in_heredoc_body() {
 		EOF'
 }
 
+atf_test_case v_cmdsub_paren_tests
+v_cmdsub__paren_tests_head() {
+	atf_set "descr" "tests with cmdsubs containing embedded ')'"
+}
+v_cmdsub_paren_tests_body() {
+
+	# Tests from:
+	#	http://www.in-ulm.de/~mascheck/various/cmd-subst/
+	# (slightly modified.)
+
+	atf_check -s exit:0 -o inline:'A.1\n' -e empty ${TEST_SH} -c \
+		'echo $(
+			case x in  x) echo A.1;; esac
+		)'
+
+	atf_check -s exit:0 -o inline:'A.2\n' -e empty ${TEST_SH} -c \
+		'echo $(
+			case x in  x) echo A.2;; esac # comment
+		)'
+
+	atf_check -s exit:0 -o inline:'A.3\n' -e empty ${TEST_SH} -c \
+		'echo $(
+			case x in (x) echo A.3;; esac
+		)'
+
+	atf_check -s exit:0 -o inline:'A.4\n' -e empty ${TEST_SH} -c \
+		'echo $(
+			case x in (x) echo A.4;; esac # comment
+		)'
+
+	atf_check -s exit:0 -o inline:'A.5\n' -e empty ${TEST_SH} -c \
+		'echo $(
+			case x in (x) echo A.5
+			esac
+		)'
+
+	atf_check -s exit:0 -o inline:'B: quoted )\n' -e empty ${TEST_SH} -c \
+		'echo $(
+			echo '\''B: quoted )'\''
+		)'
+
+	atf_check -s exit:0 -o inline:'C: comment then closing paren\n' \
+		-e empty ${TEST_SH} -c \
+			'echo $(
+echo C: comment then closing paren # )
+			)'
+
+	atf_check -s exit:0 -o inline:'D.1: here-doc with )\n' \
+		-e empty ${TEST_SH} -c \
+			'echo $(
+cat <<-\eof
+D.1: here-doc with )
+eof
+			)'
+
+	# D.2 is a bogus test.
+
+	atf_check -s exit:0 -o inline:'D.3: here-doc with \()\n' \
+		-e empty ${TEST_SH} -c \
+			'echo $(
+cat <<-\eof
+D.3: here-doc with \()
+eof
+			)'
+
+	atf_check -s exit:0 -e empty \
+	  -o inline:'E: here-doc terminated with a parenthesis ("academic")\n' \
+		${TEST_SH} -c \
+		'echo $(
+			cat <<-\)
+			E: here-doc terminated with a parenthesis ("academic")
+			)
+		)'
+
+	atf_check -s exit:0 -e empty \
+-o inline:'F.1: here-doc embed with unbal single, back- or doublequote '\''\n' \
+		${TEST_SH} -c \
+		'echo $(
+			cat <<-"eof"
+		F.1: here-doc embed with unbal single, back- or doublequote '\''
+			eof
+		)'
+	atf_check -s exit:0 -e empty \
+ -o inline:'F.2: here-doc embed with unbal single, back- or doublequote "\n' \
+		${TEST_SH} -c \
+		'echo $(
+			cat <<-"eof"
+		F.2: here-doc embed with unbal single, back- or doublequote "
+			eof
+		)'
+	atf_check -s exit:0 -e empty \
+ -o inline:'F.3: here-doc embed with unbal single, back- or doublequote `\n' \
+		${TEST_SH} -c \
+		'echo $(
+			cat <<-"eof"
+		F.3: here-doc embed with unbal single, back- or doublequote `
+			eof
+		)'
+
+	atf_check -s exit:0 -e empty -o inline:'G: backslash at end of line\n' \
+		${TEST_SH} -c \
+			'echo $(
+echo G: backslash at end of line # \
+			)'
+
+	atf_check -s exit:0 -e empty \
+		-o inline:'H: empty command-substitution\n' \
+		${TEST_SH} -c 'echo H: empty command-substitution $( )'
+}
+
 atf_test_case z_absurd_heredoc_cmdsub_combos
 z_absurd_heredoc_cmdsub_combos_head() {
 	atf_set "descr" "perverse and unusual cmd substitutions & more"
@@ -590,5 +700,6 @@ atf_init_test_cases() {
 	atf_add_test_case s_heredoc_in_backticks
 	atf_add_test_case t_nested_cmdsubs_in_heredoc
 	atf_add_test_case u_nested_backticks_in_heredoc
+	atf_add_test_case v_cmdsub_paren_tests
 	atf_add_test_case z_absurd_heredoc_cmdsub_combos
 }



CVS commit: src/tests/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:21:10 UTC 2016

Modified Files:
src/tests/bin/sh: t_expand.sh

Log Message:
PR bin/51027 - tests for shell positional parameters, including
testing that $10 is correctly parsed as ${1}0 and not as ${10}.
More than that though. (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/bin/sh/t_expand.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/bin/sh/t_expand.sh
diff -u src/tests/bin/sh/t_expand.sh:1.6 src/tests/bin/sh/t_expand.sh:1.7
--- src/tests/bin/sh/t_expand.sh:1.6	Tue Mar  8 09:26:54 2016
+++ src/tests/bin/sh/t_expand.sh	Thu Mar 31 12:21:10 2016
@@ -1,4 +1,4 @@
-# $NetBSD: t_expand.sh,v 1.6 2016/03/08 14:26:54 christos Exp $
+# $NetBSD: t_expand.sh,v 1.7 2016/03/31 16:21:10 christos Exp $
 #
 # Copyright (c) 2007, 2009 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -227,6 +227,145 @@ iteration_on_null_or_missing_parameter_b
 		'N=; set -- ${N:-}; for X; do echo "[$X]"; done'
 }
 
+nl='
+'
+reset()
+{
+	TEST_NUM=0
+	TEST_FAILURES=''
+	TEST_FAIL_COUNT=0
+	TEST_ID="$1"
+}
+
+check()
+{
+	fail=false
+	TEMP_FILE=$( mktemp OUT.XX )
+	TEST_NUM=$(( $TEST_NUM + 1 ))
+	MSG=
+
+	# our local shell (ATF_SHELL) better do quoting correctly...
+	# some of the tests expect us to expand $nl internally...
+	CMD="$1"
+
+	result="$( ${TEST_SH} -c "${CMD}" 2>"${TEMP_FILE}" )"
+	STATUS=$?
+
+	if [ "${STATUS}" -ne "$3" ]; then
+		MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
+		MSG="${MSG} expected exit code $3, got ${STATUS}"
+
+		# don't actually fail just because of wrong exit code
+		# unless we either expected, or received "good"
+		case "$3/${STATUS}" in
+		(*/0|0/*) fail=true;;
+		esac
+	fi
+
+	if [ "$3" -eq 0 ]; then
+		if [ -s "${TEMP_FILE}" ]; then
+			MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
+			MSG="${MSG} Messages produced on stderr unexpected..."
+			MSG="${MSG}${nl}$( cat "${TEMP_FILE}" )"
+			fail=true
+		fi
+	else
+		if ! [ -s "${TEMP_FILE}" ]; then
+			MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
+			MSG="${MSG} Expected messages on stderr,"
+			MSG="${MSG} nothing produced"
+			fail=true
+		fi
+	fi
+	rm -f "${TEMP_FILE}"
+
+	# Remove newlines (use local shell for this)
+	oifs="$IFS"
+	IFS="$nl"
+	result="$(echo $result)"
+	IFS="$oifs"
+	if [ "$2" != "$result" ]
+	then
+		MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
+		MSG="${MSG} Expected output '$2', received '$result'"
+		fail=true
+	fi
+
+	if $fail
+	then
+		MSG="${MSG}${MSG:+${nl}}[$TEST_NUM]"
+		MSG="${MSG} Full command: <<${CMD}>>"
+	fi
+
+	$fail && test -n "$TEST_ID" && {
+		TEST_FAILURES="${TEST_FAILURES}${TEST_FAILURES:+${nl}}"
+		TEST_FAILURES="${TEST_FAILURES}${TEST_ID}[$TEST_NUM]:"
+		TEST_FAILURES="${TEST_FAILURES} Test of '$1' failed.";
+		TEST_FAILURES="${TEST_FAILURES}${nl}${MSG}"
+		TEST_FAIL_COUNT=$(( $TEST_FAIL_COUNT + 1 ))
+		return 0
+	}
+	$fail && atf_fail "Test[$TEST_NUM] of '$1' failed${nl}${MSG}"
+	return 0
+}
+
+results()
+{
+	test -z "${TEST_ID}" && return 0
+	test -z "${TEST_FAILURES}" && return 0
+
+	echo >&2 "=="
+	echo >&2 "While testing '${TEST_ID}'"
+	echo >&2 " - - - - - - - - - - - - - - - - -"
+	echo >&2 "${TEST_FAILURES}"
+	atf_fail \
+ "Test ${TEST_ID}: $TEST_FAIL_COUNT subtests (of $TEST_NUM) failed - see stderr"
+}
+
+atf_test_case shell_params
+shell_params_head() {
+	atf_set "descr" "Test correct operation of the numeric parameters"
+}
+shell_params_body() {
+	atf_require_prog mktemp
+
+	reset shell_params
+
+	check 'set -- a b c; echo "$#: $1 $2 $3"' '3: a b c' 0
+	check 'set -- a b c d e f g h i j k l m; echo "$#: ${1}0 ${10} $10"' \
+		'13: a0 j a0' 0
+	check 'x="$0"; set -- a b; y="$0";
+	  [ "x${x}y" = "x${y}y" ] && echo OK || echo x="$x" y="$y"' \
+		'OK' 0
+	check "${TEST_SH} -c 'echo 0=\$0 1=\$1 2=\$2' a b c" '0=a 1=b 2=c' 0
+
+	echo 'echo 0="$0" 1="$1" 2="$2"' > helper.sh
+	check '${TEST_SH} helper.sh a b c' '0=helper.sh 1=a 2=b' 0
+
+	check 'set -- a bb ccc  e ff ggg  \
+		i jj kkk
+	   echo "${#}: ${#1} ${#2} ${#3} ${#4} ... ${#9} ${#10} ${#11}"' \
+		 '11: 1 2 3 4 ... 9 10 11' 0
+
+	check 'set -- a b c; echo "$#: ${1-A} ${2-B} ${3-C} ${4-D} ${5-E}"' \
+		'3: a b c D E' 0
+	check 'set -- a "" c "" e
+	   echo "$#: ${1:-A} ${2:-B} ${3:-C} ${4:-D} ${5:-E}"' \
+		'5: a B c D e' 0
+	check 'set -- a "" c "" e
+	   echo "$#: ${1:+A} ${2:+B} ${3:+C} ${4:+D} ${5:+E}"' \
+		'5: A  C  E' 0
+	check 'set -- "abab*cbb"
+	   echo "${1} ${1#a} ${1%b} ${1##ab} ${1%%b} ${1#*\*} ${1%\**}"' \
+	   'abab*cbb bab*cbb abab*cb ab*cbb abab*cb cbb abab' 0
+	check 'set -- "abab?cbb"
+echo "${1}:${1#*a}+${1%b*}-${1##*a}_${1%%b*}%${1#[ab]}=${1%?*}/${1%\?*}"' \
+	   'abab?cbb:bab?cbb+abab?cb-b?cbb_a%bab?cbb=abab?cb/abab' 0
+	check 'set -- a "" c "" e; echo "${2:=b}"' '' 1
+
+	results
+}
+
 atf_init_test_cases() {
 	

CVS commit: src/tests/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:21:10 UTC 2016

Modified Files:
src/tests/bin/sh: t_expand.sh

Log Message:
PR bin/51027 - tests for shell positional parameters, including
testing that $10 is correctly parsed as ${1}0 and not as ${10}.
More than that though. (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/bin/sh/t_expand.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:20:40 UTC 2016

Modified Files:
src/tests/bin/sh: t_cmdsub.sh

Log Message:
Added tests collected by Sven Mascheck
http://www.in-ulm.de/~mascheck/various/cmd-subst/
which test cases of ')' being embedded in command substitutions.
(from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/bin/sh/t_cmdsub.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:19:52 UTC 2016

Modified Files:
src/tests/bin/sh: t_arith.sh

Log Message:
Don't confuse more capable shells by writing operator combinations
that could be interpreted as something different. That is, for our
shell +4++3 is just (+4)+(+3) and works fine. But others treat ++
as the increment operator.  Same for --. Sprinkle spaces to taste.
(from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/bin/sh/t_arith.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/bin/sh/t_arith.sh
diff -u src/tests/bin/sh/t_arith.sh:1.2 src/tests/bin/sh/t_arith.sh:1.3
--- src/tests/bin/sh/t_arith.sh:1.2	Wed Mar 16 13:39:12 2016
+++ src/tests/bin/sh/t_arith.sh	Thu Mar 31 12:19:52 2016
@@ -1,4 +1,4 @@
-# $NetBSD: t_arith.sh,v 1.2 2016/03/16 17:39:12 christos Exp $
+# $NetBSD: t_arith.sh,v 1.3 2016/03/31 16:19:52 christos Exp $
 #
 # Copyright (c) 2016 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -280,9 +280,9 @@ elementary_add_body()
 	atf_check -s exit:0 -o inline:'\n' -e empty ${TEST_SH} -c \
 		'echo $((++))'
 	atf_check -s exit:0 -o inline:'\n' -e empty ${TEST_SH} -c \
-		'echo $((+++))'
+		'echo $((+ + +))'
 	atf_check -s exit:0 -o inline:'-\n' -e empty ${TEST_SH} -c \
-		'echo -$((+4125++3652))'
+		'echo -$((+4125+ +3652))'
 }
 
 atf_test_case elementary_sub
@@ -311,7 +311,7 @@ elementary_sub_body()
 	atf_check -s exit:0 -o inline:'-7694\n' -e empty ${TEST_SH} -c \
 		'echo $(( -2016-5678 ))'
 	atf_check -s exit:0 -o inline:'--1\n' -e empty ${TEST_SH} -c \
-		'echo -$(( -1018--1017 ))'
+		'echo -$(( -1018 - -1017 ))'
 }
 
 atf_test_case elementary_mul



CVS commit: src/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:12:52 UTC 2016

Modified Files:
src/bin/sh: parser.c

Log Message:
PR bin/51027 - fix the parsing of references to shell parameters
when given without braces (ie: $2 etc).  Only the first 9 shell
parameters ($1 .. $9) and the special parameter ($0) can be
referenced this way, $10 is ${1}0 not ${10}.   Make it so.
This bug brought to notice by Sven Mascheck's web pages which
discuss (among other things) the history of this (and other ash
based) shells .. see http://www.in-ulm.de/~mascheck/ (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/bin/sh/parser.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/tests/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:19:52 UTC 2016

Modified Files:
src/tests/bin/sh: t_arith.sh

Log Message:
Don't confuse more capable shells by writing operator combinations
that could be interpreted as something different. That is, for our
shell +4++3 is just (+4)+(+3) and works fine. But others treat ++
as the increment operator.  Same for --. Sprinkle spaces to taste.
(from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/bin/sh/t_arith.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:12:52 UTC 2016

Modified Files:
src/bin/sh: parser.c

Log Message:
PR bin/51027 - fix the parsing of references to shell parameters
when given without braces (ie: $2 etc).  Only the first 9 shell
parameters ($1 .. $9) and the special parameter ($0) can be
referenced this way, $10 is ${1}0 not ${10}.   Make it so.
This bug brought to notice by Sven Mascheck's web pages which
discuss (among other things) the history of this (and other ash
based) shells .. see http://www.in-ulm.de/~mascheck/ (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/bin/sh/parser.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.113 src/bin/sh/parser.c:1.114
--- src/bin/sh/parser.c:1.113	Thu Mar 31 12:12:09 2016
+++ src/bin/sh/parser.c	Thu Mar 31 12:12:52 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.113 2016/03/31 16:12:09 christos Exp $	*/
+/*	$NetBSD: parser.c,v 1.114 2016/03/31 16:12:52 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.113 2016/03/31 16:12:09 christos Exp $");
+__RCSID("$NetBSD: parser.c,v 1.114 2016/03/31 16:12:52 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1742,7 +1742,7 @@ parsesub: {
 			do {
 USTPUTC(c, out);
 c = pgetc();
-			} while (is_digit(c));
+			} while (subtype != VSNORMAL && is_digit(c));
 		}
 		else if (is_special(c)) {
 			USTPUTC(c, out);



CVS commit: src/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:12:09 UTC 2016

Modified Files:
src/bin/sh: parser.c

Log Message:
This is an internally visible change - no effect visible to the
user is expected. With the previous commits to parser.c, we no
longer need to handle reading here documents in the (massive)
readtoken1() function. That allows its code to be simplified and
made easier to read and understand (several goto's goto goto heaven.
RIP) (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/bin/sh/parser.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.112 src/bin/sh/parser.c:1.113
--- src/bin/sh/parser.c:1.112	Sun Mar 27 10:40:20 2016
+++ src/bin/sh/parser.c	Thu Mar 31 12:12:09 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.112 2016/03/27 14:40:20 christos Exp $	*/
+/*	$NetBSD: parser.c,v 1.113 2016/03/31 16:12:09 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.112 2016/03/27 14:40:20 christos Exp $");
+__RCSID("$NetBSD: parser.c,v 1.113 2016/03/31 16:12:09 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1460,7 +1460,7 @@ parseredir(const char *out,  int c)
 STATIC int
 readtoken1(int firstc, char const *syn, int magicq)
 {
-	int c = firstc;
+	int c;
 	char * out;
 	int len;
 	struct nodelist *bqlist;
@@ -1484,161 +1484,160 @@ readtoken1(int firstc, char const *syn, 
 	parenlevel = 0;
 
 	STARTSTACKSTR(out);
-	loop: {	/* for each line, until end of word */
-		for (;;) {	/* until end of line or end of word */
-			CHECKSTRSPACE(4, out);	/* permit 4 calls to USTPUTC */
-			switch(syntax[c]) {
-			case CNL:	/* '\n' */
-if (syntax == BASESYNTAX)
-	goto endword;	/* exit outer loop */
-USTPUTC(c, out);
+
+	for (c = firstc ;; c = pgetc_macro()) {	/* until of token */
+		CHECKSTRSPACE(4, out);	/* permit 4 calls to USTPUTC */
+		switch (syntax[c]) {
+		case CNL:	/* '\n' */
+			if (syntax == BASESYNTAX)
+break;	/* exit loop */
+			USTPUTC(c, out);
+			plinno++;
+			if (doprompt)
+setprompt(2);
+			else
+setprompt(0);
+			continue;
+
+		case CWORD:
+			USTPUTC(c, out);
+			continue;
+		case CCTL:
+			if (!magicq || ISDBLQUOTE())
+USTPUTC(CTLESC, out);
+			USTPUTC(c, out);
+			continue;
+		case CBACK:	/* backslash */
+			c = pgetc();
+			if (c == PEOF) {
+USTPUTC('\\', out);
+pungetc();
+continue;
+			}
+			if (c == '\n') {
 plinno++;
 if (doprompt)
 	setprompt(2);
 else
 	setprompt(0);
-c = pgetc();
-goto loop;		/* continue outer loop */
-			case CWORD:
-USTPUTC(c, out);
-break;
-			case CCTL:
-if (!magicq || ISDBLQUOTE())
-	USTPUTC(CTLESC, out);
-USTPUTC(c, out);
-break;
-			case CBACK:	/* backslash */
-c = pgetc();
-if (c == PEOF) {
-	USTPUTC('\\', out);
-	pungetc();
-	break;
-}
-if (c == '\n') {
-	plinno++;
-	if (doprompt)
-		setprompt(2);
-	else
-		setprompt(0);
-	break;
-}
-quotef = 1;
-if (ISDBLQUOTE() && c != '\\' &&
-c != '`' && c != '$' &&
-(c != '"' || magicq))
-	USTPUTC('\\', out);
-if (SQSYNTAX[c] == CCTL)
-	USTPUTC(CTLESC, out);
-else if (!magicq) {
-	USTPUTC(CTLQUOTEMARK, out);
-	USTPUTC(c, out);
-	if (varnest != 0)
-		USTPUTC(CTLQUOTEEND, out);
-	break;
-}
+continue;
+			}
+			quotef = 1;	/* current token is quoted */
+			if (ISDBLQUOTE() && c != '\\' && c != '`' &&
+			c != '$' && (c != '"' || magicq))
+USTPUTC('\\', out);
+			if (SQSYNTAX[c] == CCTL)
+USTPUTC(CTLESC, out);
+			else if (!magicq) {
+USTPUTC(CTLQUOTEMARK, out);
 USTPUTC(c, out);
-break;
-			case CSQUOTE:
-if (syntax != SQSYNTAX) {
-	if (!magicq)
-		USTPUTC(CTLQUOTEMARK, out);
-	quotef = 1;
-	TS_PUSH();
-	syntax = SQSYNTAX;
-	quoted = SQ;
-	break;
-}
-if (magicq && arinest == 0 && varnest == 0) {
-	/* Ignore inside quoted here document */
-	USTPUTC(c, out);
-	break;
-}
-/* End of single quotes... */
-TS_POP();
-if (syntax == BASESYNTAX && varnest != 0)
+if (varnest != 0)
 	USTPUTC(CTLQUOTEEND, out);
-break;
-			case CDQUOTE:
-if (magicq && arinest == 0 && varnest == 0) {
-	/* Ignore inside here document */
-	USTPUTC(c, out);
-	break;
-}
+continue;
+			}
+			USTPUTC(c, out);
+			continue;
+		case CSQUOTE:
+			if (syntax != SQSYNTAX) {
+if (!magicq)
+	USTPUTC(CTLQUOTEMARK, out);
 quotef = 1;
-if (arinest) {
-	if (ISDBLQUOTE()) {
-		TS_POP();
-	} else {
-		TS_PUSH();
-		syntax = DQSYNTAX;
-		SETDBLQUOTE();
-		USTPUTC(CTLQUOTEMARK, out);
-	}
-	break;
-}
-if (magicq)
-	break;
+TS_PUSH();
+syntax 

CVS commit: src/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:18:23 UTC 2016

Modified Files:
src/bin/sh: sh.1

Log Message:
Document the NETBSD_SHELL variable, the enhancements to export,
the posix option, and a whole bunch of miscellaneous updates and
corrections. (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/bin/sh/sh.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:18:23 UTC 2016

Modified Files:
src/bin/sh: sh.1

Log Message:
Document the NETBSD_SHELL variable, the enhancements to export,
the posix option, and a whole bunch of miscellaneous updates and
corrections. (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/bin/sh/sh.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.119 src/bin/sh/sh.1:1.120
--- src/bin/sh/sh.1:1.119	Wed Feb 24 10:28:36 2016
+++ src/bin/sh/sh.1	Thu Mar 31 12:18:22 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.119 2016/02/24 15:28:36 wiz Exp $
+.\"	$NetBSD: sh.1,v 1.120 2016/03/31 16:18:22 christos Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -31,7 +31,7 @@
 .\"
 .\"	@(#)sh.1	8.6 (Berkeley) 5/4/95
 .\"
-.Dd January 5, 2015
+.Dd March 31, 2016
 .Dt SH 1
 .ds flags abCEeFfhnuvxIimpqV
 .Os
@@ -330,9 +330,11 @@ in which case altering the
 flag has no effect.
 .It Fl h Em trackall
 Bind commands in functions to file system paths when the function is defined.
+.\" They can seek me here (that dreaded filesystem)
 When off,
 the file system is searched for commands each time the function is invoked.
 (Not implemented.)
+.\" then can seek me there (the filesystem, once again)
 .It Fl p Em nopriv
 Do not attempt to reset effective uid if it does not match uid.
 This is not set by default to help avoid incorrect usage by setuid
@@ -352,6 +354,22 @@ in the
 .Sx Built-ins
 section.)
 (Not implemented.)
+.It "\ \ " Em posix
+Enables closer adherence to the shell standard.
+This option will default set at shell startup if the
+environment variable
+.Ev POSIXLY_CORRECT
+is present.
+That can be overridden by the
+.Fl o
+option on the command line.
+Currently this option controls whether (!posix) or not (posix)
+the file given by the
+.Ev ENV
+variable is read at startup by a non-interactive shell.
+Consequently, while it can be manipulated by the
+.Ic set
+command, doing so has no current purpose.
 .It "\ \ " Em tabcomplete
 Enables filename completion in the command line editor.
 Typing a tab character will extend the current input word to match a
@@ -528,7 +546,9 @@ The following redirection is often calle
 .Li delimiter
 .El
 .Pp
-All the text on successive lines up to the delimiter, or to an EOF, is
+All the text on successive lines up to the delimiter,
+which must appear on a line by itself, with nothing other
+than an immediately following newline, is
 saved away and made available to the command on standard input, or file
 descriptor n if it is specified.
 If the delimiter as specified on the initial line is
@@ -538,10 +558,15 @@ expansion as described in the
 .Sx Word Expansions
 section below.
 If the operator is
-.Dq \*[Lt]\*[Lt]-
+.Dq \*[Lt]\*[Lt]\(mi
 instead of
 .Dq \*[Lt]\*[Lt] ,
-then leading tabs in the here-doc-text are stripped.
+then leading tabs in all lines in the here-doc-text, including before the
+end delimiter, are stripped.
+If the delimiter is not quoted, lines in here-doc-text that end with
+an unquoted \e are joined to the following line, the \e and following
+newline are simply removed while reading the here-doc, which thus guarantees
+that neither of those lines can be the end delimiter.
 .Ss Search and Execution
 There are three types of commands: shell functions, built-in commands, and
 normal programs -- and the command is searched for (by name) in that order.
@@ -564,6 +589,7 @@ new process.
 Otherwise, if the command name doesn't match a function or built-in, the
 command is searched for as a normal program in the file system (as
 described in the next section).
+.\" But the damned elusive filesystem shall never be defeated!
 When a normal program is executed, the shell runs the program,
 passing the arguments and the environment to the program.
 If the program is not a normal executable file (i.e., if it does
@@ -697,13 +723,18 @@ The format for running a command in back
 If the shell is not interactive, the standard input of an asynchronous
 command is set to
 .Pa /dev/null .
+The process identifier of the most recent command started in the
+background can be obtained from the value of the special parameter
+.Dq \&!
+(see
+.Sx Special Parameters ) .
 .Ss Lists -- Generally Speaking
 A list is a sequence of zero or more commands separated by newlines,
 semicolons, or ampersands, and optionally terminated by one of these three
 characters.
 The commands in a list are executed in the order they are written.
 If command is followed by an ampersand, the shell starts the
-command and immediately proceed onto the next command; otherwise it waits
+command and immediately proceeds to the next command; otherwise it waits
 for the command to terminate before proceeding to the next one.
 .Ss Short-Circuit List Operators
 

CVS commit: src/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:16:35 UTC 2016

Modified Files:
src/bin/sh: expand.c main.c options.c options.h var.c var.h
Added Files:
src/bin/sh: version.h

Log Message:
Implement the NETBSD_SHELL readonly unexportable unimportable
variable (with its current value set at 20160401) as discussed on
current-users and tech-userlevel. This also includes the necessary
support to implement it properly (particularly the unexportable
part) and adds options to the export command to support unexportable
variables. Also implement the "posix" option (no single letter
equivalent) which gets its default value from whether or not
POSIXLY_CORRECT is set in the environment when the shell starts
(but can be changed just like any other option using -o and +o on
the command line, or the set builtin command.) While there, fix
all uses of options so it is possible to have options that have a
short (one char) name, and no long name, just as it has been possible
to have options with a long name and no short name, though there
are currently none (with no long name).  For now, the only use of
the posix option is to control whether ${ENV} is read at startup
by a non-interactive shell, so changing it with set is not usful
- that might change in the future. (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/bin/sh/expand.c
cvs rdiff -u -r1.63 -r1.64 src/bin/sh/main.c
cvs rdiff -u -r1.45 -r1.46 src/bin/sh/options.c
cvs rdiff -u -r1.24 -r1.25 src/bin/sh/options.h
cvs rdiff -u -r1.48 -r1.49 src/bin/sh/var.c
cvs rdiff -u -r1.27 -r1.28 src/bin/sh/var.h
cvs rdiff -u -r0 -r1.1 src/bin/sh/version.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/expand.c
diff -u src/bin/sh/expand.c:1.100 src/bin/sh/expand.c:1.101
--- src/bin/sh/expand.c:1.100	Thu Mar 31 09:27:44 2016
+++ src/bin/sh/expand.c	Thu Mar 31 12:16:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: expand.c,v 1.100 2016/03/31 13:27:44 christos Exp $	*/
+/*	$NetBSD: expand.c,v 1.101 2016/03/31 16:16:35 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)expand.c	8.5 (Berkeley) 5/15/95";
 #else
-__RCSID("$NetBSD: expand.c,v 1.100 2016/03/31 13:27:44 christos Exp $");
+__RCSID("$NetBSD: expand.c,v 1.101 2016/03/31 16:16:35 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -907,7 +907,7 @@ numvar:
 		expdest = cvtnum(num, expdest);
 		break;
 	case '-':
-		for (i = 0; optlist[i].name; i++) {
+		for (i = 0; optlist[i].name || optlist[i].letter; i++) {
 			if (optlist[i].val && optlist[i].letter)
 STPUTC(optlist[i].letter, expdest);
 		}

Index: src/bin/sh/main.c
diff -u src/bin/sh/main.c:1.63 src/bin/sh/main.c:1.64
--- src/bin/sh/main.c:1.63	Sun Mar 27 10:34:46 2016
+++ src/bin/sh/main.c	Thu Mar 31 12:16:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.63 2016/03/27 14:34:46 christos Exp $	*/
+/*	$NetBSD: main.c,v 1.64 2016/03/31 16:16:35 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.7 (Berkeley) 7/19/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.63 2016/03/27 14:34:46 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.64 2016/03/31 16:16:35 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -82,7 +82,6 @@ __RCSID("$NetBSD: main.c,v 1.63 2016/03/
 
 int rootpid;
 int rootshell;
-int posix;
 #if PROFILE
 short profile_buf[16384];
 extern int etext();

Index: src/bin/sh/options.c
diff -u src/bin/sh/options.c:1.45 src/bin/sh/options.c:1.46
--- src/bin/sh/options.c:1.45	Tue Mar  8 09:08:39 2016
+++ src/bin/sh/options.c	Thu Mar 31 12:16:35 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: options.c,v 1.45 2016/03/08 14:08:39 christos Exp $	*/
+/*	$NetBSD: options.c,v 1.46 2016/03/31 16:16:35 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)options.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: options.c,v 1.45 2016/03/08 14:08:39 christos Exp $");
+__RCSID("$NetBSD: options.c,v 1.46 2016/03/31 16:16:35 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -224,25 +224,40 @@ STATIC void
 minus_o(char *name, int val)
 {
 	size_t i;
+	const char *sep = ": ";
 
 	if (name == NULL) {
 		if (val) {
-			out1str("Current option settings\n");
+			out1str("Current option settings");
 			for (i = 0; i < NOPTS; i++) {
-out1fmt("%-16s%s\n", optlist[i].name,
+if (optlist[i].name == NULL)  {
+	out1fmt("%s%c%c", sep,
+	"+-"[optlist[i].val],
+	optlist[i].letter);
+	sep = ", ";
+}
+			}
+			out1c('\n');
+			for (i = 0; i < NOPTS; i++) {
+if (optlist[i].name)
+out1fmt("%-16s%s\n", optlist[i].name,
 	optlist[i].val ? "on" : "off");
 			}
 		} else {
 			out1str("set");
 			for (i = 0; i < NOPTS; i++) {
-out1fmt(" %co %s",
+if (optlist[i].name)
+out1fmt(" 

CVS commit: src/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 16:16:35 UTC 2016

Modified Files:
src/bin/sh: expand.c main.c options.c options.h var.c var.h
Added Files:
src/bin/sh: version.h

Log Message:
Implement the NETBSD_SHELL readonly unexportable unimportable
variable (with its current value set at 20160401) as discussed on
current-users and tech-userlevel. This also includes the necessary
support to implement it properly (particularly the unexportable
part) and adds options to the export command to support unexportable
variables. Also implement the "posix" option (no single letter
equivalent) which gets its default value from whether or not
POSIXLY_CORRECT is set in the environment when the shell starts
(but can be changed just like any other option using -o and +o on
the command line, or the set builtin command.) While there, fix
all uses of options so it is possible to have options that have a
short (one char) name, and no long name, just as it has been possible
to have options with a long name and no short name, though there
are currently none (with no long name).  For now, the only use of
the posix option is to control whether ${ENV} is read at startup
by a non-interactive shell, so changing it with set is not usful
- that might change in the future. (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/bin/sh/expand.c
cvs rdiff -u -r1.63 -r1.64 src/bin/sh/main.c
cvs rdiff -u -r1.45 -r1.46 src/bin/sh/options.c
cvs rdiff -u -r1.24 -r1.25 src/bin/sh/options.h
cvs rdiff -u -r1.48 -r1.49 src/bin/sh/var.c
cvs rdiff -u -r1.27 -r1.28 src/bin/sh/var.h
cvs rdiff -u -r0 -r1.1 src/bin/sh/version.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/bsd/elftoolchain/dist/libdwarf

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 15:53:33 UTC 2016

Modified Files:
src/external/bsd/elftoolchain/dist/libdwarf: dwarf_attrval.c

Log Message:
Delay freeing the die where the indirect attribute is found. Found by jemalloc
J, see: https://mail-index.netbsd.org/current-users/2016/03/28/msg029130.html


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/external/bsd/elftoolchain/dist/libdwarf/dwarf_attrval.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/elftoolchain/dist/libdwarf/dwarf_attrval.c
diff -u src/external/bsd/elftoolchain/dist/libdwarf/dwarf_attrval.c:1.7 src/external/bsd/elftoolchain/dist/libdwarf/dwarf_attrval.c:1.8
--- src/external/bsd/elftoolchain/dist/libdwarf/dwarf_attrval.c:1.7	Fri Mar 18 10:58:18 2016
+++ src/external/bsd/elftoolchain/dist/libdwarf/dwarf_attrval.c	Thu Mar 31 11:53:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwarf_attrval.c,v 1.7 2016/03/18 14:58:18 christos Exp $	*/
+/*	$NetBSD: dwarf_attrval.c,v 1.8 2016/03/31 15:53:33 christos Exp $	*/
 
 /*-
  * Copyright (c) 2007 John Birrell (j...@freebsd.org)
@@ -28,7 +28,7 @@
 
 #include "_libdwarf.h"
 
-__RCSID("$NetBSD: dwarf_attrval.c,v 1.7 2016/03/18 14:58:18 christos Exp $");
+__RCSID("$NetBSD: dwarf_attrval.c,v 1.8 2016/03/31 15:53:33 christos Exp $");
 ELFTC_VCSID("Id: dwarf_attrval.c 3159 2015-02-15 21:43:27Z emaste ");
 
 int
@@ -146,14 +146,11 @@ dwarf_indirect_find(Dwarf_Debug dbg, Dwa
 Dwarf_Unsigned val)
 {
 	Dwarf_Die die1;
-	Dwarf_Attribute at;
 
 	if ((die1 = _dwarf_die_find(die, val)) == NULL)
 		return NULL;
 
-	at = _dwarf_attr_find(die1, attr);
-	dwarf_dealloc(dbg, die1, DW_DLA_DIE);
-	return at;
+	return _dwarf_attr_find(die1, attr);
 }
 
 int
@@ -213,9 +210,13 @@ dwarf_attrval_unsigned(Dwarf_Die die, Dw
 		*valp = at->u[0].u64;
 		break;
 	default:
+		if (at->at_die != die)
+			dwarf_dealloc(dbg, at->at_die, DW_DLA_DIE);
 		DWARF_SET_ERROR(dbg, err, DW_DLE_ATTR_FORM_BAD);
 		return (DW_DLV_ERROR);
 	}
 
+	if (at->at_die != die)
+		dwarf_dealloc(dbg, at->at_die, DW_DLA_DIE);
 	return (DW_DLV_OK);
 }



CVS commit: src/external/bsd/elftoolchain/dist/libdwarf

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 15:53:33 UTC 2016

Modified Files:
src/external/bsd/elftoolchain/dist/libdwarf: dwarf_attrval.c

Log Message:
Delay freeing the die where the indirect attribute is found. Found by jemalloc
J, see: https://mail-index.netbsd.org/current-users/2016/03/28/msg029130.html


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
src/external/bsd/elftoolchain/dist/libdwarf/dwarf_attrval.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/gpl3/gcc.old/lib/libgcc/libgcc

2016-03-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar 31 15:06:39 UTC 2016

Modified Files:
src/external/gpl3/gcc.old/lib/libgcc/libgcc: Makefile

Log Message:
"Extended version" of the "mips64 hack" used in gcc 5.3's libgcc.a
build: avoid lots of duplicate symbols on softfloat builds.
Now mac68k is buildable with MKSOFTFLOAT=yes again, finally!


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/gpl3/gcc.old/lib/libgcc/libgcc/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc.old/lib/libgcc/libgcc/Makefile
diff -u src/external/gpl3/gcc.old/lib/libgcc/libgcc/Makefile:1.3 src/external/gpl3/gcc.old/lib/libgcc/libgcc/Makefile:1.4
--- src/external/gpl3/gcc.old/lib/libgcc/libgcc/Makefile:1.3	Wed Sep 23 04:24:01 2015
+++ src/external/gpl3/gcc.old/lib/libgcc/libgcc/Makefile	Thu Mar 31 15:06:39 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.3 2015/09/23 04:24:01 mrg Exp $
+#	$NetBSD: Makefile,v 1.4 2016/03/31 15:06:39 martin Exp $
 
 REQUIRETOOLS=	yes
 NOLINT=		# defined
@@ -22,9 +22,20 @@ G_LIB2ADD_HACK+=	${GNUHOSTDIST}/gcc/conf
 			${GNUHOSTDIST}/gcc/config/floatunsisf.c
 .endif
 
-SRCS+=		${LIB2FUNCS} ${LIB2FUNCS_ST} ${LIB2DIVMOD} \
-		${G_LIB2ADD:T:S/.asm/.S/} ${G_LIB2ADD_HACK:T:S/.asm/.S/} \
-		${G_LIB2ADD_ST:T} ${LIB1ASMFUNCS}
+# XXX avoid duplicate softfloat symbols in libc and libgcc.a,
+# which would break the /rescue build
+.if ${MKSOFTFLOAT} == "yes"
+LIB2ADD_EDITED=	${G_LIB2ADD:T:Nfloatsisf.c:Nfloatunsisf.c:Nfloatsidf.c:Nfloatunsidf.c:Nfixsfsi.c:Nextendsfdf2.c:Naddsf3.c:Nmulsf3.c:Ndivsf3.c:Nadddf3.c:Nsubdf3.c:Nmuldf3.c:Ndivdf3.c:Nfixdfsi.c:Nxfgnulib.c:Nfpgnulib.c:S/.asm/.S/}
+LIB2FUNCS_EDITED=	${LIB2FUNCS:N_floatundisf.c:N_floatundidf.c:N_floatundixf.c:N_floatunditf.c:N_fixsfdi.c:N_fixdfdi.c:N_fixxfdi.c:N_fixtfdi.c:N_addvsi3.c:N_addvdi3.c:N_subvsi3.c:N_subvdi3.c:N_mulvsi3.c:N_mulvdi3.c:N_muldi3.c}
+LIB1ASMFUNCS_EDITED=	${LIB1ASMFUNCS:N_float.S:N_double.S:N_gedf2.S:N_eqdf2.S:N_nedf2.S:N_ltdf2.S:N_gesf2.S:N_gtdf2.S:N_ledf2.S:N_lesf2.S}
+.else
+LIB2ADD_EDITED= ${G_LIB2ADD:T:S/.asm/.S/}
+LIB2FUNCS_EDITED=	${LIB2FUNCS}
+LIB1ASMFUNCS_EDITED=	${LIB1ASMFUNCS}
+.endif
+SRCS+=		${LIB2FUNCS_EDITED} ${LIB2FUNCS_ST} ${LIB2DIVMOD} \
+		${LIB2ADD_EDITED} ${G_LIB2ADD_HACK:T:S/.asm/.S/} \
+		${G_LIB2ADD_ST:T} ${LIB1ASMFUNCS_EDITED}
 .if ${MKPIC} == "no"
 .if empty(LIBGCC_MACHINE_ARCH:Mearm*)
 SRCS+=		${LIB2_EH} ${LIB2_EHASM}



CVS commit: src/sys/arch/evbarm/gumstix

2016-03-31 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Thu Mar 31 14:33:17 UTC 2016

Modified Files:
src/sys/arch/evbarm/gumstix: gumstix_machdep.c gumstixreg.h

Log Message:
Ensure enable clocks for omapmputmr.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/evbarm/gumstix/gumstix_machdep.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/gumstix/gumstixreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/gumstix/gumstix_machdep.c
diff -u src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.50 src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.51
--- src/sys/arch/evbarm/gumstix/gumstix_machdep.c:1.50	Sat Jun  7 10:30:13 2014
+++ src/sys/arch/evbarm/gumstix/gumstix_machdep.c	Thu Mar 31 14:33:17 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gumstix_machdep.c,v 1.50 2014/06/07 10:30:13 kiyohara Exp $ */
+/*	$NetBSD: gumstix_machdep.c,v 1.51 2016/03/31 14:33:17 kiyohara Exp $ */
 /*
  * Copyright (C) 2005, 2006, 2007  WIDE Project and SOUM Corporation.
  * All rights reserved.
@@ -169,6 +169,7 @@
 #include 
 #ifdef OVERO
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -335,6 +336,13 @@ static const struct pmap_devmap gumstix_
 	},
 #elif defined(OVERO)
 	{
+		OVERO_L4_CORE_VBASE,
+		_A(OMAP3530_L4_CORE_BASE),
+		_S(L1_S_SIZE),		/* No need 16MB.  Use only first 1MB */
+		VM_PROT_READ | VM_PROT_WRITE,
+		PTE_NOCACHE
+	},
+	{
 		OVERO_L4_PERIPHERAL_VBASE,
 		_A(OMAP3530_L4_PERIPHERAL_BASE),
 		_S(OMAP3530_L4_PERIPHERAL_SIZE),
@@ -920,4 +928,28 @@ gumstix_device_register(device_t dev, vo
 			" property for %s\n", device_xname(dev));
 		}
 	}
+	if (device_is_a(dev, "omapmputmr")) {
+#ifdef OVERO
+		struct obio_attach_args *obio = aux;
+		int en;
+
+		switch (obio->obio_addr) {
+		case 0x49032000:	/* GPTIMER2 */
+		case 0x49034000:	/* GPTIMER3 */
+		case 0x49036000:	/* GPTIMER4 */
+		case 0x49038000:	/* GPTIMER5 */
+		case 0x4903a000:	/* GPTIMER6 */
+		case 0x4903c000:	/* GPTIMER7 */
+		case 0x4903e000:	/* GPTIMER8 */
+		case 0x4904:	/* GPTIMER9 */
+			/* Ensure enable PRCM.CM_[FI]CLKEN_PER[3:10]. */
+			en = 1 << (((obio->obio_addr >> 13) & 0x3f) - 0x16);
+			ioreg_write(OVERO_L4_CORE_VBASE + 0x5000,
+			ioreg_read(OVERO_L4_CORE_VBASE + 0x5000) | en);
+			ioreg_write(OVERO_L4_CORE_VBASE + 0x5010,
+			ioreg_read(OVERO_L4_CORE_VBASE + 0x5010) | en);
+			break;
+		}
+#endif
+	}
 }

Index: src/sys/arch/evbarm/gumstix/gumstixreg.h
diff -u src/sys/arch/evbarm/gumstix/gumstixreg.h:1.7 src/sys/arch/evbarm/gumstix/gumstixreg.h:1.8
--- src/sys/arch/evbarm/gumstix/gumstixreg.h:1.7	Mon Dec 24 06:49:41 2012
+++ src/sys/arch/evbarm/gumstix/gumstixreg.h	Thu Mar 31 14:33:17 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: gumstixreg.h,v 1.7 2012/12/24 06:49:41 kiyohara Exp $  */
+/*	$NetBSD: gumstixreg.h,v 1.8 2016/03/31 14:33:17 kiyohara Exp $  */
 /*
  * Copyright (C) 2005, 2006 WIDE Project and SOUM Corporation.
  * All rights reserved.
@@ -47,8 +47,9 @@
 #define GUMSTIX_HWUART_VBASE		0xfd60
 #define GUMSTIX_LCDC_VBASE		0xfd70
 
-#define OVERO_L4_PERIPHERAL_VBASE	0xc000
-#define OVERO_GPMC_VBASE		0xc010
+#define OVERO_L4_CORE_VBASE		0xc000
+#define OVERO_L4_PERIPHERAL_VBASE	0xc010
+#define OVERO_GPMC_VBASE		0xc020
 
 
 #define ioreg_read(a)		(*(volatile unsigned *)(a))



CVS commit: src/sys/arch/evbarm/gumstix

2016-03-31 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Thu Mar 31 14:33:17 UTC 2016

Modified Files:
src/sys/arch/evbarm/gumstix: gumstix_machdep.c gumstixreg.h

Log Message:
Ensure enable clocks for omapmputmr.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/evbarm/gumstix/gumstix_machdep.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/gumstix/gumstixreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 13:27:44 UTC 2016

Modified Files:
src/bin/sh: expand.c

Log Message:
After discussions with Jilles Tjoelker (FreeBSD shell) and following
a suggestion from him, the way the fix to PR bin/50993 was implemented
has changed a little.   There are three steps involved in processing
a here document, reading it, parsing it, and then evaluating it
before applying it to the correct file descriptor for the command
to use.  The third of those is not related to this problem, and
has not changed.  The bug was caused by combining the first two
steps into one (and not doing it correctly - which would be hard
that way.)  The fix is to split the first two stages into separate
events.   The original fix moved the 2nd stage (parsing) to just
immediately before the 3rd stage (evaluation.)  Jilles pointed out
some unwanted side effects from doing it that way, and suggested
moving the 2nd stage to immediately after the first.  This commit
makes that change.  The effect is to revert the changes to expand.c
and parser.h (which are no longer needed) and simplify slightly
the change to parser.c. (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/bin/sh/expand.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/bin/sh/expand.c
diff -u src/bin/sh/expand.c:1.99 src/bin/sh/expand.c:1.100
--- src/bin/sh/expand.c:1.99	Sun Mar 27 10:39:33 2016
+++ src/bin/sh/expand.c	Thu Mar 31 09:27:44 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: expand.c,v 1.99 2016/03/27 14:39:33 christos Exp $	*/
+/*	$NetBSD: expand.c,v 1.100 2016/03/31 13:27:44 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)expand.c	8.5 (Berkeley) 5/15/95";
 #else
-__RCSID("$NetBSD: expand.c,v 1.99 2016/03/27 14:39:33 christos Exp $");
+__RCSID("$NetBSD: expand.c,v 1.100 2016/03/31 13:27:44 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -121,11 +121,6 @@ STATIC char *cvtnum(int, char *);
 void
 expandhere(union node *arg, int fd)
 {
-	/*
-	 * First, parse the content of the here doc (to internal form)
-	 * It was initially saved as (almost) unmodified text.
-	 */
-	parse_heredoc(arg);
 
 	herefd = fd;
 	expandarg(arg, NULL, 0);



CVS commit: src/bin/sh

2016-03-31 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Mar 31 13:27:44 UTC 2016

Modified Files:
src/bin/sh: expand.c

Log Message:
After discussions with Jilles Tjoelker (FreeBSD shell) and following
a suggestion from him, the way the fix to PR bin/50993 was implemented
has changed a little.   There are three steps involved in processing
a here document, reading it, parsing it, and then evaluating it
before applying it to the correct file descriptor for the command
to use.  The third of those is not related to this problem, and
has not changed.  The bug was caused by combining the first two
steps into one (and not doing it correctly - which would be hard
that way.)  The fix is to split the first two stages into separate
events.   The original fix moved the 2nd stage (parsing) to just
immediately before the 3rd stage (evaluation.)  Jilles pointed out
some unwanted side effects from doing it that way, and suggested
moving the 2nd stage to immediately after the first.  This commit
makes that change.  The effect is to revert the changes to expand.c
and parser.h (which are no longer needed) and simplify slightly
the change to parser.c. (from kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/bin/sh/expand.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/external/gpl3/gcc/lib/libgcc/libgcc

2016-03-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar 31 06:59:44 UTC 2016

Modified Files:
src/external/gpl3/gcc/lib/libgcc/libgcc: Makefile

Log Message:
Extend the "mips64 hack" to all MKSOFTFLOAT builds - avoid duplicate
symbols in libgcc.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/external/gpl3/gcc/lib/libgcc/libgcc/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/lib/libgcc/libgcc/Makefile
diff -u src/external/gpl3/gcc/lib/libgcc/libgcc/Makefile:1.25 src/external/gpl3/gcc/lib/libgcc/libgcc/Makefile:1.26
--- src/external/gpl3/gcc/lib/libgcc/libgcc/Makefile:1.25	Wed Mar 23 05:28:01 2016
+++ src/external/gpl3/gcc/lib/libgcc/libgcc/Makefile	Thu Mar 31 06:59:44 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.25 2016/03/23 05:28:01 mrg Exp $
+#	$NetBSD: Makefile,v 1.26 2016/03/31 06:59:44 martin Exp $
 
 REQUIRETOOLS=	yes
 NOLINT=		# defined
@@ -23,7 +23,7 @@ LIB2ADD_HACK+=	${GNUHOSTDIST}/gcc/config
 .endif
 
 # XXXGCC5 GCC 5.3 has all these in libgcc and we have them in libc.
-.if ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb"
+.if ${MKSOFTFLOAT} == "yes"
 LIB2ADD_EDITED= ${G_LIB2ADD:T:Nfloatsisf.c:Nfloatunsisf.c:Nfloatsidf.c:Nfloatunsidf.c:Nfixsfsi.c:Nextendsfdf2.c:Naddsf3.c:Nmulsf3.c:Ndivsf3.c:Nadddf3.c:Nsubdf3.c:Nmuldf3.c:Ndivdf3.c:Nfixdfsi.c:S/.asm/.S/}
 .else
 LIB2ADD_EDITED=	${G_LIB2ADD:T:S/.asm/.S/}



CVS commit: src/external/gpl3/gcc/lib/libgcc/libgcc

2016-03-31 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Mar 31 06:59:44 UTC 2016

Modified Files:
src/external/gpl3/gcc/lib/libgcc/libgcc: Makefile

Log Message:
Extend the "mips64 hack" to all MKSOFTFLOAT builds - avoid duplicate
symbols in libgcc.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/external/gpl3/gcc/lib/libgcc/libgcc/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.