FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.23k stars 212 forks source link

fb_lock_print which is querying DB without attachments: 1) send to STDLOG (instead STDERR) one line of message; 2) ignores errorlevel env. variable [CORE5467] #5737

Open firebird-automations opened 7 years ago

firebird-automations commented 7 years ago

Submitted by: @pavel-zotov

Choose some database _without_ attachments. Then run following batch on 2.5.7, 3.0.2 and 4.0.0 (correct 'fbc' and 'dbnm' variables to be appropriate to your env.):

=== @echo off setlocal enabledelayedexpansion enableextensions

set fbc=C:\\FB\\30sC
set dbnm=C:\\FBTESTING\\qa\\fbt\-repo\\tmp\\E30\.fdb

\!fbc\!\\fb\_lock\_print \-c \-a \-d \!dbnm\! 1\>log 2\>err

for /f "tokens=\*" %%a in \('type log'\) do \(
  echo STDLOG: %%a
\)
for /f "tokens=\*" %%a in \('type err'\) do \(
  echo STDERR: %%a
\)

\!fbc\!\\fb\_lock\_print \-c \-a \!dbnm\! 1\>nul 2\>&1
if errorlevel 1 \(
  echo We have a trouble\.\.\.
\) else \(
  echo WAW\.\.\. All fine, NO errors occured\.\.\.
\)

for /d %%i in \(log,err\) do del %%i 2\>nul

===

On 3.0.2 and 4.0 you will see:

STDLOG: Unable to access lock table. STDERR: File for memory mapping is empty. WAW... All fine, NO errors occured...

On 2.5.7:

STDLOG: Unable to access lock table. STDERR: operating system directive CreateFileMapping failed STDERR: <.... localized message about volume for open file, see below ...> --- [1] WAW... All fine, NO errors occured...

[1]: this is strange line with following text: cyrillic: -Том для открытого файла был изменен извне, поэтому работа с этим файлом невозможна. ascii: \~"Volume for the open file was changed externally, so work with this file is not possible."

IMO, output should be:

STDERR: Unable to access lock table. STDERR: File for memory mapping is empty. We have a trouble...

firebird-automations commented 7 years ago
Modified by: @pavel-zotov Component: LOCK\_PRINT \[ 10120 \]
firebird-automations commented 7 years ago
Modified by: @pavel-zotov description: Run following batch on 2\.5\.7, 3\.0\.2 and 4\.0\.0: === @echo off setlocal enabledelayedexpansion enableextensions set fbc=C:\\FB\\30sC set dbnm=C:\\FBTESTING\\qa\\fbt\-repo\\tmp\\E30\.fdb \!fbc\!\\fb\_lock\_print \-c \-a \-d \!dbnm\! 1\>log 2\>err for /f "tokens=\*" %%a in \('type log'\) do \( echo STDLOG: %%a \) for /f "tokens=\*" %%a in \('type err'\) do \( echo STDERR: %%a \) \!fbc\!\\fb\_lock\_print \-c \-a \!dbnm\! 1\>nul 2\>&1 if errorlevel 1 \( echo We have a trouble\.\.\. \) else \( echo WAW\.\.\. All fine, NO errors occured\.\.\. \) for /d %%i in \(log,err\) do del %%i 2\>nul === On 3\.0\.2 and 4\.0 you will see: STDLOG: Unable to access lock table\. STDERR: File for memory mapping is empty\. WAW\.\.\. All fine, NO errors occured\.\.\. On 2\.5\.7: STDLOG: Unable to access lock table\. STDERR: operating system directive CreateFileMapping failed STDERR: <\.\.\.\. localized message about volume for open file, see below \.\.\.\> \-\-\- \[1\] WAW\.\.\. All fine, NO errors occured\.\.\. \[1\]: this is strange line with following text: cyrillic: \-Том для открытого файла был изменен извне, поэтому работа с этим файлом невозможна\. ascii: \~"Volume for the open file was changed externally, so work with this file is not possible\." IMO, output should be: === STDERR: Unable to access lock table\. STDERR: File for memory mapping is empty\. We have a trouble\.\.\. === =\> Choose some database \_without\_ attachments\. Then run following batch on 2\.5\.7, 3\.0\.2 and 4\.0\.0 \(correct 'fbc' and 'dbnm' variables to be appropriate to your env\.\): === @echo off setlocal enabledelayedexpansion enableextensions set fbc=C:\\FB\\30sC set dbnm=C:\\FBTESTING\\qa\\fbt\-repo\\tmp\\E30\.fdb \!fbc\!\\fb\_lock\_print \-c \-a \-d \!dbnm\! 1\>log 2\>err for /f "tokens=\*" %%a in \('type log'\) do \( echo STDLOG: %%a \) for /f "tokens=\*" %%a in \('type err'\) do \( echo STDERR: %%a \) \!fbc\!\\fb\_lock\_print \-c \-a \!dbnm\! 1\>nul 2\>&1 if errorlevel 1 \( echo We have a trouble\.\.\. \) else \( echo WAW\.\.\. All fine, NO errors occured\.\.\. \) for /d %%i in \(log,err\) do del %%i 2\>nul === On 3\.0\.2 and 4\.0 you will see: STDLOG: Unable to access lock table\. STDERR: File for memory mapping is empty\. WAW\.\.\. All fine, NO errors occured\.\.\. On 2\.5\.7: STDLOG: Unable to access lock table\. STDERR: operating system directive CreateFileMapping failed STDERR: <\.\.\.\. localized message about volume for open file, see below \.\.\.\> \-\-\- \[1\] WAW\.\.\. All fine, NO errors occured\.\.\. \[1\]: this is strange line with following text: cyrillic: \-Том для открытого файла был изменен извне, поэтому работа с этим файлом невозможна\. ascii: \~"Volume for the open file was changed externally, so work with this file is not possible\." IMO, output should be: === STDERR: Unable to access lock table\. STDERR: File for memory mapping is empty\. We have a trouble\.\.\. ===
firebird-automations commented 7 years ago
Modified by: @AlexPeshkoff assignee: Alexander Peshkov \[ alexpeshkoff \]