Bug 496613 - swig produces code that breaks compilation with -Wall -Werror
Summary: swig produces code that breaks compilation with -Wall -Werror
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: swig
Version: 10
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Adam Tkac
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-04-20 11:15 UTC by Michal Hlavinka
Modified: 2013-04-30 23:42 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-05-12 11:13:37 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Michal Hlavinka 2009-04-20 11:15:27 UTC
Description of problem:
Swig produces code that breaks compilation with -Wall -Werror


> ./libecryptfs_wrap.c: In function '_wrap_ecryptfs_passphrase_blob':
> ./libecryptfs_wrap.c:2619: error: pointer targets in passing argument 1 of 'PyString_FromStringAndSize' differ in signedness
> ./libecryptfs_wrap.c: In function '_wrap_ecryptfs_passphrase_sig_from_blob':
> ./libecryptfs_wrap.c:2648: error: pointer targets in passing argument 1 of > 'PyString_FromStringAndSize' differ in signedness


Version-Release number of selected component (if applicable):
swig-1.3.35

How reproducible:
allways

Steps to Reproduce:
1. download and install recent ecryptfs-utils srpm
2. prepare build (rpmbuild -bp <path_to_spec> )
3. remove src/libecryptfs-swig/libecryptfs_wrap.c
4. build it
  
Actual results:
build fails

Expected results:
build completes

Additional info:
This was working with swig-1.3.31 (and with 1.3.33 probably)

Comment 1 Adam Tkac 2009-05-12 11:13:37 UTC
Problem is in your code:

src/include/ecryptfs.h:
...
typedef struct binary_data {
        int size;
        unsigned char *data;
} binary_data;
...
-------------
src/libecryptfs-swig/libecryptfs.i:
...
%typemap(out) binary_data {
    $result = PyString_FromStringAndSize($1.data,$1.size);
}
...
-------------
/usr/include/python2.6/stringobject.h:
...
PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t);
...
-------------

As you can see function PyString_FromStringAndSize() takes "const char *" argument bug you are passing unsigned char*. You should modify binary_data structure to contain signed char instead of unsigned or you could modify PyString_FromStringAndSize call in libecryptfs.i:

$result = PyString_FromStringAndSize((char *)($1.data),$1.size);

Not sure which solution is better from ecryptfs-utils perspective. Closing.


Note You need to log in before you can comment on or make changes to this bug.