Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Oct 2010 23:09:00 +0000 (UTC)
From:      "David E. O'Brien" <obrien@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r214307 - in stable/7: . bin/sh contrib/wpa_supplicant gnu/usr.bin/groff/tmac share/misc tools/regression/bin/sh/expansion tools/tools/nanobsd usr.sbin usr.sbin/makefs usr.sbin/makefs/f...
Message-ID:  <201010242309.o9ON90uV043782@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: obrien
Date: Sun Oct 24 23:09:00 2010
New Revision: 214307
URL: http://svn.freebsd.org/changeset/base/214307

Log:
  MFC r213814: Do not assume in growstackstr() that a "precious" character
  will be immediately written into the stack after the call.  Instead let
  the caller manage the "space left".

Added:
  stable/7/tools/regression/bin/sh/expansion/trim4.0
     - copied unchanged from r213814, head/tools/regression/bin/sh/expansion/trim4.0
Modified:
  stable/7/bin/sh/histedit.c
  stable/7/bin/sh/memalloc.c
  stable/7/bin/sh/memalloc.h
Directory Properties:
  stable/7/   (props changed)
  stable/7/COPYRIGHT   (props changed)
  stable/7/Makefile   (props changed)
  stable/7/Makefile.inc1   (props changed)
  stable/7/ObsoleteFiles.inc   (props changed)
  stable/7/UPDATING   (props changed)
  stable/7/bin/   (props changed)
  stable/7/bin/chflags/   (props changed)
  stable/7/bin/chio/   (props changed)
  stable/7/bin/cp/   (props changed)
  stable/7/bin/csh/   (props changed)
  stable/7/bin/dd/   (props changed)
  stable/7/bin/df/   (props changed)
  stable/7/bin/expr/   (props changed)
  stable/7/bin/kill/   (props changed)
  stable/7/bin/ln/   (props changed)
  stable/7/bin/ls/   (props changed)
  stable/7/bin/pax/   (props changed)
  stable/7/bin/ps/   (props changed)
  stable/7/bin/rm/   (props changed)
  stable/7/bin/sh/   (props changed)
  stable/7/bin/test/   (props changed)
  stable/7/cddl/contrib/opensolaris/   (props changed)
  stable/7/cddl/lib/libzpool/   (props changed)
  stable/7/contrib/bind9/   (props changed)
  stable/7/contrib/binutils/   (props changed)
  stable/7/contrib/bsnmp/   (props changed)
  stable/7/contrib/cpio/   (props changed)
  stable/7/contrib/csup/   (props changed)
  stable/7/contrib/expat/   (props changed)
  stable/7/contrib/gcc/   (props changed)
  stable/7/contrib/gdb/   (props changed)
  stable/7/contrib/gdtoa/   (props changed)
  stable/7/contrib/groff/   (props changed)
  stable/7/contrib/ipfilter/   (props changed)
  stable/7/contrib/less/   (props changed)
  stable/7/contrib/libpcap/   (props changed)
  stable/7/contrib/ncurses/   (props changed)
  stable/7/contrib/netcat/   (props changed)
  stable/7/contrib/ntp/   (props changed)
  stable/7/contrib/nvi/   (props changed)
  stable/7/contrib/pf/   (props changed)
  stable/7/contrib/sendmail/   (props changed)
  stable/7/contrib/smbfs/   (props changed)
  stable/7/contrib/tcp_wrappers/   (props changed)
  stable/7/contrib/tcsh/   (props changed)
  stable/7/contrib/telnet/   (props changed)
  stable/7/contrib/top/   (props changed)
  stable/7/contrib/traceroute/   (props changed)
  stable/7/contrib/wpa_supplicant/   (props changed)
  stable/7/contrib/wpa_supplicant/wpa_supplicant.conf   (props changed)
  stable/7/crypto/openssh/   (props changed)
  stable/7/etc/   (props changed)
  stable/7/games/factor/   (props changed)
  stable/7/games/fortune/   (props changed)
  stable/7/games/grdc/   (props changed)
  stable/7/gnu/   (props changed)
  stable/7/gnu/lib/libstdc++/   (props changed)
  stable/7/gnu/usr.bin/   (props changed)
  stable/7/gnu/usr.bin/cc/   (props changed)
  stable/7/gnu/usr.bin/cpio/   (props changed)
  stable/7/gnu/usr.bin/cvs/   (props changed)
  stable/7/gnu/usr.bin/gdb/   (props changed)
  stable/7/gnu/usr.bin/gdb/kgdb/   (props changed)
  stable/7/gnu/usr.bin/grep/   (props changed)
  stable/7/gnu/usr.bin/groff/   (props changed)
  stable/7/gnu/usr.bin/groff/tmac/mdoc.local   (props changed)
  stable/7/gnu/usr.bin/man/   (props changed)
  stable/7/gnu/usr.bin/sort/   (props changed)
  stable/7/include/   (props changed)
  stable/7/kerberos5/   (props changed)
  stable/7/lib/   (props changed)
  stable/7/lib/bind/   (props changed)
  stable/7/lib/csu/   (props changed)
  stable/7/lib/libarchive/   (props changed)
  stable/7/lib/libbluetooth/   (props changed)
  stable/7/lib/libc/   (props changed)
  stable/7/lib/libc/stdtime/   (props changed)
  stable/7/lib/libc_r/   (props changed)
  stable/7/lib/libcam/   (props changed)
  stable/7/lib/libdisk/   (props changed)
  stable/7/lib/libdwarf/   (props changed)
  stable/7/lib/libelf/   (props changed)
  stable/7/lib/libexpat/   (props changed)
  stable/7/lib/libfetch/   (props changed)
  stable/7/lib/libftpio/   (props changed)
  stable/7/lib/libgeom/   (props changed)
  stable/7/lib/libgssapi/   (props changed)
  stable/7/lib/libkse/   (props changed)
  stable/7/lib/libkvm/   (props changed)
  stable/7/lib/libmagic/   (props changed)
  stable/7/lib/libmemstat/   (props changed)
  stable/7/lib/libpmc/   (props changed)
  stable/7/lib/libradius/   (props changed)
  stable/7/lib/libsm/   (props changed)
  stable/7/lib/libstand/   (props changed)
  stable/7/lib/libthr/   (props changed)
  stable/7/lib/libthread_db/   (props changed)
  stable/7/lib/libufs/   (props changed)
  stable/7/lib/libutil/   (props changed)
  stable/7/lib/msun/   (props changed)
  stable/7/libexec/   (props changed)
  stable/7/libexec/ftpd/   (props changed)
  stable/7/libexec/rpc.rquotad/   (props changed)
  stable/7/libexec/rpc.rstatd/   (props changed)
  stable/7/libexec/rtld-elf/   (props changed)
  stable/7/libexec/tftpd/   (props changed)
  stable/7/release/   (props changed)
  stable/7/release/doc/   (props changed)
  stable/7/release/doc/en_US.ISO8859-1/hardware/   (props changed)
  stable/7/release/picobsd/tinyware/login/   (props changed)
  stable/7/rescue/   (props changed)
  stable/7/sbin/   (props changed)
  stable/7/sbin/atacontrol/   (props changed)
  stable/7/sbin/bsdlabel/   (props changed)
  stable/7/sbin/clri/   (props changed)
  stable/7/sbin/ddb/   (props changed)
  stable/7/sbin/devd/   (props changed)
  stable/7/sbin/devfs/   (props changed)
  stable/7/sbin/dhclient/   (props changed)
  stable/7/sbin/dumpfs/   (props changed)
  stable/7/sbin/fdisk/   (props changed)
  stable/7/sbin/fdisk_pc98/   (props changed)
  stable/7/sbin/fsck/   (props changed)
  stable/7/sbin/fsck_ffs/   (props changed)
  stable/7/sbin/fsck_msdosfs/   (props changed)
  stable/7/sbin/geom/   (props changed)
  stable/7/sbin/geom/class/label/   (props changed)
  stable/7/sbin/geom/class/part/   (props changed)
  stable/7/sbin/geom/class/stripe/   (props changed)
  stable/7/sbin/geom/misc/   (props changed)
  stable/7/sbin/growfs/   (props changed)
  stable/7/sbin/ifconfig/   (props changed)
  stable/7/sbin/init/   (props changed)
  stable/7/sbin/ipf/   (props changed)
  stable/7/sbin/ipfw/   (props changed)
  stable/7/sbin/md5/   (props changed)
  stable/7/sbin/mdconfig/   (props changed)
  stable/7/sbin/mksnap_ffs/   (props changed)
  stable/7/sbin/mount/   (props changed)
  stable/7/sbin/mount_msdosfs/   (props changed)
  stable/7/sbin/natd/   (props changed)
  stable/7/sbin/newfs/   (props changed)
  stable/7/sbin/newfs_msdos/   (props changed)
  stable/7/sbin/ping6/   (props changed)
  stable/7/sbin/reboot/   (props changed)
  stable/7/sbin/restore/   (props changed)
  stable/7/sbin/route/   (props changed)
  stable/7/sbin/savecore/   (props changed)
  stable/7/sbin/sconfig/   (props changed)
  stable/7/sbin/shutdown/   (props changed)
  stable/7/sbin/sysctl/   (props changed)
  stable/7/sbin/tunefs/   (props changed)
  stable/7/secure/lib/libssh/   (props changed)
  stable/7/secure/libexec/sftp-server/   (props changed)
  stable/7/secure/usr.bin/bdes/   (props changed)
  stable/7/secure/usr.bin/ssh/   (props changed)
  stable/7/secure/usr.sbin/sshd/   (props changed)
  stable/7/share/   (props changed)
  stable/7/share/colldef/   (props changed)
  stable/7/share/dict/   (props changed)
  stable/7/share/doc/bind9/   (props changed)
  stable/7/share/examples/   (props changed)
  stable/7/share/man/   (props changed)
  stable/7/share/man/man1/   (props changed)
  stable/7/share/man/man3/   (props changed)
  stable/7/share/man/man4/   (props changed)
  stable/7/share/man/man5/   (props changed)
  stable/7/share/man/man7/   (props changed)
  stable/7/share/man/man8/   (props changed)
  stable/7/share/man/man9/   (props changed)
  stable/7/share/misc/   (props changed)
  stable/7/share/misc/iso639   (props changed)
  stable/7/share/misc/pci_vendors   (props changed)
  stable/7/share/mk/   (props changed)
  stable/7/share/mklocale/   (props changed)
  stable/7/share/monetdef/   (props changed)
  stable/7/share/msgdef/   (props changed)
  stable/7/share/numericdef/   (props changed)
  stable/7/share/sendmail/   (props changed)
  stable/7/share/syscons/   (props changed)
  stable/7/share/syscons/keymaps/   (props changed)
  stable/7/share/termcap/   (props changed)
  stable/7/share/timedef/   (props changed)
  stable/7/share/zoneinfo/   (props changed)
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/tools/   (props changed)
  stable/7/tools/build/   (props changed)
  stable/7/tools/build/options/   (props changed)
  stable/7/tools/debugscripts/   (props changed)
  stable/7/tools/regression/atm/   (props changed)
  stable/7/tools/regression/bin/sh/   (props changed)
  stable/7/tools/regression/file/   (props changed)
  stable/7/tools/regression/file/flock/   (props changed)
  stable/7/tools/regression/usr.bin/   (props changed)
  stable/7/tools/regression/usr.bin/jot/   (props changed)
  stable/7/tools/regression/usr.bin/tr/   (props changed)
  stable/7/tools/sched/   (props changed)
  stable/7/tools/test/   (props changed)
  stable/7/tools/tools/   (props changed)
  stable/7/tools/tools/aac/   (props changed)
  stable/7/tools/tools/crypto/   (props changed)
  stable/7/tools/tools/editing/   (props changed)
  stable/7/tools/tools/nanobsd/   (props changed)
  stable/7/tools/tools/nanobsd/FlashDevice.sub   (props changed)
  stable/7/tools/tools/nanobsd/nanobsd.sh   (props changed)
  stable/7/tools/tools/netrate/   (props changed)
  stable/7/tools/tools/umastat/   (props changed)
  stable/7/tools/tools/usb/   (props changed)
  stable/7/usr.bin/   (props changed)
  stable/7/usr.bin/basename/   (props changed)
  stable/7/usr.bin/bluetooth/rfcomm_sppd/   (props changed)
  stable/7/usr.bin/calendar/   (props changed)
  stable/7/usr.bin/catman/   (props changed)
  stable/7/usr.bin/cksum/   (props changed)
  stable/7/usr.bin/comm/   (props changed)
  stable/7/usr.bin/cpuset/   (props changed)
  stable/7/usr.bin/csup/   (props changed)
  stable/7/usr.bin/dirname/   (props changed)
  stable/7/usr.bin/du/   (props changed)
  stable/7/usr.bin/fetch/   (props changed)
  stable/7/usr.bin/file/   (props changed)
  stable/7/usr.bin/find/   (props changed)
  stable/7/usr.bin/finger/   (props changed)
  stable/7/usr.bin/fstat/   (props changed)
  stable/7/usr.bin/gcore/   (props changed)
  stable/7/usr.bin/gprof/   (props changed)
  stable/7/usr.bin/gzip/   (props changed)
  stable/7/usr.bin/hexdump/   (props changed)
  stable/7/usr.bin/id/   (props changed)
  stable/7/usr.bin/indent/   (props changed)
  stable/7/usr.bin/ipcrm/   (props changed)
  stable/7/usr.bin/ipcs/   (props changed)
  stable/7/usr.bin/jot/   (props changed)
  stable/7/usr.bin/kdump/   (props changed)
  stable/7/usr.bin/ktrace/   (props changed)
  stable/7/usr.bin/ldd/   (props changed)
  stable/7/usr.bin/less/   (props changed)
  stable/7/usr.bin/locate/   (props changed)
  stable/7/usr.bin/lockf/   (props changed)
  stable/7/usr.bin/logger/   (props changed)
  stable/7/usr.bin/make/   (props changed)
  stable/7/usr.bin/ncal/   (props changed)
  stable/7/usr.bin/netstat/   (props changed)
  stable/7/usr.bin/newgrp/   (props changed)
  stable/7/usr.bin/nsupdate/   (props changed)
  stable/7/usr.bin/pkill/   (props changed)
  stable/7/usr.bin/procstat/   (props changed)
  stable/7/usr.bin/quota/   (props changed)
  stable/7/usr.bin/rpcgen/   (props changed)
  stable/7/usr.bin/ruptime/   (props changed)
  stable/7/usr.bin/script/   (props changed)
  stable/7/usr.bin/sed/   (props changed)
  stable/7/usr.bin/shar/   (props changed)
  stable/7/usr.bin/sockstat/   (props changed)
  stable/7/usr.bin/stat/   (props changed)
  stable/7/usr.bin/su/   (props changed)
  stable/7/usr.bin/systat/   (props changed)
  stable/7/usr.bin/tail/   (props changed)
  stable/7/usr.bin/tar/   (props changed)
  stable/7/usr.bin/tftp/   (props changed)
  stable/7/usr.bin/tip/   (props changed)
  stable/7/usr.bin/top/   (props changed)
  stable/7/usr.bin/truncate/   (props changed)
  stable/7/usr.bin/truss/   (props changed)
  stable/7/usr.bin/uname/   (props changed)
  stable/7/usr.bin/unifdef/   (props changed)
  stable/7/usr.bin/units/   (props changed)
  stable/7/usr.bin/vmstat/   (props changed)
  stable/7/usr.bin/w/   (props changed)
  stable/7/usr.bin/wc/   (props changed)
  stable/7/usr.bin/whereis/   (props changed)
  stable/7/usr.bin/whois/   (props changed)
  stable/7/usr.bin/window/   (props changed)
  stable/7/usr.bin/xargs/   (props changed)
  stable/7/usr.bin/ypcat/   (props changed)
  stable/7/usr.bin/ypmatch/   (props changed)
  stable/7/usr.bin/ypwhich/   (props changed)
  stable/7/usr.sbin/   (props changed)
  stable/7/usr.sbin/Makefile   (props changed)
  stable/7/usr.sbin/acpi/   (props changed)
  stable/7/usr.sbin/adduser/   (props changed)
  stable/7/usr.sbin/arp/   (props changed)
  stable/7/usr.sbin/bluetooth/   (props changed)
  stable/7/usr.sbin/bluetooth/btpand/   (props changed)
  stable/7/usr.sbin/bluetooth/hcsecd/   (props changed)
  stable/7/usr.sbin/bluetooth/hcseriald/   (props changed)
  stable/7/usr.sbin/bluetooth/rfcomm_pppd/   (props changed)
  stable/7/usr.sbin/bluetooth/sdpd/   (props changed)
  stable/7/usr.sbin/boot0cfg/   (props changed)
  stable/7/usr.sbin/bsnmpd/modules/snmp_pf/   (props changed)
  stable/7/usr.sbin/burncd/   (props changed)
  stable/7/usr.sbin/cdcontrol/   (props changed)
  stable/7/usr.sbin/chown/   (props changed)
  stable/7/usr.sbin/chroot/   (props changed)
  stable/7/usr.sbin/config/   (props changed)
  stable/7/usr.sbin/cpucontrol/   (props changed)
  stable/7/usr.sbin/crashinfo/   (props changed)
  stable/7/usr.sbin/cron/   (props changed)
  stable/7/usr.sbin/cron/cron/   (props changed)
  stable/7/usr.sbin/crunch/   (props changed)
  stable/7/usr.sbin/cxgbtool/   (props changed)
  stable/7/usr.sbin/eeprom/   (props changed)
  stable/7/usr.sbin/extattr/   (props changed)
  stable/7/usr.sbin/faithd/   (props changed)
  stable/7/usr.sbin/fdcontrol/   (props changed)
  stable/7/usr.sbin/fdformat/   (props changed)
  stable/7/usr.sbin/fdread/   (props changed)
  stable/7/usr.sbin/fdwrite/   (props changed)
  stable/7/usr.sbin/fifolog/   (props changed)
  stable/7/usr.sbin/freebsd-update/   (props changed)
  stable/7/usr.sbin/fwcontrol/   (props changed)
  stable/7/usr.sbin/gstat/   (props changed)
  stable/7/usr.sbin/iostat/   (props changed)
  stable/7/usr.sbin/jail/   (props changed)
  stable/7/usr.sbin/jexec/   (props changed)
  stable/7/usr.sbin/jls/   (props changed)
  stable/7/usr.sbin/lpr/   (props changed)
  stable/7/usr.sbin/mailwrapper/   (props changed)
  stable/7/usr.sbin/makefs/   (props changed)
  stable/7/usr.sbin/makefs/ffs/ffs_bswap.c   (props changed)
  stable/7/usr.sbin/makefs/ffs/ffs_subr.c   (props changed)
  stable/7/usr.sbin/makefs/ffs/ufs_bswap.h   (props changed)
  stable/7/usr.sbin/makefs/getid.c   (props changed)
  stable/7/usr.sbin/mergemaster/   (props changed)
  stable/7/usr.sbin/mfiutil/   (props changed)
  stable/7/usr.sbin/mfiutil/mfiutil.8   (props changed)
  stable/7/usr.sbin/mountd/   (props changed)
  stable/7/usr.sbin/mptutil/   (props changed)
  stable/7/usr.sbin/mtree/   (props changed)
  stable/7/usr.sbin/ndiscvt/   (props changed)
  stable/7/usr.sbin/ndp/   (props changed)
  stable/7/usr.sbin/newsyslog/   (props changed)
  stable/7/usr.sbin/nscd/   (props changed)
  stable/7/usr.sbin/ntp/   (props changed)
  stable/7/usr.sbin/pciconf/   (props changed)
  stable/7/usr.sbin/pkg_install/   (props changed)
  stable/7/usr.sbin/pmccontrol/   (props changed)
  stable/7/usr.sbin/pmcstat/   (props changed)
  stable/7/usr.sbin/portsnap/   (props changed)
  stable/7/usr.sbin/powerd/   (props changed)
  stable/7/usr.sbin/ppp/   (props changed)
  stable/7/usr.sbin/pstat/   (props changed)
  stable/7/usr.sbin/pw/   (props changed)
  stable/7/usr.sbin/pwd_mkdb/   (props changed)
  stable/7/usr.sbin/rpc.lockd/   (props changed)
  stable/7/usr.sbin/rpc.statd/   (props changed)
  stable/7/usr.sbin/rpc.yppasswdd/   (props changed)
  stable/7/usr.sbin/rtsold/   (props changed)
  stable/7/usr.sbin/sade/   (props changed)
  stable/7/usr.sbin/service/   (props changed)
  stable/7/usr.sbin/setfib/   (props changed)
  stable/7/usr.sbin/sysinstall/   (props changed)
  stable/7/usr.sbin/syslogd/   (props changed)
  stable/7/usr.sbin/traceroute/   (props changed)
  stable/7/usr.sbin/traceroute6/   (props changed)
  stable/7/usr.sbin/tzsetup/   (props changed)
  stable/7/usr.sbin/ugidfw/   (props changed)
  stable/7/usr.sbin/wpa/wpa_supplicant/   (props changed)
  stable/7/usr.sbin/ypserv/   (props changed)
  stable/7/usr.sbin/zic/   (props changed)

