From patchwork Fri Dec 6 16:42:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tremer X-Patchwork-Id: 8300 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4Y4cVr1bPlz3wfS for ; Fri, 6 Dec 2024 16:42:28 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature ECDSA (secp384r1) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "E6" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4Y4cVp4ZC2z2NX; Fri, 6 Dec 2024 16:42:26 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4Y4cVp3DRzz33v6; Fri, 6 Dec 2024 16:42:26 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R11" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4Y4cVm0Lrvz2xfQ for ; Fri, 6 Dec 2024 16:42:24 +0000 (UTC) Received: from michael.haj.ipfire.org (michael.haj.ipfire.org [172.28.1.242]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "michael.haj.ipfire.org", Issuer "E6" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4Y4cVl3qb4z4YX; Fri, 6 Dec 2024 16:42:23 +0000 (UTC) Received: by michael.haj.ipfire.org (Postfix, from userid 0) id 4Y4cVl2MBvzTgKx; Fri, 6 Dec 2024 16:42:23 +0000 (UTC) From: Michael Tremer To: development@lists.ipfire.org Subject: [PATCH 2/3] initscripts: readhash: Only strip quotes if they exist Date: Fri, 6 Dec 2024 16:42:16 +0000 Message-Id: <20241206164217.3840140-2-michael.tremer@ipfire.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20241206164217.3840140-1-michael.tremer@ipfire.org> References: <20241206164217.3840140-1-michael.tremer@ipfire.org> MIME-Version: 1.0 Message-ID-Hash: CEDOYEADFWR4DYZTVO6IHBVBNNWTUM5I X-Message-ID-Hash: CEDOYEADFWR4DYZTVO6IHBVBNNWTUM5I X-MailFrom: root@michael.haj.ipfire.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Michael Tremer X-Mailman-Version: 3.3.8 Precedence: list List-Id: IPFire development talk Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: Michael Tremer --- src/initscripts/system/functions | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/initscripts/system/functions b/src/initscripts/system/functions index 125aa1dc6..094e35495 100644 --- a/src/initscripts/system/functions +++ b/src/initscripts/system/functions @@ -899,7 +899,6 @@ readhash() { local line while read -r line; do - # Skip Blank Lines if [[ ${line} =~ ^[[:space:]]*$ ]]; then continue @@ -932,8 +931,12 @@ readhash() { fi # strip leading and trailing single quotes - val="${val#\'}" - val="${val%\'}" + case "${val}" in + '*') + val="${val#\'}" + val="${val%\'}" + ;; + esac printf -v "${array}[${key}]" "%s" "${val}" done < "${file}"