From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4ZnjMR6Vshz339k for ; Wed, 30 Apr 2025 16:29:55 +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) client-signature RSA-PSS (4096 bits)) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4ZnjMN2TXrz2xw9 for ; Wed, 30 Apr 2025 16:29:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (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) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4ZnjMM4p47z66; Wed, 30 Apr 2025 16:29:51 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1746030591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qo7GbGQFXOsaAww5WUfUNA8KuQHZB/yxPvNBAHn76Cw=; b=fieDnhDtdv8g1nm3hahZfU+7yhzHE5G4UwyVT/PHo3RJ+whnYI5vGGshmbBzEzfmncYDEW 0gO9P0YSirhJyJBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1746030591; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Qo7GbGQFXOsaAww5WUfUNA8KuQHZB/yxPvNBAHn76Cw=; b=g+2WJrUr6GR3no5KelAuCcUYL5Yq3N0uPJv1uIA5dywZ1uh1vP+hPaD7qaetOgHcbj3Nkc kzAKoRlsZB1+oEdTI1p5mDQU96d+R5Pc6KyxfvcF7E1KjFsmUikodgoQUjs8UaYxVCUyNc +2Tyu1JJavkpsGMPRqNo23fF7INEAsFvliWKOb+Fi9RoNx7mqRgnquowO6pC7JVCOh5s3h g/Bt3Mv1Cb95XeKl4KkCIPYMEolxNxJroD9k0VaThYBRUuNFMIw29zIUFyxlIk+QViq7P0 u8kpVY/l9Lq2z3TzgeDA5gxXk0jNsUKKITWgKqDVtBh8216jZ3c00H4xbENAlg== Message-ID: <54e23991-ca8b-463c-ae86-2379199596f0@ipfire.org> Date: Wed, 30 Apr 2025 18:29:47 +0200 Precedence: list List-Id: List-Subscribe: , List-Unsubscribe: , List-Post: List-Help: Sender: Mail-Followup-To: MIME-Version: 1.0 Subject: Re: [PATCH] core194: Fix cert name and change other check to ! -z To: Nick Howitt , Michael Tremer References: <20250430141746.44261-1-adolf.belka@ipfire.org> <09f1b0d4-a0ad-43ae-b71a-4c1d53d95b6d@howitts.co.uk> Content-Language: en-GB Cc: "IPFire: Development-List" From: Adolf Belka In-Reply-To: <09f1b0d4-a0ad-43ae-b71a-4c1d53d95b6d@howitts.co.uk> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Nick, On 30/04/2025 16:53, Nick Howitt wrote: > Can I ask what you are testing here with the "! -z"? Typically you would use "-n" rather than "! -z", but both are tests for strings and not files - https://tldp.org/LDP/abs/html/comparison-ops.html. "! -s" would test for a zero length file and if the file exists at all. Thanks for the input. You are absolutely correct. I tested my script but only with index.txt empty. I just tried it with something in index.txt and it still detected it as empty because, as you point out -s is for the file test while -z is for the string test. So in my case it is checking if the string "/var/ipfire/certs/index.txt" is not empty, which of course it will never be empty. Duuuh. I just tried it with -z replaced by -s and that properly detects if the file is empty or not. Hi Michael, Could you please change the ! -z to ! -s in my last patch or should I send out a v2 patch? Regards, Adolf. > > Nick > > On 30/04/2025 15:17, Adolf Belka wrote: >> - Error in hostcert extension >> - -z gives true if not zero and we need true if it is zero so had to add not command. >> - I thought I had tested the original patch of this change but obviously not because >> there was missing whitespace and filenames not quoted plus the fixes I have added >> in this patch. >> - I definitely tested this out this time by copying it from the update.sh and applying >> it to my vm system. >> >> Tested-by: Adolf Belka >> Signed-off-by: Adolf Belka >> --- >> config/rootfiles/core/194/update.sh | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/config/rootfiles/core/194/update.sh b/config/rootfiles/core/194/update.sh >> index b758c7bf6..8fbf22750 100644 >> --- a/config/rootfiles/core/194/update.sh >> +++ b/config/rootfiles/core/194/update.sh >> @@ -104,7 +104,7 @@ ldconfig >> /usr/local/bin/filesystem-cleanup >> >> # Increment ipsec serial file if x509 certificates present and no content in index.txt >> -if [ -e "/var/ipfire/certs/hostcert.pm" ] && [ -z "/var/ipfire/certs/index.txt" ]; then >> +if [ -e "/var/ipfire/certs/hostcert.pem" ] && [ ! -z "/var/ipfire/certs/index.txt" ]; then >> sed -i "s/01/02/" /var/ipfire/certs/serial >> fi >> >