From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Tremer To: development@lists.ipfire.org Subject: Re: [PATCH] pakfire.cgi: Give pakfire time to write lockfile when update/upgrade. Date: Thu, 14 Oct 2021 15:02:00 +0100 Message-ID: <10EE1959-7092-4C2D-B051-7FC827E28C1C@ipfire.org> In-Reply-To: <579a369b-bafc-2549-0831-b4e946c5f4f7@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============3176796584031046596==" List-Id: --===============3176796584031046596== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Reviewed-by: Michael Tremer > On 12 Oct 2021, at 18:23, Peter M=C3=BCller wr= ote: >=20 > Acked-by: Peter M=C3=BCller >=20 >> In case the package list should be grabbed or the system should be >> upgraded, pakfire got called which writes a lock file to prevent from >> beeing launched multiple times and to lock the pakfire.cgi with the nice >> log output. >>=20 >> In case update or upgrade has been performed via WUI, pakfire has been cal= led >> and written the file in the background but the WUI script has been >> executed further and because of a race condition it did not recognize >> the lockfile at this moment because it was not present. >>=20 >> So a simple sleep should to the trick and give pakfire the required time >> to write out it's lockfile. >>=20 >> Fixes #12696. >>=20 >> Signed-off-by: Stefan Schantl >> --- >> html/cgi-bin/pakfire.cgi | 2 ++ >> 1 file changed, 2 insertions(+) >>=20 >> diff --git a/html/cgi-bin/pakfire.cgi b/html/cgi-bin/pakfire.cgi >> index 0cf522ba1..aaf63d469 100644 >> --- a/html/cgi-bin/pakfire.cgi >> +++ b/html/cgi-bin/pakfire.cgi >> @@ -133,8 +133,10 @@ END >>=20 >> } elsif (($cgiparams{'ACTION'} eq 'update') && (! -e $Pakfire::lockfile)) { >> &General::system_background("/usr/local/bin/pakfire", "update", "--force"= , "--no-colors"); >> + sleep(1); >> } elsif (($cgiparams{'ACTION'} eq 'upgrade') && (!-e $Pakfire::lockfile)) { >> &General::system_background("/usr/local/bin/pakfire", "upgrade", "-y", "-= -no-colors"); >> + sleep(1); >> } elsif ($cgiparams{'ACTION'} eq "$Lang::tr{'save'}") { >> $pakfiresettings{"TREE"} =3D $cgiparams{"TREE"}; >>=20 >>=20 --===============3176796584031046596==--