Date: Fri, 13 Dec 2019 17:52:10 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r355718 - head/sbin/devd Message-ID: <201912131752.xBDHqAVk008077@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Fri Dec 13 17:52:09 2019 New Revision: 355718 URL: https://svnweb.freebsd.org/changeset/base/355718 Log: Fix $() handling, broken since the beginning at r108014. Due to off-by-one error in brackets counting it consumed the rest of the string, preventing later variables expansions. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sbin/devd/devd.cc Modified: head/sbin/devd/devd.cc ============================================================================== --- head/sbin/devd/devd.cc Fri Dec 13 16:51:56 2019 (r355717) +++ head/sbin/devd/devd.cc Fri Dec 13 17:52:09 2019 (r355718) @@ -681,15 +681,15 @@ config::expand_one(const char *&src, string &dst, bool // This is the escape hatch for passing down shell subcommands if (*src == '(') { dst += '$'; - count = 1; + count = 0; /* If the string ends before ) is matched , return. */ - while (count > 0 && *src) { + do { if (*src == ')') count--; else if (*src == '(') count++; dst += *src++; - } + } while (count > 0 && *src); return; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912131752.xBDHqAVk008077>