From patchwork Mon Nov 15 20:23:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schantl X-Patchwork-Id: 4842 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 (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4HtLHj28TMz3wcw for ; Mon, 15 Nov 2021 20:23:45 +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 ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4HtLHg6J6WzN6; Mon, 15 Nov 2021 20:23:43 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4HtLHg0v53z2yTq; Mon, 15 Nov 2021 20:23:43 +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 (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4HtLHd3bM7z2xYj for ; Mon, 15 Nov 2021 20:23:41 +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 ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4HtLHc63NmzN6; Mon, 15 Nov 2021 20:23:40 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1637007821; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=3Rm7LLkaw0v8Eo5s+6AyT9s3tdNu88Gxfw+TP3+Kh+0=; b=hntCijaboULqWM7PPGpToF6bi6i8q2p/KbiSjhVsK8M3Tge8MTKeBs02qExAyqCrm4BsJk A2Xh4DMmvOvRHeCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1637007821; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=3Rm7LLkaw0v8Eo5s+6AyT9s3tdNu88Gxfw+TP3+Kh+0=; b=TVmevWxkrYGZ1XFTNuuU6Rz4pJdV4pfWu2BDcpf5JwU3Q7kNW7IwHj8WHEF7gXImUwNjyT uZuzvh1OWpGFrn4eR3b1ho7MD0wa78xENwiSVBnCLJaxSEjJFQz+s2J0UDfaOwgCE+8Ebv fewheL0Dvi1HMYcd+xlNI5u9FH9yhNnO7vyFCSr7M/alUzyGjC04T3Hb1dWXucHZ/foETx Dmm0NhyYqW9JVyh0SYtzovLF7Aybp/tj60l5w1EDyPVmVoiTnTupKbZdk78ZiiOPUMJkpT KAOCeUD4TtvtYmtvQeG5qvt19Gw+9VyzurAweqnu0KxCNUp8dTGBgAal8qq4nA== From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH] pakfire.cgi: Bring back old logic for log displaying Date: Mon, 15 Nov 2021 21:23:33 +0100 Message-Id: <20211115202333.2664-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" Trying to get rid of the system backpipe check if a pakfire is running does not work very well. It simply makes the code more complex and only introduced some new problems. This commit switches back to the old logic which worked well in the past. Signed-off-by: Stefan Schantl Reviewed-by: Bernhard Bitsch Tested-by: Bernhard Bitsch --- html/cgi-bin/pakfire.cgi | 57 +++++++--------------------------------- 1 file changed, 10 insertions(+), 47 deletions(-) diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi index f2381f031..4d6eee284 100644 --- a/html/cgi-bin/pakfire.cgi +++ b/html/cgi-bin/pakfire.cgi @@ -44,8 +44,6 @@ $cgiparams{'VALID'} = ''; $cgiparams{'INSPAKS'} = ''; $cgiparams{'DELPAKS'} = ''; -my $page_lock; - sub refreshpage{&Header::openbox( 'Waiting', 1, "" );print "

$Lang::tr{'pagerefresh'}
";&Header::closebox();} &Header::getcgihash(\%cgiparams); @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', 1, " - - - $Lang::tr{ - - - - $Lang::tr{'pakfire working'} - - - -END - &Header::closebox(); - - # Infinite loop to lock the page until pakfire lockfile is present. - while($page_lock) { - unless (-e $Pakfire::lockfile) { - sleep(1); - } else { - # Release page lock. - undef($page_lock); - - # Break loop. - last; - } - } - - # Perform page reload. - print "\n"; - exit; -} +# Check if pakfire is already running. +# +# The system backpipe command is safe, because no user input is computed. +my $pid = `pidof pakfire`; -# Check if pakfire is already running. In this case a lockfile is present. -if (-e $Pakfire::lockfile) { +if ($pid) { &Header::openbox( 'Waiting', 1, "" ); print <