Modified: stable/7/bin/sh/histedit.c
==============================================================================
--- stable/7/bin/sh/histedit.c	Sun Oct 24 22:59:38 2010	(r214306)
+++ stable/7/bin/sh/histedit.c	Sun Oct 24 23:09:00 2010	(r214307)
@@ -411,7 +411,7 @@ fc_replace(const char *s, char *p, char 
 		} else
 			STPUTC(*s++, dest);
 	}
-	STACKSTRNUL(dest);
+	STPUTC('\0', dest);
 	dest = grabstackstr(dest);
 
 	return (dest);

Modified: stable/7/bin/sh/memalloc.c
==============================================================================
--- stable/7/bin/sh/memalloc.c	Sun Oct 24 22:59:38 2010	(r214306)
+++ stable/7/bin/sh/memalloc.c	Sun Oct 24 23:09:00 2010	(r214307)
@@ -295,6 +295,13 @@ grabstackblock(int len)
  * is space for at least one character.
  */
 
+static char *
+growstrstackblock(int n)
+{
+	growstackblock();
+	sstrnleft = stackblocksize() - n;
+	return stackblock() + n;
+}
 
 char *
 growstackstr(void)
@@ -304,12 +311,10 @@ growstackstr(void)
 	len = stackblocksize();
 	if (herefd >= 0 && len >= 1024) {
 		xwrite(herefd, stackblock(), len);
-		sstrnleft = len - 1;
+		sstrnleft = len;
 		return stackblock();
 	}
