-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ibm_db.createdb() and ibmdb.dropdb() fail on linux because of coding defect in ibm_db.c #942
Comments
@bimalkjha , perhaps an earlier breaking change , older than #862 introduced the incorrect #ifdef clause , as no doubt you will agree that "db2cli64.dll" is also incorrect for non-Windows. A code review should have spotted that, but perhaps independent code-reviews are not being done per change. Regardless of exactly how/when the code broke, it does not change the fact that the code needs to be fixed. Is there a policy of running every test case on relevant platforms ( or at the least on both win64, linux x64) for every release, to catch snafu's like this at the earliest opportunity? I'm aware of earlier efforts to use third-party tooling to continually run tests but that effort seems to have come to an end although I saw no announcements about it. |
@Earamark, below my steps to unit-test this merge on linux x46: Result: PASS Unit Testing the PR post merge for issue #942 ibm_db.c #define LIBDB2 Note: not tested by me on Microsoft-Windows or AIX. cd python -v venv ~/env38build # the system default python on this box is v3.8.10 python -m pip install --upgrade pip # 24.1.1 source ~/env38build/bin/activate cd ~/env38build pip install build # module is not automatically pre-installed in a new venv with python 3.8.10 Note: private-key already loaded, and public key made known to github. export GIT_SSH_COMMAND="/usr/bin/ssh -i ~/.ssh/id_ed25519.pub" # my public key git clone git@github.com:ibmdb/python-ibmdb.git cd python-ibmdb python -m build # note the filename of the wheel produced, needed below pip install dist/ibm_db-3.2.3-cp38-cp38-linux_x86_64.whl cp config.py.sample config.py # adjust config.py as needed vi config.json # adjust for the Db2-environment you are using export DB2DSDRIVER_CFG_PATH=/home/user1/db2dsdriver.cfg # has entry for db in config.json export SINGLE_PYTHON_TEST=test_createDropDB.py python ibmdb_tests.py ==> success (pass) |
@imavo, Thank you for confirmation. I have tested them in those machines also. Thanks |
Operating System Name: linux x64
db2level output from clidriver if in use: 11.5.8.0
Target Db2 Server Version: 11.5.8.0
Python Version: 3.9
ibm_db version: 3.2.3
For non-Windows, output of below commands:
uname : Linux
uname -m : x86_64
Value of below environment variables if set:
IBM_DB_HOME: ~db2inst7/sqllib
PATH:
LIB/LD_LIBRARY_PATH/DYLD_LIBRARY_PATH:
Test script to reproduce the problem.
(existing test scripts supplied by ibm_db source test_createdbNX.py, test_createDropDB.py, test_recreateDB.py)
For installation related issue, complete output of
pip install ibm_db
command.: N/A, this is not installation relatedSteps to Reproduce:
Install ibm_db 3.2.3
Run one of the existing test scrpts e.g. test_createdbNX.py, test_createDropDB.py, test_recreateDB.py on linux, (adjusting for your local environment) the expectation is that the databases will get created or dropped etc. However, what actually happens is that when the createdb() or dropdb() APIs run on linux, the API will fail with the exception "Error in loading db2cli.dll library file".
Investigation....
Looks like a change made in August-2023 (for #862) to the file ibm_db.c broke the code but only on linux.
The defect in the code causes the LIBDB2 macro to be evaluated to "db2cli.dll" when the _WIN64 is not defined.
(i.e. the same problem will persist on aix and linux, but NOT on microsoft-windows).
It is evident that the code for ibmdb.createdb() after this change was not tested on linux, or if tested then the error was ignored. Existing test files test_createdbNX.py, test_createDropDB.py, test_recreateDB.py exercise these 2 APIs that are impacted by this breaking change.
When the code in ibm_db.c runs the
_python_ibm_db_createdb()
function, or the_python_ibm_db_dropdb()
, the LIBDB2 evaluates on linux x64 to "db2cli.dll" so the DLOPEN (i.e. dlopen() syscall) will fail because that filename is incorrect for linux. The expectation is that LIBDB2 evaluates to "libdb2.so.1" on linux x64, which would allow the code to run.Easy fix in ibm_db.c .
The text was updated successfully, but these errors were encountered: