Skip to content

Commit

Permalink
pushpdb: Don't loop indefinitely if symbol store is broken
Browse files Browse the repository at this point in the history
If the store is not accessible the script should not get stuck
in an inifinite loop trying to create the lock file. This commit
adds another check which aborts the pushpdb attempt in such a
case.

Also fixing 'timeout' invocation to make sure it runs the Windows
tool and not the GNU one when running under Cygwin.

Signed-off-by: Ladi Prosek <lprosek@redhat.com>
  • Loading branch information
ladipro committed May 12, 2017
1 parent 539da1a commit 29a4a5c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Tools/pushpdb.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ if exist "%~n1.inf" (
for /f "tokens=2 delims=," %%t in ('findstr /b "DriverVer" "%~n1.inf"') do (
for /f "tokens=1 delims= " %%v in ('echo %%~t') do (
call :lock_file
if ERRORLEVEL 1 (
exit /b 1
)
echo Pushing %~1 version %%~v to the symbol store.
if "%DSTORE_BUILD_TAG%"=="" (
call "%path_to_systore_exe%" add /s "%store_address%" /f "%~1" /t "%~n1" /v "%%~v" /c "eng" > NUL
Expand All @@ -225,6 +228,8 @@ exit /b 0
:: Creates a lock file with its unique stamp, tries to copy it to the stores
:: location, then compares the lock at the store with its own, if equal then
:: we locked and we continue, if not then we wait for 2 seconds then try again.
:: If we're unable to create a uniquely named file in the store directory we
:: abort the loop and return an error.
:lock_file
:loop
(
Expand All @@ -241,8 +246,14 @@ fc %GUID%.lock "%store_address%\lock" > NUL 2>&1
if not ERRORLEVEL 1 (
exit /b 0
) else (
copy /y %GUID%.lock "%store_address%\%GUID%.lock" > NUL
if ERRORLEVEL 1 (
echo store appears to be broken, aborting
exit /b 1
)
del "%store_address%\%GUID%.lock" > NUL
echo someone else is pushing, waiting for 2 secs
timeout /t 2 /nobreak > NUL
%windir%\system32\timeout /t 2 /nobreak > NUL
goto :loop
)

Expand Down

0 comments on commit 29a4a5c

Please sign in to comment.