-	growstackblock();
-	sstrnleft = stackblocksize() - len - 1;
-	return stackblock() + len;
+	return growstrstackblock(len);
 }
 
 
@@ -323,9 +328,7 @@ makestrspace(void)
 	int len;
 
 	len = stackblocksize() - sstrnleft;
-	growstackblock();
-	sstrnleft = stackblocksize() - len;
-	return stackblock() + len;
+	return growstrstackblock(len);
 }
 
 

Modified: stable/7/bin/sh/memalloc.h
==============================================================================
--- stable/7/bin/sh/memalloc.h	Sun Oct 24 22:59:38 2010	(r214306)
+++ stable/7/bin/sh/memalloc.h	Sun Oct 24 23:09:00 2010	(r214307)
@@ -65,9 +65,16 @@ void ungrabstackstr(char *, char *);
 #define stackblock() stacknxt
 #define stackblocksize() stacknleft
 #define STARTSTACKSTR(p)	p = stackblock(), sstrnleft = stackblocksize()
-#define STPUTC(c, p)	(--sstrnleft >= 0? (*p++ = (c)) : (p = growstackstr(), *p++ = (c)))
+#define STPUTC(c, p)	(--sstrnleft >= 0? (*p++ = (c)) : (p = growstackstr(), --sstrnleft, *p++ = (c)))
 #define CHECKSTRSPACE(n, p)	{ if (sstrnleft < n) p = makestrspace(); }
 #define USTPUTC(c, p)	(--sstrnleft, *p++ = (c))
