iustin / pyxattr

A python module for accessing filesystem Extended Attributes
https://pyxattr.k1024.org/
GNU Lesser General Public License v2.1
30 stars 15 forks source link

Fails to build due to compiler warning #8

Closed ahknight closed 8 years ago

ahknight commented 8 years ago

Looks like warnings-as-errors strikes again. That flag is generally evil for source deployments for reasons like this, IMO (in development, whatever floats yer boat though).

    gcc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -D_XATTR_VERSION="0.5.5" -D_XATTR_AUTHOR="Iustin Pop" -D_XATTR_EMAIL="iustin@k1024.org" -I/home/ahknight/.pyenv/versions/3.5.1/include/python3.5m -c xattr.c -o build/temp.linux-x86_64-3.5/xattr.o -Wall -Werror
    xattr.c: In function ‘merge_ns’:
    xattr.c:183:16: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
             if(cnt > new_size || cnt < 0) {
                    ^
    cc1: all warnings being treated as errors
    error: command 'gcc' failed with exit status 1
$ python --version
Python 3.5.1
$ gcc --version                                                                  1
gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010

(Does the same in clang 3.6.2 FWIW.)

ahknight commented 8 years ago

A simple cast of cnt to unsigned does the trick, BTW.

iustin commented 8 years ago

I'm sorry to disagree about the evilness of that flag - without it, I wouldn't have heard about the problem until much later, as this library is not under active development. So it might create trouble for you, but for me it's quite helpful (well, assuming people submit bug reports, of course). Thanks for bringing it to my attention!

(And yes, there have been issues before with bugs due to sign comparison)

iustin commented 8 years ago

Actually, I'm wrong - I fixed this a while ago (8d76924) but I haven't released a new version. Thanks for the reminder, will do so tomorrow.

iustin commented 8 years ago

I've just pushed version 0.5.6, which should fix this issue. Thanks for the reminder and let me know if you have further issues.