[GH-ISSUE #1157] Build error by cppcheck 1.89 #604

Closed
opened 2026-03-04 01:47:08 +03:00 by kerem · 1 comment
Owner

Originally created by @ggtakec on GitHub (Sep 23, 2019).
Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/1157

Version of s3fs being used (s3fs --version)

master branch for OSX

Version of fuse being used (pkg-config --modversion fuse, rpm -qi fuse, dpkg -s fuse)

n/a

Kernel information (uname -r)

n/a

GNU/Linux Distribution, if applicable (cat /etc/os-release)

OSX

s3fs command line used, if applicable

make cppcheck is failed in build-step.

/etc/fstab entry, if applicable

n/a

s3fs syslog messages (grep s3fs /var/log/syslog, journalctl | grep s3fs, or s3fs outputs)

run make cppcheck, we got following error on OSX.

<error id="invalidContainer" severity="error" msg="Using iterator to local container &apos;addheadlist&apos; that may be invalid." verbose="Using iterator to local container &apos;addheadlist&apos; that may be invalid." cwe="664">
    <location file="src/addhead.cpp" line="172" column="26"/>
    <location file0="src/addhead.cpp" file="src/addhead.h" line="43" column="29" info="Variable created here."/>
    <location file="src/addhead.cpp" line="171" column="93" info="After calling &apos;erase&apos;, iterators or references to the container&apos;s data may be invalid ."/>
    <location file="src/addhead.cpp" line="171" column="38" info="Iterator to container is created here."/>
</error>
<error id="constParameter" severity="style" msg="Parameter &apos;ts1&apos; can be declared with const" verbose="Parameter &apos;ts1&apos; can be declared with const" cwe="398">
    <location file="src/cache.cpp" line="90" column="50"/>
</error>
<error id="constParameter" severity="style" msg="Parameter &apos;ts2&apos; can be declared with const" verbose="Parameter &apos;ts2&apos; can be declared with const" cwe="398">
    <location file="src/cache.cpp" line="90" column="72"/>
</error>
<error id="constParameter" severity="style" msg="Parameter &apos;key&apos; can be declared with const" verbose="Parameter &apos;key&apos; can be declared with const" cwe="398">
    <location file="src/cache.cpp" line="307" column="41"/>
</error>
<error id="constParameter" severity="style" msg="Parameter &apos;upload_id&apos; can be declared with const" verbose="Parameter &apos;upload_id&apos; can be declared with const" cwe="398">
    <location file="src/curl.cpp" line="3453" column="71"/>
</error>
<error id="constParameter" severity="style" msg="Parameter &apos;upload_id&apos; can be declared with const" verbose="Parameter &apos;upload_id&apos; can be declared with const" cwe="398">
    <location file="src/curl.cpp" line="3567" column="63"/>
</error>
<error id="constParameter" severity="style" msg="Parameter &apos;upload_id&apos; can be declared with const" verbose="Parameter &apos;upload_id&apos; can be declared with const" cwe="398">
    <location file="src/curl.cpp" line="3702" column="94"/>
</error>
<error id="knownConditionTrueFalse" severity="style" msg="Condition &apos;result&apos; is always false" verbose="Condition &apos;result&apos; is always false" cwe="570">
    <location file="src/s3fs.cpp" line="2753" column="12" info="Condition &apos;result&apos; is always false"/>
    <location file="src/s3fs.cpp" line="2750" column="17" info="Assignment &apos;result=false&apos;, assigned value is 0"/>
</error>
<error id="knownConditionTrueFalse" severity="style" msg="Condition &apos;result&apos; is always false" verbose="Condition &apos;result&apos; is always false" cwe="570">
    <location file="src/s3fs.cpp" line="2880" column="12" info="Condition &apos;result&apos; is always false"/>
    <location file="src/s3fs.cpp" line="2876" column="17" info="Assignment &apos;result=false&apos;, assigned value is 0"/>
</error>
<error id="constParameter" severity="style" msg="Parameter &apos;head&apos; can be declared with const" verbose="Parameter &apos;head&apos; can be declared with const" cwe="398">
    <location file="src/s3fs.cpp" line="2443" column="60"/>
</error>
<error id="knownConditionTrueFalse" severity="style" msg="Condition &apos;result&apos; is always false" verbose="Condition &apos;result&apos; is always false" cwe="570">
    <location file="src/s3fs_util.cpp" line="997" column="12" info="Condition &apos;result&apos; is always false"/>
    <location file="src/s3fs_util.cpp" line="994" column="17" info="Assignment &apos;result=false&apos;, assigned value is 0"/>
</error>
<error id="knownConditionTrueFalse" severity="style" msg="Condition &apos;result&apos; is always false" verbose="Condition &apos;result&apos; is always false" cwe="570">
    <location file="src/s3fs_util.cpp" line="1003" column="12" info="Condition &apos;result&apos; is always false"/>
    <location file="src/s3fs_util.cpp" line="994" column="17" info="Assignment &apos;result=false&apos;, assigned value is 0"/>
</error>
<error id="knownConditionTrueFalse" severity="style" msg="Condition &apos;result&apos; is always false" verbose="Condition &apos;result&apos; is always false" cwe="570">
    <location file="src/s3fs_util.cpp" line="1008" column="12" info="Condition &apos;result&apos; is always false"/>
    <location file="src/s3fs_util.cpp" line="994" column="17" info="Assignment &apos;result=false&apos;, assigned value is 0"/>
</error>

Details about issue

I will make a patch as soon as possible.

Originally created by @ggtakec on GitHub (Sep 23, 2019). Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/1157 #### Version of s3fs being used (s3fs --version) master branch for OSX #### Version of fuse being used (pkg-config --modversion fuse, rpm -qi fuse, dpkg -s fuse) n/a #### Kernel information (uname -r) n/a #### GNU/Linux Distribution, if applicable (cat /etc/os-release) OSX #### s3fs command line used, if applicable `make cppcheck` is failed in build-step. #### /etc/fstab entry, if applicable n/a #### s3fs syslog messages (grep s3fs /var/log/syslog, journalctl | grep s3fs, or s3fs outputs) run make cppcheck, we got following error on OSX. ``` <error id="invalidContainer" severity="error" msg="Using iterator to local container &apos;addheadlist&apos; that may be invalid." verbose="Using iterator to local container &apos;addheadlist&apos; that may be invalid." cwe="664"> <location file="src/addhead.cpp" line="172" column="26"/> <location file0="src/addhead.cpp" file="src/addhead.h" line="43" column="29" info="Variable created here."/> <location file="src/addhead.cpp" line="171" column="93" info="After calling &apos;erase&apos;, iterators or references to the container&apos;s data may be invalid ."/> <location file="src/addhead.cpp" line="171" column="38" info="Iterator to container is created here."/> </error> <error id="constParameter" severity="style" msg="Parameter &apos;ts1&apos; can be declared with const" verbose="Parameter &apos;ts1&apos; can be declared with const" cwe="398"> <location file="src/cache.cpp" line="90" column="50"/> </error> <error id="constParameter" severity="style" msg="Parameter &apos;ts2&apos; can be declared with const" verbose="Parameter &apos;ts2&apos; can be declared with const" cwe="398"> <location file="src/cache.cpp" line="90" column="72"/> </error> <error id="constParameter" severity="style" msg="Parameter &apos;key&apos; can be declared with const" verbose="Parameter &apos;key&apos; can be declared with const" cwe="398"> <location file="src/cache.cpp" line="307" column="41"/> </error> <error id="constParameter" severity="style" msg="Parameter &apos;upload_id&apos; can be declared with const" verbose="Parameter &apos;upload_id&apos; can be declared with const" cwe="398"> <location file="src/curl.cpp" line="3453" column="71"/> </error> <error id="constParameter" severity="style" msg="Parameter &apos;upload_id&apos; can be declared with const" verbose="Parameter &apos;upload_id&apos; can be declared with const" cwe="398"> <location file="src/curl.cpp" line="3567" column="63"/> </error> <error id="constParameter" severity="style" msg="Parameter &apos;upload_id&apos; can be declared with const" verbose="Parameter &apos;upload_id&apos; can be declared with const" cwe="398"> <location file="src/curl.cpp" line="3702" column="94"/> </error> <error id="knownConditionTrueFalse" severity="style" msg="Condition &apos;result&apos; is always false" verbose="Condition &apos;result&apos; is always false" cwe="570"> <location file="src/s3fs.cpp" line="2753" column="12" info="Condition &apos;result&apos; is always false"/> <location file="src/s3fs.cpp" line="2750" column="17" info="Assignment &apos;result=false&apos;, assigned value is 0"/> </error> <error id="knownConditionTrueFalse" severity="style" msg="Condition &apos;result&apos; is always false" verbose="Condition &apos;result&apos; is always false" cwe="570"> <location file="src/s3fs.cpp" line="2880" column="12" info="Condition &apos;result&apos; is always false"/> <location file="src/s3fs.cpp" line="2876" column="17" info="Assignment &apos;result=false&apos;, assigned value is 0"/> </error> <error id="constParameter" severity="style" msg="Parameter &apos;head&apos; can be declared with const" verbose="Parameter &apos;head&apos; can be declared with const" cwe="398"> <location file="src/s3fs.cpp" line="2443" column="60"/> </error> <error id="knownConditionTrueFalse" severity="style" msg="Condition &apos;result&apos; is always false" verbose="Condition &apos;result&apos; is always false" cwe="570"> <location file="src/s3fs_util.cpp" line="997" column="12" info="Condition &apos;result&apos; is always false"/> <location file="src/s3fs_util.cpp" line="994" column="17" info="Assignment &apos;result=false&apos;, assigned value is 0"/> </error> <error id="knownConditionTrueFalse" severity="style" msg="Condition &apos;result&apos; is always false" verbose="Condition &apos;result&apos; is always false" cwe="570"> <location file="src/s3fs_util.cpp" line="1003" column="12" info="Condition &apos;result&apos; is always false"/> <location file="src/s3fs_util.cpp" line="994" column="17" info="Assignment &apos;result=false&apos;, assigned value is 0"/> </error> <error id="knownConditionTrueFalse" severity="style" msg="Condition &apos;result&apos; is always false" verbose="Condition &apos;result&apos; is always false" cwe="570"> <location file="src/s3fs_util.cpp" line="1008" column="12" info="Condition &apos;result&apos; is always false"/> <location file="src/s3fs_util.cpp" line="994" column="17" info="Assignment &apos;result=false&apos;, assigned value is 0"/> </error> ``` ### Details about issue I will make a patch as soon as possible.
kerem 2026-03-04 01:47:08 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@ggtakec commented on GitHub (Sep 23, 2019):

#1154 PR is as same as #1158, and #1158 was merged by my mistake.

<!-- gh-comment-id:534072101 --> @ggtakec commented on GitHub (Sep 23, 2019): #1154 PR is as same as #1158, and #1158 was merged by my mistake.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#604
No description provided.