Skip to content
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

Incorrect escaping #70

Closed
stepthom opened this issue Jan 8, 2015 · 2 comments
Closed

Incorrect escaping #70

stepthom opened this issue Jan 8, 2015 · 2 comments
Labels

Comments

@stepthom
Copy link

stepthom commented Jan 8, 2015

I'm using Bear to create a compilation database for PostgreSQL. One of the commands executed by the the PostgreSQL build system is:

/usr/local/bin/clang -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-    strict-aliasing -fwrapv -g -I../../../../src/include -D_GNU_SOURCE  -DDLSUFFIX=\".so\"  -c -o dfmgr.o dfmgr.c

Notice the -DDLSUFFIX=\".so\" flag.

The compilation database entry created by bear is:

{
    "command": "/usr/local/bin/clang -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -g -../../../../src/include -D_GNU_SOURCE -DDLSUFFIX=\".so\" -c -o dfmgr.o dfmgr.c",
    "directory": "/dataware/postgres/src/backend/utils/fmgr",
    "file": "/dataware/postgres/src/backend/utils/fmgr/dfmgr.c"
}

Notice the -DDLSUFFIX=\".so\" flag. This is incorrect, because CMake is interpreting this flag after escaping, i.e., as -DDLSUFFIX=".so", which is causing that file to compile incorrectly. (I can't tell if the \character is being dropped altogether but the " character is being escaped correctly, or if no escaping is happening at all.) Instead, the compilation database entry created by bear should have -DDLSUFFIX=\\\".so\\\", which will then be interpreted by CMake as -DDLSUFFIX=\".so\", as desired.

@rizsotto
Copy link
Owner

rizsotto commented Jan 8, 2015

Thanks Stephen for the report! I checked the branch master has this bug, but on the branch devel this is fixed. Could you confirm it?

@stepthom
Copy link
Author

stepthom commented Jan 9, 2015

@rizsotto That worked perfectly! The DLSUFFIX flag is now correctly escaped as DDLSUFFIX=\\\".so\\\" Thanks for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants