diff --git a/.github/workflows/tzdata-update.yml b/.github/workflows/tzdata-update.yml new file mode 100644 index 0000000000..08842f048e --- /dev/null +++ b/.github/workflows/tzdata-update.yml @@ -0,0 +1,37 @@ +name: tzdata-update + +on: + schedule: + - cron: '0 11 * * *' + +jobs: + tzdata-update: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Checkout ICU + run: git clone --depth 1 https://github.com/unicode-org/icu-data.git -b master /tmp/icu-checkout + + - name: Check and update + run: | + VERSION=`ls /tmp/icu-checkout/tzdata/icunew/ -r1a |head -1` + echo Last version: $VERSION + + if [ "$VERSION" == "`cat extern/icu/tzdata/version.txt`" ] + then + exit + fi + + echo $VERSION > extern/icu/tzdata/version.txt + extern/icu/tzdata/update.sh + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: Updata tzdata. + title: Updata tzdata. + assignees: asfernandes + branch: work/tzdata-update diff --git a/builds/install/arch-specific/solaris/CS/prototype.in b/builds/install/arch-specific/solaris/CS/prototype.in index 1443a4748a..360c6bc1cf 100644 --- a/builds/install/arch-specific/solaris/CS/prototype.in +++ b/builds/install/arch-specific/solaris/CS/prototype.in @@ -18,7 +18,7 @@ d none @prefix@ 0751 firebird firebird v CONFIG.prsv @prefix@/security2.fdb=$SRCDIR/security2.fdb 0660 firebird firebird v CONFIG.prsv @prefix@/firebird.conf=$SRCDIR/misc/firebird.conf 0444 firebird firebird -v CONFIG.prsv @prefix@/databases.conf=$SRCDIR/../../builds/install/misc/databases.conf.in 0444 firebird firebird +v CONFIG.prsv @prefix@/databases.conf=$SRCDIR/../../builds/install/misc/databases.conf 0444 firebird firebird v CONFIG.prsv @prefix@/intl/fbintl.conf=$SRCDIR/misc/fbintl.conf 0644 firebird firebird f none @prefix@/CHANGELOG.md=$SRCDIR/../../CHANGELOG.md 0644 firebird firebird f none @prefix@/README.md=$SRCDIR/../../README.md 0644 firebird firebird diff --git a/builds/install/arch-specific/solaris/SS/prototype.in b/builds/install/arch-specific/solaris/SS/prototype.in index bb928b98a3..35bd67adb8 100644 --- a/builds/install/arch-specific/solaris/SS/prototype.in +++ b/builds/install/arch-specific/solaris/SS/prototype.in @@ -18,7 +18,7 @@ d none @prefix@ 0755 firebird firebird v CONFIG.prsv @prefix@/security2.fdb=$SRCDIR/security2.fdb 0660 firebird firebird v CONFIG.prsv @prefix@/firebird.conf=$SRCDIR/misc/firebird.conf 0644 firebird firebird -v CONFIG.prsv @prefix@/databases.conf=$SRCDIR/../../builds/install/misc/databases.conf.in 0544 firebird firebird +v CONFIG.prsv @prefix@/databases.conf=$SRCDIR/../../builds/install/misc/databases.conf 0544 firebird firebird v CONFIG.prsv @prefix@/intl/fbintl.conf=$SRCDIR/misc/fbintl.conf 0644 firebird firebird f none @prefix@/CHANGELOG.md=$SRCDIR/../../CHANGELOG.md 0644 firebird firebird f none @prefix@/README.md=$SRCDIR/../../README.md 0644 firebird firebird diff --git a/builds/install/arch-specific/win32/After_Installation.url b/builds/install/arch-specific/win32/After_Installation.url index 430c312307..c5d29c42a6 100644 --- a/builds/install/arch-specific/win32/After_Installation.url +++ b/builds/install/arch-specific/win32/After_Installation.url @@ -1,2 +1,2 @@ [InternetShortcut] -URL=http://www.firebirdsql.org/afterinstall/$MAJOR$MINOR$RELEASE \ No newline at end of file +URL=http://www.firebirdsql.org/afterinstall/{#FB_MAJOR_VER}{#FB_MINOR_VER}{#FB_REV_NO} diff --git a/builds/install/arch-specific/win32/BuildExecutableInstall.bat b/builds/install/arch-specific/win32/BuildExecutableInstall.bat index db2b0426aa..095c01c752 100644 --- a/builds/install/arch-specific/win32/BuildExecutableInstall.bat +++ b/builds/install/arch-specific/win32/BuildExecutableInstall.bat @@ -22,6 +22,8 @@ ::============================================================================ :SET_PARAMS +::========= + @echo off :: reset ERRLEV to clear error from last run in same cmd shell set ERRLEV=0 @@ -35,21 +37,6 @@ set FBBUILD_ISX_PACK=0 if not defined FB2_SNAPSHOT (set FB2_SNAPSHOT=0) -:: Set our package number at 0 and increment every -:: time we rebuild in a single session -if not defined FBBUILD_PACKAGE_NUMBER ( -set FBBUILD_PACKAGE_NUMBER=0 -) else ( -set /A FBBUILD_PACKAGE_NUMBER+=1 -) -@echo Setting FBBUILD_PACKAGE_NUMBER to %FBBUILD_PACKAGE_NUMBER% - -::If a suffix is defined (usually for an RC) ensure it is prefixed correctly. -if defined FBBUILD_FILENAME_SUFFIX ( -if not "%FBBUILD_FILENAME_SUFFIX:~0,1%"=="_" ( -(set FBBUILD_FILENAME_SUFFIX=_%FBBUILD_FILENAME_SUFFIX%) -) -) :: See what we have on the command line @@ -61,39 +48,12 @@ for %%v in ( %* ) do ( ( if /I "%%v"=="ALL" ( (set FBBUILD_ZIP_PACK=1) & (set FBBUILD_ISX_PACK=1) ) ) ) -:: Now check whether we are debugging the InnoSetup script - -@if %FB2_ISS_DEBUG% equ 0 (@set ISS_BUILD_TYPE=iss_release) else (@set ISS_BUILD_TYPE=iss_debug) -@if %FB2_ISS_DEBUG% equ 0 (@set ISS_COMPRESS=compression) else (@set ISS_COMPRESS=nocompression) - -(@set ISS_EXAMPLES=examples) -@if %FB2_ISS_DEBUG% equ 1 ( - @if %FB2_EXAMPLES% equ 0 (@set ISS_EXAMPLES=noexamples) -) - ::Are we doing a snapshot build? If so we always do less work. if "%FB2_SNAPSHOT%"=="1" ( - (set FB_ISS_EXAMPLES=noexamples) (set FBBUILD_ISX_PACK=0) ) -:: Set up our final destination -set FBBUILD_INSTALL_IMAGES=%FB_ROOT_PATH%\builds\install_images -if not exist %FBBUILD_INSTALL_IMAGES% (mkdir %FBBUILD_INSTALL_IMAGES%) - - - -:: Determine Product Status -set FBBUILD_PROD_STATUS= -@type %FB_ROOT_PATH%\src\jrd\build_no.h | findstr /I UNSTABLE > nul && ( -set FBBUILD_PROD_STATUS=DEV) || type %FB_ROOT_PATH%\src\jrd\build_no.h | findstr /I ALPHA > nul && ( -set FBBUILD_PROD_STATUS=DEV) || type %FB_ROOT_PATH%\src\jrd\build_no.h | findstr /I BETA > nul && ( -set FBBUILD_PROD_STATUS=PROD) || type %FB_ROOT_PATH%\src\jrd\build_no.h | findstr /I "Release Candidate" > nul && ( -set FBBUILD_PROD_STATUS=PROD) || type %FB_ROOT_PATH%\src\jrd\build_no.h | findstr "RC" > nul && ( -set FBBUILD_PROD_STATUS=PROD) || type %FB_ROOT_PATH%\src\jrd\build_no.h | findstr /I "Final" > nul && ( -set FBBUILD_PROD_STATUS=PROD) - ::End of SET_PARAMS ::----------------- @goto :EOF @@ -110,6 +70,19 @@ set FBBUILD_PROD_STATUS=PROD) @echo o Checking for unix2dos... (cmd /c "unix2dos.exe --version 2>&1 | findstr version > nul" ) || ( call :ERROR Could not locate unix2dos && @goto :EOF ) +@for /f "usebackq tokens=*" %%c in (`where /f touch 2^>nul`) do set TOUCH_COMMAND=%%c +if defined TOUCH_COMMAND ( + @%TOUCH_COMMAND% --version nul 2>nul + if not errorlevel 1 ( + @echo o POSIX touch utility found at %TOUCH_COMMAND% + ) else ( @set TOUCH_COMMAND= ) +) + +@for /f "usebackq tokens=*" %%c in (`where /f md5sum 2^>nul`) do set MD5_COMMAND=%%c +if defined MD5_COMMAND ( + @echo o POSIX md5sum utility found at %MD5_COMMAND% +) + if %FBBUILD_ZIP_PACK% EQU 1 ( if not defined SEVENZIP ( call :ERROR SEVENZIP environment variable is not defined. @@ -117,33 +90,40 @@ if %FBBUILD_ZIP_PACK% EQU 1 ( ) else (@echo o Compression utility found.) ) +if %FBBUILD_ISX_PACK% NEQ 1 goto :SKIP_INNO -if %FBBUILD_ISX_PACK% EQU 1 ( - if NOT DEFINED INNO5_SETUP_PATH ( - call :ERROR INNO5_SETUP_PATH variable not defined - @goto :EOF - ) else ( - @echo o Inno Setup found at %INNO5_SETUP_PATH%. - ) +if defined INNO5_SETUP_PATH ( + set ISCC_COMMAND=%INNO5_SETUP_PATH%\iscc.exe ) +:: If the environment variable is not set let's search in PATH +if not defined ISCC_COMMAND ( + @for /f "usebackq tokens=*" %%c in (`where /f iscc 2^>nul`) do set ISCC_COMMAND=%%c +) +if not defined ISCC_COMMAND ( + @echo Required Inno Setup compiler not found + @exit /b 1 +) +@echo o Inno Setup found as %ISCC_COMMAND%. + +:SKIP_INNO if not defined WIX ( - call :ERROR WIX not defined. WiX is needed to build the MSI kits of the CRT runtimes. - @goto :EOF + @echo. + @echo The WIX environment var not defined. + @echo WiX is needed to build the MSI kits of the CRT runtimes. + @echo. ) else ( @echo o WiX found at "%WIX%". ) -if not DEFINED FB_EXTERNAL_DOCS ( +if not defined FB_EXTERNAL_DOCS ( @echo. @echo The FB_EXTERNAL_DOCS environment var is not defined @echo It should point to the directory containing the relevant release notes @echo in adobe pdf format. @echo. - @echo Subsequent script execution will be cancelled. - @echo. - cancel_script > nul 2>&1 - goto :EOF +) else ( + @echo o Package will include documentation from "%FB_EXTERNAL_DOCS%". ) @@ -152,94 +132,69 @@ if not DEFINED FB_EXTERNAL_DOCS ( @goto :EOF -:SED_MAGIC -:: Do some sed magic to make sure that the final product -:: includes the version string in the filename. -:: If the Firebird Unix tools for Win32 aren't on -:: the path this will fail! Use of the cygwin tools has not -:: been tested and may produce unexpected results. -::======================================================== -find "#define PRODUCT_VER_STRING" %FB_ROOT_PATH%\src\jrd\build_no.h > %temp%.\b$1.txt -sed -n -e s/\"//g -e s/"#define PRODUCT_VER_STRING "//w%temp%.\b$2.txt %temp%.\b$1.txt -for /f "tokens=*" %%a in ('type %temp%.\b$2.txt') do set FBBUILD_PRODUCT_VER_STRING=%%a +:SET_VERSION +::========== -find "#define FB_MAJOR_VER" %FB_ROOT_PATH%\src\jrd\build_no.h > %temp%.\b$1.txt -sed -n -e s/\"//g -e s/"#define FB_MAJOR_VER "//w%temp%.\b$2.txt %temp%.\b$1.txt -for /f "tokens=*" %%a in ('type %temp%.\b$2.txt') do set FB_MAJOR_VER=%%a +:: Cut off everything that is not #define to let Inno Setup use it +findstr /B /L "#define" "%FB_ROOT_PATH%\src\jrd\build_no.h" >"%FB_ROOT_PATH%\gen\jrd\build_no.h" +:: Read version parameters from build_no.h +for /F "tokens=2*" %%a in (%FB_ROOT_PATH%\gen\jrd\build_no.h) do ( +@echo Setting %%a to %%~b +SET %%a=%%~b +) -find "#define FB_MINOR_VER" %FB_ROOT_PATH%\src\jrd\build_no.h > %temp%.\b$1.txt -sed -n -e s/\"//g -e s/"#define FB_MINOR_VER "//w%temp%.\b$2.txt %temp%.\b$1.txt -for /f "tokens=*" %%a in ('type %temp%.\b$2.txt') do set FB_MINOR_VER=%%a +:: Set our package number at 0 and increment every +:: time we rebuild in a single session +if not defined FBBUILD_PACKAGE_NUMBER ( +set FBBUILD_PACKAGE_NUMBER=0 +) else ( +set /A FBBUILD_PACKAGE_NUMBER+=1 +) +@echo Setting FBBUILD_PACKAGE_NUMBER to %FBBUILD_PACKAGE_NUMBER% -find "#define FB_REV_NO" %FB_ROOT_PATH%\src\jrd\build_no.h > %temp%.\b$1.txt -sed -n -e s/\"//g -e s/"#define FB_REV_NO "//w%temp%.\b$2.txt %temp%.\b$1.txt -for /f "tokens=*" %%a in ('type %temp%.\b$2.txt') do set FB_REV_NO=%%a +:: If a suffix is defined (usually for an RC) ensure it is prefixed correctly. +if defined FBBUILD_FILENAME_SUFFIX ( +if not "%FBBUILD_FILENAME_SUFFIX:~0,1%"=="_" ( +(set FBBUILD_FILENAME_SUFFIX=_%FBBUILD_FILENAME_SUFFIX%) +) +) -find "#define FB_BUILD_NO" %FB_ROOT_PATH%\src\jrd\build_no.h > %temp%.\b$1.txt -sed -n -e s/\"//g -e s/"#define FB_BUILD_NO "//w%temp%.\b$2.txt %temp%.\b$1.txt -for /f "tokens=*" %%a in ('type %temp%.\b$2.txt') do set FB_BUILD_NO=%%a +:: Set up our final destination +set FBBUILD_INSTALL_IMAGES=%FB_ROOT_PATH%\builds\install_images +if not exist "%FBBUILD_INSTALL_IMAGES%" (mkdir "%FBBUILD_INSTALL_IMAGES%") -set FBBUILD_FILE_ID=%FBBUILD_PRODUCT_VER_STRING%-%FBBUILD_PACKAGE_NUMBER%_%FB_TARGET_PLATFORM% +:: Determine Product Status +if %FB_BUILD_TYPE%==V ( +set FBBUILD_PROD_STATUS=PROD +) else ( +set FBBUILD_PROD_STATUS=DEV +) -::@echo s/-2.0.0-/-%FBBUILD_PRODUCT_VER_STRING%-/ > %temp%.\b$3.txt -@echo s/define release/define %FBBUILD_BUILDTYPE%/ > %temp%.\b$3.txt -@echo s/define no_pdb/define %FBBUILD_SHIP_PDB%/ >> %temp%.\b$3.txt -::@echo s/define package_number=\"0\"/define package_number=\"%FBBUILD_PACKAGE_NUMBER%\"/ >> %temp%.\b$3.txt -@echo s/define iss_release/define %ISS_BUILD_TYPE%/ >> %temp%.\b$3.txt -@echo s/define examples/define %ISS_EXAMPLES%/ >> %temp%.\b$3.txt -@echo s/define compression/define %ISS_COMPRESS%/ >> %temp%.\b$3.txt -@echo s/FBBUILD_PRODUCT_VER_STRING/%FBBUILD_PRODUCT_VER_STRING%/ >> %temp%.\b$3.txt +set FBBUILD_FILE_ID=%PRODUCT_VER_STRING%-%FBBUILD_PACKAGE_NUMBER%_%FB_TARGET_PLATFORM% -sed -f %temp%.\b$3.txt FirebirdInstall.iss > FirebirdInstall_%FBBUILD_FILE_ID%.iss - -:: This is a better way of achieving what is done in make_all.bat, but we don't -:: test for sed in that script. -@sed /@UDF_COMMENT@/s/@UDF_COMMENT@/#/ < %FB_ROOT_PATH%\builds\install\misc\firebird.conf.in > %FB_OUTPUT_DIR%\firebird.conf - -set FBBUILD_FB40_CUR_VER=%FB_MAJOR_VER%.%FB_MINOR_VER%.%FB_REV_NO% -set FBBUILD_FB_CUR_VER=%FBBUILD_FB40_CUR_VER% -set FBBUILD_FB_LAST_VER=%FBBUILD_FB30_CUR_VER% - -:: Now set some version strings of our legacy releases. -:: This helps us copy the correct documentation, -:: as well as set up the correct shortcuts -set FBBUILD_FB15_CUR_VER=1.5.6 -set FBBUILD_FB20_CUR_VER=2.0.7 -set FBBUILD_FB21_CUR_VER=2.1.7 -set FBBUILD_FB25_CUR_VER=2.5.8 -set FBBUILD_FB30_CUR_VER=3.0.4 - -:: Now fix up the major.minor version strings in the readme files. -:: We place output in %FB_GEN_DIR%\readmes +@setlocal +@echo. @if not exist %FB_GEN_DIR%\readmes (@mkdir %FB_GEN_DIR%\readmes) -@for %%d in (ba cz de es fr hu it pl pt ru si ) do ( - @if not exist %FB_GEN_DIR%\readmes\%%d ( - @mkdir %FB_GEN_DIR%\readmes\%%d - ) -) - -@echo s/\$MAJOR/%FB_MAJOR_VER%/g > %temp%.\b$4.txt -@echo s/\$MINOR/%FB_MINOR_VER%/g >> %temp%.\b$4.txt -@echo s/\$RELEASE/%FB_REV_NO%/g >> %temp%.\b$4.txt -@echo %FBBUILD_PROD_STATUS% release. Copying Readme_%FBBUILD_PROD_STATUS%.txt Readme.txt -@copy Readme_%FBBUILD_PROD_STATUS%.txt Readme.txt -@for %%f in (Readme.txt installation_readme.txt After_Installation.url) do ( +set SED_COMMAND=sed -e s/\$MAJOR/%FB_MAJOR_VER%/g ^ + -e s/\$MINOR/%FB_MINOR_VER%/g ^ + -e s/\$RELEASE/%FB_REV_NO%/g +@echo Processing version strings in Readme_%FBBUILD_PROD_STATUS%.txt +@%SED_COMMAND% Readme_%FBBUILD_PROD_STATUS%.txt > %FB_GEN_DIR%\readmes\Readme.txt +@for %%f in (installation_readme.txt) do ( @echo Processing version strings in %%f - @sed -f %temp%.\b$4.txt %%f > %FB_GEN_DIR%\readmes\%%f + @%SED_COMMAND% %%f > %FB_GEN_DIR%\readmes\%%f ) @for %%d in (ba cz de es fr hu it pl pt ru si ) do ( - @pushd %%d - @for /F %%f in ( '@dir /B /A-D *.txt' ) do ( - @echo Processing version strings in %%d\%%f - @sed -f %temp%.\b$4.txt %%f > %FB_GEN_DIR%\readmes\%%d\%%f + @if not exist %FB_GEN_DIR%\readmes\%%d (@mkdir %FB_GEN_DIR%\readmes\%%d) + @for %%f in ( %%d\*.txt ) do ( + @echo Processing version strings in %%f + @%SED_COMMAND% %%f > %FB_GEN_DIR%\readmes\%%f ) - @popd ) -del %temp%.\b$?.txt +@endlocal - -::End of SED_MAGIC +::End of SET_VERSION ::---------------- @goto :EOF @@ -268,14 +223,14 @@ if %MSVC_VERSION% EQU 15 ( ) for %%f in ( msvcp%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_0%.dll vcruntime%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_0%.dll ) do ( echo Copying "%VCToolsRedistDir%\%VSCMD_ARG_TGT_ARCH%\Microsoft.VC%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%.CRT\%%f" - copy "%VCToolsRedistDir%\%VSCMD_ARG_TGT_ARCH%\Microsoft.VC%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%.CRT\%%f" %FB_OUTPUT_DIR%\ + copy "%VCToolsRedistDir%\%VSCMD_ARG_TGT_ARCH%\Microsoft.VC%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%.CRT\%%f" %FB_OUTPUT_DIR%\ >nul if %ERRORLEVEL% GEQ 1 ( call :ERROR Copying "%VCToolsRedistDir%\%VSCMD_ARG_TGT_ARCH%\Microsoft.VC%MSVC_RUNTIME_MAJOR_VERSION%%MSVC_RUNTIME_MINOR_VERSION_1%.CRT\%%f" failed with error %ERRORLEVEL% ) && (goto :EOF) ) ) -@implib.exe | findstr "Borland" > nul -@if errorlevel 0 ( +@where /Q implib.exe +@if not errorlevel 1 ( if "%VSCMD_ARG_TGT_ARCH%"=="x86" ( @echo Generating fbclient_bor.lib @implib %FB_OUTPUT_DIR%\lib\fbclient_bor.lib %FB_OUTPUT_DIR%\fbclient.dll > nul @@ -325,13 +280,8 @@ mkdir %FB_OUTPUT_DIR%\misc\upgrade\security 2>nul goto :EOF ) - @echo Copying other documentation... @copy %FB_GEN_DIR%\readmes\installation_readme.txt %FB_OUTPUT_DIR%\doc\installation_readme.txt > nul -:: WhatsNew doesn't exist at the moment (Alpha1) - perhaps it will turn up later in the release cycle. -:: In any case, if it is not an error if it doesn't exist -@ren %FB_OUTPUT_DIR%\doc\WhatsNew %FB_OUTPUT_DIR%\doc\WhatsNew.txt - :: FIX ME - we now have some .md files and ChangeLog is no longer a monster. :: Maybe we can just do nothing here. @@ -342,7 +292,6 @@ mkdir %FB_OUTPUT_DIR%\misc\upgrade\security 2>nul :: @copy %FB_ROOT_PATH%\ChangeLog %FB_OUTPUT_DIR%\doc\ChangeLog.txt > nul ::) - @mkdir %FB_OUTPUT_DIR%\doc\sql.extensions 2>nul @if %ERRORLEVEL% GEQ 2 ( (call :ERROR MKDIR for doc\sql.extensions dir failed) & (@goto :EOF)) @copy %FB_ROOT_PATH%\doc\sql.extensions\*.* %FB_OUTPUT_DIR%\doc\sql.extensions\ > nul @@ -353,7 +302,7 @@ mkdir %FB_OUTPUT_DIR%\misc\upgrade\security 2>nul :: if the docs are available then we can include them. if defined FB_EXTERNAL_DOCS ( @echo Copying pdf docs... -@for %%v in ( Firebird-%FB_MAJOR_VER%.%FB_MINOR_VER%-QuickStart.pdf Firebird_v%FBBUILD_FB_CUR_VER%.ReleaseNotes.pdf ) do ( +@for %%v in ( Firebird-%FB_MAJOR_VER%.%FB_MINOR_VER%-QuickStart.pdf Firebird_v%FB_MAJOR_VER%.%FB_MINOR_VER%.%FB_REV_NO%.ReleaseNotes.pdf ) do ( @echo ... %%v (@copy /Y %FB_EXTERNAL_DOCS%\%%v %FB_OUTPUT_DIR%\doc\%%v > nul) || (call :WARNING Copying %FB_EXTERNAL_DOCS%\%%v failed.) ) @@ -361,42 +310,46 @@ if defined FB_EXTERNAL_DOCS ( @echo. ) +@echo Cleaning irrelevant files... :: Clean out text notes that are either not relevant to Windows or :: are only of use to engine developers. @for %%v in ( README.makefiles README.user.embedded README.user.troubleshooting README.build.mingw.html README.build.msvc.html fb2-todo.txt cleaning-todo.txt install_win32.txt README.coding.style emacros-cross_ref.html firebird_conf.txt *.*~) do ( @del %FB_OUTPUT_DIR%\doc\%%v 2>nul ) +@echo Copy license... :: Add license for %%v in (IPLicense.txt IDPLicense.txt ) do ( @copy %FB_ROOT_PATH%\builds\install\misc\%%v %FB_OUTPUT_DIR%\%%v > nul ) :: And readme -@copy %FB_GEN_DIR%\readmes\readme.txt %FB_OUTPUT_DIR%\ > nul +@copy %FB_GEN_DIR%\readmes\Readme.txt %FB_OUTPUT_DIR%\ > nul :: Walk through all docs and transform any that are not .txt, .pdf or .html to .txt @echo Setting .txt filetype to ascii docs. -for /R %FB_OUTPUT_DIR%\doc %%v in (.) do ( - pushd %%v - for /F %%W in ( 'dir /B /A-D' ) do ( - if /I "%%~xW" NEQ ".txt" ( - if /I "%%~xW" NEQ ".pdf" ( - if /I "%%~xW" NEQ ".htm" ( - if /I "%%~xW" NEQ ".html" ( - ren %%W %%W.txt +for /R %FB_OUTPUT_DIR%\doc %%v in ( * ) do ( + if /I not "%%~xv" == ".md" ( + if /I not "%%~xv" == ".txt" ( + if /I not "%%~xv" == ".pdf" ( + if /I not "%%~xv" == ".htm" ( + if /I not "%%~xv" == ".html" ( + ren %%v %%~nxv.txt ) ) ) ) ) - popd ) -:: Throw away any errorlevel left hanging around -@set | findstr win > nul +if %FB2_SNAPSHOT% EQU 1 ( + @copy %FB_ROOT_PATH%\builds\install\arch-specific\win32\readme_snapshot.txt %FB_OUTPUT_DIR%\readme_snapshot.txt > nul +) @echo Completed copying docs. + +:: Examples were already copied by make_examples + ::End of COPY_XTRA ::---------------- @goto :EOF @@ -426,6 +379,7 @@ if %MSVC_VERSION% EQU 15 ( :INCLUDE_DIR +::========== :: Prepare other files needed for deployment to /include dir setlocal :: grab some missing bits'n'pieces from different parts of the source tree @@ -437,8 +391,8 @@ setlocal @echo Copying other include files required for development... set OUTPATH=%FB_OUTPUT_DIR%\include @copy %FB_ROOT_PATH%\src\yvalve\perf.h %OUTPATH%\ > nul -@copy %FB_ROOT_PATH%\src\include\gen\firebird.pas %OUTPATH%\firebird\ > nul || (@call :ERROR Failure executing copy %FB_ROOT_PATH%\src\include\gen\firebird.pas %OUTPATH%\firebird\ && @goto :EOF ) -@xcopy /e /i /y %FB_ROOT_PATH%\src\include\firebird\impl %OUTPATH%\firebird\ > nul || (@call :ERROR Failure executing @xcopy /e /i /y %FB_ROOT_PATH%\src\include\firebird\* %OUTPATH%\firebird\ && @goto :EOF ) +@copy %FB_ROOT_PATH%\src\include\gen\firebird.pas %OUTPATH%\firebird\ > nul || (@call :ERROR Failure executing copy %FB_ROOT_PATH%\src\include\gen\firebird.pas %OUTPATH%\firebird\ ) +@xcopy /e /i /y %FB_ROOT_PATH%\src\include\firebird\impl %OUTPATH%\firebird\ > nul || (@call :ERROR Failure executing @xcopy /e /i /y %FB_ROOT_PATH%\src\include\firebird\* %OUTPATH%\firebird\ ) @if %ERRLEV% GEQ 1 goto :END endlocal @@ -452,7 +406,7 @@ endlocal :: Generate sample databases file ::=============================== @echo Creating sample databases.conf -copy %FB_ROOT_PATH%\builds\install\misc\databases.conf.in %FB_OUTPUT_DIR%\databases.conf > nul +copy %FB_ROOT_PATH%\builds\install\misc\databases.conf %FB_OUTPUT_DIR%\databases.conf > nul ::End of DB_CONF ::----------------- @@ -494,85 +448,40 @@ copy %FB_ROOT_PATH%\builds\install\misc\databases.conf.in %FB_OUTPUT_DIR%\databa :: Get a list of all files in the tree make sure :: that and they all have windows EOL ::=============================================== -for /F %%W in ( 'dir %FB_OUTPUT_DIR% /b /a-d /s' ) do ( - for %%X in ( txt conf sql c cpp hpp h bat pas e def rc md ) do ( - if /I "%%~xW" EQU ".%%X" ( unix2dos --u2d --safe %%W 2>nul >nul ) - ) +for /R %FB_OUTPUT_DIR% %%W in ( *.txt *.conf *.sql *.c *.cpp *.hpp *.h *.bat *.pas *.e *.def *.rc *.md *.html ) do ( + unix2dos -q --safe %%W || exit /b 1 ) + ::End of SET_CRLF ::------------- @goto :EOF -:GEN_ZIP -::====== -if %FBBUILD_ZIP_PACK% EQU 0 goto :EOF -@echo - Generate the directory tree to be zipped -set FBBUILD_ZIP_PACK_ROOT=%FB_ROOT_PATH%\builds\zip_pack_%FB_TARGET_PLATFORM% -if not exist %FBBUILD_ZIP_PACK_ROOT% @mkdir %FBBUILD_ZIP_PACK_ROOT% 2>nul -@del /s /q %FBBUILD_ZIP_PACK_ROOT%\ > nul -::@copy /Y %FB_OUTPUT_DIR% %FBBUILD_ZIP_PACK_ROOT% > nul -::for %%v in (doc doc\sql.extensions help include intl lib udf misc misc\upgrade\security plugins system32 ) do ( -:: @mkdir %FBBUILD_ZIP_PACK_ROOT%\%%v 2>nul -:: @dir /b /a-d /s %FB_OUTPUT_DIR%\%%v\*.* >nul 2>nul -:: if not ERRORLEVEL 1 @copy /Y %FB_OUTPUT_DIR%\%%v\*.* %FBBUILD_ZIP_PACK_ROOT%\%%v\ > nul -::) -@xcopy /Y /E /S %FB_OUTPUT_DIR% %FBBUILD_ZIP_PACK_ROOT% > nul - -@echo - Add examples to zip tree -@xcopy /Y /E /S %FB_OUTPUT_DIR%\examples\*.* %FBBUILD_ZIP_PACK_ROOT%\examples > nul -::@if %FB2_EXAMPLES% equ 1 for %%v in (examples examples\api examples\build_win32 examples\dbcrypt examples\empbuild examples\include examples\interfaces examples\package examples\stat examples\udf examples\udr ) do ( -:: @mkdir %FBBUILD_ZIP_PACK_ROOT%\%%v 2>nul -:: dir %FB_OUTPUT_DIR%\%%v\*.* > nul 2>nul -:: if not ERRORLEVEL 1 @copy /Y %FB_OUTPUT_DIR%\%%v\*.* %FBBUILD_ZIP_PACK_ROOT%\%%v\ > nul -::) - - -@echo - Now remove stuff from zip tree that is not needed... -setlocal -set FB_RM_FILE_LIST=doc\installation_readme.txt system32\vccrt%MSVC_VERSION%_%FB_TARGET_PLATFORM%.wixpdb icudt52l_empty.dat -for %%v in ( %FB_RM_FILE_LIST% ) do ( - @del %FBBUILD_ZIP_PACK_ROOT%\%%v > nul 2>&1 -) -endlocal - -if %FB2_SNAPSHOT% EQU 1 ( - @copy %FB_ROOT_PATH%\builds\install\arch-specific\win32\readme_snapshot.txt %FBBUILD_ZIP_PACK_ROOT%\readme_snapshot.txt > nul -) - -if not "%FBBUILD_SHIP_PDB%"=="ship_pdb" ( - @del /q %FBBUILD_ZIP_PACK_ROOT%\*.pdb > nul 2>&1 -) - -rmdir /s /q %FBBUILD_ZIP_PACK_ROOT%\examples\build_unix - -:: Don't grab old install notes for zip pack - document needs a complete re-write. -::@copy %FB_ROOT_PATH%\doc\install_win32.txt %FBBUILD_ZIP_PACK_ROOT%\doc\README_installation.txt > nul - -::End of GEN_ZIP -::-------------- -goto :EOF - - :ZIP_PACK ::======= -if %FBBUILD_ZIP_PACK% EQU 0 goto :EOF -if "%FBBUILD_SHIP_PDB%" == "ship_pdb" ( - if exist %FBBUILD_INSTALL_IMAGES%\Firebird-%FBBUILD_FILE_ID%_pdb%FBBUILD_FILENAME_SUFFIX%.zip ( - @del %FBBUILD_INSTALL_IMAGES%\Firebird-%FBBUILD_FILE_ID%_pdb%FBBUILD_FILENAME_SUFFIX%.zip - ) - set FBBUILD_ZIPFILE=%FBBUILD_INSTALL_IMAGES%\Firebird-%FBBUILD_FILE_ID%_pdb%FBBUILD_FILENAME_SUFFIX%.zip +:: Forcefully disable delayed expansion because of exclamation marks in 7z switches +setlocal DisableDelayedExpansion +set SKIP_FILES=-x!installation_readme.txt + +if "%FBBUILD_SHIP_PDB%" == "ship_pdb" ( + set FBBUILD_ZIPFILE=%FBBUILD_INSTALL_IMAGES%\Firebird-%FBBUILD_FILE_ID%_pdb%FBBUILD_FILENAME_SUFFIX%.zip ) else ( - if exist %FBBUILD_INSTALL_IMAGES%\Firebird-%FBBUILD_FILE_ID%%FBBUILD_FILENAME_SUFFIX%.zip ( - @del %FBBUILD_INSTALL_IMAGES%\Firebird-%FBBUILD_FILE_ID%%FBBUILD_FILENAME_SUFFIX%.zip - ) set FBBUILD_ZIPFILE=%FBBUILD_INSTALL_IMAGES%\Firebird-%FBBUILD_FILE_ID%%FBBUILD_FILENAME_SUFFIX%.zip + set SKIP_FILES=%SKIP_FILES% -x!*.pdb ) -@%SEVENZIP%\7z.exe a -r -tzip -mx9 %FBBUILD_ZIPFILE% %FBBUILD_ZIP_PACK_ROOT%\*.* -@echo End of ZIP_PACK -@echo. +if "%FB2_EXAMPLES%" == "0" set SKIP_FILES=%SKIP_FILES% -xr-!examples + +if exist %FBBUILD_ZIPFILE% ( + @del %FBBUILD_ZIPFILE% +) + +%SEVENZIP%\7z.exe a -r -tzip -mx9 %SKIP_FILES% %FBBUILD_ZIPFILE% %FB_OUTPUT_DIR%\*.* + +endlocal + +::End of ZIP_PACK ::---------------- @goto :EOF @@ -583,12 +492,23 @@ if "%FBBUILD_SHIP_PDB%" == "ship_pdb" ( ::While building and testing this feature might be annoying, so we don't do it. ::========================================================== setlocal -set TIMESTRING=0%PRODUCT_VER_STRING:~0,1%:0%PRODUCT_VER_STRING:~2,1%:0%PRODUCT_VER_STRING:~4,1% -@if /I "%BUILDTYPE%"=="release" ( - (@echo Touching release build files with %TIMESTRING% timestamp) & (touch -s -D -t%TIMESTRING% %FB_OUTPUT_DIR%\*.*) - (if %FBBUILD_ZIP_PACK% EQU 1 (@echo Touching release build files with %TIMESTRING% timestamp) & (touch -s -D -t%TIMESTRING% %FB_ROOT_PATH%\zip_pack\*.*) ) + +if /I not "%FBBUILD_BUILDTYPE%"=="release" goto :EOF +if not defined TOUCH_COMMAND echo POSIX touch utility not found && exit /b 1 + +set TIMESTRING=0%FB_MAJOR_VER%:0%FB_MINOR_VER%:0%FB_REV_NO% + +:: Perhaps here we should touch directories as well +:: Here and there XXX_COMMAND is "call"-ed in case if it is a batch file + +@echo Touching release build files with %TIMESTRING% timestamp + +@for /R %FB_OUTPUT_DIR% %%F in ( * ) do ( + call %TOUCH_COMMAND% -c -d %TIMESTRING% %%F || exit /b 1 ) + endlocal + ::End of TOUCH_ALL ::---------------- @goto :EOF @@ -602,14 +522,11 @@ endlocal :: eg set INNO5_SETUP_PATH="C:\Program Files\Inno Setup 5" :: ::================================================= -if %FBBUILD_ISX_PACK% NEQ 1 goto :EOF -@echo Now let's compile the InnoSetup scripts @echo. -%INNO5_SETUP_PATH%\iscc %FB_ROOT_PATH%\builds\install\arch-specific\win32\FirebirdInstall_%FBBUILD_FILE_ID%.iss +call %ISCC_COMMAND% %FB_ROOT_PATH%\builds\install\arch-specific\win32\FirebirdInstall.iss @echo. -@echo End of ISX_PACK -@echo. +::End of ISX_PACK ::--------------- @goto :EOF @@ -618,15 +535,25 @@ if %FBBUILD_ISX_PACK% NEQ 1 goto :EOF ::========= :: Generate the md5sum checksum file ::================================== -if NOT DEFINED GNU_TOOLCHAIN ( - call :WARNING GNU_TOOLCHAIN variable not defined. Cannot generate md5 sums. +if not defined MD5_COMMAND ( + call :WARNING md5sum utility not found. Cannot generate md5 sums. @goto :EOF ) -@echo Generating md5sums for Firebird-%FBBUILD_PRODUCT_VER_STRING%-%FBBUILD_PACKAGE_NUMBER% +@echo Generating md5sums for Firebird-%PRODUCT_VER_STRING%-%FBBUILD_PACKAGE_NUMBER% -%GNU_TOOLCHAIN%\md5sum.exe %FBBUILD_INSTALL_IMAGES%\Firebird-%FBBUILD_PRODUCT_VER_STRING%?%FBBUILD_PACKAGE_NUMBER%*.* > %FBBUILD_INSTALL_IMAGES%\Firebird-%FBBUILD_PRODUCT_VER_STRING%-%FBBUILD_PACKAGE_NUMBER%.md5sum +:: write sums into temporary file to avoid including it into the process +pushd %FBBUILD_INSTALL_IMAGES% +call %MD5_COMMAND% Firebird-%PRODUCT_VER_STRING%?%FBBUILD_PACKAGE_NUMBER%*.* >md5sum.tmp -::--------------- +:: then rename it to the proper name +if not errorlevel 1 ( + del Firebird-%PRODUCT_VER_STRING%-%FBBUILD_PACKAGE_NUMBER%.md5sum >nul 2>nul + ren md5sum.tmp Firebird-%PRODUCT_VER_STRING%-%FBBUILD_PACKAGE_NUMBER%.md5sum +) +popd + +::End of DO_MD5SUMS +::----------------- @goto :EOF @@ -654,7 +581,7 @@ if NOT DEFINED GNU_TOOLCHAIN ( @echo. @echo HELP This help screen. @echo. -@echo In addition, the following environment variables are checked: +@echo In addition, the following environment variables are checked by ISS script: @echo. @echo FB2_ISS_DEBUG=1 - Prepare an InnoSetup script that is @echo easier to debug @@ -729,7 +656,6 @@ popd @if errorlevel 1 (goto :END) @if not defined FB2_ISS_DEBUG (set FB2_ISS_DEBUG=0) -@if not defined FB2_EXAMPLES (set FB2_EXAMPLES=1) @echo. @echo Reading command-line parameters... @@ -742,7 +668,7 @@ popd @echo. @echo Setting version number... -@(@call :SED_MAGIC ) || (@echo Error calling SED_MAGIC && @goto :END) +@(@call :SET_VERSION ) || (@echo Error calling SET_VERSION && @goto :END) @echo. @echo Copying additional files needed for installation, documentation etc. @@ -776,13 +702,6 @@ if defined WIX ( @(@call :SET_CRLF ) || (@echo Error calling SET_CRLF && @goto :EOF) @echo. - -if %FBBUILD_ZIP_PACK% EQU 1 ( -@echo Generating image of zipped install -@(@call :GEN_ZIP ) || (@echo Error calling GEN_ZIP && @goto :END) -@echo. -) - ::@echo Creating .local files for libraries ::@(@call :TOUCH_LOCAL ) || (@echo Error calling TOUCH_LOCAL & @goto :END) ::@echo. @@ -797,6 +716,7 @@ if %FBBUILD_ZIP_PACK% EQU 1 ( ) if %FBBUILD_ISX_PACK% EQU 1 ( +@echo Now let's compile the InnoSetup scripts @(@call :ISX_PACK ) || (@echo Error calling ISX_PACK && @goto :END) @echo. ) @@ -815,7 +735,7 @@ if %FBBUILD_ISX_PACK% EQU 1 ( :END -popd + exit /b diff --git a/builds/install/arch-specific/win32/FirebirdInstall.iss b/builds/install/arch-specific/win32/FirebirdInstall.iss index 57840935ee..49c7557776 100644 --- a/builds/install/arch-specific/win32/FirebirdInstall.iss +++ b/builds/install/arch-specific/win32/FirebirdInstall.iss @@ -49,30 +49,46 @@ #define FirebirdURL MyAppURL #define UninstallBinary "{app}\firebird.exe" +#define Root GetEnv("FB_ROOT_PATH") +#if Root == "" +;We are not run from batch file, let's set some sane defaults +#define Root = "..\..\..\.." +;Assume iss debug as well +#define iss_debug +#else + +#endif + +#if GetEnv("FB2_ISS_DEBUG") == "1" +#define iss_debug +#endif + +#if GetEnv("FBBUILD_SHIP_PDB") == "ship_pdb" +#define ship_pdb +#endif + +;Get version information from build_no.h +#include Root + "\gen\jrd\build_no.h" + ;Hard code some defaults to aid debugging and running script standalone. ;In practice, these values are set in the environment and we use the env vars. -#define MajorVer "4" -#define MinorVer "0" -#define PointRelease "0" -#define BuildNumber "0" +#define PackageNumber GetEnv("FBBUILD_PACKAGE_NUMBER") +#if PackageNumber == "" #define PackageNumber "0" -#define FilenameSuffix "" - +#endif +#define FilenameSuffix GetEnv("FBBUILD_FILENAME_SUFFIX") +#if FilenameSuffix != "" && pos('_',FilenameSuffix) == 0 +#define FilenameSuffix "_" + FilenameSuffix +#endif ;-------Start of Innosetup script debug flags section -; if iss_release is undefined then iss_debug is set +; if iss_debug is undefined then iss_release is set ; Setting iss_release implies that the defines for files, ; examples and compression are set. If debug is set then this ; section controls the settings of files, examples ; and compression. -; A dynamically generated sed script sets the appropriate define -; See BuildExecutableInstall.bat for more details. - - -;#define iss_debug - #ifndef iss_debug #define iss_release #endif @@ -80,10 +96,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;; #ifdef iss_release #define files +#if GetEnv("FB2_EXAMPLES") != "0" #define examples +#endif #define compression -#else -#define iss_debug +#define i18n #endif ;-------------------- @@ -107,72 +124,8 @@ ;-------end of Innosetup script debug flags section - ;-------Start of Innosetup script - -;---- These three defines need a bit of tidying up in the near future, -; but for now they must stay, as the BuildExecutableInstall.bat -; uses them. -#define release -#define no_pdb -#define i18n - - -;------If necessary we can turn off i18n by uncommenting this undefine -;------In general this is a good idea for alpha and beta releases. -#undef i18n - -;----- If we are debugging the script (and not executed from command prompt) -;----- there is no guarantee that the environment variable exists. However an -;----- expression such as #define FB_MAJOR_VER GetEnv("FB_MAJOR_VER") will -;----- 'define' the macro anyway so we need to test for a valid env var before -;----- we define our macro. -#if Len(GetEnv("FB_MAJOR_VER")) > 0 -#define FB_MAJOR_VER GetEnv("FB_MAJOR_VER") -#endif -#ifdef FB_MAJOR_VER -#define MajorVer FB_MAJOR_VER -#endif - -#if Len(GetEnv("FB_MINOR_VER")) > 0 -#define FB_MINOR_VER GetEnv("FB_MINOR_VER") -#endif -#ifdef FB_MINOR_VER -#define MinorVer FB_MINOR_VER -#endif - -#if Len(GetEnv("FB_REV_NO")) > 0 -#define FB_REV_NO GetEnv("FB_REV_NO") -#endif -#ifdef FB_REV_NO -#define PointRelease FB_REV_NO -#endif - -#if Len(GetEnv("FB_BUILD_NO")) > 0 -#define FB_BUILD_NO GetEnv("FB_BUILD_NO") -#endif -#ifdef FB_BUILD_NO -#define BuildNumber FB_BUILD_NO -#endif - -#if Len(GetEnv("FBBUILD_PACKAGE_NUMBER")) > 0 -#define FBBUILD_PACKAGE_NUMBER GetEnv("FBBUILD_PACKAGE_NUMBER") -#endif -#ifdef FBBUILD_PACKAGE_NUMBER -#define PackageNumber FBBUILD_PACKAGE_NUMBER -#endif - -#if Len(GetEnv("FBBUILD_FILENAME_SUFFIX")) > 0 -#define FBBUILD_FILENAME_SUFFIX GetEnv("FBBUILD_FILENAME_SUFFIX") -#endif -#ifdef FBBUILD_FILENAME_SUFFIX -#define FilenameSuffix FBBUILD_FILENAME_SUFFIX -#if pos('_',FilenameSuffix) == 0 -#define FilenameSuffix "_" + FilenameSuffix -#endif -#endif - #if Len(GetEnv("MSVC_VERSION")) > 0 #define msvc_version GetEnv("MSVC_VERSION") #else @@ -212,10 +165,10 @@ #define msvcr_filename = "vcruntime" #endif -#if BuildNumber == "0" -#define MyAppVerString MajorVer + "." + MinorVer + "." + PointRelease +#if FB_BUILD_NO == "0" +#define MyAppVerString FB_MAJOR_VER + "." + FB_MINOR_VER + "." + FB_REV_NO #else -#define MyAppVerString MajorVer + "." + MinorVer + "." + PointRelease + "." + BuildNumber +#define MyAppVerString FB_MAJOR_VER + "." + FB_MINOR_VER + "." + FB_REV_NO + "." + FB_BUILD_NO #endif #define MyAppVerName MyAppName + " " + MyAppVerString @@ -224,11 +177,16 @@ #define PlatformTarget GetEnv("FB_TARGET_PLATFORM") #endif #if PlatformTarget == "" +;Assume native platform +#if IsWin64 +#define PlatformTarget "x64" +#else #define PlatformTarget "win32" #endif +#endif +#if FB_BUILD_TYPE == "T" ;If we are still under development we can ignore some missing files. -#if GetEnv("FBBUILD_PROD_STATUS") == "DEV" #define SkipFileIfDevStatus " skipifsourcedoesntexist " #else #define SkipFileIfDevStatus " " @@ -240,21 +198,12 @@ #define WOW64Dir="output_win32" #endif -;BaseVer should be used for all MajorVer.MinorVer installs. -;This allows us to upgrade silently from MajorVer.MinorVer.m to MajorVer.MinorVer.n -#define BaseVer MajorVer + "_" + MinorVer -#define AppVer MajorVer + "_" + MinorVer -#define GroupnameVer MajorVer + "." + MinorVer - -;These variables are set in BuildExecutableInstall -#define FB15_cur_ver GetEnv("FBBUILD_FB15_CUR_VER") -#define FB20_cur_ver GetEnv("FBBUILD_FB20_CUR_VER") -#define FB21_cur_ver GetEnv("FBBUILD_FB21_CUR_VER") -#define FB25_cur_ver GetEnv("FBBUILD_FB25_CUR_VER") -#define FB30_cur_ver GetEnv("FBBUILD_FB30_CUR_VER") -#define FB40_cur_ver GetEnv("FBBUILD_FB40_CUR_VER") -#define FB_cur_ver FB40_cur_ver -#define FB_last_ver FB30_cur_ver +;BaseVer should be used for all FB_MAJOR_VER.FB_MINOR_VER installs. +;This allows us to upgrade silently from FB_MAJOR_VER.FB_MINOR_VER.m to FB_MAJOR_VER.FB_MINOR_VER.n +#define BaseVer FB_MAJOR_VER + "_" + FB_MINOR_VER +#define AppVer FB_MAJOR_VER + "_" + FB_MINOR_VER +#define GroupnameVer FB_MAJOR_VER + "." + FB_MINOR_VER +#define FB_cur_ver FB_MAJOR_VER + "." + FB_MINOR_VER + "." + FB_REV_NO ; We can save space by shipping a pdb package that just includes ; the pdb files. It would then upgrade an existing installation, @@ -276,7 +225,7 @@ #else #define pdb_str="" #endif -#ifdef debug +#if GetEnv("FBBUILD_BUILDTYPE") == "debug" #define debug_str="_debug" #else #define debug_str="" @@ -300,7 +249,7 @@ AppUpdatesURL={#MyAppURL} AppVersion={#MyAppVerString} VersionInfoVersion={#MyAppVerString} -SourceDir=..\..\..\..\ +SourceDir={#Root} OutputBaseFilename={#MyAppName}-{#MyAppVerString}_{#PackageNumber}_{#PlatformTarget}{#debug_str}{#pdb_str}{#FilenameSuffix} ;OutputManifestFile={#MyAppName}-{#MyAppVerString}_{#PackageNumber}_{#PlatformTarget}{#debug_str}{#pdb_str}{#FilenameSuffix}_Setup-Manifest.txt OutputDir=builds\install_images @@ -342,7 +291,7 @@ SetupLogging=yes #endif [Languages] -Name: en; MessagesFile: compiler:Default.isl; InfoBeforeFile: {#GenDir}\installation_readme.txt; InfoAfterFile: {#GenDir}\readme.txt; +Name: en; MessagesFile: compiler:Default.isl; InfoBeforeFile: {#GenDir}\installation_readme.txt; InfoAfterFile: {#GenDir}\Readme.txt; #ifdef i18n Name: ba; MessagesFile: compiler:Languages\Bosnian.isl; InfoBeforeFile: {#GenDir}\ba\Instalacija_ProcitajMe.txt; InfoAfterFile: {#GenDir}\ba\ProcitajMe.txt; Name: cz; MessagesFile: compiler:Languages\Czech.isl; InfoBeforeFile: {#GenDir}\cz\instalace_ctime.txt; InfoAfterFile: {#GenDir}\cz\ctime.txt; @@ -389,21 +338,6 @@ Name: ru; MessagesFile: compiler:Languages\Russian.isl; InfoBeforeFile: {#GenDir ;#include "si\custom_messages_si.inc" #endif -#ifdef iss_debug -; *** Note - this comment section needs revision or deletion. -; It is only applicable to the ansi installer, which is no longer -; supported for Firebird 3 -; By default, the languages available at runtime depend on the user's -; code page. A user with the Western European code page set will not -; even see that we support installation with the czech language -; for example. -; It can be useful when debugging to force the display of all available -; languages by setting LanguageCodePage to 0. Of course, if the langauge -; is not supported by the user's current code page it will be unusable. -[LangOptions] -LanguageCodePage=0 -#endif - [Types] Name: ServerInstall; Description: {cm:ServerInstall} Name: DeveloperInstall; Description: {cm:DeveloperInstall} @@ -478,7 +412,7 @@ Name: {group}\Firebird Server; Filename: {app}\firebird.exe; Parameters: {code:S Name: {group}\Firebird Guardian; Filename: {app}\fbguard.exe; Parameters: {code:StartAppParams}; Flags: runminimized; MinVersion: 4.0,4.0; Check: InstallGuardianIcon; IconIndex: 1; Components: ServerComponent; Comment: Run Firebird Server (with guardian); Name: {group}\Firebird ISQL Tool; Filename: {app}\isql.exe; Parameters: -z; WorkingDir: {app}; MinVersion: 4.0,4.0; Comment: {cm:RunISQL} Name: {group}\Firebird {#FB_cur_ver} Release Notes; Filename: {app}\doc\Firebird_v{#FB_cur_ver}.ReleaseNotes.pdf; MinVersion: 4.0,4.0; Comment: {#MyAppName} {cm:ReleaseNotes} -;Name: {group}\Firebird {#GroupnameVer} Quick Start Guide; Filename: {app}\doc\Firebird-{#MajorVer}-QuickStart.pdf; MinVersion: 4.0,4.0; Comment: {#MyAppName} {#FB_cur_ver} +;Name: {group}\Firebird {#GroupnameVer} Quick Start Guide; Filename: {app}\doc\Firebird-{#FB_MAJOR_VER}-QuickStart.pdf; MinVersion: 4.0,4.0; Comment: {#MyAppName} {#FB_cur_ver} Name: "{group}\After Installation"; Filename: "{app}\doc\After_Installation.url"; Comment: "New User? Here's a quick guide to what you should do next." Name: "{group}\Firebird Web-site"; Filename: "{app}\doc\firebirdsql.org.url" ;Always install the original english version @@ -493,7 +427,7 @@ Name: {group}\{cm:Uninstall,{#FB_cur_ver}}; Filename: {uninstallexe}; Comment: U #ifdef files Source: {#LicensesDir}\IPLicense.txt; DestDir: {app}; Components: ClientComponent; Flags: sharedfile ignoreversion; Source: {#LicensesDir}\IDPLicense.txt; DestDir: {app}; Components: ClientComponent; Flags: sharedfile ignoreversion -Source: {#ScriptsDir}\After_Installation.url; DestDir: {app}\doc; Components: ServerComponent DevAdminComponent; Flags: sharedfile ignoreversion +Source: {#file "After_Installation.url"}; DestDir: {app}\doc; DestName: "After_Installation.url"; Components: ServerComponent DevAdminComponent; Flags: sharedfile ignoreversion Source: {#ScriptsDir}\firebirdsql.org.url; DestDir: {app}\doc; Components: ServerComponent DevAdminComponent; Flags: sharedfile ignoreversion ;Always install the original english version Source: {#GenDir}\readme.txt; DestDir: {app}; Components: DevAdminComponent; Flags: ignoreversion; @@ -543,8 +477,8 @@ Source: {#FilesDir}\fbsvcmgr.exe; DestDir: {app}; Components: DevAdminComponent; Source: {#FilesDir}\fbtracemgr.exe; DestDir: {app}; Components: DevAdminComponent; Flags: ignoreversion Source: {#FilesDir}\fbclient.dll; DestDir: {app}; Components: ClientComponent; Flags: overwritereadonly sharedfile promptifolder #if PlatformTarget == "x64" -Source: {#WOW64Dir}\fbclient.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: overwritereadonly sharedfile promptifolder -Source: {#WOW64Dir}\instclient.exe; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile ignoreversion +Source: {#WOW64Dir}\fbclient.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: overwritereadonly sharedfile promptifolder {#SkipFileIfDevStatus} +Source: {#WOW64Dir}\instclient.exe; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile ignoreversion {#SkipFileIfDevStatus} #endif Source: {#FilesDir}\icuuc??.dll; DestDir: {app}; Components: ServerComponent; Flags: sharedfile ignoreversion Source: {#FilesDir}\icuin??.dll; DestDir: {app}; Components: ServerComponent; Flags: sharedfile ignoreversion @@ -563,8 +497,8 @@ Source: {#FilesDir}\{#msvcr_filename}{#msvc_runtime_major_version}{#msvc_runtime Source: {#FilesDir}\msvcp{#msvc_runtime_major_version}{#msvc_runtime_minor_version_0}.dll; DestDir: {app}; Components: ClientComponent; Flags: sharedfile; #if PlatformTarget == "x64" ;If we are installing on x64 we need some 32-bit libraries for compatibility with 32-bit applications -Source: {#WOW64Dir}\{#msvcr_filename}{#msvc_runtime_major_version}{#msvc_runtime_minor_version_0}.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile; -Source: {#WOW64Dir}\msvcp{#msvc_runtime_major_version}{#msvc_runtime_minor_version_0}.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile; +Source: {#WOW64Dir}\{#msvcr_filename}{#msvc_runtime_major_version}{#msvc_runtime_minor_version_0}.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile {#SkipFileIfDevStatus}; +Source: {#WOW64Dir}\msvcp{#msvc_runtime_major_version}{#msvc_runtime_minor_version_0}.dll; DestDir: {app}\WOW64; Components: ClientComponent; Flags: sharedfile {#SkipFileIfDevStatus}; #endif #endif /* #if Int(msvc_runtime_major_version,14) >= 10 */ @@ -572,10 +506,10 @@ Source: {#WOW64Dir}\msvcp{#msvc_runtime_major_version}{#msvc_runtime_minor_versi #if PlatformTarget == "x64" ;MinVersion 0,5.0 means no version of Win9x and at least Win2k if NT O/S ;In addition, O/S must have Windows Installer 3.0. -Source: {#FilesDir}\system32\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_x64.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: 0,5.0; Components: ClientComponent; -Source: {#WOW64Dir}\system32\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_Win32.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: 0,5.0; Components: ClientComponent; +Source: {#FilesDir}\system32\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_x64.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: 0,5.0; Components: ClientComponent; Flags: {#SkipFileIfDevStatus} +Source: {#WOW64Dir}\system32\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_Win32.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: 0,5.0; Components: ClientComponent; Flags: {#SkipFileIfDevStatus} #else -Source: {#FilesDir}\system32\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_Win32.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: 0,5.0; Components: ClientComponent; +Source: {#FilesDir}\system32\vccrt{#msvc_runtime_major_version}{#msvc_runtime_minor_version_1}_Win32.msi; DestDir: {tmp}; Check: HasWI30; MinVersion: 0,5.0; Components: ClientComponent; Flags: {#SkipFileIfDevStatus} #endif #endif @@ -592,7 +526,7 @@ Source: {#FilesDir}\intl\fbintl.dll; DestDir: {app}\intl; Components: ServerComp Source: {#FilesDir}\intl\fbintl.conf; DestDir: {app}\intl; Components: ServerComponent; Flags: onlyifdoesntexist Source: {#FilesDir}\lib\*.*; DestDir: {app}\lib; Components: DevAdminComponent; Flags: ignoreversion; #if PlatformTarget == "x64" -Source: {#WOW64Dir}\lib\*.lib; DestDir: {app}\WOW64\lib; Components: DevAdminComponent; Flags: ignoreversion +Source: {#WOW64Dir}\lib\*.lib; DestDir: {app}\WOW64\lib; Components: DevAdminComponent; Flags: ignoreversion {#SkipFileIfDevStatus} #endif ;deprecated in FB4.0 @@ -832,7 +766,7 @@ begin InstallRootDir := Default; // but the user has changed the default if (( InstallRootDir = '') and - ( FirebirdVer[0] = {#MajorVer} ) and ( FirebirdVer[1] = {#MinorVer} ) ) then // Firebird 2.n is installed + ( FirebirdVer[0] = {#FB_MAJOR_VER} ) and ( FirebirdVer[1] = {#FB_MINOR_VER} ) ) then // Firebird 2.n is installed InstallRootDir := FirebirdRootDir; // but the user has changed the default // if we haven't found anything then try the FIREBIRD env var diff --git a/builds/install/arch-specific/win32/Readme_DEV.txt b/builds/install/arch-specific/win32/Readme_DEV.txt index f245899119..5b2568ca1a 100644 --- a/builds/install/arch-specific/win32/Readme_DEV.txt +++ b/builds/install/arch-specific/win32/Readme_DEV.txt @@ -28,6 +28,8 @@ considered ready for use in production. o Please make sure you read the installation readme and the release notes. + + Reporting Bugs ============== diff --git a/builds/install/arch-specific/win32/i18n_readme.txt b/builds/install/arch-specific/win32/i18n_readme.txt index 541e9460c0..d4f4be669f 100644 --- a/builds/install/arch-specific/win32/i18n_readme.txt +++ b/builds/install/arch-specific/win32/i18n_readme.txt @@ -9,7 +9,7 @@ documentatation i18n should be available separately. I18n is a good thing, but bloating the installer with large amounts of translated documentation is not desirable. -The current version of InnoSetup used by Firebird $MAJOR.$MINOR - 5.5.8 - provides +The current version of InnoSetup used by Firebird - 5.5.8 - provides generic support for the following languages: BrazilianPortuguese, Catalan, Corsican, Czech, Danish, Dutch, Finnish, French, diff --git a/builds/install/misc/databases.conf.in b/builds/install/misc/databases.conf similarity index 100% rename from builds/install/misc/databases.conf.in rename to builds/install/misc/databases.conf diff --git a/builds/install/misc/firebird.conf.in b/builds/install/misc/firebird.conf similarity index 98% rename from builds/install/misc/firebird.conf.in rename to builds/install/misc/firebird.conf index 5830d25a9e..897e583e66 100644 --- a/builds/install/misc/firebird.conf.in +++ b/builds/install/misc/firebird.conf @@ -180,7 +180,7 @@ # the same restrictions as in previous FB versions. To specify access # to specific trees, enum all required paths (for Windows this may be # something like 'C:\ExternalFunctions', for unix - '/db/udf;/mnt/udf'). -@UDF_COMMENT@ +# # NOTE: THE EXTERNAL FUNCTION ENGINE FEATURE COULD BE USED TO COMPROMISE # THE SERVER/HOST AS WELL AS DATABASE SECURITY!! # @@ -446,8 +446,8 @@ #AuthClient = Srp256, Srp, Legacy_Auth #Non Windows clients #AuthClient = Srp256, Srp, Win_Sspi, Legacy_Auth #Windows clients # -# If you need to use server plugins that do not provide encryption key (both Legacy_Auth -# & Win_Sspi) you should also turn off required encryption on the wire with WireCrypt +# If you need to use server plugins that do not provide encryption key (Legacy_Auth is the +# only such std plugin) you should also turn off required encryption on the wire with WireCrypt # configuration parameter except when working with the XNET protocol which is never encrypted. # @@ -466,12 +466,14 @@ #TracePlugin = fbtrace # Wire crypt plugins are used to crypt data transferred over the wire. -# In default case wire is encrypted using Alleged RC4 -# (key must be generated by auth plugin). +# In default case wire is encrypted using ChaCha#20 or Alleged RC4. +# Key must be generated by auth plugin. +# For chacha we are using 16 or 32 bytes key (depends upon what is provided +# by auth plugin), 12 bytes nonce and 4 bytes counter, 20 (10 + 10) rounds are made. # # Per-connection configurable. # -#WireCryptPlugin = Arc4 +#WireCryptPlugin = ChaCha, Arc4 # Key holder is a kind of temp storage for DB crypt keys. # There is no default for this kind of plugins. diff --git a/builds/mac_os_x/CS/CS.pbproj/project.pbxproj b/builds/mac_os_x/CS/CS.pbproj/project.pbxproj index 9c84eabf94..82eb6a0601 100644 --- a/builds/mac_os_x/CS/CS.pbproj/project.pbxproj +++ b/builds/mac_os_x/CS/CS.pbproj/project.pbxproj @@ -4411,11 +4411,6 @@ path = ids.h; refType = 4; }; - F616C6050200B0CF01EF0ADE = { - isa = PBXFileReference; - path = ids.m; - refType = 4; - }; F616C6060200B0CF01EF0ADE = { isa = PBXFileReference; path = idx.cpp; diff --git a/builds/posix/Makefile.in b/builds/posix/Makefile.in index 538c3fb714..c194682fc3 100644 --- a/builds/posix/Makefile.in +++ b/builds/posix/Makefile.in @@ -226,7 +226,7 @@ $(TOMCRYPT_LIB): $(TOM_Objs) # main build target for both debug and release builds # -.PHONY: cross1 cross2 boot yvalve engine fbintl gpre utilities plugins rest codes ids examples cross_rest preliminaryCheck +.PHONY: cross1 cross2 boot yvalve engine fbintl gpre utilities plugins rest codes examples cross_rest master_process: ln -sf $(SRC_ROOT)/include/gen/autoconfig.auto $(SRC_ROOT)/include/gen/autoconfig.h @@ -234,13 +234,8 @@ master_process: $(MAKE) export_lists $(MAKE) external $(MAKE) updateCloopInterfaces - $(MAKE) preliminaryCheck $(MAKE) boot $(MAKE) yvalve -ifeq ($(IsDeveloper), Y) -# In developer mode we must regenerate various files in include/gen - $(MAKE) ids -endif $(MAKE) engine $(MAKE) fbintl $(MAKE) utilities @@ -272,10 +267,6 @@ cross1: $(MAKE) updateCloopInterfaces $(MAKE) boot $(MAKE) yvalve -ifeq ($(IsDeveloper), Y) -# In developer mode we must regenerate various files in include/gen - $(MAKE) ids -endif $(MAKE) engine $(MAKE) fbintl $(MAKE) gbak isql gfix @@ -306,25 +297,6 @@ cross2: $(MAKE) cross_rest -#___________________________________________________________________________ -# preliminary checks - make sure platform is OK to build FB -# - -STD_SIZES:=$(SRC_ROOT)/misc/ods.txt -RUN_SIZES:=$(GEN_ROOT)/ods.txt -ODS_H:=$(SRC_ROOT)/jrd/ods.h -ODS_AWK:=$(SRC_ROOT)/misc/ods.awk -ODS_TEST_CPP:=$(GEN_ROOT)/odstest.cpp -ODS_TEST:=$(GEN_ROOT)/odstest$(EXEC_EXT) - -preliminaryCheck: $(STD_SIZES) $(RUN_SIZES) - diff -u $^ - -$(RUN_SIZES): $(ODS_H) $(ODS_AWK) - awk -f $(ODS_AWK) <$(ODS_H) >$(ODS_TEST_CPP) - $(CXX) -o $(ODS_TEST) $(WCXXFLAGS) $(ODS_TEST_CPP) - $(ODS_TEST) >$(RUN_SIZES) - #___________________________________________________________________________ # static library - various common code, used in different FB projects # @@ -610,33 +582,26 @@ $(COMPAT_SQL): $(SRC_COMPAT_SQL) .PHONY: gen_codes CODES = $(BIN)/codes$(EXEC_EXT) -IDS = $(SRC_ROOT)/include/gen/ids.h codes: gen_codes -ids: $(IDS) - gen_codes: $(CODES) msg.timestamp $(CODES) $(SRC_ROOT)/include/gen $(LNG_ROOT) $(CODES): $(CODES_Objects) $(COMMON_LIB) $(EXE_LINK) $(EXE_LINK_OPTIONS) $^ -o $@ $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS) $(call LINK_DARWIN_RPATH,..) -$(IDS): $(SRC_ROOT)/misc/ids.m $(SRC_ROOT)/jrd/relations.h - m4 $< > $@ - - #___________________________________________________________________________ # all the rest we need to build # -.PHONY: qli message_file gbak_files +.PHONY: qli message_file tzdata gbak_files FDB_FILES := $(HELP_FDB) $(ROOT)/gen/msg.fdb $(SECURITY_FDB) $(FIREBIRD)/examples/empbuild/employee.fdb GBAK_FILES := $(FDB_FILES:.fdb=.gbak) $(FIREBIRD)/msg.gbak GBAK_FILES := $(subst Native,$(TARGET),$(GBAK_FILES)) -rest: qli message_file +rest: qli message_file tzdata cross_rest: qli gbak_files $(MAKE) $(BUILD_FILE) @@ -656,6 +621,12 @@ $(FIREBIRD_MSG): $(BUILD_FILE) msg.timestamp $(BUILD_FILE) -d msg.fdb -f $@ $(CHMOD_6) $@ +tzdata: $(FIREBIRD)/tzdata + +# FIXME: For big-endian, be.zip must be used. +$(FIREBIRD)/tzdata: $(ROOT)/extern/icu/tzdata/le.zip + unzip -o $(ROOT)/extern/icu/tzdata/le.zip -d $(FIREBIRD)/tzdata + $(BUILD_FILE): $(BUILD_Objects) $(COMMON_LIB) $(EXE_LINK) $(EXE_LINK_OPTIONS) $(LSB_UNDEF) $^ -o $@ $(FIREBIRD_LIBRARY_LINK) $(LINK_LIBS) $(call LINK_DARWIN_RPATH,..) diff --git a/builds/win32/make_all.bat b/builds/win32/make_all.bat index b10caa714c..698ae1bd50 100644 --- a/builds/win32/make_all.bat +++ b/builds/win32/make_all.bat @@ -38,6 +38,7 @@ if errorlevel 1 call :ERROR build failed - see make_all_%FB_TARGET_PLATFORM%.log @mkdir %FB_OUTPUT_DIR% 2>nul @mkdir %FB_OUTPUT_DIR%\intl 2>nul +@mkdir %FB_OUTPUT_DIR%\tzdata 2>nul @mkdir %FB_OUTPUT_DIR%\help 2>nul @mkdir %FB_OUTPUT_DIR%\doc 2>nul @mkdir %FB_OUTPUT_DIR%\doc\sql.extensions 2>nul @@ -50,6 +51,7 @@ if errorlevel 1 call :ERROR build failed - see make_all_%FB_TARGET_PLATFORM%.log @copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\* %FB_OUTPUT_DIR% >nul @copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\intl\* %FB_OUTPUT_DIR%\intl >nul +@copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\tzdata\* %FB_OUTPUT_DIR%\tzdata >nul @copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\system32\* %FB_OUTPUT_DIR%\system32 >nul @copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\plugins\*.dll %FB_OUTPUT_DIR%\plugins >nul @copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\plugins\udr\*.dll %FB_OUTPUT_DIR%\plugins\udr >nul @@ -61,11 +63,10 @@ for %%v in (gpre_boot build_msg codes) do ( ) :: Firebird.conf, etc -@copy %FB_GEN_DIR%\firebird.msg %FB_OUTPUT_DIR% > nul -:: The line @UDF_COMMENT@ should be deleted from the target file. -findstr /V "@UDF_COMMENT@" %FB_ROOT_PATH%\builds\install\misc\firebird.conf.in > %FB_OUTPUT_DIR%\firebird.conf -@copy %FB_ROOT_PATH%\builds\install\misc\databases.conf.in %FB_OUTPUT_DIR%\databases.conf >nul -@copy %FB_ROOT_PATH%\builds\install\misc\fbintl.conf %FB_OUTPUT_DIR%\intl >nul +@copy %FB_GEN_DIR%\firebird.msg %FB_OUTPUT_DIR%\ > nul +@copy %FB_ROOT_PATH%\builds\install\misc\firebird.conf %FB_OUTPUT_DIR%\firebird.conf >nul +@copy %FB_ROOT_PATH%\builds\install\misc\databases.conf %FB_OUTPUT_DIR%\databases.conf >nul +@copy %FB_ROOT_PATH%\builds\install\misc\fbintl.conf %FB_OUTPUT_DIR%\intl\ >nul @copy %FB_ROOT_PATH%\builds\install\misc\plugins.conf %FB_OUTPUT_DIR% >nul @copy %FB_ROOT_PATH%\builds\install\misc\replication.conf %FB_OUTPUT_DIR% >nul @copy %FB_ROOT_PATH%\src\utilities\ntrace\fbtrace.conf %FB_OUTPUT_DIR% >nul diff --git a/builds/win32/make_boot.bat b/builds/win32/make_boot.bat index 5683e08830..d7c77277d1 100644 --- a/builds/win32/make_boot.bat +++ b/builds/win32/make_boot.bat @@ -75,7 +75,7 @@ if "%ERRLEV%"=="1" goto :END call :isql if "%ERRLEV%"=="1" goto :END -@findstr /V "@UDF_COMMENT@" %FB_ROOT_PATH%\builds\install\misc\firebird.conf.in > %FB_BIN_DIR%\firebird.conf +@copy %FB_ROOT_PATH%\builds\install\misc\firebird.conf %FB_BIN_DIR%\firebird.conf :: Copy ICU and zlib both to Debug and Release configurations diff --git a/builds/win32/make_examples.bat b/builds/win32/make_examples.bat index e3db17867f..60df8c9936 100644 --- a/builds/win32/make_examples.bat +++ b/builds/win32/make_examples.bat @@ -1,5 +1,4 @@ -::@echo off - +@echo off :: Set env vars @call setenvvar.bat @@ -38,8 +37,9 @@ if errorlevel 1 ( @call :MOVE2 @goto :EOF -::=========== + :BUILD_EMPBUILD +::=========== @echo. @echo Building empbuild.fdb @copy /y %FB_ROOT_PATH%\examples\empbuild\*.sql %FB_GEN_DIR%\examples\ > nul @@ -47,7 +47,7 @@ if errorlevel 1 ( @echo. :: Here we must use cd because isql does not have an option to set a base directory -@cd "%FB_LONG_ROOT_PATH%\gen\examples" +@pushd "%FB_LONG_ROOT_PATH%\gen\examples" @echo Creating empbuild.fdb... @echo. @del empbuild.fdb 2> nul @@ -62,7 +62,8 @@ if defined FB2_INTLEMP ( @%FB_BIN_DIR%\isql -i intlbld.sql ) -@cd "%FB_LONG_ROOT_PATH%\builds\win32" +@popd + @echo. @echo path = %FB_GEN_DB_DIR%\examples @echo Preprocessing empbuild.e... @@ -75,17 +76,18 @@ if defined FB2_INTLEMP ( @%FB_BIN_DIR%\gpre.exe -r -m -n -z %FB_ROOT_PATH%\examples\empbuild\intlbld.e %FB_GEN_DIR%\examples\intlbld.c -b %FB_GEN_DB_DIR%/examples/ ) +::End of BUILD_EMPBUILD +::--------------------- @goto :EOF -::=========== :MOVE +::=========== @echo. @rmdir /q /s %FB_OUTPUT_DIR%\examples 2>nul @mkdir %FB_OUTPUT_DIR%\examples @mkdir %FB_OUTPUT_DIR%\examples\api @mkdir %FB_OUTPUT_DIR%\examples\dbcrypt -@mkdir %FB_OUTPUT_DIR%\examples\build_unix @mkdir %FB_OUTPUT_DIR%\examples\build_win32 @mkdir %FB_OUTPUT_DIR%\examples\empbuild @mkdir %FB_OUTPUT_DIR%\examples\include @@ -97,23 +99,20 @@ if defined FB2_INTLEMP ( @mkdir %FB_OUTPUT_DIR%\plugins\udr 2>nul @echo Moving files to output directory -@copy %FB_ROOT_PATH%\examples\* %FB_OUTPUT_DIR%\examples > nul -@ren %FB_OUTPUT_DIR%\examples\readme readme.txt > nul -@copy %FB_ROOT_PATH%\examples\api\* %FB_OUTPUT_DIR%\examples\api > nul -@copy %FB_ROOT_PATH%\examples\dbcrypt\* %FB_OUTPUT_DIR%\examples\dbcrypt > nul -@copy %FB_ROOT_PATH%\examples\build_unix\* %FB_OUTPUT_DIR%\examples\build_unix > nul -@copy %FB_ROOT_PATH%\examples\build_win32\* %FB_OUTPUT_DIR%\examples\build_win32 > nul +copy %FB_ROOT_PATH%\examples\* %FB_OUTPUT_DIR%\examples > nul +ren %FB_OUTPUT_DIR%\examples\readme readme.txt > nul +copy %FB_ROOT_PATH%\examples\api\* %FB_OUTPUT_DIR%\examples\api > nul +copy %FB_ROOT_PATH%\examples\dbcrypt\* %FB_OUTPUT_DIR%\examples\dbcrypt > nul +copy %FB_ROOT_PATH%\examples\build_win32\* %FB_OUTPUT_DIR%\examples\build_win32 > nul :: @copy %FB_ROOT_PATH%\examples\empbuild\* %FB_OUTPUT_DIR%\examples\empbuild > nul -@copy %FB_ROOT_PATH%\examples\empbuild\employe2.sql %FB_OUTPUT_DIR%\examples\empbuild > nul -@copy %FB_ROOT_PATH%\examples\include\* %FB_OUTPUT_DIR%\examples\include > nul -@copy %FB_ROOT_PATH%\examples\interfaces\* %FB_OUTPUT_DIR%\examples\interfaces > nul -@copy %FB_ROOT_PATH%\examples\package\* %FB_OUTPUT_DIR%\examples\package > nul -@copy %FB_ROOT_PATH%\examples\stat\* %FB_OUTPUT_DIR%\examples\stat > nul -@copy %FB_ROOT_PATH%\examples\udf\* %FB_OUTPUT_DIR%\examples\udf > nul -@copy %FB_ROOT_PATH%\examples\udr\* %FB_OUTPUT_DIR%\examples\udr > nul -@copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\plugins\udr\*.dll %FB_OUTPUT_DIR%\plugins\udr >nul -@copy %FB_ROOT_PATH%\src\extlib\ib_udf* %FB_OUTPUT_DIR%\examples\udf > nul -@copy %FB_ROOT_PATH%\src\extlib\fbudf\* %FB_OUTPUT_DIR%\examples\udf > nul +copy %FB_ROOT_PATH%\examples\empbuild\employe2.sql %FB_OUTPUT_DIR%\examples\empbuild > nul +copy %FB_ROOT_PATH%\examples\include\* %FB_OUTPUT_DIR%\examples\include > nul +copy %FB_ROOT_PATH%\examples\interfaces\* %FB_OUTPUT_DIR%\examples\interfaces > nul +copy %FB_ROOT_PATH%\examples\package\* %FB_OUTPUT_DIR%\examples\package > nul +copy %FB_ROOT_PATH%\examples\stat\* %FB_OUTPUT_DIR%\examples\stat > nul +copy %FB_ROOT_PATH%\examples\udf\* %FB_OUTPUT_DIR%\examples\udf > nul +copy %FB_ROOT_PATH%\examples\udr\* %FB_OUTPUT_DIR%\examples\udr > nul +copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\plugins\udr\*.dll %FB_OUTPUT_DIR%\plugins\udr >nul ::@copy %FB_GEN_DIR%\examples\empbuild.c %FB_OUTPUT_DIR%\examples\empbuild\ > nul ::@copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\examples\empbuild.exe %FB_GEN_DIR%\examples\empbuild.exe > nul @@ -124,37 +123,50 @@ if defined FB2_INTLEMP ( ::@copy %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\examples\intlbuild.exe %FB_GEN_DIR%\examples\intlbuild.exe > nul ::) ::) + +::End of MOVE +::----------- @goto :EOF +:BUILD_EMPLOYEE ::=========== :: only to test if it works -:BUILD_EMPLOYEE + @echo. @echo Building employee.fdb -:: Here we must use cd because isql does not have an option to set a base directory -:: and empbuild.exe uses isql -@set FB_SAVE_PATH=%PATH% -@set PATH=%FB_BIN_DIR%;%PATH% + +:: Do no mess with global variables +setlocal + :: This allows us to use the new engine in embedded mode to build :: the employee database. @set FIREBIRD=%FB_BIN_DIR% +@set PATH=%FB_BIN_DIR%;%PATH% -@cd "%FB_LONG_ROOT_PATH%\gen\examples" -@del %FB_GEN_DIR%\examples\employee.fdb 2>nul -@%FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\empbuild\empbuild.exe %FB_GEN_DB_DIR%/examples/employee.fdb -if errorlevel 44 (call :ERROR empbuild.exe failed - see empbuild_%FB_TARGET_PLATFORM%.log for details & goto :EOF) +:: Here we must use cd because isql does not have an option to set a base directory +:: and empbuild.exe uses isql +:: BEWARE: It will run without error if you have FB client from previous version +:: installed in System32 and server run but created database will have +:: wrong ODS. +@pushd "%FB_GEN_DIR%\examples" +if exist employee.fdb del employee.fdb + +%FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\empbuild\empbuild.exe %FB_GEN_DB_DIR%/examples/employee.fdb +if errorlevel 44 (call :ERROR empbuild.exe failed - see empbuild_%FB_TARGET_PLATFORM%.log for details ) @if defined FB2_INTLEMP ( @echo Building intlemp.fdb @del %FB_GEN_DIR%\examples\intlemp.fdb 2>nul @del isql.tmp 2>nul - @echo s;intlemp.fdb;%SERVER_NAME%:%FB_GEN_DIR%\examples\intlemp.fdb;g > isql.tmp + @echo s;intlemp.fdb;%FB_GEN_DIR%\examples\intlemp.fdb;g > isql.tmp @%FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\intlbuild\intlbuild.exe %FB_GEN_DB_DIR%/examples/intlemp.fdb ) -@set FIREBIRD= -@set PATH=%FB_SAVE_PATH% -@cd "%FB_LONG_ROOT_PATH%\builds\win32" +@popd +endlocal + +::End of BUILD_EMPLOYEE +::--------------------- @goto :EOF ::============== @@ -182,8 +194,8 @@ if defined FB2_INTLEMP ( @echo Error - %* @echo. set ERRLEV=1 -cancel_script > nul 2>&1 + +exit /b 1 + ::End of ERROR ::------------ -@goto :EOF - diff --git a/builds/win32/make_icu.bat b/builds/win32/make_icu.bat index 3f14be2659..ced0139464 100644 --- a/builds/win32/make_icu.bat +++ b/builds/win32/make_icu.bat @@ -10,12 +10,14 @@ :: MAIN @echo Extracting pre-built ICU - %FB_ROOT_PATH%\extern\icu\icu.exe -y > make_icu_%FB_TARGET_PLATFORM%.log 2>&1 - if errorlevel 1 call :ERROR build failed - see make_icu_%FB_TARGET_PLATFORM%.log for details -@goto :EOF +@echo Extracting tzdata +mkdir %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\tzdata +call zipjs.bat unzip -source "%FB_LONG_ROOT_PATH%\extern\icu\tzdata\le.zip" -destination %FB_ROOT_PATH%\temp\%FB_OBJ_DIR%\firebird\tzdata -keep yes + +@goto :EOF :ERROR diff --git a/builds/win32/setenvvar.bat b/builds/win32/setenvvar.bat index ce2bbfec59..724f8bfc26 100644 --- a/builds/win32/setenvvar.bat +++ b/builds/win32/setenvvar.bat @@ -4,11 +4,6 @@ :: FB_DB_PATH unix format path of the main directory :: (This is used by gpre and preprocess.bat) :: VS_VER VisualStudio version (msvc10|msvc12|msvc14) -:: SERVER_NAME server needed to connect to firebird (could include port) -:: Example : localhost/3051 -:: (Note - SERVER_NAME is almost deprecated - it is only used by -:: make_examples.bat -:: @echo off @@ -48,8 +43,6 @@ set VS_VER=msvc%MSVC_VERSION% ::================= :SET_DB_DIR -@SET SERVER_NAME=localhost - @cd ..\.. @for /f "delims=" %%a in ('@cd') do (set FB_LONG_ROOT_PATH=%%a) @for /f "delims=" %%a in ('@cd') do (set FB_ROOT_PATH=%%~sa) @@ -108,7 +101,6 @@ if defined VS_VER_EXPRESS ( @echo msvc_version=%MSVC_VERSION% @echo db_path=%FB_DB_PATH% @echo root_path=%FB_ROOT_PATH% -@echo server_name=%SERVER_NAME% @echo. @echo (End of %0) @echo. diff --git a/builds/win32/zipjs.bat b/builds/win32/zipjs.bat new file mode 100644 index 0000000000..02b8fcbc24 --- /dev/null +++ b/builds/win32/zipjs.bat @@ -0,0 +1,823 @@ +@if (@X)==(@Y) @end /* JScript comment + @echo off + + rem :: the first argument is the script name as it will be used for proper help message + cscript //E:JScript //nologo "%~f0" "%~nx0" %* + + exit /b %errorlevel% + +@if (@X)==(@Y) @end JScript comment */ + + +/* +Compression/uncompression command-line tool that uses Shell.Application and WSH/Jscript - +http://msdn.microsoft.com/en-us/library/windows/desktop/bb774085(v=vs.85).aspx + +Some resources That I've used: +http://www.robvanderwoude.com/vbstech_files_zip.php +https://code.google.com/p/jsxt/source/browse/trunk/js/win32/ZipFile.js?r=161 + + + + +UPDATE *17-03-15* + +Devnullius Plussed noticed a bug in ZipDirItems and ZipItem functions (now fixed) +And also following issues (at the moment not handled by the script): +- if there's not enough space on the system drive (usually C:\) the script could produce various errors , most often the script halts. +- Folders and files that contain unicode symbols cannot be handled by Shell.Application object. + +UPDATE *24-03-15* + +Error messages are caught in waitforcount method and if shuch pops-up the script is stopped. +As I don't know hoe to check the content of the pop-up the exact reason for the failure is not given +but only the possible reasons. + +UPDATE *22-02-16* + +Javid Pack(https://github.com/JavidPack) has found two bugs in zipItem command and in ZipItem function.Now fixed. + +------ +It's possible to be ported for C#,Powershell and JScript.net so I'm planning to do it at some time. + +For sure there's a lot of room for improvements and optimization and I'm absolutely sure there are some bugs +as the script is big enough to not have. + + + +!!! +For suggestions contact me at - npocmaka@gmail.com +!!! + +*/ + + +////////////////////////////////////// +// CONSTANTS + +// TODO - Shell.Application and Scripting.FileSystemObject objects could be set as global variables to avoid theit creation +// in every method. + +//empty zip character sequense +var ZIP_DATA= "PK" + String.fromCharCode(5) + String.fromCharCode(6) + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"; + +var SLEEP_INTERVAL=200; + +//copy option(s) used by Shell.Application.CopyHere/MoveHere +var NO_PROGRESS_BAR=4; + + +//oprions used for zip/unzip +var force=true; +var move=false; + +//option used for listing content of archive +var flat=false; + +var source=""; +var destination=""; + +var ARGS = WScript.Arguments; +var scriptName=ARGS.Item(0); + +// +////////////////////////////////////// + +////////////////////////////////////// +// ADODB.Stream extensions + +if ( ! this.ADODB ) { + var ADODB = {}; +} + +if ( ! ADODB.Stream ) { + ADODB.Stream = {}; +} + +// writes a binary data to a file +if ( ! ADODB.Stream.writeFile ) { + ADODB.Stream.writeFile = function(filename, bindata) + { + var stream = new ActiveXObject("ADODB.Stream"); + stream.Type = 2; + stream.Mode = 3; + stream.Charset ="ASCII"; + stream.Open(); + stream.Position = 0; + stream.WriteText(bindata); + stream.SaveToFile(filename, 2); + stream.Close(); + return true; + }; +} + +// +////////////////////////////////////// + +////////////////////////////////////// +// common + +if ( ! this.Common ) { + var Common = {}; +} + +if ( ! Common.WaitForCount ) { + Common.WaitForCount = function(folderObject,targetCount,countFunction){ + var shell = new ActiveXObject("Wscript.Shell"); + while (countFunction(folderObject) < targetCount ){ + WScript.Sleep(SLEEP_INTERVAL); + //checks if a pop-up with error message appears while zipping + //at the moment I have no idea how to read the pop-up content + // to give the exact reason for failing + if (shell.AppActivate("Compressed (zipped) Folders Error")) { + WScript.Echo("Error While zipping"); + WScript.Echo(""); + WScript.Echo("Possible reasons:"); + WScript.Echo(" -source contains filename(s) with unicode characters"); + WScript.Echo(" -produces zip exceeds 8gb size (or 2,5 gb for XP and 2003)"); + WScript.Echo(" -not enough space on system drive (usually C:\\)"); + WScript.Quit(432); + } + + } + } +} + +if ( ! Common.getParent ) { + Common.getParent = function(path){ + var splitted=path.split("\\"); + var result=""; + for (var s=0;s/tzdata` is the default directory where Firebird looks for the database. It could be overriden with the `ICU_TIMEZONE_FILES_DIR` environment variable. + +Important note: Firebird stores `WITH TIME ZONE` values translated to UTC time. If a value is created with one time zone database and later that database is updated and the update changes the information in the range of a stored value, when reading that value it will be returned as a different value than the one initially stored. # Appendix: time zone regions diff --git a/extern/icu/Readme.txt b/extern/icu/Readme.txt index 58ad881a06..990fa71721 100644 --- a/extern/icu/Readme.txt +++ b/extern/icu/Readme.txt @@ -2,10 +2,14 @@ icu.exe is a self-extract pre-built (by us) IBM ICU 63.1 library. The sources was downloaded from http://site.icu-project.org/download. -The simple fix for bug ICU-20302 (Windows 7: timezone detection on Windows +The simple fix for bug ICU-20302 (Windows 7: timezone detection on Windows is broken) is applyed, see: https://unicode-org.atlassian.net/browse/ICU-20302 https://github.com/unicode-org/icu/pull/315 The build was done using VS 2017 (15.9). + +--- + +tzdata is automatically updated (pull request created) by GitHub Actions tzdata-update.yml. diff --git a/extern/icu/tzdata/be.zip b/extern/icu/tzdata/be.zip new file mode 100644 index 0000000000..410ebd0605 Binary files /dev/null and b/extern/icu/tzdata/be.zip differ diff --git a/extern/icu/tzdata/le.zip b/extern/icu/tzdata/le.zip new file mode 100644 index 0000000000..7e9390b15c Binary files /dev/null and b/extern/icu/tzdata/le.zip differ diff --git a/extern/icu/tzdata/update.sh b/extern/icu/tzdata/update.sh new file mode 100755 index 0000000000..ffa1e19ede --- /dev/null +++ b/extern/icu/tzdata/update.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# Change version.txt before run this script. + +THIS_DIR=`readlink -f $0` +THIS_DIR=`dirname $THIS_DIR` + +TMP_DIR=`mktemp -d` +VERSION=`cat $THIS_DIR/version.txt` +BASE_URL=https://github.com/unicode-org/icu-data/raw/master/tzdata/icunew/$VERSION/44 + +echo Downloading and updating little-endian files... +mkdir $TMP_DIR/le +cd $TMP_DIR/le +curl -OLs $BASE_URL/le/metaZones.res +curl -OLs $BASE_URL/le/timezoneTypes.res +curl -OLs $BASE_URL/le/windowsZones.res +curl -OLs $BASE_URL/le/zoneinfo64.res +rm $THIS_DIR/le.zip +zip $THIS_DIR/le.zip *.res + +echo Downloading and updating big-endian files... +mkdir $TMP_DIR/be +cd $TMP_DIR/be +curl -OLs $BASE_URL/be/metaZones.res +curl -OLs $BASE_URL/be/timezoneTypes.res +curl -OLs $BASE_URL/be/windowsZones.res +curl -OLs $BASE_URL/be/zoneinfo64.res +rm $THIS_DIR/be.zip +zip $THIS_DIR/be.zip *.res + +rm -r $TMP_DIR diff --git a/extern/icu/tzdata/version.txt b/extern/icu/tzdata/version.txt new file mode 100644 index 0000000000..db18f8311d --- /dev/null +++ b/extern/icu/tzdata/version.txt @@ -0,0 +1 @@ +2019c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index dfedabe21b..b890c4ea8b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -909,8 +909,8 @@ add_custom_target(copy_files COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GENERATED_DIR}/security.fdb ${output_dir}/security4.fdb COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GENERATED_DIR}/help.fdb ${output_dir}/help/help.fdb # configs, text files - COMMAND sed "/@UDF_COMMENT@/d" < ${CMAKE_SOURCE_DIR}/builds/install/misc/firebird.conf.in > ${output_dir}/firebird.conf - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/misc/databases.conf.in ${output_dir}/databases.conf + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/misc/firebird.conf ${output_dir}/firebird.conf + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/misc/databases.conf ${output_dir}/databases.conf COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/misc/fbintl.conf ${output_dir}/intl/fbintl.conf COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/misc/plugins.conf ${output_dir}/plugins.conf COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/misc/IPLicense.txt ${output_dir}/IPLicense.txt diff --git a/src/burp/burp.cpp b/src/burp/burp.cpp index c8bc046f6e..ed449de7f4 100644 --- a/src/burp/burp.cpp +++ b/src/burp/burp.cpp @@ -826,16 +826,14 @@ int gbak(Firebird::UtilSvc* uSvc) FILE* tmp_outfile = os_utils::fopen(redirect, fopen_read_type); if (tmp_outfile) { - BURP_print(true, 66, redirect); - // msg 66 can't open status and error output file %s fclose(tmp_outfile); - BURP_exit_local(FINI_ERROR, tdgbl); + BURP_error(66, true, SafeArg() << redirect); + // msg 66 can't open status and error output file %s } if (! (tdgbl->output_file = os_utils::fopen(redirect, fopen_write_type))) { - BURP_print(true, 66, redirect); + BURP_error(66, true, SafeArg() << redirect); // msg 66 can't open status and error output file %s - BURP_exit_local(FINI_ERROR, tdgbl); } } } diff --git a/src/burp/restore.epp b/src/burp/restore.epp index 9493ae7fa8..267119b87c 100644 --- a/src/burp/restore.epp +++ b/src/burp/restore.epp @@ -1090,7 +1090,7 @@ void create_database(BurpGlobals* tdgbl, Firebird::IProvider* provider, const TE if (!tdgbl->gbl_sw_crypt) { - BURP_error(true, 378); + BURP_error(378, true); // Unknown crypt plugin name - use -CRYPT switch } @@ -4903,12 +4903,15 @@ bool get_function(BurpGlobals* tdgbl) bool existFlag = false; + Firebird::ITransaction* local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans; + if (tdgbl->runtimeODS >= DB_VERSION_DDL12) { GDS_NAME function_name; bool securityClass = false; - STORE (REQUEST_HANDLE tdgbl->handles_get_function_req_handle1) + STORE (TRANSACTION_HANDLE local_trans + REQUEST_HANDLE tdgbl->handles_get_function_req_handle1) X IN RDB$FUNCTIONS X.RDB$DESCRIPTION.NULL = TRUE; X.RDB$ENGINE_NAME.NULL = TRUE; @@ -4959,12 +4962,12 @@ bool get_function(BurpGlobals* tdgbl) case att_function_description: X.RDB$DESCRIPTION.NULL = FALSE; - get_misc_blob (tdgbl, X.RDB$DESCRIPTION, false); + get_misc_blob (tdgbl, X.RDB$DESCRIPTION, true); break; case att_function_description2: X.RDB$DESCRIPTION.NULL = FALSE; - get_source_blob (tdgbl, X.RDB$DESCRIPTION, false); + get_source_blob (tdgbl, X.RDB$DESCRIPTION, true); break; case att_function_module_name: @@ -5024,7 +5027,7 @@ bool get_function(BurpGlobals* tdgbl) case att_function_blr: if (tdgbl->RESTORE_format >= 10) { - get_blr_blob(tdgbl, X.RDB$FUNCTION_BLR, false); + get_blr_blob(tdgbl, X.RDB$FUNCTION_BLR, true); X.RDB$FUNCTION_BLR.NULL = FALSE; } else @@ -5034,7 +5037,7 @@ bool get_function(BurpGlobals* tdgbl) case att_function_source: if (tdgbl->RESTORE_format >= 10) { - get_source_blob(tdgbl, X.RDB$FUNCTION_SOURCE, false); + get_source_blob(tdgbl, X.RDB$FUNCTION_SOURCE, true); X.RDB$FUNCTION_SOURCE.NULL = FALSE; } else @@ -5054,7 +5057,7 @@ bool get_function(BurpGlobals* tdgbl) case att_function_debug_info: if (tdgbl->RESTORE_format >= 10) { - get_misc_blob(tdgbl, X.RDB$DEBUG_INFO, false); + get_misc_blob(tdgbl, X.RDB$DEBUG_INFO, true); X.RDB$DEBUG_INFO.NULL = FALSE; } else @@ -5133,7 +5136,8 @@ bool get_function(BurpGlobals* tdgbl) } else { - STORE (REQUEST_HANDLE tdgbl->handles_get_function_req_handle1) + STORE (TRANSACTION_HANDLE local_trans + REQUEST_HANDLE tdgbl->handles_get_function_req_handle1) X IN RDB$FUNCTIONS X.RDB$SYSTEM_FLAG = 0; X.RDB$SYSTEM_FLAG.NULL = FALSE; @@ -5279,6 +5283,8 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments) att_type attribute; scan_attr_t scan_next_attr; + Firebird::ITransaction* local_trans = tdgbl->global_trans ? tdgbl->global_trans : gds_trans; + if (skip_arguments) { skip_init(&scan_next_attr); @@ -5378,7 +5384,8 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments) if (tdgbl->runtimeODS >= DB_VERSION_DDL12) { // with RDB$FIELD_PRECISION - STORE (REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1) + STORE (TRANSACTION_HANDLE local_trans + REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1) X IN RDB$FUNCTION_ARGUMENTS X.RDB$FIELD_SUB_TYPE.NULL = TRUE; X.RDB$CHARACTER_SET_ID.NULL = TRUE; @@ -5496,7 +5503,7 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments) case att_functionarg_default_value: if (tdgbl->RESTORE_format >= 10) { - get_blr_blob(tdgbl, X.RDB$DEFAULT_VALUE, false); + get_blr_blob(tdgbl, X.RDB$DEFAULT_VALUE, true); X.RDB$DEFAULT_VALUE.NULL = FALSE; } else @@ -5587,7 +5594,8 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments) else if (tdgbl->runtimeODS >= DB_VERSION_DDL10) { // with RDB$FIELD_PRECISION - STORE (REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1) + STORE (TRANSACTION_HANDLE local_trans + REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1) X IN RDB$FUNCTION_ARGUMENTS X.RDB$FIELD_SUB_TYPE.NULL = TRUE; X.RDB$CHARACTER_SET_ID.NULL = TRUE; @@ -5700,7 +5708,8 @@ void get_function_arg(BurpGlobals* tdgbl, bool skip_arguments) else { // without RDB$FIELD_PRECISION - STORE (REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1) + STORE (TRANSACTION_HANDLE local_trans + REQUEST_HANDLE tdgbl->handles_get_function_arg_req_handle1) X IN RDB$FUNCTION_ARGUMENTS X.RDB$FIELD_SUB_TYPE.NULL = TRUE; X.RDB$CHARACTER_SET_ID.NULL = TRUE; diff --git a/src/common/TimeZoneUtil.cpp b/src/common/TimeZoneUtil.cpp index 05d1d6f7ee..862686466c 100644 --- a/src/common/TimeZoneUtil.cpp +++ b/src/common/TimeZoneUtil.cpp @@ -34,6 +34,7 @@ #include "../common/classes/timestamp.h" #include "../common/classes/GenericMap.h" #include "../common/config/config.h" +#include "../common/os/path_utils.h" #include "unicode/ucal.h" #ifdef TZ_UPDATE @@ -190,6 +191,21 @@ static InitInstance timeZoneStartup; //------------------------------------- const char TimeZoneUtil::GMT_FALLBACK[5] = "GMT*"; +InitInstance TimeZoneUtil::tzDataPath; + +void TimeZoneUtil::initTimeZoneEnv() +{ + PathName path; + PathUtils::concatPath(path, Config::getRootDirectory(), "tzdata"); + + if (fb_utils::setenv("ICU_TIMEZONE_FILES_DIR", path.c_str(), false)) + tzDataPath() = path; +} + +const PathName& TimeZoneUtil::getTzDataPath() +{ + return tzDataPath(); +} // Return the current user's time zone. USHORT TimeZoneUtil::getSystemTimeZone() diff --git a/src/common/TimeZoneUtil.h b/src/common/TimeZoneUtil.h index 69bc5ba18a..b2bda3dd63 100644 --- a/src/common/TimeZoneUtil.h +++ b/src/common/TimeZoneUtil.h @@ -65,6 +65,9 @@ public: static const unsigned MAX_LEN = 32; static const unsigned MAX_SIZE = MAX_LEN + 1; +private: + static InitInstance tzDataPath; + public: static UDate ticksToIcuDate(SINT64 ticks) { @@ -76,6 +79,9 @@ public: return (SINT64(icuDate) * 10) + (TimeStamp::UNIX_DATE * TimeStamp::ISC_TICKS_PER_DAY); } + static void initTimeZoneEnv(); + static const PathName& getTzDataPath(); + static USHORT getSystemTimeZone(); static void getDatabaseVersion(Firebird::string& str); diff --git a/src/common/classes/RefCounted.h b/src/common/classes/RefCounted.h index d8a6027c47..547f1f9171 100644 --- a/src/common/classes/RefCounted.h +++ b/src/common/classes/RefCounted.h @@ -219,7 +219,7 @@ namespace Firebird } } - return ptr; + return p; } private: diff --git a/src/common/config/config.cpp b/src/common/config/config.cpp index c02df718e1..e2573d8140 100644 --- a/src/common/config/config.cpp +++ b/src/common/config/config.cpp @@ -202,9 +202,9 @@ const Config::ConfigEntry Config::entries[MAX_CONFIG_KEY] = {TYPE_STRING, "UserManager", (ConfigValue) "Srp"}, {TYPE_STRING, "TracePlugin", (ConfigValue) "fbtrace"}, {TYPE_STRING, "SecurityDatabase", (ConfigValue) "security.db"}, // sec/db alias - rely on databases.conf - {TYPE_STRING, "ServerMode", (ConfigValue) "Super"}, + {TYPE_STRING, "ServerMode", (ConfigValue) ""}, // actual value differs in boot/regular cases {TYPE_STRING, "WireCrypt", (ConfigValue) NULL}, - {TYPE_STRING, "WireCryptPlugin", (ConfigValue) "Arc4"}, + {TYPE_STRING, "WireCryptPlugin", (ConfigValue) "ChaCha, Arc4"}, {TYPE_STRING, "KeyHolderPlugin", (ConfigValue) ""}, {TYPE_BOOLEAN, "RemoteAccess", (ConfigValue) true}, {TYPE_BOOLEAN, "IPv6V6Only", (ConfigValue) false}, @@ -718,7 +718,7 @@ int Config::getServerMode() } // use default - rc = MODE_SUPER; + rc = fb_utils::bootBuild() ? MODE_CLASSIC : MODE_SUPER; return rc; } diff --git a/src/common/cvt.cpp b/src/common/cvt.cpp index ecac568f9f..dfeb2019e2 100644 --- a/src/common/cvt.cpp +++ b/src/common/cvt.cpp @@ -1802,7 +1802,7 @@ void CVT_move_common(const dsc* from, dsc* to, DecimalStatus decSt, Callbacks* c const UCHAR* start = to->dsc_address; UCHAR fill_char = ASCII_SPACE; Jrd::CharSet* toCharset = cb->getToCharset(charset2); - ULONG toLength; + ULONG toLength = 0; ULONG fill; if (charset2 == ttype_binary) diff --git a/src/common/unicode_util.cpp b/src/common/unicode_util.cpp index faacf19c78..d53dcb50ad 100644 --- a/src/common/unicode_util.cpp +++ b/src/common/unicode_util.cpp @@ -31,12 +31,14 @@ #include "../common/isc_proto.h" #include "../common/CharSet.h" #include "../common/IntlUtil.h" +#include "../common/TimeZoneUtil.h" #include "../common/gdsassert.h" #include "../common/classes/auto.h" #include "../common/classes/GenericMap.h" #include "../common/classes/init.h" #include "../common/classes/objects_array.h" #include "../common/classes/rwlock.h" +#include "../common/config/config.h" #include "../common/StatusHolder.h" #include "../common/os/path_utils.h" @@ -126,9 +128,11 @@ public: void BaseICU::initialize(ModuleLoader::Module* module) { void (U_EXPORT2 *uInit)(UErrorCode* status); + void (U_EXPORT2 *uSetTimeZoneFilesDirectory)(const char* path, UErrorCode* status); void (U_EXPORT2 *uSetDataDirectory)(const char* directory); getEntryPoint("u_init", module, uInit, true); + getEntryPoint("u_setTimeZoneFilesDirectory", module, uSetTimeZoneFilesDirectory, true); getEntryPoint("u_setDataDirectory", module, uSetDataDirectory, true); #if defined(WIN_NT) || defined(DARWIN) @@ -166,6 +170,15 @@ void BaseICU::initialize(ModuleLoader::Module* module) (Arg::Gds(isc_random) << diag).raise(); } } + + // ICU's u_setTimeZoneFilesDirectory is an internal API, but we try to use + // it because internally set ICU_TIMEZONE_FILES_DIR envvar in Windows is not + // safe. See comments in fb_utils::setenv. + if (uSetTimeZoneFilesDirectory && TimeZoneUtil::getTzDataPath().hasData()) + { + UErrorCode status = U_ZERO_ERROR; + uSetTimeZoneFilesDirectory(TimeZoneUtil::getTzDataPath().c_str(), &status); + } } } diff --git a/src/common/utils.cpp b/src/common/utils.cpp index 7ae7234641..09285a6e10 100644 --- a/src/common/utils.cpp +++ b/src/common/utils.cpp @@ -38,6 +38,7 @@ #endif #include #include +#include #include #include "../common/gdsassert.h" @@ -303,6 +304,35 @@ bool readenv(const char* env_name, Firebird::PathName& env_value) } +bool setenv(const char* name, const char* value, bool overwrite) +{ +#ifdef WIN_NT + int errcode = 0; + + if (!overwrite) + { + size_t envsize = 0; + errcode = getenv_s(&envsize, NULL, 0, name); + if (errcode || envsize) + return false; + } + + // In Windows, _putenv_s sets only the environment data in the CRT. + // Each DLL (for example ICU) may use a different CRT which different data + // or use Win32's GetEnvironmentVariable, so we also use SetEnvironmentVariable. + // This is a mess and is not guarenteed to work correctly in all situations. + if (SetEnvironmentVariable(name, value)) + { + _putenv_s(name, value); + return true; + } + else + return false; +#else + return ::setenv(name, value, (int) overwrite) == 0; +#endif +} + // *************** // s n p r i n t f // *************** diff --git a/src/common/utils_proto.h b/src/common/utils_proto.h index fa362bec68..f49b7ff1bf 100644 --- a/src/common/utils_proto.h +++ b/src/common/utils_proto.h @@ -55,6 +55,7 @@ namespace fb_utils int name_length_limit(const TEXT* const name, size_t bufsize); bool readenv(const char* env_name, Firebird::string& env_value); bool readenv(const char* env_name, Firebird::PathName& env_value); + bool setenv(const char* name, const char* value, bool overwrite); int snprintf(char* buffer, size_t count, const char* format...); char* cleanup_passwd(char* arg); inline char* get_passwd(char* arg) diff --git a/src/dsql/ExprNodes.cpp b/src/dsql/ExprNodes.cpp index d645e92d94..decd7fc757 100644 --- a/src/dsql/ExprNodes.cpp +++ b/src/dsql/ExprNodes.cpp @@ -3314,7 +3314,7 @@ DmlNode* CastNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb if (itemInfo.isSpecial()) node->itemInfo = FB_NEW_POOL(*tdbb->getDefaultPool()) ItemInfo(*tdbb->getDefaultPool(), itemInfo); - if (itemInfo.explicitCollation) + if ((csb->csb_g_flags & csb_get_dependencies) && itemInfo.explicitCollation) { CompilerScratch::Dependency dependency(obj_collation); dependency.number = INTL_TEXT_TYPE(node->castDesc); @@ -4805,10 +4805,13 @@ DmlNode* DefaultNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb->csb_blr_reader.getMetaName(relationName); csb->csb_blr_reader.getMetaName(fieldName); - CompilerScratch::Dependency dependency(obj_relation); - dependency.relation = MET_lookup_relation(tdbb, relationName); - dependency.subName = FB_NEW_POOL(pool) MetaName(fieldName); - csb->csb_dependencies.push(dependency); + if (csb->csb_g_flags & csb_get_dependencies) + { + CompilerScratch::Dependency dependency(obj_relation); + dependency.relation = MET_lookup_relation(tdbb, relationName); + dependency.subName = FB_NEW_POOL(pool) MetaName(fieldName); + csb->csb_dependencies.push(dependency); + } jrd_fld* fld = NULL; diff --git a/src/dsql/StmtNodes.cpp b/src/dsql/StmtNodes.cpp index 2e9d79e026..d9c8a98763 100644 --- a/src/dsql/StmtNodes.cpp +++ b/src/dsql/StmtNodes.cpp @@ -2174,7 +2174,7 @@ DmlNode* DeclareVariableNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerS csb->csb_map_item_info.put(Item(Item::TYPE_VARIABLE, node->varId), itemInfo); } - if (itemInfo.explicitCollation) + if ((csb->csb_g_flags & csb_get_dependencies) && itemInfo.explicitCollation) { CompilerScratch::Dependency dependency(obj_collation); dependency.number = INTL_TEXT_TYPE(node->varDesc); @@ -2715,9 +2715,13 @@ DmlNode* ErrorHandlerNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScra if (!MET_load_exception(tdbb, item)) PAR_error(csb, Arg::Gds(isc_xcpnotdef) << item.name); - CompilerScratch::Dependency dependency(obj_exception); - dependency.number = item.code; - csb->csb_dependencies.push(dependency); + if (csb->csb_g_flags & csb_get_dependencies) + { + CompilerScratch::Dependency dependency(obj_exception); + dependency.number = item.code; + csb->csb_dependencies.push(dependency); + } + break; } @@ -2886,7 +2890,7 @@ DmlNode* ExecProcedureNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScr PAR_procedure_parms(tdbb, csb, procedure, node->outputMessage.getAddress(), node->outputSources.getAddress(), node->outputTargets.getAddress(), false); - if (!procedure->isSubRoutine()) + if ((csb->csb_g_flags & csb_get_dependencies) && !procedure->isSubRoutine()) { CompilerScratch::Dependency dependency(obj_procedure); dependency.procedure = procedure; @@ -4500,9 +4504,12 @@ DmlNode* ExceptionNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch if (!MET_load_exception(tdbb, *item)) PAR_error(csb, Arg::Gds(isc_xcpnotdef) << item->name); - CompilerScratch::Dependency dependency(obj_exception); - dependency.number = item->code; - csb->csb_dependencies.push(dependency); + if (csb->csb_g_flags & csb_get_dependencies) + { + CompilerScratch::Dependency dependency(obj_exception); + dependency.number = item->code; + csb->csb_dependencies.push(dependency); + } } break; diff --git a/src/include/firebird/impl/consts_pub.h b/src/include/firebird/impl/consts_pub.h index fc6f912f92..9ba14d70f9 100644 --- a/src/include/firebird/impl/consts_pub.h +++ b/src/include/firebird/impl/consts_pub.h @@ -153,8 +153,9 @@ ::= isc_dpb_addr_protocol | - isc_dpb_addr_endpoint - isc_dpb_addr_flags + isc_dpb_addr_endpoint | + isc_dpb_addr_flags | + isc_dpb_addr_crypt ::= "TCPv4" | @@ -163,6 +164,11 @@ "WNET" | .... + ::= + "Arc4" | + "ChaCha" | + .... + ::= | // such as "172.20.1.1" | // such as "2001:0:13FF:09FF::1" @@ -178,6 +184,7 @@ #define isc_dpb_addr_protocol 1 #define isc_dpb_addr_endpoint 2 #define isc_dpb_addr_flags 3 +#define isc_dpb_addr_crypt 4 /* possible addr flags */ #define isc_dpb_addr_flag_conn_compressed 0x01 diff --git a/src/include/firebird/impl/inf_pub.h b/src/include/firebird/impl/inf_pub.h index ea4d31eb9d..003ef9a68d 100644 --- a/src/include/firebird/impl/inf_pub.h +++ b/src/include/firebird/impl/inf_pub.h @@ -160,6 +160,8 @@ enum db_info_types fb_info_creation_timestamp_tz = 139, + fb_info_wire_crypt = 140, + isc_info_db_last_value /* Leave this LAST! */ }; diff --git a/src/include/gen/ids.h b/src/include/gen/ids.h deleted file mode 100644 index 9c3beca6b8..0000000000 --- a/src/include/gen/ids.h +++ /dev/null @@ -1,707 +0,0 @@ - -/* - * PROGRAM: JRD Access Method - * MODULE: relations.h - * DESCRIPTION: System relation definitions - * - * The contents of this file are subject to the Interbase Public - * License Version 1.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy - * of the License at http://www.Inprise.com/IPL.html - * - * Software distributed under the License is distributed on an - * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express - * or implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code was created by Inprise Corporation - * and its predecessors. Portions created by Inprise Corporation are - * Copyright (C) Inprise Corporation. - * - * All Rights Reserved. - * Contributor(s): ______________________________________. - */ - -// Order of relations in this file affect their IDs, -// so please add new relations to the end of the list - -// Relation 0 (RDB$PAGES) - - const USHORT f_pag_page = 0; - const USHORT f_pag_id = 1; - const USHORT f_pag_seq = 2; - const USHORT f_pag_type = 3; - - -// Relation 1 (RDB$DATABASE) - - const USHORT f_dat_desc = 0; - const USHORT f_dat_id = 1; - const USHORT f_dat_class = 2; - const USHORT f_dat_charset = 3; - const USHORT f_dat_linger = 4; - const USHORT f_dat_sql_security = 5; - - -// Relation 2 (RDB$FIELDS) - - const USHORT f_fld_name = 0; - const USHORT f_fld_qname = 1; - const USHORT f_fld_v_blr = 2; - const USHORT f_fld_v_source = 3; - const USHORT f_fld_computed = 4; - const USHORT f_fld_csource = 5; - const USHORT f_fld_default = 6; - const USHORT f_fld_dsource = 7; - const USHORT f_fld_length = 8; - const USHORT f_fld_scale = 9; - const USHORT f_fld_type = 10; - const USHORT f_fld_sub_type = 11; - const USHORT f_fld_missing = 12; - const USHORT f_fld_msource = 13; - const USHORT f_fld_desc = 14; - const USHORT f_fld_sys_flag = 15; - const USHORT f_fld_qheader = 16; - const USHORT f_fld_seg_len = 17; - const USHORT f_fld_estring = 18; - const USHORT f_fld_ext_length = 19; - const USHORT f_fld_ext_scale = 20; - const USHORT f_fld_ext_type = 21; - const USHORT f_fld_dimensions = 22; - const USHORT f_fld_null_flag = 23; - const USHORT f_fld_char_length = 24; - const USHORT f_fld_coll_id = 25; - const USHORT f_fld_charset_id = 26; - const USHORT f_fld_precision = 27; - const USHORT f_fld_class = 28; - const USHORT f_fld_owner = 29; - - -// Relation 3 (RDB$INDEX_SEGMENTS) - - const USHORT f_seg_name = 0; - const USHORT f_seg_field = 1; - const USHORT f_seg_position = 2; - const USHORT f_seg_statistics = 3; - - -// Relation 4 (RDB$INDICES) - - const USHORT f_idx_name = 0; - const USHORT f_idx_relation = 1; - const USHORT f_idx_id = 2; - const USHORT f_idx_flag = 3; - const USHORT f_idx_desc = 4; - const USHORT f_idx_count = 5; - const USHORT f_idx_inactive = 6; - const USHORT f_idx_type = 7; - const USHORT f_idx_foreign = 8; - const USHORT f_idx_sys_flag = 9; - const USHORT f_idx_exp_blr = 10; - const USHORT f_idx_exp_source = 11; - const USHORT f_idx_statistics = 12; - - -// Relation 5 (RDB$RELATION_FIELDS) - - const USHORT f_rfr_fname = 0; - const USHORT f_rfr_rname = 1; - const USHORT f_rfr_sname = 2; - const USHORT f_rfr_qname = 3; - const USHORT f_rfr_base = 4; - const USHORT f_rfr_estring = 5; - const USHORT f_rfr_position = 6; - const USHORT f_rfr_qheader = 7; - const USHORT f_rfr_flag = 8; - const USHORT f_rfr_id = 9; - const USHORT f_rfr_context = 10; - const USHORT f_rfr_desc = 11; - const USHORT f_rfr_default = 12; - const USHORT f_rfr_sys_flag = 13; - const USHORT f_rfr_class = 14; - const USHORT f_rfr_complex = 15; - const USHORT f_rfr_null_flag = 16; - const USHORT f_rfr_dsource = 17; - const USHORT f_rfr_coll_id = 18; - const USHORT f_rfr_gen_name = 19; - const USHORT f_rfr_identity_type = 20; - - -// Relation 6 (RDB$RELATIONS) - - const USHORT f_rel_blr = 0; - const USHORT f_rel_source = 1; - const USHORT f_rel_desc = 2; - const USHORT f_rel_id = 3; - const USHORT f_rel_sys_flag = 4; - const USHORT f_rel_key_len = 5; - const USHORT f_rel_format = 6; - const USHORT f_rel_field_id = 7; - const USHORT f_rel_name = 8; - const USHORT f_rel_class = 9; - const USHORT f_rel_ext_file = 10; - const USHORT f_rel_runtime = 11; - const USHORT f_rel_ext_desc = 12; - const USHORT f_rel_owner = 13; - const USHORT f_rel_def_class = 14; - const USHORT f_rel_flags = 15; - const USHORT f_rel_type = 16; - const USHORT f_rel_sql_security = 17; - - -// Relation 7 (RDB$VIEW_RELATIONS) - - const USHORT f_vrl_vname = 0; - const USHORT f_vrl_rname = 1; - const USHORT f_vrl_context = 2; - const USHORT f_vrl_cname = 3; - const USHORT f_vrl_context_type = 4; - const USHORT f_vrl_pkg_name = 5; - - -// Relation 8 (RDB$FORMATS) - - const USHORT f_fmt_rid = 0; - const USHORT f_fmt_format = 1; - const USHORT f_fmt_desc = 2; - - -// Relation 9 (RDB$SECURITY_CLASSES) - - const USHORT f_cls_class = 0; - const USHORT f_cls_acl = 1; - const USHORT f_cls_desc = 2; - - -// Relation 10 (RDB$FILES) - - const USHORT f_file_name = 0; - const USHORT f_file_seq = 1; - const USHORT f_file_start = 2; - const USHORT f_file_length = 3; - const USHORT f_file_flags = 4; - const USHORT f_file_shad_num = 5; - - -// Relation 11 (RDB$TYPES) - - const USHORT f_typ_field = 0; - const USHORT f_typ_type = 1; - const USHORT f_typ_name = 2; - const USHORT f_typ_desc = 3; - const USHORT f_typ_sys_flag = 4; - - -// Relation 12 (RDB$TRIGGERS) - - const USHORT f_trg_name = 0; - const USHORT f_trg_rname = 1; - const USHORT f_trg_seq = 2; - const USHORT f_trg_type = 3; - const USHORT f_trg_source = 4; - const USHORT f_trg_blr = 5; - const USHORT f_trg_desc = 6; - const USHORT f_trg_inactive = 7; - const USHORT f_trg_sys_flag = 8; - const USHORT f_trg_flags = 9; - const USHORT f_trg_valid_blr = 10; - const USHORT f_trg_debug_info = 11; - const USHORT f_trg_engine_name = 12; - const USHORT f_trg_entry = 13; - const USHORT f_trg_sql_security = 14; - - -// Relation 13 (RDB$DEPENDENCIES) - - const USHORT f_dpd_name = 0; - const USHORT f_dpd_o_name = 1; - const USHORT f_dpd_f_name = 2; - const USHORT f_dpd_type = 3; - const USHORT f_dpd_o_type = 4; - const USHORT f_dpd_pkg_name = 5; - - -// Relation 14 (RDB$FUNCTIONS) - - const USHORT f_fun_name = 0; - const USHORT f_fun_type = 1; - const USHORT f_fun_qname = 2; - const USHORT f_fun_desc = 3; - const USHORT f_fun_module = 4; - const USHORT f_fun_entry = 5; - const USHORT f_fun_ret_arg = 6; - const USHORT f_fun_sys_flag = 7; - const USHORT f_fun_engine_name = 8; - const USHORT f_fun_pkg_name = 9; - const USHORT f_fun_private_flag = 10; - const USHORT f_fun_source = 11; - const USHORT f_fun_id = 12; - const USHORT f_fun_blr = 13; - const USHORT f_fun_valid_blr = 14; - const USHORT f_fun_debug_info = 15; - const USHORT f_fun_class = 16; - const USHORT f_fun_owner = 17; - const USHORT f_fun_legacy_flag = 18; - const USHORT f_fun_deterministic_flag = 19; - const USHORT f_fun_sql_security = 20; - - -// Relation 15 (RDB$FUNCTION_ARGUMENTS) - - const USHORT f_arg_fun_name = 0; - const USHORT f_arg_pos = 1; - const USHORT f_arg_mech = 2; - const USHORT f_arg_type = 3; - const USHORT f_arg_scale = 4; - const USHORT f_arg_length = 5; - const USHORT f_arg_sub_type = 6; - const USHORT f_arg_charset_id = 7; - const USHORT f_arg_precision = 8; - const USHORT f_arg_char_length = 9; - const USHORT f_arg_pkg_name = 10; - const USHORT f_arg_name = 11; - const USHORT f_arg_sname = 12; - const USHORT f_arg_default = 13; - const USHORT f_arg_dsource = 14; - const USHORT f_arg_coll_id = 15; - const USHORT f_arg_null_flag = 16; - const USHORT f_arg_arg_mech = 17; - const USHORT f_arg_fname = 18; - const USHORT f_arg_rname = 19; - const USHORT f_arg_sys_flag = 20; - const USHORT f_arg_desc = 21; - - -// Relation 16 (RDB$FILTERS) - - const USHORT f_flt_name = 0; - const USHORT f_flt_desc = 1; - const USHORT f_flt_module = 2; - const USHORT f_flt_entry = 3; - const USHORT f_flt_input = 4; - const USHORT f_flt_output = 5; - const USHORT f_flt_sys_flag = 6; - const USHORT f_flt_class = 7; - const USHORT f_flt_owner = 8; - - -// Relation 17 (RDB$TRIGGER_MESSAGES) - - const USHORT f_msg_trigger = 0; - const USHORT f_msg_number = 1; - const USHORT f_msg_msg = 2; - - -// Relation 18 (RDB$USER_PRIVILEGES) - - const USHORT f_prv_user = 0; - const USHORT f_prv_grantor = 1; - const USHORT f_prv_priv = 2; - const USHORT f_prv_grant = 3; - const USHORT f_prv_rname = 4; - const USHORT f_prv_fname = 5; - const USHORT f_prv_u_type = 6; - const USHORT f_prv_o_type = 7; - - -// Relation 19 (RDB$TRANSACTIONS) - - const USHORT f_trn_id = 0; - const USHORT f_trn_state = 1; - const USHORT f_trn_time = 2; - const USHORT f_trn_desc = 3; - - -// Relation 20 (RDB$GENERATORS) - - const USHORT f_gen_name = 0; - const USHORT f_gen_id = 1; - const USHORT f_gen_sys_flag = 2; - const USHORT f_gen_desc = 3; - const USHORT f_gen_class = 4; - const USHORT f_gen_owner = 5; - const USHORT f_gen_init_val = 6; - const USHORT f_gen_increment = 7; - - -// Relation 21 (RDB$FIELD_DIMENSIONS) - - const USHORT f_dims_fname = 0; - const USHORT f_dims_dim = 1; - const USHORT f_dims_lower = 2; - const USHORT f_dims_upper = 3; - - -// Relation 22 (RDB$RELATION_CONSTRAINTS) - - const USHORT f_rcon_cname = 0; - const USHORT f_rcon_ctype = 1; - const USHORT f_rcon_rname = 2; - const USHORT f_rcon_dfr = 3; - const USHORT f_rcon_idfr = 4; - const USHORT f_rcon_iname = 5; - - -// Relation 23 (RDB$REF_CONSTRAINTS) - - const USHORT f_refc_cname = 0; - const USHORT f_refc_uq = 1; - const USHORT f_refc_match = 2; - const USHORT f_refc_upd_rul = 3; - const USHORT f_refc_del_rul = 4; - - -// Relation 24 (RDB$CHECK_CONSTRAINTS) - - const USHORT f_ccon_cname = 0; - const USHORT f_ccon_tname = 1; - - -// Relation 25 (RDB$LOG_FILES) - - const USHORT f_log_name = 0; - const USHORT f_log_seq = 1; - const USHORT f_log_length = 2; - const USHORT f_log_partitions = 3; - const USHORT f_log_p_offset = 4; - const USHORT f_log_flags = 5; - - -// Relation 26 (RDB$PROCEDURES) - - const USHORT f_prc_name = 0; - const USHORT f_prc_id = 1; - const USHORT f_prc_inputs = 2; - const USHORT f_prc_outputs = 3; - const USHORT f_prc_desc = 4; - const USHORT f_prc_source = 5; - const USHORT f_prc_blr = 6; - const USHORT f_prc_class = 7; - const USHORT f_prc_owner = 8; - const USHORT f_prc_runtime = 9; - const USHORT f_prc_sys_flag = 10; - const USHORT f_prc_type = 11; - const USHORT f_prc_valid_blr = 12; - const USHORT f_prc_debug_info = 13; - const USHORT f_prc_engine_name = 14; - const USHORT f_prc_entry = 15; - const USHORT f_prc_pkg_name = 16; - const USHORT f_prc_private_flag = 17; - const USHORT f_prc_sql_security = 18; - - -// Relation 27 (RDB$PROCEDURE_PARAMETERS) - - const USHORT f_prm_name = 0; - const USHORT f_prm_procedure = 1; - const USHORT f_prm_number = 2; - const USHORT f_prm_type = 3; - const USHORT f_prm_sname = 4; - const USHORT f_prm_desc = 5; - const USHORT f_prm_sys_flag = 6; - const USHORT f_prm_default = 7; - const USHORT f_prm_dsource = 8; - const USHORT f_prm_coll_id = 9; - const USHORT f_prm_null_flag = 10; - const USHORT f_prm_mech = 11; - const USHORT f_prm_fname = 12; - const USHORT f_prm_rname = 13; - const USHORT f_prm_pkg_name = 14; - - -// Relation 28 (RDB$CHARACTER_SETS) - - const USHORT f_cs_cs_name = 0; - const USHORT f_cs_form_of_use = 1; - const USHORT f_cs_num_chars = 2; - const USHORT f_cs_def_collate = 3; - const USHORT f_cs_id = 4; - const USHORT f_cs_sys_flag = 5; - const USHORT f_cs_desc = 6; - const USHORT f_cs_fun_name = 7; - const USHORT f_cs_bytes_char = 8; - const USHORT f_cs_class = 9; - const USHORT f_cs_owner = 10; - - -// Relation 29 (RDB$COLLATIONS) - - const USHORT f_coll_name = 0; - const USHORT f_coll_id = 1; - const USHORT f_coll_cs_id = 2; - const USHORT f_coll_attr = 3; - const USHORT f_coll_sys_flag = 4; - const USHORT f_coll_desc = 5; - const USHORT f_coll_fun_name = 6; - const USHORT f_coll_base_collation_name = 7; - const USHORT f_coll_specific_attr = 8; - const USHORT f_coll_class = 9; - const USHORT f_coll_owner = 10; - - -// Relation 30 (RDB$EXCEPTIONS) - - const USHORT f_xcp_name = 0; - const USHORT f_xcp_number = 1; - const USHORT f_xcp_msg = 2; - const USHORT f_xcp_desc = 3; - const USHORT f_xcp_sys_flag = 4; - const USHORT f_xcp_class = 5; - const USHORT f_xcp_owner = 6; - - -// Relation 31 (RDB$ROLES) - - const USHORT f_rol_name = 0; - const USHORT f_rol_owner = 1; - const USHORT f_rol_desc = 2; - const USHORT f_rol_sys_flag = 3; - const USHORT f_rol_class = 4; - const USHORT f_rol_sys_priv = 5; - - -// Relation 32 (RDB$BACKUP_HISTORY) - - const USHORT f_backup_id = 0; - const USHORT f_backup_time = 1; - const USHORT f_backup_level = 2; - const USHORT f_backup_guid = 3; - const USHORT f_backup_scn = 4; - const USHORT f_backup_name = 5; - - -// Relation 33 (MON$DATABASE) - - const USHORT f_mon_db_name = 0; - const USHORT f_mon_db_page_size = 1; - const USHORT f_mon_db_ods_major = 2; - const USHORT f_mon_db_ods_minor = 3; - const USHORT f_mon_db_oit = 4; - const USHORT f_mon_db_oat = 5; - const USHORT f_mon_db_ost = 6; - const USHORT f_mon_db_nt = 7; - const USHORT f_mon_db_page_bufs = 8; - const USHORT f_mon_db_dialect = 9; - const USHORT f_mon_db_shut_mode = 10; - const USHORT f_mon_db_sweep_int = 11; - const USHORT f_mon_db_read_only = 12; - const USHORT f_mon_db_forced_writes = 13; - const USHORT f_mon_db_res_space = 14; - const USHORT f_mon_db_created = 15; - const USHORT f_mon_db_pages = 16; - const USHORT f_mon_db_stat_id = 17; - const USHORT f_mon_db_backup_state = 18; - const USHORT f_mon_db_crypt_page = 19; - const USHORT f_mon_db_owner = 20; - const USHORT f_mon_db_secdb = 21; - const USHORT f_mon_db_crypt_state = 22; - - -// Relation 34 (MON$ATTACHMENTS) - - const USHORT f_mon_att_id = 0; - const USHORT f_mon_att_server_pid = 1; - const USHORT f_mon_att_state = 2; - const USHORT f_mon_att_name = 3; - const USHORT f_mon_att_user = 4; - const USHORT f_mon_att_role = 5; - const USHORT f_mon_att_remote_proto = 6; - const USHORT f_mon_att_remote_addr = 7; - const USHORT f_mon_att_remote_pid = 8; - const USHORT f_mon_att_charset_id = 9; - const USHORT f_mon_att_timestamp = 10; - const USHORT f_mon_att_gc = 11; - const USHORT f_mon_att_remote_process = 12; - const USHORT f_mon_att_stat_id = 13; - const USHORT f_mon_att_client_version = 14; - const USHORT f_mon_att_remote_version = 15; - const USHORT f_mon_att_remote_host = 16; - const USHORT f_mon_att_remote_os_user = 17; - const USHORT f_mon_att_auth_method = 18; - const USHORT f_mon_att_sys_flag = 19; - const USHORT f_mon_att_idle_timeout = 20; - const USHORT f_mon_att_idle_timer = 21; - const USHORT f_mon_att_stmt_timeout = 22; - const USHORT f_mon_att_wire_compressed = 23; - const USHORT f_mon_att_wire_encrypted = 24; - - -// Relation 35 (MON$TRANSACTIONS) - - const USHORT f_mon_tra_id = 0; - const USHORT f_mon_tra_att_id = 1; - const USHORT f_mon_tra_state = 2; - const USHORT f_mon_tra_timestamp = 3; - const USHORT f_mon_tra_top = 4; - const USHORT f_mon_tra_oit = 5; - const USHORT f_mon_tra_oat = 6; - const USHORT f_mon_tra_iso_mode = 7; - const USHORT f_mon_tra_lock_timeout = 8; - const USHORT f_mon_tra_read_only = 9; - const USHORT f_mon_tra_auto_commit = 10; - const USHORT f_mon_tra_auto_undo = 11; - const USHORT f_mon_tra_stat_id = 12; - - -// Relation 36 (MON$STATEMENTS) - - const USHORT f_mon_stmt_id = 0; - const USHORT f_mon_stmt_att_id = 1; - const USHORT f_mon_stmt_tra_id = 2; - const USHORT f_mon_stmt_state = 3; - const USHORT f_mon_stmt_timestamp = 4; - const USHORT f_mon_stmt_sql_text = 5; - const USHORT f_mon_stmt_stat_id = 6; - const USHORT f_mon_stmt_expl_plan = 7; - const USHORT f_mon_stmt_timeout = 8; - const USHORT f_mon_stmt_timer = 9; - - -// Relation 37 (MON$CALL_STACK) - - const USHORT f_mon_call_id = 0; - const USHORT f_mon_call_stmt_id = 1; - const USHORT f_mon_call_caller_id = 2; - const USHORT f_mon_call_name = 3; - const USHORT f_mon_call_type = 4; - const USHORT f_mon_call_timestamp = 5; - const USHORT f_mon_call_src_line = 6; - const USHORT f_mon_call_src_column = 7; - const USHORT f_mon_call_stat_id = 8; - const USHORT f_mon_call_pkg_name = 9; - - -// Relation 38 (MON$IO_STATS) - - const USHORT f_mon_io_stat_id = 0; - const USHORT f_mon_io_stat_group = 1; - const USHORT f_mon_io_page_reads = 2; - const USHORT f_mon_io_page_writes = 3; - const USHORT f_mon_io_page_fetches = 4; - const USHORT f_mon_io_page_marks = 5; - - -// Relation 39 (MON$RECORD_STATS) - - const USHORT f_mon_rec_stat_id = 0; - const USHORT f_mon_rec_stat_group = 1; - const USHORT f_mon_rec_seq_reads = 2; - const USHORT f_mon_rec_idx_reads = 3; - const USHORT f_mon_rec_inserts = 4; - const USHORT f_mon_rec_updates = 5; - const USHORT f_mon_rec_deletes = 6; - const USHORT f_mon_rec_backouts = 7; - const USHORT f_mon_rec_purges = 8; - const USHORT f_mon_rec_expunges = 9; - const USHORT f_mon_rec_locks = 10; - const USHORT f_mon_rec_waits = 11; - const USHORT f_mon_rec_conflicts = 12; - const USHORT f_mon_rec_bkver_reads = 13; - const USHORT f_mon_rec_frg_reads = 14; - const USHORT f_mon_rec_rpt_reads = 15; - const USHORT f_mon_rec_imgc = 16; - - -// Relation 40 (MON$CONTEXT_VARIABLES) - - const USHORT f_mon_ctx_var_att_id = 0; - const USHORT f_mon_ctx_var_tra_id = 1; - const USHORT f_mon_ctx_var_name = 2; - const USHORT f_mon_ctx_var_value = 3; - - -// Relation 41 (MON$MEMORY_USAGE) - - const USHORT f_mon_mem_stat_id = 0; - const USHORT f_mon_mem_stat_group = 1; - const USHORT f_mon_mem_cur_used = 2; - const USHORT f_mon_mem_cur_alloc = 3; - const USHORT f_mon_mem_max_used = 4; - const USHORT f_mon_mem_max_alloc = 5; - - -// Relation 42 (RDB$PACKAGES) - - const USHORT f_pkg_name = 0; - const USHORT f_pkg_header_source = 1; - const USHORT f_pkg_body_source = 2; - const USHORT f_pkg_valid_body_flag = 3; - const USHORT f_pkg_class = 4; - const USHORT f_pkg_owner = 5; - const USHORT f_pkg_sys_flag = 6; - const USHORT f_pkg_desc = 7; - const USHORT f_pkg_sql_security = 8; - - -// Relation 43 (SEC$USERS) - - const USHORT f_sec_user_name = 0; - const USHORT f_sec_first_name = 1; - const USHORT f_sec_middle_name = 2; - const USHORT f_sec_last_name = 3; - const USHORT f_sec_active = 4; - const USHORT f_sec_admin = 5; - const USHORT f_sec_comment = 6; - const USHORT f_sec_plugin = 7; - - -// Relation 44 (SEC$USER_ATTRIBUTES) - - const USHORT f_sec_attr_user = 0; - const USHORT f_sec_attr_key = 1; - const USHORT f_sec_attr_value = 2; - const USHORT f_sec_attr_plugin = 3; - - -// Relation 45 (RDB$AUTH_MAPPING) - - const USHORT f_map_name = 0; - const USHORT f_map_using = 1; - const USHORT f_map_plugin = 2; - const USHORT f_map_db = 3; - const USHORT f_map_from_type = 4; - const USHORT f_map_from = 5; - const USHORT f_map_to_type = 6; - const USHORT f_map_to = 7; - const USHORT f_map_sys_flag = 8; - const USHORT f_map_desc = 9; - - -// Relation 46 (SEC$GLOBAL_AUTH_MAPPING) - - const USHORT f_sec_map_name = 0; - const USHORT f_sec_map_using = 1; - const USHORT f_sec_map_plugin = 2; - const USHORT f_sec_map_db = 3; - const USHORT f_sec_map_from_type = 4; - const USHORT f_sec_map_from = 5; - const USHORT f_sec_map_to_type = 6; - const USHORT f_sec_map_to = 7; - - -// Relation 47 (RDB$DB_CREATORS) - - const USHORT f_crt_user = 0; - const USHORT f_crt_u_type = 1; - - -// Relation 48 (SEC$DB_CREATORS) - - const USHORT f_sec_crt_user = 0; - const USHORT f_sec_crt_u_type = 1; - - -// Relation 49 (MON$TABLE_STATS) - - const USHORT f_mon_tab_stat_id = 0; - const USHORT f_mon_tab_stat_group = 1; - const USHORT f_mon_tab_name = 2; - const USHORT f_mon_tab_rec_stat_id = 3; - - -// Relation 50 (RDB$TIME_ZONES) - - const USHORT f_tz_id = 0; - const USHORT f_tz_name = 1; - - diff --git a/src/isql/extract.epp b/src/isql/extract.epp index 33ecd7a499..1b720d6822 100644 --- a/src/isql/extract.epp +++ b/src/isql/extract.epp @@ -417,10 +417,13 @@ int EXTRACT_list_table(const SCHAR* relation_name, if ((FLD.RDB$FIELD_TYPE == T_CHAR) || (FLD.RDB$FIELD_TYPE == VARCHAR)) { - if (FLD.RDB$CHARACTER_LENGTH.NULL) - isqlGlob.printf("(%d)", FLD.RDB$FIELD_LENGTH); - else - isqlGlob.printf("(%d)", FLD.RDB$CHARACTER_LENGTH); + isqlGlob.printf("(%d)", + ISQL_get_char_length( + FLD.RDB$FIELD_LENGTH, + FLD.RDB$CHARACTER_LENGTH.NULL, FLD.RDB$CHARACTER_LENGTH, + FLD.RDB$CHARACTER_SET_ID.NULL, FLD.RDB$CHARACTER_SET_ID + ) + ); } // Catch arrays after printing the type @@ -833,10 +836,13 @@ static void get_procedure_args(const char* proc_name) // FSG 18.Nov.2000 if ((FLD.RDB$FIELD_TYPE == T_CHAR) || (FLD.RDB$FIELD_TYPE == VARCHAR)) { - if (FLD.RDB$CHARACTER_LENGTH.NULL) - isqlGlob.printf("(%d)", FLD.RDB$FIELD_LENGTH); - else - isqlGlob.printf("(%d)", FLD.RDB$CHARACTER_LENGTH); + isqlGlob.printf("(%d)", + ISQL_get_char_length( + FLD.RDB$FIELD_LENGTH, + FLD.RDB$CHARACTER_LENGTH.NULL, FLD.RDB$CHARACTER_LENGTH, + FLD.RDB$CHARACTER_SET_ID.NULL, FLD.RDB$CHARACTER_SET_ID + ) + ); } // Show international character sets and collations @@ -1054,10 +1060,13 @@ static void get_function_args_ods12(const char* func_name, USHORT out_arg) // FSG 18.Nov.2000 if ((FLD.RDB$FIELD_TYPE == T_CHAR) || (FLD.RDB$FIELD_TYPE == VARCHAR)) { - if (FLD.RDB$CHARACTER_LENGTH.NULL) - isqlGlob.printf("(%d)", FLD.RDB$FIELD_LENGTH); - else - isqlGlob.printf("(%d)", FLD.RDB$CHARACTER_LENGTH); + isqlGlob.printf("(%d)", + ISQL_get_char_length( + FLD.RDB$FIELD_LENGTH, + FLD.RDB$CHARACTER_LENGTH.NULL, FLD.RDB$CHARACTER_LENGTH, + FLD.RDB$CHARACTER_SET_ID.NULL, FLD.RDB$CHARACTER_SET_ID + ) + ); } // Show international character sets and collations @@ -2624,10 +2633,13 @@ static void listRelationComputed(LegacyTables flag, SSHORT default_char_set_id) if ((FLD.RDB$FIELD_TYPE == T_CHAR) || (FLD.RDB$FIELD_TYPE == VARCHAR)) { - if (FLD.RDB$CHARACTER_LENGTH.NULL) - isqlGlob.printf("(%d)", FLD.RDB$FIELD_LENGTH); - else - isqlGlob.printf("(%d)", FLD.RDB$CHARACTER_LENGTH); + isqlGlob.printf("(%d)", + ISQL_get_char_length( + FLD.RDB$FIELD_LENGTH, + FLD.RDB$CHARACTER_LENGTH.NULL, FLD.RDB$CHARACTER_LENGTH, + FLD.RDB$CHARACTER_SET_ID.NULL, FLD.RDB$CHARACTER_SET_ID + ) + ); } // Catch arrays after printing the type diff --git a/src/isql/isql.epp b/src/isql/isql.epp index 033194a87f..059d4a8d9e 100644 --- a/src/isql/isql.epp +++ b/src/isql/isql.epp @@ -1211,6 +1211,34 @@ SSHORT ISQL_get_field_length(const TEXT* field_name) } +SSHORT ISQL_get_char_length( + SSHORT fieldLength, + SSHORT characterLengthNull, SSHORT characterLength, + SSHORT characterSetIdNull, SSHORT characterSetId) +{ + if (characterLengthNull || characterLength == 0) + { + if (!characterSetIdNull) + { + FOR CS IN RDB$CHARACTER_SETS + WITH CS.RDB$CHARACTER_SET_ID EQ characterSetId AND + CS.RDB$BYTES_PER_CHARACTER > 0 + { + fieldLength /= CS.RDB$BYTES_PER_CHARACTER; + } + END_FOR + ON_ERROR + ISQL_errmsg(fbStatus); + END_ERROR; + } + + return fieldLength; + } + else + return characterLength; +} + + void ISQL_get_character_sets(SSHORT char_set_id, SSHORT collation, bool collate_only, bool not_null, bool quote, TEXT* string) { diff --git a/src/isql/isql_proto.h b/src/isql/isql_proto.h index 5a7b79c536..52a83c5cfa 100644 --- a/src/isql/isql_proto.h +++ b/src/isql/isql_proto.h @@ -45,6 +45,10 @@ void ISQL_get_character_sets(SSHORT, SSHORT, bool, bool, bool, TEXT*); SSHORT ISQL_get_default_char_set_id(); void ISQL_get_default_source(const TEXT*, TEXT*, ISC_QUAD*); SSHORT ISQL_get_field_length(const TEXT*); +SSHORT ISQL_get_char_length( + SSHORT fieldLength, + SSHORT characterLengthNull, SSHORT characterLength, + SSHORT characterSetIdNull, SSHORT characterSetId); SLONG ISQL_get_index_segments(TEXT*, const size_t, const TEXT*, bool); bool ISQL_get_null_flag(const TEXT*, TEXT*); void ISQL_get_version(bool); diff --git a/src/isql/show.epp b/src/isql/show.epp index b36ebeb6ab..cdd23a5ea8 100644 --- a/src/isql/show.epp +++ b/src/isql/show.epp @@ -251,6 +251,7 @@ static const UCHAR db_items[] = isc_info_db_id, #endif fb_info_crypt_state, + fb_info_wire_crypt, isc_info_end }; @@ -554,6 +555,11 @@ bool SHOW_dbb_parameters(Firebird::IAttachment* db_handle, (SLONG) isqlGlob.major_ods, value_out, separator); break; + case fb_info_wire_crypt: + if (d) + sprintf (info, "Wire crypt plugin: %.*s%s", length, d, separator); + break; + #ifdef DEV_BUILD case isc_info_db_id: { diff --git a/src/jrd/Attachment.cpp b/src/jrd/Attachment.cpp index b4d32104f0..b380b6e748 100644 --- a/src/jrd/Attachment.cpp +++ b/src/jrd/Attachment.cpp @@ -221,6 +221,7 @@ Jrd::Attachment::Attachment(MemoryPool* pool, Database* dbb) att_context_vars(*pool), ddlTriggersContext(*pool), att_network_protocol(*pool), + att_remote_crypt(*pool), att_remote_address(*pool), att_remote_process(*pool), att_client_version(*pool), diff --git a/src/jrd/Attachment.h b/src/jrd/Attachment.h index 847e45c00b..93769141f7 100644 --- a/src/jrd/Attachment.h +++ b/src/jrd/Attachment.h @@ -440,6 +440,7 @@ public: Firebird::StringMap att_context_vars; // Context variables for the connection Firebird::Stack ddlTriggersContext; // Context variables for DDL trigger event Firebird::string att_network_protocol; // Network protocol used by client for connection + Firebird::PathName att_remote_crypt; // Name of wire crypt plugin (if any) Firebird::string att_remote_address; // Protocol-specific address of remote client SLONG att_remote_pid; // Process id of remote client ULONG att_remote_flags; // Flags specific for server/client link diff --git a/src/jrd/DbCreators.cpp b/src/jrd/DbCreators.cpp index 113678912f..ead6f27708 100644 --- a/src/jrd/DbCreators.cpp +++ b/src/jrd/DbCreators.cpp @@ -49,7 +49,7 @@ #include "../jrd/tra.h" #include "../jrd/ini.h" #include "../jrd/status.h" -#include "gen/ids.h" +#include "../jrd/ids.h" #define DBC_DEBUG(A) diff --git a/src/jrd/Mapping.cpp b/src/jrd/Mapping.cpp index 781052398c..a0a9e04da7 100644 --- a/src/jrd/Mapping.cpp +++ b/src/jrd/Mapping.cpp @@ -46,7 +46,7 @@ #include "../jrd/tra.h" #include "../jrd/ini.h" #include "../jrd/status.h" -#include "gen/ids.h" +#include "../jrd/ids.h" #ifdef WIN_NT #include diff --git a/src/jrd/Monitoring.cpp b/src/jrd/Monitoring.cpp index f5d55d1bbe..49a02453e9 100644 --- a/src/jrd/Monitoring.cpp +++ b/src/jrd/Monitoring.cpp @@ -133,13 +133,20 @@ MonitoringData::MonitoringData(const Database* dbb) MonitoringData::~MonitoringData() { - Guard guard(this); + m_sharedMemory->mutexLock(); - if (m_sharedMemory->getHeader() && - m_sharedMemory->getHeader()->used == alignOffset(sizeof(Header))) + try { - m_sharedMemory->removeMapFile(); + if (m_sharedMemory->getHeader() && + m_sharedMemory->getHeader()->used == alignOffset(sizeof(Header))) + { + m_sharedMemory->removeMapFile(); + } } + catch (const Exception&) + {} // no-op + + m_sharedMemory->mutexUnlock(); } @@ -971,6 +978,8 @@ void Monitoring::putAttachment(SnapshotData::DumpRecord& record, const Jrd::Atta record.storeString(f_mon_att_client_version, attachment->att_client_version); // remote protocol version record.storeString(f_mon_att_remote_version, attachment->att_remote_protocol); + // wire encryption plugin + record.storeString(f_mon_att_remote_crypt, attachment->att_remote_crypt); // remote host name record.storeString(f_mon_att_remote_host, attachment->att_remote_host); // OS user name diff --git a/src/jrd/SysFunction.cpp b/src/jrd/SysFunction.cpp index 9273c840a1..be5e09b45d 100644 --- a/src/jrd/SysFunction.cpp +++ b/src/jrd/SysFunction.cpp @@ -335,6 +335,7 @@ const char NETWORK_PROTOCOL_NAME[] = "NETWORK_PROTOCOL", WIRE_COMPRESSED_NAME[] = "WIRE_COMPRESSED", WIRE_ENCRYPTED_NAME[] = "WIRE_ENCRYPTED", + WIRE_CRYPT_PLUGIN_NAME[] = "WIRE_CRYPT_PLUGIN", CLIENT_ADDRESS_NAME[] = "CLIENT_ADDRESS", CLIENT_HOST_NAME[] = "CLIENT_HOST", CLIENT_PID_NAME[] = "CLIENT_PID", @@ -4048,6 +4049,13 @@ dsc* evlGetContext(thread_db* tdbb, const SysFunction*, const NestValueArray& ar resultStr = (attachment->att_remote_flags & isc_dpb_addr_flag_conn_encrypted) ? TRUE_VALUE : FALSE_VALUE; } + else if (nameStr == WIRE_CRYPT_PLUGIN_NAME) + { + if (attachment->att_remote_crypt.isEmpty()) + return NULL; + + resultStr = attachment->att_remote_crypt.ToString(); + } else if (nameStr == CLIENT_ADDRESS_NAME) { if (attachment->att_remote_address.isEmpty()) diff --git a/src/jrd/TimeZone.cpp b/src/jrd/TimeZone.cpp index d89c092473..20565c30f0 100644 --- a/src/jrd/TimeZone.cpp +++ b/src/jrd/TimeZone.cpp @@ -25,7 +25,7 @@ #include "../jrd/Record.h" #include "../jrd/ini.h" #include "../jrd/tra.h" -#include "gen/ids.h" +#include "../jrd/ids.h" using namespace Jrd; using namespace Firebird; diff --git a/src/jrd/UserManagement.cpp b/src/jrd/UserManagement.cpp index ccfae63f2d..c1ed05501c 100644 --- a/src/jrd/UserManagement.cpp +++ b/src/jrd/UserManagement.cpp @@ -30,7 +30,7 @@ #include "../common/security.h" #include "../jrd/met_proto.h" #include "../jrd/ini.h" -#include "gen/ids.h" +#include "../jrd/ids.h" using namespace Jrd; using namespace Firebird; diff --git a/src/jrd/build_no.h b/src/jrd/build_no.h index 532c36683a..46d566cf15 100644 --- a/src/jrd/build_no.h +++ b/src/jrd/build_no.h @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:1715 + FORMAL BUILD NUMBER:1743 */ -#define PRODUCT_VER_STRING "4.0.0.1715" -#define FILE_VER_STRING "WI-T4.0.0.1715" -#define LICENSE_VER_STRING "WI-T4.0.0.1715" -#define FILE_VER_NUMBER 4, 0, 0, 1715 +#define PRODUCT_VER_STRING "4.0.0.1743" +#define FILE_VER_STRING "WI-T4.0.0.1743" +#define LICENSE_VER_STRING "WI-T4.0.0.1743" +#define FILE_VER_NUMBER 4, 0, 0, 1743 #define FB_MAJOR_VER "4" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "1715" +#define FB_BUILD_NO "1743" #define FB_BUILD_TYPE "T" #define FB_BUILD_SUFFIX "Firebird 4.0 Beta 1" diff --git a/src/jrd/constants.h b/src/jrd/constants.h index 8e0268cc77..72b463455f 100644 --- a/src/jrd/constants.h +++ b/src/jrd/constants.h @@ -62,7 +62,7 @@ const int TEMP_STR_LENGTH = 128; // Metadata constants // When changing these constants, change MaxIdentifierByteLength and MaxIdentifierCharLength in -// firebird.conf.in too. +// firebird.conf too. const unsigned METADATA_IDENTIFIER_CHAR_LEN = 63; const unsigned METADATA_BYTES_PER_CHAR = 4; diff --git a/src/jrd/fields.h b/src/jrd/fields.h index 36f75f9497..aa60900fa4 100644 --- a/src/jrd/fields.h +++ b/src/jrd/fields.h @@ -208,4 +208,5 @@ FIELD(fld_tz_db_version , nam_tz_db_version , dtype_varying , 10 , dsc_text_type_ascii , NULL , true) - FIELD(fld_crypt_state , nam_crypt_state , dtype_short , sizeof(SSHORT) , 0 , NULL , true) \ No newline at end of file + FIELD(fld_crypt_state , nam_crypt_state , dtype_short , sizeof(SSHORT) , 0 , NULL , true) + FIELD(fld_remote_crypt , nam_wire_crypt_plugin, dtype_varying, MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) diff --git a/src/jrd/ids.h b/src/jrd/ids.h new file mode 100644 index 0000000000..5d240d311d --- /dev/null +++ b/src/jrd/ids.h @@ -0,0 +1,89 @@ +/* + * PROGRAM: JRD Access Method + * MODULE: ids.h + * DESCRIPTION: System relation field numbers + * + * The contents of this file are subject to the Interbase Public + * License Version 1.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy + * of the License at http://www.Inprise.com/IPL.html + * + * Software distributed under the License is distributed on an + * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express + * or implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code was created by Inprise Corporation + * and its predecessors. Portions created by Inprise Corporation are + * Copyright (C) Inprise Corporation. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + */ + +#define RELATION(...) enum : USHORT { +#define FIELD(field_id, ...) field_id, +#define END_RELATION }; + +#include "relations.h" + +#undef RELATION +#undef FIELD +#undef END_RELATION + + +// Because it is ODS-related header, an additional check +// to ensure compatibility: position of one field for each table is checked. +// This field don't have to be the last, any one is good. + + static_assert(f_pag_type == 3, "Wrong field id"); + static_assert(f_dat_sql_security == 5, "Wrong field id"); + static_assert(f_fld_owner == 29, "Wrong field id"); + static_assert(f_seg_statistics == 3, "Wrong field id"); + static_assert(f_idx_statistics == 12, "Wrong field id"); + static_assert(f_rfr_identity_type == 20, "Wrong field id"); + static_assert(f_rel_sql_security == 17, "Wrong field id"); + static_assert(f_vrl_pkg_name == 5, "Wrong field id"); + static_assert(f_fmt_desc == 2, "Wrong field id"); + static_assert(f_cls_desc == 2, "Wrong field id"); + static_assert(f_file_shad_num == 5, "Wrong field id"); + static_assert(f_typ_sys_flag == 4, "Wrong field id"); + static_assert(f_trg_sql_security == 14, "Wrong field id"); + static_assert(f_dpd_pkg_name == 5, "Wrong field id"); + static_assert(f_fun_sql_security == 20, "Wrong field id"); + static_assert(f_arg_desc == 21, "Wrong field id"); + static_assert(f_flt_owner == 8, "Wrong field id"); + static_assert(f_msg_msg == 2, "Wrong field id"); + static_assert(f_prv_o_type == 7, "Wrong field id"); + static_assert(f_trn_desc == 3, "Wrong field id"); + static_assert(f_gen_increment == 7, "Wrong field id"); + static_assert(f_dims_upper == 3, "Wrong field id"); + static_assert(f_rcon_iname == 5, "Wrong field id"); + static_assert(f_refc_del_rul == 4, "Wrong field id"); + static_assert(f_ccon_tname == 1, "Wrong field id"); + static_assert(f_log_flags == 5, "Wrong field id"); + static_assert(f_prc_sql_security == 18, "Wrong field id"); + static_assert(f_prm_pkg_name == 14, "Wrong field id"); + static_assert(f_cs_owner == 10, "Wrong field id"); + static_assert(f_coll_owner == 10, "Wrong field id"); + static_assert(f_xcp_owner == 6, "Wrong field id"); + static_assert(f_rol_sys_priv == 5, "Wrong field id"); + static_assert(f_backup_name == 5, "Wrong field id"); + static_assert(f_mon_db_crypt_state == 22, "Wrong field id"); + static_assert(f_mon_att_remote_crypt == 25, "Wrong field id"); + static_assert(f_mon_tra_stat_id == 12, "Wrong field id"); + static_assert(f_mon_stmt_timer == 9, "Wrong field id"); + static_assert(f_mon_call_pkg_name == 9, "Wrong field id"); + static_assert(f_mon_io_page_marks == 5, "Wrong field id"); + static_assert(f_mon_rec_imgc == 16, "Wrong field id"); + static_assert(f_mon_ctx_var_value == 3, "Wrong field id"); + static_assert(f_mon_mem_max_alloc == 5, "Wrong field id"); + static_assert(f_pkg_sql_security == 8, "Wrong field id"); + static_assert(f_sec_plugin == 7, "Wrong field id"); + static_assert(f_sec_attr_plugin == 3, "Wrong field id"); + static_assert(f_map_desc == 9, "Wrong field id"); + static_assert(f_sec_map_to == 7, "Wrong field id"); + static_assert(f_crt_u_type == 1, "Wrong field id"); + static_assert(f_sec_crt_u_type == 1, "Wrong field id"); + static_assert(f_mon_tab_rec_stat_id == 3, "Wrong field id"); + static_assert(f_tz_name == 1, "Wrong field id"); diff --git a/src/jrd/inf.cpp b/src/jrd/inf.cpp index 27babdf081..38b1a5a742 100644 --- a/src/jrd/inf.cpp +++ b/src/jrd/inf.cpp @@ -822,6 +822,19 @@ void INF_database_info(thread_db* tdbb, length = INF_convert(tdbb->getAttachment()->att_remote_flags, buffer); break; + case fb_info_wire_crypt: + { + const PathName& nm = tdbb->getAttachment()->att_remote_crypt; + if (!(info = INF_put_item(item, static_cast(nm.length()), nm.c_str(), info, end))) + { + if (transaction) + TRA_commit(tdbb, transaction, false); + + return; + } + } + continue; + case fb_info_statement_timeout_db: length = INF_convert(dbb->dbb_config->getStatementTimeout(), buffer); break; diff --git a/src/jrd/ini.epp b/src/jrd/ini.epp index e501980986..fb8cf5b87c 100644 --- a/src/jrd/ini.epp +++ b/src/jrd/ini.epp @@ -29,7 +29,7 @@ #include "../jrd/val.h" #include "../jrd/ods.h" #include "../jrd/btr.h" -#include "gen/ids.h" +#include "../jrd/ids.h" #include "../jrd/intl.h" #include "../jrd/tra.h" #include "../jrd/trig.h" @@ -71,9 +71,9 @@ const int FB_MAX_ACL_SIZE = 4096; static void add_index_set(thread_db*); -static void add_security_to_sys_obj(thread_db*, AutoRequest&, AutoRequest&, AutoRequest&, +static void add_security_to_sys_obj(thread_db*, AutoRequest&, AutoRequest&, AutoRequest&, const MetaName&, USHORT, const MetaName&, USHORT = 0, const UCHAR* = NULL); -static void add_security_class(thread_db* tdbb, AutoRequest&, const MetaName& class_name, +static void add_security_class(thread_db* tdbb, AutoRequest&, const MetaName& class_name, USHORT acl_length, const UCHAR* acl); static void add_security_to_sys_rel(thread_db*, AutoRequest&, AutoRequest&, AutoRequest&, const MetaName&, const TEXT*, const USHORT, const UCHAR*); @@ -411,9 +411,12 @@ void INI_format(const char* owner, const char* charset) const UCHAR NON_REL_OWNER_ACL[] = {ACL_priv_list, priv_control, priv_alter, priv_drop, priv_usage, ACL_end}; - const UCHAR NON_REL_PUBLIC_ACL[] = + const UCHAR NON_REL_PUBLIC_USAGE_ACL[] = {ACL_priv_list, priv_usage, ACL_end}; + const UCHAR PKG_PUBLIC_EXECUTE_ACL[] = + {ACL_priv_list, priv_execute, ACL_end}; + UCHAR buffer[FB_MAX_ACL_SIZE]; UCHAR* acl = buffer; *acl++ = ACL_version; @@ -431,8 +434,11 @@ void INI_format(const char* owner, const char* charset) *acl++ = ACL_id_list; *acl++ = ACL_end; - memcpy(acl, NON_REL_PUBLIC_ACL, sizeof(NON_REL_PUBLIC_ACL)); - acl += sizeof(NON_REL_PUBLIC_ACL); + + UCHAR* aclPublicStart = acl; + + memcpy(acl, NON_REL_PUBLIC_USAGE_ACL, sizeof(NON_REL_PUBLIC_USAGE_ACL)); + acl += sizeof(NON_REL_PUBLIC_USAGE_ACL); *acl++ = ACL_end; // Put an extra terminator to avoid scl.epp:walk_acl() missing the end. USHORT length = acl - buffer; @@ -471,13 +477,21 @@ void INI_format(const char* owner, const char* charset) add_security_to_sys_obj(tdbb, reqAddSC, reqModObjSC, reqInsUserPriv, ownerName, obj_collation, collation->name, length, buffer); } + // Must be last! + acl = aclPublicStart; + memcpy(acl, PKG_PUBLIC_EXECUTE_ACL, sizeof(PKG_PUBLIC_EXECUTE_ACL)); + acl += sizeof(PKG_PUBLIC_EXECUTE_ACL); + *acl++ = ACL_end; // Put an extra terminator to avoid scl.epp:walk_acl() missing the end. + length = acl - buffer; + reqModObjSC.reset(); for (auto& systemPackage : SystemPackage::get()) { if (systemPackage.odsVersion > ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version)) continue; - add_security_to_sys_obj(tdbb, reqAddSC, reqModObjSC, reqInsUserPriv, ownerName, obj_package_header, systemPackage.name, length, buffer); + add_security_to_sys_obj(tdbb, reqAddSC, reqModObjSC, reqInsUserPriv, ownerName, + obj_package_header, systemPackage.name, length, buffer); } } @@ -1091,8 +1105,8 @@ static void add_security_to_sys_rel(thread_db* tdbb, // Add security to system objects. static void add_security_to_sys_obj(thread_db* tdbb, - AutoRequest& reqAddSC, - AutoRequest& reqModObjSC, + AutoRequest& reqAddSC, + AutoRequest& reqModObjSC, AutoRequest& reqInsUserPriv, const MetaName& user_name, USHORT obj_type, @@ -1109,6 +1123,8 @@ static void add_security_to_sys_obj(thread_db* tdbb, add_security_class(tdbb, reqAddSC, security_class, acl_length, acl); + bool needsUsagePrivileges = false, needsExecPrivileges = false; + if (obj_type == obj_field) { FOR(REQUEST_HANDLE reqModObjSC) FLD IN RDB$FIELDS @@ -1118,6 +1134,8 @@ static void add_security_to_sys_obj(thread_db* tdbb, FLD.RDB$SECURITY_CLASS.NULL = FALSE; PAD(security_class.c_str(), FLD.RDB$SECURITY_CLASS); END_MODIFY + + needsUsagePrivileges = true; } END_FOR } @@ -1130,6 +1148,8 @@ static void add_security_to_sys_obj(thread_db* tdbb, CS.RDB$SECURITY_CLASS.NULL = FALSE; PAD(security_class.c_str(), CS.RDB$SECURITY_CLASS); END_MODIFY + + needsUsagePrivileges = true; } END_FOR } @@ -1142,6 +1162,8 @@ static void add_security_to_sys_obj(thread_db* tdbb, COLL.RDB$SECURITY_CLASS.NULL = FALSE; PAD(security_class.c_str(), COLL.RDB$SECURITY_CLASS); END_MODIFY + + needsUsagePrivileges = true; } END_FOR } @@ -1154,6 +1176,8 @@ static void add_security_to_sys_obj(thread_db* tdbb, XCP.RDB$SECURITY_CLASS.NULL = FALSE; PAD(security_class.c_str(), XCP.RDB$SECURITY_CLASS); END_MODIFY + + needsUsagePrivileges = true; } END_FOR } @@ -1166,6 +1190,8 @@ static void add_security_to_sys_obj(thread_db* tdbb, GEN.RDB$SECURITY_CLASS.NULL = FALSE; PAD(security_class.c_str(), GEN.RDB$SECURITY_CLASS); END_MODIFY + + needsUsagePrivileges = true; } END_FOR } @@ -1178,6 +1204,8 @@ static void add_security_to_sys_obj(thread_db* tdbb, PKG.RDB$SECURITY_CLASS.NULL = FALSE; PAD(security_class.c_str(), PKG.RDB$SECURITY_CLASS); END_MODIFY + + needsExecPrivileges = true; } END_FOR } @@ -1195,18 +1223,29 @@ static void add_security_to_sys_obj(thread_db* tdbb, else fb_assert(false); - for (const char* p = USAGE_PRIVILEGES; *p; ++p) + const char* const privileges = + needsUsagePrivileges ? USAGE_PRIVILEGES : + needsExecPrivileges ? EXEC_PRIVILEGES : + NULL; + + if (privileges) { - STORE(REQUEST_HANDLE reqInsUserPriv) PRIV IN RDB$USER_PRIVILEGES - PAD(user_name.c_str(), PRIV.RDB$USER); - PAD(obj_name.c_str(), PRIV.RDB$RELATION_NAME); - PRIV.RDB$PRIVILEGE[0] = *p; - PRIV.RDB$PRIVILEGE[1] = 0; - PRIV.RDB$GRANT_OPTION = WITH_GRANT_OPTION; - PRIV.RDB$USER_TYPE = obj_user; - PRIV.RDB$OBJECT_TYPE = obj_type; - PRIV.RDB$GRANTOR.NULL = TRUE; - END_STORE + fb_assert(user_name.hasData()); + fb_assert(obj_name.hasData()); + + for (const char* p = privileges; *p; ++p) + { + STORE(REQUEST_HANDLE reqInsUserPriv) PRIV IN RDB$USER_PRIVILEGES + PAD(user_name.c_str(), PRIV.RDB$USER); + PAD(obj_name.c_str(), PRIV.RDB$RELATION_NAME); + PRIV.RDB$PRIVILEGE[0] = *p; + PRIV.RDB$PRIVILEGE[1] = 0; + PRIV.RDB$GRANT_OPTION = WITH_GRANT_OPTION; + PRIV.RDB$USER_TYPE = obj_user; + PRIV.RDB$OBJECT_TYPE = obj_type; + PRIV.RDB$GRANTOR.NULL = TRUE; + END_STORE + } } } diff --git a/src/jrd/jrd.cpp b/src/jrd/jrd.cpp index 0a53d15f38..bc82593032 100644 --- a/src/jrd/jrd.cpp +++ b/src/jrd/jrd.cpp @@ -1065,6 +1065,7 @@ namespace Jrd PathName dpb_working_directory; string dpb_set_db_charset; string dpb_network_protocol; + PathName dpb_remote_crypt; string dpb_remote_address; string dpb_remote_host; string dpb_remote_os_user; @@ -6970,6 +6971,9 @@ void DatabaseOptions::get(const UCHAR* dpb, USHORT dpb_length, bool& invalid_cli case isc_dpb_addr_flags: dpb_remote_flags = address.getInt(); break; + case isc_dpb_addr_crypt: + address.getPath(dpb_remote_crypt); + break; default: break; } @@ -7275,6 +7279,7 @@ static JAttachment* create_attachment(const PathName& alias_name, attachment->att_filename = alias_name; attachment->att_network_protocol = options.dpb_network_protocol; + attachment->att_remote_crypt = options.dpb_remote_crypt; attachment->att_remote_address = options.dpb_remote_address; attachment->att_remote_pid = options.dpb_remote_pid; attachment->att_remote_flags = options.dpb_remote_flags; diff --git a/src/jrd/names.h b/src/jrd/names.h index 05b405cd47..6ebe4528c0 100644 --- a/src/jrd/names.h +++ b/src/jrd/names.h @@ -419,6 +419,7 @@ NAME("MON$STATEMENT_TIMER", nam_stmt_timer) NAME("MON$WIRE_COMPRESSED", nam_wire_compressed) NAME("MON$WIRE_ENCRYPTED", nam_wire_encrypted) +NAME("MON$WIRE_CRYPT_PLUGIN", nam_wire_crypt_plugin) NAME("RDB$TIME_ZONES", nam_time_zones) NAME("RDB$TIME_ZONE_ID", nam_tz_id) diff --git a/src/jrd/ods.h b/src/jrd/ods.h index 9b3d432906..73fd2ae28b 100644 --- a/src/jrd/ods.h +++ b/src/jrd/ods.h @@ -33,10 +33,8 @@ #ifndef JRD_ODS_H #define JRD_ODS_H -#ifndef ODS_TESTING #include "../jrd/RecordNumber.h" #include "../common/classes/fb_string.h" -#endif //ODS_TESTING // This macro enables the ability of the engine to connect to databases // from ODS 8 up to the latest. If this macro is undefined, the engine @@ -234,6 +232,14 @@ struct pag ULONG pag_pageno; // for validation }; +static_assert(sizeof(struct pag) == 16, "struct pag size mismatch"); +static_assert(offsetof(struct pag, pag_type) == 0, "pag_type offset mismatch"); +static_assert(offsetof(struct pag, pag_flags) == 1, "pag_flags offset mismatch"); +static_assert(offsetof(struct pag, pag_reserved) == 2, "pag_reserved offset mismatch"); +static_assert(offsetof(struct pag, pag_generation) == 4, "pag_generation offset mismatch"); +static_assert(offsetof(struct pag, pag_scn) == 8, "pag_scn offset mismatch"); +static_assert(offsetof(struct pag, pag_pageno) == 12, "pag_pageno offset mismatch"); + typedef pag* PAG; @@ -249,6 +255,14 @@ struct blob_page ULONG blp_page[1]; // Page number if level 1 }; +static_assert(sizeof(struct blob_page) == 32, "struct blob_page size mismatch"); +static_assert(offsetof(struct blob_page, blp_header) == 0, "blp_header offset mismatch"); +static_assert(offsetof(struct blob_page, blp_lead_page) == 16, "blp_lead_page offset mismatch"); +static_assert(offsetof(struct blob_page, blp_sequence) == 20, "blp_sequence offset mismatch"); +static_assert(offsetof(struct blob_page, blp_length) == 24, "blp_length offset mismatch"); +static_assert(offsetof(struct blob_page, blp_pad) == 26, "blp_pag offset mismatch"); +static_assert(offsetof(struct blob_page, blp_page) == 28, "blp_page offset mismatch"); + #define BLP_SIZE static_cast(offsetof(Ods::blob_page, blp_page[0])) // pag_flags @@ -272,6 +286,20 @@ struct btree_page UCHAR btr_nodes[1]; }; +static_assert(sizeof(struct btree_page) == 40, "struct btree_page size mismatch"); +static_assert(offsetof(struct btree_page, btr_header) == 0, "btr_header offset mismatch"); +static_assert(offsetof(struct btree_page, btr_sibling) == 16, "btr_sibling offset mismatch"); +static_assert(offsetof(struct btree_page, btr_left_sibling) == 20, "btr_left_sibling offset mismatch"); +static_assert(offsetof(struct btree_page, btr_prefix_total) == 24, "btr_prefix_total offset mismatch"); +static_assert(offsetof(struct btree_page, btr_relation) == 28, "btr_relation offset mismatch"); +static_assert(offsetof(struct btree_page, btr_length) == 30, "btr_length offset mismatch"); +static_assert(offsetof(struct btree_page, btr_id) == 32, "btr_id offset mismatch"); +static_assert(offsetof(struct btree_page, btr_level) == 33, "btr_level offset mismatch"); +static_assert(offsetof(struct btree_page, btr_jump_interval) == 34, "btr_jump_interval offset mismatch"); +static_assert(offsetof(struct btree_page, btr_jump_size) == 36, "btr_jump_size offset mismatch"); +static_assert(offsetof(struct btree_page, btr_jump_count) == 38, "btr_jump_count offset mismatch"); +static_assert(offsetof(struct btree_page, btr_nodes) == 39, "btr_nodes offset mismatch"); + // NS 2014-07-17: You can define this thing as "const FB_SIZE_t ...", and it works // for standards-conforming compilers (recent GCC and MSVC will do) // But older versions might have a problem, so I leave #define in place for now @@ -298,6 +326,17 @@ struct data_page } dpg_rpt[1]; }; +static_assert(sizeof(struct data_page) == 28, "struct data_page size mismatch"); +static_assert(offsetof(struct data_page, dpg_header) == 0, "dpg_header offset mismatch"); +static_assert(offsetof(struct data_page, dpg_sequence) == 16, "gpg_sequence offset mismatch"); +static_assert(offsetof(struct data_page, dpg_relation) == 20, "dpg_relation offset mismatch"); +static_assert(offsetof(struct data_page, dpg_count) == 22, "dpg_count offset mismatch"); +static_assert(offsetof(struct data_page, dpg_rpt) == 24, "dpg_rpt offset mismatch"); + +static_assert(sizeof(struct data_page::dpg_repeat) == 4, "struct dpg_repeat size mismatch"); +static_assert(offsetof(struct data_page::dpg_repeat, dpg_offset) == 0, "dpg_offset offset mismatch"); +static_assert(offsetof(struct data_page::dpg_repeat, dpg_length) == 2, "dpg_length offset mismatch"); + #define DPG_SIZE (sizeof (Ods::data_page) - sizeof (Ods::data_page::dpg_repeat)) // pag_flags @@ -318,9 +357,8 @@ struct index_root_page USHORT irt_count; // Number of indices struct irt_repeat { -#ifndef ODS_TESTING private: -#endif //ODS_TESTING + friend struct index_root_page; // to allow offset check for private members ULONG irt_root; // page number of index root if irt_in_progress is NOT set, or // highest 32 bit of transaction if irt_in_progress is set ULONG irt_transaction; // transaction in progress (lowest 32 bits) @@ -329,7 +367,6 @@ struct index_root_page UCHAR irt_keys; // number of keys in index UCHAR irt_flags; -#ifndef ODS_TESTING ULONG getRoot() const; void setRoot(ULONG root_page); @@ -337,10 +374,23 @@ struct index_root_page void setTransaction(TraNumber traNumber); bool isUsed() const; -#endif //ODS_TESTING + } irt_rpt[1]; + + static_assert(sizeof(struct irt_repeat) == 12, "struct irt_repeat size mismatch"); + static_assert(offsetof(struct irt_repeat, irt_root) == 0, "irt_root offset mismatch"); + static_assert(offsetof(struct irt_repeat, irt_transaction) == 4, "irt_transaction offset mismatch"); + static_assert(offsetof(struct irt_repeat, irt_desc) == 8, "irt_desc offset mismatch"); + static_assert(offsetof(struct irt_repeat, irt_keys) == 10, "irt_keys offset mismatch"); + static_assert(offsetof(struct irt_repeat, irt_flags) == 11, "irt_flags offset mismatch"); }; +static_assert(sizeof(struct index_root_page) == 32, "struct index_root_page size mismatch"); +static_assert(offsetof(struct index_root_page, irt_header) == 0, "irt_header offset mismatch"); +static_assert(offsetof(struct index_root_page, irt_relation) == 16, "irt_relation offset mismatch"); +static_assert(offsetof(struct index_root_page, irt_count) == 18, "irt_count offset mismatch"); +static_assert(offsetof(struct index_root_page, irt_rpt) == 20, "irt_rpt offset mismatch"); + // key descriptor struct irtd @@ -350,6 +400,11 @@ struct irtd float irtd_selectivity; }; +static_assert(sizeof(struct irtd) == 8, "struct irtd size mismatch"); +static_assert(offsetof(struct irtd, irtd_field) == 0, "irtd_field offset mismatch"); +static_assert(offsetof(struct irtd, irtd_itype) == 2, "irtd_itype offset mismatch"); +static_assert(offsetof(struct irtd, irtd_selectivity) == 4, "irtd_selectivity offset mismatch"); + // irt_flags, must match the idx_flags (see btr.h) const USHORT irt_unique = 1; const USHORT irt_descending = 2; @@ -358,7 +413,6 @@ const USHORT irt_foreign = 8; const USHORT irt_primary = 16; const USHORT irt_expression = 32; -#ifndef ODS_TESTING inline ULONG index_root_page::irt_repeat::getRoot() const { return (irt_flags & irt_in_progress) ? 0 : irt_root; @@ -386,7 +440,6 @@ inline bool index_root_page::irt_repeat::isUsed() const { return (irt_flags & irt_in_progress) || (irt_root != 0); } -#endif //ODS_TESTING const int STUFF_COUNT = 4; @@ -427,6 +480,35 @@ struct header_page UCHAR hdr_data[1]; // Misc data }; +static_assert(sizeof(struct header_page) == 132, "struct header_page size mismatch"); +static_assert(offsetof(struct header_page, hdr_header) == 0, "hdr_header offset mismatch"); +static_assert(offsetof(struct header_page, hdr_page_size) == 16, "hdr_page_size offset mismatch"); +static_assert(offsetof(struct header_page, hdr_ods_version) == 18, "hdr_ods_version offset mismatch"); +static_assert(offsetof(struct header_page, hdr_PAGES) == 20, "hdr_PAGES offset mismatch"); +static_assert(offsetof(struct header_page, hdr_next_page) == 24, "hdr_next_page offset mismatch"); +static_assert(offsetof(struct header_page, hdr_oldest_transaction) == 28, "hdr_oldest_transaction offset mismatch"); +static_assert(offsetof(struct header_page, hdr_oldest_active) == 32, "hdr_oldest_active offset mismatch"); +static_assert(offsetof(struct header_page, hdr_next_transaction) == 36, "hdr_next_transaction offset mismatch"); +static_assert(offsetof(struct header_page, hdr_sequence) == 40, "hdr_sequence offset mismatch"); +static_assert(offsetof(struct header_page, hdr_flags) == 42, "hdr_flags offset mismatch"); +static_assert(offsetof(struct header_page, hdr_creation_date) == 44, "hdr_creation_date offset mismatch"); +static_assert(offsetof(struct header_page, hdr_attachment_id) == 52, "hdr_attachment_id offset mismatch"); +static_assert(offsetof(struct header_page, hdr_shadow_count) == 56, "hdr_shadow_count offset mismatch"); +static_assert(offsetof(struct header_page, hdr_cpu) == 60, "hdr_cpu offset mismatch"); +static_assert(offsetof(struct header_page, hdr_os) == 61, "hdr_os offset mismatch"); +static_assert(offsetof(struct header_page, hdr_cc) == 62, "hdr_cc offset mismatch"); +static_assert(offsetof(struct header_page, hdr_compatibility_flags) == 63, "hdr_compatibility_flags offset mismatch"); +static_assert(offsetof(struct header_page, hdr_ods_minor) == 64, "hdr_ods_minor offset mismatch"); +static_assert(offsetof(struct header_page, hdr_end) == 66, "hdr_end offset mismatch"); +static_assert(offsetof(struct header_page, hdr_page_buffers) == 68, "hdr_page_buffers offset mismatch"); +static_assert(offsetof(struct header_page, hdr_oldest_snapshot) == 72, "hdr_oldest_snapshot offset mismatch"); +static_assert(offsetof(struct header_page, hdr_backup_pages) == 76, "hdr_backup_pages offset mismatch"); +static_assert(offsetof(struct header_page, hdr_crypt_page) == 80, "hdr_crypt_page offset mismatch"); +static_assert(offsetof(struct header_page, hdr_crypt_plugin) == 84, "hdr_crypt_plugin offset mismatch"); +static_assert(offsetof(struct header_page, hdr_att_high) == 116, "hdr_att_high offset mismatch"); +static_assert(offsetof(struct header_page, hdr_tra_high) == 120, "hdr_tra_high offset mismatch"); +static_assert(offsetof(struct header_page, hdr_data) == 128, "hdr_data offset mismatch"); + #define HDR_SIZE static_cast(offsetof(Ods::header_page, hdr_data[0])) // Header page clumplets @@ -492,6 +574,13 @@ struct page_inv_page UCHAR pip_bits[1]; }; +static_assert(sizeof(struct page_inv_page) == 32, "struct page_inv_page size mismatch"); +static_assert(offsetof(struct page_inv_page, pip_header) == 0, "pip_header offset mismatch"); +static_assert(offsetof(struct page_inv_page, pip_min) == 16, "pip_min offset mismatch"); +static_assert(offsetof(struct page_inv_page, pip_extent) == 20, "pip_extent offset mismatch"); +static_assert(offsetof(struct page_inv_page, pip_used) == 24, "pip_used offset mismatch"); +static_assert(offsetof(struct page_inv_page, pip_bits) == 28, "pip_bits offset mismatch"); + // SCN's Page @@ -502,6 +591,12 @@ struct scns_page ULONG scn_pages[1]; // SCN's vector }; +static_assert(sizeof(struct scns_page) == 24, "struct scns_page size mismatch"); +static_assert(offsetof(struct scns_page, scn_header) == 0, "scn_header offset mismatch"); +static_assert(offsetof(struct scns_page, scn_sequence) == 16, "scn_sequence offset mismatch"); +static_assert(offsetof(struct scns_page, scn_pages) == 20, "scn_pages offset mismatch"); + + // Important note ! // pagesPerPIP value must be multiply of pagesPerSCN value ! // @@ -544,6 +639,16 @@ struct pointer_page ULONG ppg_page[1]; // Data page vector }; +static_assert(sizeof(struct pointer_page) == 36, "struct pointer_page size mismatch"); +static_assert(offsetof(struct pointer_page, ppg_header) == 0, "ppg_header offset mismatch"); +static_assert(offsetof(struct pointer_page, ppg_sequence) == 16, "ppg_sequence offset mismatch"); +static_assert(offsetof(struct pointer_page, ppg_next) == 20, "ppg_next offset mismatch"); +static_assert(offsetof(struct pointer_page, ppg_count) == 24, "ppg_count offset mismatch"); +static_assert(offsetof(struct pointer_page, ppg_relation) == 26, "ppg_relation offset mismatch"); +static_assert(offsetof(struct pointer_page, ppg_min_space) == 28, "ppg_min_space offset mismatch"); +static_assert(offsetof(struct pointer_page, ppg_page) == 32, "ppg_page offset mismatch"); + + // pag_flags const UCHAR ppg_eof = 1; // Last pointer page in relation @@ -577,6 +682,11 @@ struct tx_inv_page UCHAR tip_transactions[1]; }; +static_assert(sizeof(struct tx_inv_page) == 24, "struct tx_inv_page size mismatch"); +static_assert(offsetof(struct tx_inv_page, tip_header) == 0, "tip_header offset mismatch"); +static_assert(offsetof(struct tx_inv_page, tip_next) == 16, "tip_next offset mismatch"); +static_assert(offsetof(struct tx_inv_page, tip_transactions) == 20, "tip_transactions offset mismatch"); + // Generator Page @@ -588,6 +698,12 @@ struct generator_page SINT64 gpg_values[1]; // Generator vector }; +static_assert(sizeof(struct generator_page) == 32, "struct generator_page size mismatch"); +static_assert(offsetof(struct generator_page, gpg_header) == 0, "gpg_header offset mismatch"); +static_assert(offsetof(struct generator_page, gpg_sequence) == 16, "gpg_sequence offset mismatch"); +static_assert(offsetof(struct generator_page, gpg_dummy1) == 20, "gpg_dummy1 offset mismatch"); +static_assert(offsetof(struct generator_page, gpg_values) == 24, "gpg_values offset mismatch"); + // Record header @@ -601,6 +717,14 @@ struct rhd UCHAR rhd_data[1]; // record data }; +static_assert(sizeof(struct rhd) == 16, "struct rhd size mismatch"); +static_assert(offsetof(struct rhd, rhd_transaction) == 0, "rhd_transaction offset mismatch"); +static_assert(offsetof(struct rhd, rhd_b_page) == 4, "rhd_b_page offset mismatch"); +static_assert(offsetof(struct rhd, rhd_b_line) == 8, "rhd_b_line offset mismatch"); +static_assert(offsetof(struct rhd, rhd_flags) == 10, "rhd_flags offset mismatch"); +static_assert(offsetof(struct rhd, rhd_format) == 12, "rhd_format offset mismatch"); +static_assert(offsetof(struct rhd, rhd_data) == 13, "rhd_data offset mismatch"); + #define RHD_SIZE static_cast(offsetof(Ods::rhd, rhd_data[0])) // Record header extended to hold long transaction id @@ -616,6 +740,15 @@ struct rhde UCHAR rhde_data[1]; // record data }; +static_assert(sizeof(struct rhde) == 20, "struct rhde size mismatch"); +static_assert(offsetof(struct rhde, rhde_transaction) == 0, "rhde_transaction offset mismatch"); +static_assert(offsetof(struct rhde, rhde_b_page) == 4, "rhde_b_page offset mismatch"); +static_assert(offsetof(struct rhde, rhde_b_line) == 8, "rhde_b_line offset mismatch"); +static_assert(offsetof(struct rhde, rhde_flags) == 10, "rhde_flags offset mismatch"); +static_assert(offsetof(struct rhde, rhde_format) == 12, "rhde_formats offset mismatch"); +static_assert(offsetof(struct rhde, rhde_tra_high) == 14, "rhde_tra_high offset mismatch"); +static_assert(offsetof(struct rhde, rhde_data) == 16, "rhde_data offset mismatch"); + #define RHDE_SIZE static_cast(offsetof(Ods::rhde, rhde_data[0])) // Record header for fragmented record @@ -633,6 +766,17 @@ struct rhdf UCHAR rhdf_data[1]; // record data }; +static_assert(sizeof(struct rhdf) == 24, "struct rhdf size mismatch"); +static_assert(offsetof(struct rhdf, rhdf_transaction) == 0, "rhdf_transaction offset mismatch"); +static_assert(offsetof(struct rhdf, rhdf_b_page) == 4, "rhdf_b_page offset mismatch"); +static_assert(offsetof(struct rhdf, rhdf_b_line) == 8, "rhdf_b_line offset mismatch"); +static_assert(offsetof(struct rhdf, rhdf_flags) == 10, "rhdf_flags offset mismatch"); +static_assert(offsetof(struct rhdf, rhdf_format) == 12, "rhdf_format offset mismatch"); +static_assert(offsetof(struct rhdf, rhdf_tra_high) == 14, "rhdf_tra_high offset mismatch"); +static_assert(offsetof(struct rhdf, rhdf_f_page) == 16, "rhdf_f_page offset mismatch"); +static_assert(offsetof(struct rhdf, rhdf_f_line) == 20, "rhdf_f_line offset mismatch"); +static_assert(offsetof(struct rhdf, rhdf_data) == 22, "rhdf_data offset mismatch"); + #define RHDF_SIZE static_cast(offsetof(Ods::rhdf, rhdf_data[0])) @@ -649,17 +793,29 @@ struct blh ULONG blh_length; // Total length of data USHORT blh_sub_type; // Blob sub-type UCHAR blh_charset; // Blob charset (since ODS 11.1) - UCHAR blh_unused; -#ifndef ODS_TESTING // Macro CHECK_BLOB_FIELD_ACCESS_FOR_SELECT is never defined, code under it was left for a case // we would like to have that check in a future. #ifdef CHECK_BLOB_FIELD_ACCESS_FOR_SELECT USHORT blh_fld_id; // Field ID #endif -#endif //ODS_TESTING + UCHAR blh_unused; ULONG blh_page[1]; // Page vector for blob pages }; +static_assert(sizeof(struct blh) == 32, "struct blh size mismatch"); +static_assert(offsetof(struct blh, blh_lead_page) == 0, "blh_lead_page offset mismatch"); +static_assert(offsetof(struct blh, blh_max_sequence) == 4, "blh_max_sequence offset mismatch"); +static_assert(offsetof(struct blh, blh_max_segment) == 8, "blh_max_segment offset mismatch"); +static_assert(offsetof(struct blh, blh_flags) == 10, "blh_flags offset mismatch"); +static_assert(offsetof(struct blh, blh_level) == 12, "blh_level offset mismatch"); +static_assert(offsetof(struct blh, blh_count) == 16, "blh_count offset mismatch"); +static_assert(offsetof(struct blh, blh_length) == 20, "blh_length offset mismatch"); +static_assert(offsetof(struct blh, blh_sub_type) == 24, "blh_sub_type offset mismatch"); +static_assert(offsetof(struct blh, blh_charset) == 26, "blh_charset offset mismatch"); +static_assert(offsetof(struct blh, blh_unused) == 27, "blh_unused offset mismatch"); +static_assert(offsetof(struct blh, blh_page) == 28, "blh_page offset mismatch"); + + #define BLH_SIZE static_cast(offsetof(Ods::blh, blh_page[0])) // rhd_flags, rhdf_flags and blh_flags @@ -691,6 +847,14 @@ struct Descriptor ULONG dsc_offset; }; +static_assert(sizeof(struct Descriptor) == 12, "struct Descriptor size mismatch"); +static_assert(offsetof(struct Descriptor, dsc_dtype) == 0, "dsc_dtype offset mismatch"); +static_assert(offsetof(struct Descriptor, dsc_scale) == 1, "dsc_scale offset mismatch"); +static_assert(offsetof(struct Descriptor, dsc_length) == 2, "dsc_length offset mismatch"); +static_assert(offsetof(struct Descriptor, dsc_sub_type) == 4, "dsc_sub_type offset mismatch"); +static_assert(offsetof(struct Descriptor, dsc_flags) == 6, "dsc_flags offset mismatch"); +static_assert(offsetof(struct Descriptor, dsc_offset) == 8, "dsc_offset offset mismatch"); + // Array description, "internal side" used by the engine. // And stored on the disk, in the relation summary blob. @@ -711,8 +875,24 @@ struct InternalArrayDesc SLONG iad_upper; // Upper bound }; iad_repeat iad_rpt[1]; + + static_assert(sizeof(struct iad_repeat) == 24, "struct iad_repeat size mismatch"); + static_assert(offsetof(struct iad_repeat, iad_desc) == 0, "iad_desc offset mismatch"); + static_assert(offsetof(struct iad_repeat, iad_length) == 12, "iad_length offset mismatch"); + static_assert(offsetof(struct iad_repeat, iad_lower) == 16, "iad_lower offset mismatch"); + static_assert(offsetof(struct iad_repeat, iad_upper) == 20, "iad_upper offset mismatch"); }; +static_assert(sizeof(struct InternalArrayDesc) == 40, "struct InternalArrayDesc size mismatch"); +static_assert(offsetof(struct InternalArrayDesc, iad_version) == 0, "iad_version offset mismatch"); +static_assert(offsetof(struct InternalArrayDesc, iad_dimensions) == 1, "iad_dimension offset mismatch"); +static_assert(offsetof(struct InternalArrayDesc, iad_struct_count) == 2, "iad_struct_count offset mismatch"); +static_assert(offsetof(struct InternalArrayDesc, iad_element_length) == 4, "iad_element_length offset mismatch"); +static_assert(offsetof(struct InternalArrayDesc, iad_length) == 6, "iad_length offset mismatch"); +static_assert(offsetof(struct InternalArrayDesc, iad_count) == 8, "iad_count offset mismatch"); +static_assert(offsetof(struct InternalArrayDesc, iad_total_length) == 12, "iad_total_length offset mismatch"); +static_assert(offsetof(struct InternalArrayDesc, iad_rpt) == 16, "iad_rpt offset mismatch"); + const UCHAR IAD_VERSION_1 = 1; /* @@ -727,13 +907,10 @@ inline int IAD_LEN(int count) #define IAD_LEN(count) (sizeof (Ods::InternalArrayDesc) + \ (count ? count - 1: count) * sizeof (Ods::InternalArrayDesc::iad_repeat)) -#ifndef ODS_TESTING Firebird::string pagtype(UCHAR type); -#endif //ODS_TESTING } //namespace Ods -#ifndef ODS_TESTING // alignment for raw page access const USHORT PAGE_ALIGNMENT = 1024; @@ -745,6 +922,5 @@ const int MAX_TABLE_VERSIONS = 255; // max number of view formats (aka versions), limited by "SSHORT RDB$FORMAT" const int MAX_VIEW_VERSIONS = MAX_SSHORT; -#endif //ODS_TESTING #endif // JRD_ODS_H diff --git a/src/jrd/os/posix/unix.cpp b/src/jrd/os/posix/unix.cpp index b1c5ab06fb..3a0794dbae 100644 --- a/src/jrd/os/posix/unix.cpp +++ b/src/jrd/os/posix/unix.cpp @@ -713,7 +713,7 @@ jrd_file* PIO_open(thread_db* tdbb, } const bool shareMode = dbb->dbb_config->getServerMode() != MODE_SUPER; - lockDatabaseFile(desc, shareMode || readOnly, false, file_name.c_str(), isc_io_open_err); + lockDatabaseFile(desc, shareMode, false, file_name.c_str(), isc_io_open_err); // os_utils::posix_fadvise(desc, 0, 0, POSIX_FADV_RANDOM); diff --git a/src/jrd/par.cpp b/src/jrd/par.cpp index a0eabbe1bf..951cdeec40 100644 --- a/src/jrd/par.cpp +++ b/src/jrd/par.cpp @@ -506,9 +506,12 @@ USHORT PAR_desc(thread_db* tdbb, CompilerScratch* csb, dsc* desc, ItemInfo* item } } - CompilerScratch::Dependency dependency(obj_field); - dependency.name = name; - csb->csb_dependencies.push(dependency); + if (csb->csb_g_flags & csb_get_dependencies) + { + CompilerScratch::Dependency dependency(obj_field); + dependency.name = name; + csb->csb_dependencies.push(dependency); + } break; } @@ -568,10 +571,13 @@ USHORT PAR_desc(thread_db* tdbb, CompilerScratch* csb, dsc* desc, ItemInfo* item } } - CompilerScratch::Dependency dependency(obj_relation); - dependency.relation = MET_lookup_relation(tdbb, *relationName); - dependency.subName = fieldName; - csb->csb_dependencies.push(dependency); + if (csb->csb_g_flags & csb_get_dependencies) + { + CompilerScratch::Dependency dependency(obj_relation); + dependency.relation = MET_lookup_relation(tdbb, *relationName); + dependency.subName = fieldName; + csb->csb_dependencies.push(dependency); + } break; } @@ -582,7 +588,7 @@ USHORT PAR_desc(thread_db* tdbb, CompilerScratch* csb, dsc* desc, ItemInfo* item break; } - if (desc->getTextType() != CS_NONE) + if ((csb->csb_g_flags & csb_get_dependencies) && desc->getTextType() != CS_NONE) { CompilerScratch::Dependency dependency(obj_collation); dependency.number = INTL_TEXT_TYPE(*desc); @@ -896,6 +902,9 @@ void PAR_dependency(thread_db* tdbb, CompilerScratch* csb, StreamType stream, SS **************************************/ SET_TDBB(tdbb); + if (!(csb->csb_g_flags & csb_get_dependencies)) + return; + CompilerScratch::Dependency dependency(0); if (csb->csb_rpt[stream].csb_relation) diff --git a/src/jrd/relations.h b/src/jrd/relations.h index 37ce864eb8..ceb93f0c6c 100644 --- a/src/jrd/relations.h +++ b/src/jrd/relations.h @@ -523,6 +523,7 @@ RELATION(nam_mon_attachments, rel_mon_attachments, ODS_11_1, rel_virtual) FIELD(f_mon_att_stmt_timeout, nam_stmt_timeout, fld_stmt_timeout, 0, ODS_13_0) FIELD(f_mon_att_wire_compressed, nam_wire_compressed, fld_bool, 0, ODS_13_0) FIELD(f_mon_att_wire_encrypted, nam_wire_encrypted, fld_bool, 0, ODS_13_0) + FIELD(f_mon_att_remote_crypt, nam_wire_crypt_plugin, fld_remote_crypt, 0, ODS_12_0) END_RELATION // Relation 35 (MON$TRANSACTIONS) diff --git a/src/jrd/replication/Applier.cpp b/src/jrd/replication/Applier.cpp index a326481dc2..1fd6ef3c3e 100644 --- a/src/jrd/replication/Applier.cpp +++ b/src/jrd/replication/Applier.cpp @@ -21,7 +21,7 @@ */ #include "firebird.h" -#include "ids.h" +#include "../ids.h" #include "../jrd/align.h" #include "../jrd/jrd.h" #include "../jrd/blb.h" diff --git a/src/jrd/sort.cpp b/src/jrd/sort.cpp index f893fb044d..f44bc99bd3 100644 --- a/src/jrd/sort.cpp +++ b/src/jrd/sort.cpp @@ -819,15 +819,14 @@ void Sort::diddleKey(UCHAR* record, bool direction, bool duplicateHandling) break; case SKD_dec64: - if (direction && !duplicateHandling) + fb_assert(false); // diddleKey for Dec64/128 not tested on bigendians! + if (direction) { ((Decimal64*) p)->makeKey(lwp); *p ^= 1 << 7; } else if (!(key->skd_flags & SKD_separate_data)) { - fb_assert(false); - if (complement && n) { UCHAR* pp = p; @@ -843,15 +842,13 @@ void Sort::diddleKey(UCHAR* record, bool direction, bool duplicateHandling) case SKD_dec128: fb_assert(false); // diddleKey for Dec64/128 not tested on bigendians! - if (direction && !duplicateHandling) + if (direction) { ((Decimal128*) p)->makeKey(lwp); *p ^= 1 << 7; } else if (!(key->skd_flags & SKD_separate_data)) { - fb_assert(false); - if (complement && n) { UCHAR* pp = p; @@ -1133,15 +1130,13 @@ void Sort::diddleKey(UCHAR* record, bool direction, bool duplicateHandling) #endif // IEEE case SKD_dec64: - if (direction && !duplicateHandling) + if (direction) { ((Decimal64*) p)->makeKey(lwp); p[3] ^= 1 << 7; } else if (!(key->skd_flags & SKD_separate_data)) { - fb_assert(false); - if (complement && n) { UCHAR* pp = p; @@ -1156,15 +1151,13 @@ void Sort::diddleKey(UCHAR* record, bool direction, bool duplicateHandling) break; case SKD_dec128: - if (direction && !duplicateHandling) + if (direction) { ((Decimal128*) p)->makeKey(lwp); p[3] ^= 1 << 7; } else if (!(key->skd_flags & SKD_separate_data)) { - fb_assert(false); - if (complement && n) { UCHAR* pp = p; diff --git a/src/jrd/svc.cpp b/src/jrd/svc.cpp index f31d051e0e..e1861ad296 100644 --- a/src/jrd/svc.cpp +++ b/src/jrd/svc.cpp @@ -1365,11 +1365,13 @@ ISC_STATUS Service::query2(thread_db* /*tdbb*/, case isc_info_svc_user_dbpath: if (svc_user_flag & SVC_user_dba) { - // The path to the user security database (security2.fdb) - const RefPtr defConf(Config::getDefaultConfig()); - const char* secDb = defConf->getSecurityDatabase(); + // The path to the user security database + PathName secDb; + RefPtr config; + expandDatabaseName(svc_expected_db, secDb, &config); + expandDatabaseName(config->getSecurityDatabase(), secDb, nullptr); - if (!(info = INF_put_item(item, static_cast(strlen(secDb)), secDb, info, end))) + if (!(info = INF_put_item(item, static_cast(secDb.length()), secDb.c_str(), info, end))) { return 0; } @@ -1817,11 +1819,13 @@ void Service::query(USHORT send_item_length, case isc_info_svc_user_dbpath: if (svc_user_flag & SVC_user_dba) { - // The path to the user security database (security2.fdb) - const RefPtr defConf(Config::getDefaultConfig()); - const char* secDb = defConf->getSecurityDatabase(); + // The path to the user security database + PathName secDb; + RefPtr config; + expandDatabaseName(svc_expected_db, secDb, &config); + expandDatabaseName(config->getSecurityDatabase(), secDb, nullptr); - if (!(info = INF_put_item(item, static_cast(strlen(secDb)), secDb, info, end))) + if (!(info = INF_put_item(item, static_cast(secDb.length()), secDb.c_str(), info, end))) { return; } diff --git a/src/jrd/vio.cpp b/src/jrd/vio.cpp index ee2ab4b616..0a7ff9d2d4 100644 --- a/src/jrd/vio.cpp +++ b/src/jrd/vio.cpp @@ -48,7 +48,7 @@ #include "../jrd/val.h" #include "../jrd/req.h" #include "../jrd/tra.h" -#include "gen/ids.h" +#include "../jrd/ids.h" #include "../jrd/lck.h" #include "../jrd/lls.h" #include "../jrd/scl.h" diff --git a/src/misc/ids.m b/src/misc/ids.m deleted file mode 100644 index 899d658abd..0000000000 --- a/src/misc/ids.m +++ /dev/null @@ -1,30 +0,0 @@ -divert(-1) -/* - * The contents of this file are subject to the Interbase Public - * License Version 1.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy - * of the License at http://www.Inprise.com/IPL.html - * - * Software distributed under the License is distributed on an - * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express - * or implied. See the License for the specific language governing - * rights and limitations under the License. - * - * The Original Code was created by Inprise Corporation - * and its predecessors. Portions created by Inprise Corporation are - * Copyright (C) Inprise Corporation. - * - * All Rights Reserved. - * Contributor(s): ______________________________________. - */ - -changequote([,]) - -define(RELATION, [define([N], 0)]) -define(FIELD, [[const USHORT ] $1 [=] N[;]define([N], incr(N)) -dnl]) -define(END_RELATION, ) -define(FIELD_ODS8, ) - -divert -include(../src/jrd/relations.h) diff --git a/src/misc/ods.awk b/src/misc/ods.awk deleted file mode 100644 index 53b6bb6451..0000000000 --- a/src/misc/ods.awk +++ /dev/null @@ -1,112 +0,0 @@ -# -# PROGRAM: ODS sizes and offsets validation -# MODULE: ods.awk -# DESCRIPTION: Generates c++ code printing reference sample for ODS strctures -# -# The contents of this file are subject to the Initial -# Developer's Public License Version 1.0 (the "License"); -# you may not use this file except in compliance with the -# License. You may obtain a copy of the License at -# http://www.firebirdsql.org/en/initial-developer-s-public-license-version-1-0/ -# -# Software distributed under the License is distributed AS IS, -# WITHOUT WARRANTY OF ANY KIND, either express or implied. -# See the License for the specific language governing rights -# and limitations under the License. -# -# The Original Code was created by Alexander Peshkoff -# for the Firebird Open Source RDBMS project. -# -# Copyright (c) 2018 Alexander Peshkoff -# and all contributors signed below. -# -# All Rights Reserved. -# Contributor(s): ______________________________________. -# - -BEGIN { - st = 0; - nm = ""; - nm2 = ""; - v2 = ""; - skip = 0; - - print "#include " - print "#ifdef _MSC_VER" - print "#include \"gen/autoconfig_msvc.h\"" - print "#else" - print "#include \"gen/autoconfig.h\"" - print "#endif" - print "" - print "#if SIZEOF_VOID_P == 8" - print "#define FMT \"l\"" - print "#else" - print "#define FMT \"\"" - print "#endif" - print "" - print "#include \"fb_types.h\"" - print "#define ODS_TESTING" - print "#include \"../jrd/ods.h\"" - print "" - print "using namespace Ods;" - print "" - print "int main() {" -} - -($1 == "struct") { - ++st; - if (st <= 2) - { - if (st == 1) - { - nm = $2; - nm2 = nm; - } - else - { - nm2 = nm "::" $2; - } - v2 = $2 "_"; - - print "\tprintf(\"\\n *** " $0 " %\" FMT \"u\\n\", sizeof(" nm2 "));"; - print "\t" nm2 " " v2 ";"; - } -} - - -($1 == "};") { - if (st > 1) - { - v2 = nm "_"; - } - st--; -} - -($1 == "}") { - if (st > 1) - { - st--; - v2 = nm "_"; - } -} - -($2 == "ODS_TESTING") { skip = 1; } - -(st > 0 && substr($1, 1, 1) != "#" && $1 != "struct" && skip == 0 && $1 != "//") { - m = $2; - i = index(m, "["); - if (i == 0) - i = index(m, ";"); - if (i > 0) - m = substr(m, 1, i - 1); - - if (length(m) > 0) - print "\tprintf(\"" m " %\" FMT \"d\\n\", (char*)&" v2 "." m " - (char*)&" v2 ");" -} - -($2 == "//ODS_TESTING") { skip = 0; } - -END { - print "}" -} - diff --git a/src/misc/ods.txt b/src/misc/ods.txt deleted file mode 100644 index 101bde4278..0000000000 --- a/src/misc/ods.txt +++ /dev/null @@ -1,185 +0,0 @@ - - *** struct pag 16 -pag_type 0 -pag_flags 1 -pag_reserved 2 -pag_generation 4 -pag_scn 8 -pag_pageno 12 - - *** struct blob_page 32 -blp_header 0 -blp_lead_page 16 -blp_sequence 20 -blp_length 24 -blp_pad 26 -blp_page 28 - - *** struct btree_page 40 -btr_header 0 -btr_sibling 16 -btr_left_sibling 20 -btr_prefix_total 24 -btr_relation 28 -btr_length 30 -btr_id 32 -btr_level 33 -btr_jump_interval 34 -btr_jump_size 36 -btr_jump_count 38 -btr_nodes 39 - - *** struct data_page 28 -dpg_header 0 -dpg_sequence 16 -dpg_relation 20 -dpg_count 22 - - *** struct dpg_repeat 4 -dpg_offset 0 -dpg_length 2 -dpg_rpt 24 - - *** struct index_root_page 32 -irt_header 0 -irt_relation 16 -irt_count 18 - - *** struct irt_repeat 12 -irt_root 0 -irt_transaction 4 -irt_desc 8 -irt_keys 10 -irt_flags 11 -irt_rpt 20 - - *** struct irtd 8 -irtd_field 0 -irtd_itype 2 -irtd_selectivity 4 - - *** struct header_page 132 -hdr_header 0 -hdr_page_size 16 -hdr_ods_version 18 -hdr_PAGES 20 -hdr_next_page 24 -hdr_oldest_transaction 28 -hdr_oldest_active 32 -hdr_next_transaction 36 -hdr_sequence 40 -hdr_flags 42 -hdr_creation_date 44 -hdr_attachment_id 52 -hdr_shadow_count 56 -hdr_cpu 60 -hdr_os 61 -hdr_cc 62 -hdr_compatibility_flags 63 -hdr_ods_minor 64 -hdr_end 66 -hdr_page_buffers 68 -hdr_oldest_snapshot 72 -hdr_backup_pages 76 -hdr_crypt_page 80 -hdr_crypt_plugin 84 -hdr_att_high 116 -hdr_tra_high 120 -hdr_data 128 - - *** struct page_inv_page 32 -pip_header 0 -pip_min 16 -pip_extent 20 -pip_used 24 -pip_bits 28 - - *** struct scns_page 24 -scn_header 0 -scn_sequence 16 -scn_pages 20 - - *** struct pointer_page 36 -ppg_header 0 -ppg_sequence 16 -ppg_next 20 -ppg_count 24 -ppg_relation 26 -ppg_min_space 28 -ppg_page 32 - - *** struct tx_inv_page 24 -tip_header 0 -tip_next 16 -tip_transactions 20 - - *** struct generator_page 32 -gpg_header 0 -gpg_sequence 16 -gpg_dummy1 20 -gpg_values 24 - - *** struct rhd 16 -rhd_transaction 0 -rhd_b_page 4 -rhd_b_line 8 -rhd_flags 10 -rhd_format 12 -rhd_data 13 - - *** struct rhde 20 -rhde_transaction 0 -rhde_b_page 4 -rhde_b_line 8 -rhde_flags 10 -rhde_format 12 -rhde_tra_high 14 -rhde_data 16 - - *** struct rhdf 24 -rhdf_transaction 0 -rhdf_b_page 4 -rhdf_b_line 8 -rhdf_flags 10 -rhdf_format 12 -rhdf_tra_high 14 -rhdf_f_page 16 -rhdf_f_line 20 -rhdf_data 22 - - *** struct blh 32 -blh_lead_page 0 -blh_max_sequence 4 -blh_max_segment 8 -blh_flags 10 -blh_level 12 -blh_count 16 -blh_length 20 -blh_sub_type 24 -blh_charset 26 -blh_unused 27 -blh_page 28 - - *** struct Descriptor 12 -dsc_dtype 0 -dsc_scale 1 -dsc_length 2 -dsc_sub_type 4 -dsc_flags 6 -dsc_offset 8 - - *** struct InternalArrayDesc 40 -iad_version 0 -iad_dimensions 1 -iad_struct_count 2 -iad_element_length 4 -iad_length 6 -iad_count 8 -iad_total_length 12 - - *** struct iad_repeat 24 -iad_desc 0 -iad_length 12 -iad_lower 16 -iad_upper 20 -iad_rpt 16 diff --git a/src/misc/writeBuildNum.sh b/src/misc/writeBuildNum.sh index 1f6cbcf0ce..53739c0de7 100755 --- a/src/misc/writeBuildNum.sh +++ b/src/misc/writeBuildNum.sh @@ -9,7 +9,7 @@ BuildType=T MajorVer=4 MinorVer=0 RevNo=0 -BuildNum=1715 +BuildNum=1743 NowAt=`pwd` cd `dirname $0` diff --git a/src/plugins/crypt/chacha/ChaCha.cpp b/src/plugins/crypt/chacha/ChaCha.cpp index 7331c6a899..218bd3c7c7 100644 --- a/src/plugins/crypt/chacha/ChaCha.cpp +++ b/src/plugins/crypt/chacha/ChaCha.cpp @@ -168,7 +168,7 @@ SimpleFactory factory; } // anonymous namespace -extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master) +extern "C" void FB_EXPORTED FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master) { CachedMasterInterface::set(master); PluginManagerInterfacePtr()->registerPluginFactory(IPluginManager::TYPE_WIRE_CRYPT, "ChaCha", &factory); diff --git a/src/remote/client/interface.cpp b/src/remote/client/interface.cpp index 18fa388fbb..abb2ecbfda 100644 --- a/src/remote/client/interface.cpp +++ b/src/remote/client/interface.cpp @@ -7204,7 +7204,14 @@ static THREAD_ENTRY_DECLARE event_thread(THREAD_ENTRY_PARAM arg) P_OP operation = op_void; { // scope RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION); - stuff = port->receive(&packet); + try + { + stuff = port->receive(&packet); + } + catch(status_exception&) + { + // ignore + } operation = packet.p_operation; diff --git a/src/remote/os/win32/wnet.cpp b/src/remote/os/win32/wnet.cpp index b551112bd9..11c1fb939c 100644 --- a/src/remote/os/win32/wnet.cpp +++ b/src/remote/os/win32/wnet.cpp @@ -759,7 +759,11 @@ static void disconnect(rem_port* port) } wnet_ports->unRegisterPort(port); - port->release(); + + if (port->port_thread_guard && port->port_events_thread && !Thread::isCurrent(port->port_events_threadId)) + port->port_thread_guard->setWait(port->port_events_thread); + else + port->release(); } @@ -1332,7 +1336,7 @@ static bool packet_receive(rem_port* port, UCHAR* buffer, SSHORT buffer_length, if (!n) { - if (port->port_flags & PORT_detached) + if (port->port_flags & (PORT_detached | PORT_disconnect)) return false; return wnet_error(port, "ReadFile end-of-file", isc_net_read_err, dwError); @@ -1408,10 +1412,15 @@ static bool packet_send( rem_port* port, const SCHAR* buffer, SSHORT buffer_leng status = GetOverlappedResult(port->port_pipe, &ovrl, &n, TRUE); dwError = GetLastError(); } - if (!status) + if (!status && dwError != ERROR_NO_DATA) return wnet_error(port, "WriteFile", isc_net_write_err, dwError); if (n != length) + { + if (port->port_flags & (PORT_detached | PORT_disconnect)) + return false; + return wnet_error(port, "WriteFile truncated", isc_net_write_err, dwError); + } #if defined(DEBUG) && defined(WNET_trace) packet_print("send", reinterpret_cast(buffer), buffer_length); diff --git a/src/remote/os/win32/xnet.cpp b/src/remote/os/win32/xnet.cpp index 7385d0c09e..482f14a1f4 100644 --- a/src/remote/os/win32/xnet.cpp +++ b/src/remote/os/win32/xnet.cpp @@ -1068,6 +1068,14 @@ static void cleanup_port(rem_port* port) * **************************************/ + if (port->port_thread_guard && port->port_events_thread && !Thread::isCurrent(port->port_events_threadId)) + { + //port->port_thread_guard->setWait(port->port_events_thread); + + // Do not release XNET structures while event's thread working + Thread::waitForCompletion(port->port_events_thread); + } + if (port->port_xcc) { cleanup_comm(port->port_xcc); @@ -1996,6 +2004,9 @@ static bool_t xnet_read(XDR* xdrs) const DWORD wait_result = WaitForSingleObject(xcc->xcc_event_recv_channel_filled, XNET_RECV_WAIT_TIMEOUT); + if (port->port_flags & PORT_disconnect) + return FALSE; + if (wait_result == WAIT_OBJECT_0) { // Client has written some data for us (server) to read diff --git a/src/remote/remote.h b/src/remote/remote.h index 6e575106fb..8ffa2f8ced 100644 --- a/src/remote/remote.h +++ b/src/remote/remote.h @@ -1093,6 +1093,7 @@ struct rem_port : public Firebird::GlobalStorage, public Firebird::RefCounted Firebird::IWireCryptPlugin* port_crypt_plugin; // plugin used by port, when not NULL - crypts wire data Firebird::ICryptKeyCallback* port_client_crypt_callback; // client callback to transfer database crypt key ServerCallbackBase* port_server_crypt_callback; // server callback to transfer database crypt key + Firebird::PathName port_crypt_name; // name of actual wire crypt plugin Firebird::RefPtr port_replicator; @@ -1138,8 +1139,8 @@ public: port_srv_auth(NULL), port_srv_auth_block(NULL), port_crypt_keys(getPool()), port_crypt_complete(false), port_crypt_level(WIRECRYPT_REQUIRED), port_known_server_keys(getPool()), port_crypt_plugin(NULL), - port_client_crypt_callback(NULL), port_server_crypt_callback(NULL), port_replicator(NULL), - port_buffer(FB_NEW_POOL(getPool()) UCHAR[rpt]), + port_client_crypt_callback(NULL), port_server_crypt_callback(NULL), port_crypt_name(getPool()), + port_replicator(NULL), port_buffer(FB_NEW_POOL(getPool()) UCHAR[rpt]), port_snd_packets(0), port_rcv_packets(0), port_snd_bytes(0), port_rcv_bytes(0) { addRef(); diff --git a/src/remote/server/server.cpp b/src/remote/server/server.cpp index 2a9c1a3825..425deb35e5 100644 --- a/src/remote/server/server.cpp +++ b/src/remote/server/server.cpp @@ -2328,7 +2328,10 @@ static void addClumplets(ClumpletWriter* dpb_buffer, flags |= isc_dpb_addr_flag_conn_compressed; #endif if (port->port_crypt_plugin) + { flags |= isc_dpb_addr_flag_conn_encrypted; + address_record.insertString(isc_dpb_addr_crypt, port->port_crypt_name); + } if (flags) address_record.insertInt(isc_dpb_addr_flags, flags); @@ -6175,6 +6178,7 @@ void rem_port::start_crypt(P_CRYPT * crypt, PACKET* sendL) port_crypt_plugin = cp.plugin(); port_crypt_plugin->addRef(); port_crypt_complete = true; + port_crypt_name = cp.name(); send_response(sendL, 0, 0, &st, false); WIRECRYPT_DEBUG(fprintf(stderr, "Srv: Installed cipher %s\n", cp.name())); diff --git a/src/yvalve/gds.cpp b/src/yvalve/gds.cpp index c0dd855594..afab931314 100644 --- a/src/yvalve/gds.cpp +++ b/src/yvalve/gds.cpp @@ -3930,6 +3930,8 @@ public: } msgPrefix.copyTo(fb_prefix_msg_val, sizeof(fb_prefix_msg_val)); fb_prefix_msg = fb_prefix_msg_val; + + TimeZoneUtil::initTimeZoneEnv(); } static void cleanup() {