[SSSD] Re: [PATCHES] Fix warnings Wsign-compare
On (29/01/16 09:33), Lukas Slebodnik wrote: >On (28/01/16 21:54), Jakub Hrozek wrote: >>On Tue, Jan 12, 2016 at 03:21:30PM +0100, Lukas Slebodnik wrote: >>> python-3.5 is also in debian-sid and migh be in debian-testing >>> within 10 days. First 3 patches can be reviwed and meanwhile >>> I will need to figure out solution for 4th patch (but it's only problem for >>> 32 bit platforms) >>> >>> The first 3 patches are attached. >> >>Garbage-collecting patches untouched for a week or more.. >> >>ACK >> >>I tested with a local i386 build and put the patches to CI: >>http://sssd-ci.duckdns.org/logs/job/36/85/summary.html >> >>The code also looks good to me, the pyhbac change is not public API, so >>it's OK to change the type. > >master: >* f47a339d7794cd5a24d368b3b3640452686e45a5 >* 2ff8131cf02decaf0dd0754e843732fe7774fc59 >* d3f14ed93ef61268d0a68898ed9c44b4f773081c > Backported to sssd-1-13 due to PR#51 * 085746864de710adfa506c342434722ad69c3d85 * 9341809d4428cd187aefdb2871afffb327447002 * 0257239c8504435961dc428f719d4d655ba4688d LS ___ sssd-devel mailing list -- sssd-devel@lists.fedorahosted.org To unsubscribe send an email to sssd-devel-le...@lists.fedorahosted.org
[SSSD] Re: [PATCHES] Fix warnings Wsign-compare
On (28/01/16 21:54), Jakub Hrozek wrote: >On Tue, Jan 12, 2016 at 03:21:30PM +0100, Lukas Slebodnik wrote: >> python-3.5 is also in debian-sid and migh be in debian-testing >> within 10 days. First 3 patches can be reviwed and meanwhile >> I will need to figure out solution for 4th patch (but it's only problem for >> 32 bit platforms) >> >> The first 3 patches are attached. > >Garbage-collecting patches untouched for a week or more.. > >ACK > >I tested with a local i386 build and put the patches to CI: >http://sssd-ci.duckdns.org/logs/job/36/85/summary.html > >The code also looks good to me, the pyhbac change is not public API, so >it's OK to change the type. master: * f47a339d7794cd5a24d368b3b3640452686e45a5 * 2ff8131cf02decaf0dd0754e843732fe7774fc59 * d3f14ed93ef61268d0a68898ed9c44b4f773081c LS ___ sssd-devel mailing list sssd-devel@lists.fedorahosted.org https://lists.fedorahosted.org/admin/lists/sssd-devel@lists.fedorahosted.org
[SSSD] Re: [PATCHES] Fix warnings Wsign-compare
On Tue, Jan 12, 2016 at 03:21:30PM +0100, Lukas Slebodnik wrote: > python-3.5 is also in debian-sid and migh be in debian-testing > within 10 days. First 3 patches can be reviwed and meanwhile > I will need to figure out solution for 4th patch (but it's only problem for > 32 bit platforms) > > The first 3 patches are attached. Garbage-collecting patches untouched for a week or more.. ACK I tested with a local i386 build and put the patches to CI: http://sssd-ci.duckdns.org/logs/job/36/85/summary.html The code also looks good to me, the pyhbac change is not public API, so it's OK to change the type. ___ sssd-devel mailing list sssd-devel@lists.fedorahosted.org https://lists.fedorahosted.org/admin/lists/sssd-devel@lists.fedorahosted.org
[SSSD] Re: [PATCHES] Fix warnings Wsign-compare
On (24/11/15 14:28), Lukas Slebodnik wrote: >On (23/11/15 15:29), Lukas Slebodnik wrote: >>On (20/11/15 10:17), Lukas Slebodnik wrote: >>>ehlo, >>> >>>I found few warnings on rawhide when I build sssd-1.13.2 >>>https://kojipkgs.fedoraproject.org//work/tasks/8618/11918618/build.log >>> >>>LS >> >>I missed one warning in pysss_nss_idmap.cwhich was not visible >>on 64 bit architecture. >> >>@see 32 bit build log >>https://kojipkgs.fedoraproject.org//packages/sssd/1.13.2/1.fc24/data/logs/i686/build.log >> >>BTW warning are caused by newly added warnings in python3.5 cflags >> >>PYTHON3_CFLAGS='-I/usr/include/python3.5m -I/usr/include/python3.5m >>-Wno-unused-result -Wsign-compare -Wunreachable-code -O2 -g -pipe -Wall >>-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions >>-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches >>-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom >>-fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv >>-DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall >>-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions >>-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches >>-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom >>-fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv' >> >> >>python3.5 is only on rawhide. >> >>Updated patches are attached. >> >>LS > >>From c3e22efaacac525476ade16fd7d81bdfe7115e5c Mon Sep 17 00:00:00 2001 >>From: Lukas Slebodnik >>Date: Thu, 19 Nov 2015 13:07:10 + >>Subject: [PATCH 1/3] TOOLS: Fix warning Wsign-compare >>MIME-Version: 1.0 >>Content-Type: text/plain; charset=UTF-8 >>Content-Transfer-Encoding: 8bit >> >>src/tools/tools_util.c: In function ‘parse_groups’: >>src/tools/tools_util.c:116:19: error: comparison between >>signed and unsigned integer expressions [-Werror=sign-compare] >> for (i = 0; i < tokens; i++) { >> ^ >>--- >> src/tools/tools_util.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >>diff --git a/src/tools/tools_util.c b/src/tools/tools_util.c >>index >>f9dca728751f0429bb2f1c3ef46ffc269ecfba40..f475a51ef380f5d0397deb22d161fd2c8d2a81b8 >> 100644 >>--- a/src/tools/tools_util.c >>+++ b/src/tools/tools_util.c >>@@ -94,7 +94,7 @@ int parse_groups(TALLOC_CTX *mem_ctx, const char *optstr, >>char ***_out) >> char *orig, *n, *o; >> char delim = ','; >> unsigned int tokens = 1; >>-int i; >>+unsigned int i; >> >> orig = talloc_strdup(mem_ctx, optstr); >> if (!orig) return ENOMEM; >>-- >>2.5.0 >> > >>From b79f1fe6f6ffec7b9a7c9f045c12bc6c894faa78 Mon Sep 17 00:00:00 2001 >>From: Lukas Slebodnik >>Date: Thu, 19 Nov 2015 13:07:52 + >>Subject: [PATCH 2/3] pysss_murmur: Fix warning Wsign-compare >>MIME-Version: 1.0 >>Content-Type: text/plain; charset=UTF-8 >>Content-Transfer-Encoding: 8bit >> >>src/python/pysss_murmur.c: In function ‘py_murmurhash3’: >>src/python/pysss_murmur.c:47:17: error: comparison between >> signed and unsigned integer expressions [-Werror=sign-compare] >> key_len > strlen(key)) { >> ^ >> >>uint32_t murmurhash3(const char *key, int len, uint32_t seed) >>The second argument of the function murmurhash3 has type int. >>But the code expects to be unsigned integer. >> >>There is code in python wrapper py_murmurhash3 >>which check boundaries of that argument. >>It should be an unsigned "key_len > INT_MAX || key_len < 0". >>An exception should be thrown for negative number. >> >>Moreover, the length should be shorter then a length of input string. >>The strlen returns size_t which is unsigned and key_len is signed long. >>We already checked that value is unsigned so >>we can safely cast key_len to size_t >>--- >> src/python/pysss_murmur.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >>diff --git a/src/python/pysss_murmur.c b/src/python/pysss_murmur.c >>index >>97d752b2a7734a332a5d5da07d75b594638015c8..b14a672025c218ae3ab314c3ad2cf2c5ced40870 >> 100644 >>--- a/src/python/pysss_murmur.c >>+++ b/src/python/pysss_murmur.c >>@@ -44,7 +44,7 @@ static PyObject * py_murmurhash3(PyObject *module, PyObject >>*args) >> } >> >> if (seed > UINT32_MAX || key_len > INT_MAX || key_len < 0 || >>-key_len > strlen(key)) { >>+(size_t)key_len > strlen(key)) { >> PyErr_Format(PyExc_ValueError, "Invalid value\n"); >> return NULL; >> } >>-- >>2.5.0 >> > >>From 07d5ea89b83e0176f7e51bd8b0ae9881aadff3bf Mon Sep 17 00:00:00 2001 >>From: Lukas Slebodnik >>Date: Thu, 19 Nov 2015 14:17:36 + >>Subject: [PATCH 3/3] pyhbac: Fix warning Wsign-compare >>MIME-Version: 1.0 >>Content-Type: text/plain; charset=UTF-8 >>Content-Transfer-Encoding: 8bit >> >>src/python/pyhbac.c: In function ‘HbacRuleElement_repr’: >>src/python/pyhbac.c:506:59: error: comparison between >>signed and unsigned integer expressions [-Werror=sign-compare] >> if (strnames == NULL || strgroups == NULL || categ
[SSSD]Re: [PATCHES] Fix warnings Wsign-compare
On (23/11/15 15:29), Lukas Slebodnik wrote: >On (20/11/15 10:17), Lukas Slebodnik wrote: >>ehlo, >> >>I found few warnings on rawhide when I build sssd-1.13.2 >>https://kojipkgs.fedoraproject.org//work/tasks/8618/11918618/build.log >> >>LS > >I missed one warning in pysss_nss_idmap.cwhich was not visible >on 64 bit architecture. > >@see 32 bit build log >https://kojipkgs.fedoraproject.org//packages/sssd/1.13.2/1.fc24/data/logs/i686/build.log > >BTW warning are caused by newly added warnings in python3.5 cflags > >PYTHON3_CFLAGS='-I/usr/include/python3.5m -I/usr/include/python3.5m >-Wno-unused-result -Wsign-compare -Wunreachable-code -O2 -g -pipe -Wall >-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions >-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches >-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom >-fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv >-DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall >-Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions >-fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches >-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom >-fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv' > > >python3.5 is only on rawhide. > >Updated patches are attached. > >LS >From c3e22efaacac525476ade16fd7d81bdfe7115e5c Mon Sep 17 00:00:00 2001 >From: Lukas Slebodnik >Date: Thu, 19 Nov 2015 13:07:10 + >Subject: [PATCH 1/3] TOOLS: Fix warning Wsign-compare >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >src/tools/tools_util.c: In function ‘parse_groups’: >src/tools/tools_util.c:116:19: error: comparison between >signed and unsigned integer expressions [-Werror=sign-compare] > for (i = 0; i < tokens; i++) { > ^ >--- > src/tools/tools_util.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/src/tools/tools_util.c b/src/tools/tools_util.c >index >f9dca728751f0429bb2f1c3ef46ffc269ecfba40..f475a51ef380f5d0397deb22d161fd2c8d2a81b8 > 100644 >--- a/src/tools/tools_util.c >+++ b/src/tools/tools_util.c >@@ -94,7 +94,7 @@ int parse_groups(TALLOC_CTX *mem_ctx, const char *optstr, >char ***_out) > char *orig, *n, *o; > char delim = ','; > unsigned int tokens = 1; >-int i; >+unsigned int i; > > orig = talloc_strdup(mem_ctx, optstr); > if (!orig) return ENOMEM; >-- >2.5.0 > >From b79f1fe6f6ffec7b9a7c9f045c12bc6c894faa78 Mon Sep 17 00:00:00 2001 >From: Lukas Slebodnik >Date: Thu, 19 Nov 2015 13:07:52 + >Subject: [PATCH 2/3] pysss_murmur: Fix warning Wsign-compare >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >src/python/pysss_murmur.c: In function ‘py_murmurhash3’: >src/python/pysss_murmur.c:47:17: error: comparison between > signed and unsigned integer expressions [-Werror=sign-compare] > key_len > strlen(key)) { > ^ > >uint32_t murmurhash3(const char *key, int len, uint32_t seed) >The second argument of the function murmurhash3 has type int. >But the code expects to be unsigned integer. > >There is code in python wrapper py_murmurhash3 >which check boundaries of that argument. >It should be an unsigned "key_len > INT_MAX || key_len < 0". >An exception should be thrown for negative number. > >Moreover, the length should be shorter then a length of input string. >The strlen returns size_t which is unsigned and key_len is signed long. >We already checked that value is unsigned so >we can safely cast key_len to size_t >--- > src/python/pysss_murmur.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > >diff --git a/src/python/pysss_murmur.c b/src/python/pysss_murmur.c >index >97d752b2a7734a332a5d5da07d75b594638015c8..b14a672025c218ae3ab314c3ad2cf2c5ced40870 > 100644 >--- a/src/python/pysss_murmur.c >+++ b/src/python/pysss_murmur.c >@@ -44,7 +44,7 @@ static PyObject * py_murmurhash3(PyObject *module, PyObject >*args) > } > > if (seed > UINT32_MAX || key_len > INT_MAX || key_len < 0 || >-key_len > strlen(key)) { >+(size_t)key_len > strlen(key)) { > PyErr_Format(PyExc_ValueError, "Invalid value\n"); > return NULL; > } >-- >2.5.0 > >From 07d5ea89b83e0176f7e51bd8b0ae9881aadff3bf Mon Sep 17 00:00:00 2001 >From: Lukas Slebodnik >Date: Thu, 19 Nov 2015 14:17:36 + >Subject: [PATCH 3/3] pyhbac: Fix warning Wsign-compare >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >src/python/pyhbac.c: In function ‘HbacRuleElement_repr’: >src/python/pyhbac.c:506:59: error: comparison between >signed and unsigned integer expressions [-Werror=sign-compare] > if (strnames == NULL || strgroups == NULL || category == -1) { > ^ >src/python/pyhbac.c: In function ‘HbacRuleElement_to_native’: >src/python/pyhbac.c:614:51: error: compar
[SSSD]Re: [PATCHES] Fix warnings Wsign-compare
On (20/11/15 10:17), Lukas Slebodnik wrote: >ehlo, > >I found few warnings on rawhide when I build sssd-1.13.2 >https://kojipkgs.fedoraproject.org//work/tasks/8618/11918618/build.log > >LS I missed one warning in pysss_nss_idmap.cwhich was not visible on 64 bit architecture. @see 32 bit build log https://kojipkgs.fedoraproject.org//packages/sssd/1.13.2/1.fc24/data/logs/i686/build.log BTW warning are caused by newly added warnings in python3.5 cflags PYTHON3_CFLAGS='-I/usr/include/python3.5m -I/usr/include/python3.5m -Wno-unused-result -Wsign-compare -Wunreachable-code -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m32 -march=i686 -mtune=atom -fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fwrapv' python3.5 is only on rawhide. Updated patches are attached. LS >From c3e22efaacac525476ade16fd7d81bdfe7115e5c Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Thu, 19 Nov 2015 13:07:10 + Subject: [PATCH 1/3] TOOLS: Fix warning Wsign-compare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/tools/tools_util.c: In function ‘parse_groups’: src/tools/tools_util.c:116:19: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] for (i = 0; i < tokens; i++) { ^ --- src/tools/tools_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/tools_util.c b/src/tools/tools_util.c index f9dca728751f0429bb2f1c3ef46ffc269ecfba40..f475a51ef380f5d0397deb22d161fd2c8d2a81b8 100644 --- a/src/tools/tools_util.c +++ b/src/tools/tools_util.c @@ -94,7 +94,7 @@ int parse_groups(TALLOC_CTX *mem_ctx, const char *optstr, char ***_out) char *orig, *n, *o; char delim = ','; unsigned int tokens = 1; -int i; +unsigned int i; orig = talloc_strdup(mem_ctx, optstr); if (!orig) return ENOMEM; -- 2.5.0 >From b79f1fe6f6ffec7b9a7c9f045c12bc6c894faa78 Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Thu, 19 Nov 2015 13:07:52 + Subject: [PATCH 2/3] pysss_murmur: Fix warning Wsign-compare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/python/pysss_murmur.c: In function ‘py_murmurhash3’: src/python/pysss_murmur.c:47:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] key_len > strlen(key)) { ^ uint32_t murmurhash3(const char *key, int len, uint32_t seed) The second argument of the function murmurhash3 has type int. But the code expects to be unsigned integer. There is code in python wrapper py_murmurhash3 which check boundaries of that argument. It should be an unsigned "key_len > INT_MAX || key_len < 0". An exception should be thrown for negative number. Moreover, the length should be shorter then a length of input string. The strlen returns size_t which is unsigned and key_len is signed long. We already checked that value is unsigned so we can safely cast key_len to size_t --- src/python/pysss_murmur.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python/pysss_murmur.c b/src/python/pysss_murmur.c index 97d752b2a7734a332a5d5da07d75b594638015c8..b14a672025c218ae3ab314c3ad2cf2c5ced40870 100644 --- a/src/python/pysss_murmur.c +++ b/src/python/pysss_murmur.c @@ -44,7 +44,7 @@ static PyObject * py_murmurhash3(PyObject *module, PyObject *args) } if (seed > UINT32_MAX || key_len > INT_MAX || key_len < 0 || -key_len > strlen(key)) { +(size_t)key_len > strlen(key)) { PyErr_Format(PyExc_ValueError, "Invalid value\n"); return NULL; } -- 2.5.0 >From 07d5ea89b83e0176f7e51bd8b0ae9881aadff3bf Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Thu, 19 Nov 2015 14:17:36 + Subject: [PATCH 3/3] pyhbac: Fix warning Wsign-compare MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit src/python/pyhbac.c: In function ‘HbacRuleElement_repr’: src/python/pyhbac.c:506:59: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] if (strnames == NULL || strgroups == NULL || category == -1) { ^ src/python/pyhbac.c: In function ‘HbacRuleElement_to_native’: src/python/pyhbac.c:614:51: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] if (!el->names || !el->groups || el->category == -1) {