Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Sep 2018 15:32:54 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338888 - head/sbin/devd
Message-ID:  <201809221532.w8MFWsPk073665@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Sat Sep 22 15:32:53 2018
New Revision: 338888
URL: https://svnweb.freebsd.org/changeset/base/338888

Log:
  We don't need shell protection for when we're expanding matches.
  Don't add it. This should fix when we do regepx matches against
  variables we've set and fix wifi bring up.
  
  PR: 231441
  Approved by: re@ (kib)
  Differential Revision: https://reviews.freebsd.org/D17267

Modified:
  head/sbin/devd/devd.cc
  head/sbin/devd/devd.hh

Modified: head/sbin/devd/devd.cc
==============================================================================
--- head/sbin/devd/devd.cc	Sat Sep 22 13:17:30 2018	(r338887)
+++ head/sbin/devd/devd.cc	Sat Sep 22 15:32:53 2018	(r338888)
@@ -666,7 +666,7 @@ config::shell_quote(const string &s)
 }
 
 void
-config::expand_one(const char *&src, string &dst)
+config::expand_one(const char *&src, string &dst, bool is_shell)
 {
 	int count;
 	string buffer;
@@ -705,7 +705,7 @@ config::expand_one(const char *&src, string &dst)
 	do {
 		buffer += *src++;
 	} while (is_id_char(*src));
-	dst.append(shell_quote(get_variable(buffer)));
+	dst.append(is_shell ? shell_quote(get_variable(buffer)) : get_variable(buffer));
 }
 
 const string
@@ -731,7 +731,7 @@ config::expand_string(const char *src, const char *pre
 		}
 		dst.append(src, var_at - src);
 		src = var_at;
-		expand_one(src, dst);
+		expand_one(src, dst, prepend == NULL);
 	}
 
 	if (append != NULL)

Modified: head/sbin/devd/devd.hh
==============================================================================
--- head/sbin/devd/devd.hh	Sat Sep 22 13:17:30 2018	(r338887)
+++ head/sbin/devd/devd.hh	Sat Sep 22 15:32:53 2018	(r338888)
@@ -172,7 +172,7 @@ class config (protected)
 	void sort_vector(std::vector<event_proc *> &);
 	void parse_one_file(const char *fn);
 	void parse_files_in_dir(const char *dirname);
-	void expand_one(const char *&src, std::string &dst);
+	void expand_one(const char *&src, std::string &dst, bool is_shell);
 	std::string shell_quote(const std::string &s);
 	bool is_id_char(char) const;
 	bool chop_var(char *&buffer, char *&lhs, char *&rhs) const;



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