-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
fix address sanitize reported stack-use-after-scope #1721
Conversation
@@ -46,7 +46,7 @@ elseif(${BUILD_TYPE} STREQUAL MINSIZEREL) | |||
elseif(${BUILD_TYPE} STREQUAL RELWITHDEBINFO) | |||
set(LIB_BUILD_TYPE RELWITHDEBINFO) | |||
else() | |||
set(LIB_BUILD_TYPE RElEASE) | |||
set(LIB_BUILD_TYPE RELEASE) | |||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") | |||
endif() | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code patch you provided appears to be correcting a typo in setting the CMAKE_BUILD_TYPE and LIB_BUILD_TYPE variables. Here are my observations and suggestions:
-
Line 34: The
COMMAND uname -p OUTPUT_VARIABLE HOST_ARCH
might need to be enclosed in double quotes to ensure proper execution. -
Lines 35-37: The
string(TOLOWER ${HOST_ARCH} HOST_ARCH)
converts the value of${HOST_ARCH}
to lowercase. Make sure this is the desired behavior. -
Lines 40-42: The condition checks if
CMAKE_BUILD_TYPE
is empty (NOT CMAKE_BUILD_TYPE
). If it's empty, it setsCMAKE_BUILD_TYPE
to "RELEASE". This ensures thatCMAKE_BUILD_TYPE
is always set to a valid value. -
Lines 47-48: Similar to the previous point, these lines handle the case where
${BUILD_TYPE}
is not recognized. It will setLIB_BUILD_TYPE
to "RELEASE" and updateCMAKE_CXX_FLAGS_RELEASE
with the desired optimization flags.
Overall, the code patch seems to address potential issues and improve consistency by ensuring that the build types are consistently set to "RELEASE" when not explicitly defined. However, without a complete understanding of the context and the rest of the code, it is difficult to provide a comprehensive review. It would be helpful to provide more details about the purpose and context of this code for a more accurate assessment.
pika/src/storage/src/redis_hashes.cc Lines 320 to 375 in 3e745f3
这段代码里,各种 if、else 判断,在 if、else 块里,有如 328、345、350、361 行的临时 而 batch 最终执行写操作是在 if、else 块外,已经出了各个 这个问题,只要把 这个改动可以修复 但是,
|
这个文章,把 我找时间再修修。 |
pika/src/storage/tests/lists_filter_test.cc Lines 67 to 81 in 3e745f3
|
sanitizer 找的问题还挺准,建议全局都用 sanitizer 验一下。@AlexStocks |
你好,我最近在CI上加了Macos环境的测试,其中CTest测试是跑不过的,如你的这个提交,如果你最后在本机检测完毕没问题了可以在pika.yml帮我把这个注释取消掉吗,这样可以帮你检测Macos环境下这个PR能否通过 这个是PR的地址:PR |
Hi @Mixficsol , 这个 issue 最初提到的几个问题,我都修了。然后我本地是可以跑过 test 的。 不过这个 pr 的 ci 我才看到, |
Signed-off-by: lizhen6 <[email protected]>
@@ -46,7 +46,7 @@ elseif(${BUILD_TYPE} STREQUAL MINSIZEREL) | |||
elseif(${BUILD_TYPE} STREQUAL RELWITHDEBINFO) | |||
set(LIB_BUILD_TYPE RELWITHDEBINFO) | |||
else() | |||
set(LIB_BUILD_TYPE RElEASE) | |||
set(LIB_BUILD_TYPE RELEASE) | |||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") | |||
endif() | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the provided code patch, there are a few changes made to the CMakeLists.txt file. Here's a brief code review:
-
Line 34: The code uses the
execute_process
function to execute theuname -p
command and stores the output in the variableHOST_ARCH
. -
Line 35: It converts the value of
HOST_ARCH
to lowercase usingstring(TOLOWER)
. -
Lines 37-40: This block handles the case when the
CMAKE_BUILD_TYPE
variable is not set. It sets theCMAKE_BUILD_TYPE
to "RELEASE" if it is not already specified. -
Line 43: It converts the value of
CMAKE_BUILD_TYPE
to uppercase usingstring(TOUPPER)
and stores it in the variableBUILD_TYPE
. -
Lines 46-49: These conditions check the value of
BUILD_TYPE
and set theLIB_BUILD_TYPE
accordingly. If it is neither "DEBUG" nor "RELEASE," it sets it to "RELEASE" and also sets theCMAKE_CXX_FLAGS_RELEASE
to "-O2 -DNDEBUG".
Overall, the code changes seem to fix spelling errors related to the RELEASE
build type. The code review does not indicate any bug risks. However, since this is a partial code segment, it is difficult to comment on the broader context and functionality.
我跟之前的 pr 一行没改,只是把 2 个 commit 给 rebase 成 1 个 commit,重新 push 了一下,触发重新 build。 |
Hi @tedli, |
我看 build log 是没找到 c compiler,都没开始构建,就退了。应该跟这个 pr 代码改动无关。 |
working-directory: ${{github.workspace}}/build | ||
run: | | ||
export CC=/usr/local/opt/gcc@10/bin/gcc-10 | ||
ctest -C ${{env.BUILD_TYPE}} | ||
|
||
- name: Unit Test | ||
working-directory: ${{github.workspace}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the code patch you provided, here's a brief code review:
- The code changes seem to modify a CI/CD configuration file.
- In the
jobs
section, there is a change related to theTest
step. Previously, it was commented out, but now it has been uncommented and its content modified. - The modified
Test
step sets theworking-directory
to$github.workspace/build
and runs the following commands in that directory:- Sets the environment variable
CC
to/usr/local/opt/gcc@10/bin/gcc-10
. - Executes
ctest -C ${env.BUILD_TYPE}
.
- Sets the environment variable
Review suggestions:
- As the changes primarily focus on un-commenting and modifying the
Test
step, it appears there are no obvious bug risks based on the given context. - To further enhance the code, you could consider adding error handling and outputs for better visibility into the test results, for example, by including options like
--output-on-failure
or capturing the test output logs. - It might be beneficial to provide more details or context about the purpose of these changes or any specific issues you encountered while testing this configuration.
Please note that without additional details or the complete context, it may not be possible to identify potential issues or improvements accurately.
…on#1721) * fix address sanitize Signed-off-by: lizhen6 <[email protected]> * run unit test in build_macos ci task Signed-off-by: lizhen6 <[email protected]> --------- Signed-off-by: lizhen6 <[email protected]>
…on#1721) * fix address sanitize Signed-off-by: lizhen6 <[email protected]> * run unit test in build_macos ci task Signed-off-by: lizhen6 <[email protected]> --------- Signed-off-by: lizhen6 <[email protected]>
fix #1711