git: 8d7221ca2dd5 - main - sh: when loading profile, read only .sh files.

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Sat, 22 Oct 2022 17:05:40 UTC
The branch main has been updated by des:

URL: https://cgit.FreeBSD.org/src/commit/?id=8d7221ca2dd5e0b6c633761b314cffed82ddca72

commit 8d7221ca2dd5e0b6c633761b314cffed82ddca72
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2022-10-18 13:28:23 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2022-10-22 17:05:31 +0000

    sh: when loading profile, read only .sh files.
    
    Reviewers: jilles, eugen_grosbein.net, cy
    
    Subscribers: imp
    
    Differential Revision: https://reviews.freebsd.org/D37034
---
 bin/sh/profile | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/bin/sh/profile b/bin/sh/profile
index ac6acced6596..5b8a57d4b7b2 100644
--- a/bin/sh/profile
+++ b/bin/sh/profile
@@ -13,17 +13,12 @@
 # Allow terminal messages
 # mesg y
 
-# Load each file in /etc/profile.d/, then /usr/local/etc/profile, then
-# each file in /usr/local/etc/profile.d/.
+# Load each .sh file in /etc/profile.d/, then /usr/local/etc/profile,
+# then each .sh file in /usr/local/etc/profile.d/.
 _loaded=${_loaded:-/etc/profile}
 export _loaded
 for _dir in /etc /usr/local/etc ; do
-	for _file in "${_dir}"/profile "${_dir}"/profile.d/* ; do
-		case ${_file} in
-		*[~#]|*.OLD|*.bak|*.orig|*,v)
-			continue
-			;;
-		esac
+	for _file in "${_dir}"/profile "${_dir}"/profile.d/*.sh ; do
 		if [ -f "${_file}" ] ; then
 			case :${_loaded}: in
 			*:"${_file}":*)