From owner-freebsd-current@FreeBSD.ORG Sat Mar 23 08:41:56 2013 Return-Path: Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id D31FD79A; Sat, 23 Mar 2013 08:41:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id D57EFACF; Sat, 23 Mar 2013 08:41:55 +0000 (UTC) Received: from porto.starpoint.kiev.ua (porto-e.starpoint.kiev.ua [212.40.38.100]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id KAA14977; Sat, 23 Mar 2013 10:41:47 +0200 (EET) (envelope-from avg@FreeBSD.org) Received: from localhost ([127.0.0.1]) by porto.starpoint.kiev.ua with esmtp (Exim 4.34 (FreeBSD)) id 1UJK1K-000Dml-Ox; Sat, 23 Mar 2013 10:41:46 +0200 Message-ID: <514D6AC5.8010409@FreeBSD.org> Date: Sat, 23 Mar 2013 10:41:41 +0200 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130321 Thunderbird/17.0.4 MIME-Version: 1.0 To: FreeBSD Current , freebsd-rc@FreeBSD.org Subject: rc.subr: disabling globbing while processing devfs rules X-Enigmail-Version: 1.5.1 Content-Type: text/plain; charset=X-VIET-VPS Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 23 Mar 2013 08:41:56 -0000 Any objections / concerns for the following change? An example. This rule in devfs.rules: add path da* mode 660 group operator and this directory: /data result in the following rule being actually installed: 100 path data group operator mode 660 Of course, I could refine the pattern in the rule, but I shouldn't have to do it, because the pattern is for /dev/ entries, not arbitrary files in the filesystem namespace. commit 7ce5e9ca5c107e2669f18efa472c1ab14999247c Author: Andriy Gapon Date: Sat Mar 23 10:29:39 2013 +0200 rc.subr: disabling globbing while processing devfs rules in devfs_rulesets_from_file() The rules themselves typically have shell-like patterns and it is incorrect when they get replaced with matching filesystem entries. Shell magic by: jilles diff --git a/etc/rc.subr b/etc/rc.subr index f37ede7..9952c82 100644 --- a/etc/rc.subr +++ b/etc/rc.subr @@ -1301,7 +1301,7 @@ make_symlink() # devfs_rulesets_from_file() { - local file _err _me + local file _err _me _opts file="$1" _me="devfs_rulesets_from_file" _err=0 @@ -1314,6 +1314,11 @@ devfs_rulesets_from_file() debug "$_me: no such file ($file)" return 0 fi + + # Disable globbing so that the rule patterns are not expanded + # by accident with matching filesystem entries. + _opts=$-; set -f + debug "reading rulesets from file ($file)" { while read line do @@ -1360,6 +1365,7 @@ devfs_rulesets_from_file() break fi done } < $file + case $_opts in *f*) ;; *) set +f ;; esac return $_err } -- Andriy Gapon