Bug 496613 - swig produces code that breaks compilation with -Wall -Werror
swig produces code that breaks compilation with -Wall -Werror
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: swig (Show other bugs)
10
All Linux
medium Severity low
: ---
: ---
Assigned To: Adam Tkac
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-04-20 07:15 EDT by Michal Hlavinka
Modified: 2013-04-30 19:42 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-05-12 07:13:37 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Michal Hlavinka 2009-04-20 07:15:27 EDT
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 07:13:37 EDT
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.