+/*
+ * STACKSTRNUL's use is where we want to be able to turn a stack
+ * (non-sentinel, character counting string) into a C string,
+ * and later pretend the NUL is not there.
+ * Note: Because of STACKSTRNUL's semantics, STACKSTRNUL cannot be used
+ * on a stack that will grabstackstr()ed.
+ */
 #define STACKSTRNUL(p)	(sstrnleft == 0? (p = growstackstr(), *p = '\0') : (*p = '\0'))
 #define STUNPUTC(p)	(++sstrnleft, --p)
 #define STTOPC(p)	p[-1]

Copied: stable/7/tools/regression/bin/sh/expansion/trim4.0 (from r213814, head/tools/regression/bin/sh/expansion/trim4.0)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/7/tools/regression/bin/sh/expansion/trim4.0	Sun Oct 24 23:09:00 2010	(r214307, copy of r213814, head/tools/regression/bin/sh/expansion/trim4.0)
@@ -0,0 +1,15 @@
+# $FreeBSD$
+
+v1=/homes/SOME_USER
+v2=
+v3=C123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
+
+# Trigger bug in VSTRIMRIGHT processing STADJUST() call in expand.c:subevalvar()
+while [ ${#v2} -lt 2000 ]; do
+	v4="${v2} ${v1%/*} $v3"
+	if [ ${#v4} -ne $((${#v2} + ${#v3} + 8)) ]; then
+		echo bad: ${#v4} -ne $((${#v2} + ${#v3} + 8))
+	fi
+	v2=x$v2
+	v3=y$v3
+done



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010242309.o9ON90uV043782>