From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Schantl To: development@lists.ipfire.org Subject: Re: [PATCH] pakfire.cgi: Bring back old logic for log displaying Date: Tue, 16 Nov 2021 19:36:48 +0100 Message-ID: <0417b6a1637eff70598dccdc7dbbf9380a683f56.camel@ipfire.org> In-Reply-To: <8ae94ef5-399d-b827-0cdb-2d18d032c233@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============8197393214246807913==" List-Id: --===============8197393214246807913== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hello Bernhard, thanks for pointing this out. The "page refresh" is defined and performed by the following line: >> &Header::openbox( 'Waiting', 1, "" ); << This kind of refresh logic is untouched and worked well since many years. The "http-equiv" tells the browser to do a refresh of the page and the content contains the amount in seconds to wait. (See more here:=C2=A0https://www.w3schools.com/tags/att_meta_http_equiv.asp) I didn't noticed any problems with Firefox as browser on various linux distros. A very easy test would be to decrease the time interval (minimum is "1") to force more periodic page reloads and check if the log output go further. If everything works well we may need to think about a new interval value because 10 seconds nowadays may be to long for the high speed hardware out there. Best regards, -Stefan > Hello Stefan, >=20 > the logs are only displayed once ( the last 20 lines ). > The aim of the change was a refreshing of this log to show the > progress=20 > of the pakfire function, if I remember right. > I tried to implement this, but with no success. :( >=20 > - Bernhard >=20 > Am 16.11.2021 um 05:47 schrieb Stefan Schantl: > > Hello Bernhard, > >=20 > > thanks for testing and your feedback. > > > Reviewed-by: Bernhard Bitsch > > > Tested-by: Bernhard Bitsch > > >=20 > > > Okay, the old behaviour is reinstalled. Remains the problem with > > > the > > > page reload. > >=20 > > I'm sorry I do not exactly understand which problem do you mean > > here - > > please provide some more details. > >=20 > > A big thanks in advance, > >=20 > > -Stefan > >=20 > > >=20 > > > Am 15.11.2021 um 21:23 schrieb Stefan Schantl: > > > > 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. > > > >=20 > > > > This commit switches back to the old logic which worked well in > > > > the > > > > past. > > > >=20 > > > > Signed-off-by: Stefan Schantl > > > > --- > > > > =C2=A0=C2=A0 html/cgi-bin/pakfire.cgi | 57 +++++++-------------------= ---- > > > > ----- > > > > ----- > > > > =C2=A0=C2=A0 1 file changed, 10 insertions(+), 47 deletions(-) > > > >=20 > > > > 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'} =3D ''; > > > > =C2=A0=C2=A0 $cgiparams{'INSPAKS'} =3D ''; > > > > =C2=A0=C2=A0 $cgiparams{'DELPAKS'} =3D ''; > > > > =C2=A0=C2=A0=20 > > > > -my $page_lock; > > > > - > > > > =C2=A0=C2=A0 sub refreshpage{&Header::openbox( 'Waiting', 1, " > > > equiv=3D'refresh' content=3D'1;'>" );print "
> > > src=3D'/images/clock.gif' alt=3D'' />
> > > color=3D'red'>$Lang::tr{'pagerefresh'}
";&Header:: > > > > clos > > > > ebox();} > > > > =C2=A0=C2=A0=20 > > > > =C2=A0=C2=A0 &Header::getcgihash(\%cgiparams); > > > > @@ -59,9 +57,8 @@ sub refreshpage{&Header::openbox( 'Waiting', > > > > 1, > > > > " > > > =C2=A0=C2=A0 if (($cgiparams{'ACTION'} eq 'install') && (! -e > > > > $Pakfire::lockfile)) { > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0my @pkgs =3D sp= lit(/\|/, $cgiparams{'INSPAKS'}); > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if ("$cgiparams= {'FORCE'}" eq "on") { > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0# Lock the page. > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0$page_lock =3D "1"; > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&General::system_background("/usr/local/bin/= pa > > > > kfire > > > > ", "install", "--non-interactive", "--no-colors", @pkgs); > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0sleep(1); > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} else { > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&Header::openbox("100%", "center", > > > > $Lang::tr{'request'}); > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0my @output =3D > > > > &General::system_output("/usr/local/bin/pakfire", > > > > "resolvedeps", "- > > > > -no-colors", @pkgs); > > > > @@ -98,9 +95,8 @@ END > > > > =C2=A0=C2=A0 } elsif (($cgiparams{'ACTION'} eq 'remove') && (! -e > > > > $Pakfire::lockfile)) { > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0my @pkgs =3D sp= lit(/\|/, $cgiparams{'DELPAKS'}); > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if ("$cgiparams= {'FORCE'}" eq "on") { > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0# Lock the page. > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0$page_lock =3D "1"; > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&General::system_background("/usr/local/bin/= pa > > > > kfire > > > > ", "remove", "--non-interactive", "--no-colors", @pkgs); > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0sleep(1); > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} else { > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&Header::openbox("100%", "center", > > > > $Lang::tr{'request'}); > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0my @output =3D > > > > &General::system_output("/usr/local/bin/pakfire", > > > > "resolvedeps", "- > > > > -no-colors", @pkgs); > > > > @@ -136,13 +132,11 @@ END > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > > > > =C2=A0=C2=A0=20 > > > > =C2=A0=C2=A0 } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e > > > > $Pakfire::lockfile)) { > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# Set variable to lock the= page. > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$page_lock =3D "1"; > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&General::syste= m_background("/usr/local/bin/pakfire", > > > > "update", "--force", "--no-colors"); > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0sleep(1); > > > > =C2=A0=C2=A0 } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e > > > > $Pakfire::lockfile)) { > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# Lock the page. > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$page_lock =3D "1"; > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&General::syste= m_background("/usr/local/bin/pakfire", > > > > "upgrade", "-y", "--no-colors"); > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0sleep(1); > > > > =C2=A0=C2=A0 } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0$pakfiresetting= s{"TREE"} =3D $cgiparams{"TREE"}; > > > > =C2=A0=C2=A0=20 > > > > @@ -156,6 +150,7 @@ END > > > > =C2=A0=C2=A0=20 > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# Update lists > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&General::system_background("/usr/local/bin/= pa > > > > kfire > > > > ", "update", "--force", "--no-colors"); > > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0sleep(1); > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > > > > =C2=A0=C2=A0 } > > > > =C2=A0=C2=A0=20 > > > > @@ -177,44 +172,12 @@ if ($errormessage) { > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&Header::closeb= ox(); > > > > =C2=A0=C2=A0 } > > > > =C2=A0=C2=A0=20 > > > > -# Check if a page lock is required. > > > > -if ($page_lock) { > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&Header::openbox('Waiting'= , 1, ,); > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0print < > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 > > > > - > > > > -=C2=A0=C2=A0=C2=A0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=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0$Lang::tr{'pakfire > > > > working'} > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
> > > > -END > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&Header::closebox(); > > > > - > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# Infinite loop to lock th= e page until pakfire lockfile > > > > is > > > > present. > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0while($page_lock) { > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0unless (-e $Pakfire::lockfile) { > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0sleep= (1); > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0} else { > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# Rel= ease page lock. > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0undef= ($page_lock); > > > > - > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# Bre= ak loop. > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0last; > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0} > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} > > > > - > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0# Perform page reload. > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0print "\n"; > > > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0exit; > > > > -} > > > > +# Check if pakfire is already running. > > > > +# > > > > +# The system backpipe command is safe, because no user input > > > > is > > > > computed. > > > > +my $pid =3D `pidof pakfire`; > > > > =C2=A0=C2=A0=20 > > > > -# Check if pakfire is already running. In this case a lockfile > > > > is > > > > present. > > > > -if (-e $Pakfire::lockfile) { > > > > +if ($pid) { > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0&Header::openbo= x( 'Waiting', 1, " > > > equiv=3D'refresh' > > > > content=3D'10;'>" ); > > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0print < > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 > > > >=20 > >=20 --===============8197393214246807913==--