Date: Fri, 27 Dec 2019 18:52:43 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r356132 - stable/12/sbin/devd Message-ID: <201912271852.xBRIqhTW082824@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Fri Dec 27 18:52:43 2019 New Revision: 356132 URL: https://svnweb.freebsd.org/changeset/base/356132 Log: MFC r355718: 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. Modified: stable/12/sbin/devd/devd.cc Directory Properties: stable/12/ (props changed) Modified: stable/12/sbin/devd/devd.cc ============================================================================== --- stable/12/sbin/devd/devd.cc Fri Dec 27 17:55:56 2019 (r356131) +++ stable/12/sbin/devd/devd.cc Fri Dec 27 18:52:43 2019 (r356132) @@ -682,15 +682,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?201912271852.xBRIqhTW082824>