Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

managesieve.xs requires assert.h from both Cyrus and libc #4796

Open
dilyanpalauzov opened this issue Jan 19, 2024 · 1 comment
Open

managesieve.xs requires assert.h from both Cyrus and libc #4796

dilyanpalauzov opened this issue Jan 19, 2024 · 1 comment
Assignees

Comments

@dilyanpalauzov
Copy link
Contributor

I have updated from perl 5.22.1 to 5.38.1 and took over the changes from 4ba9878 at the same time.

The file perl/sieve/managesieve/managesieve/managesieve.xs contains

#include "perl.h"
#include "xmalloc.h"

the last line implies #include "assert.h" and means the assert.h file included in Cyrus IMAP. perl.h is /usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/perl.h , it also contains #include <assert.h> and insists to get assert.h from libc. The error below could be replaced by "macro-redefinition error" by tweaking here and there, but the software wants to have two different macro definitions of a macro with the same name.

Changing xzfree() not to depened on assert() does not help, as cyrus/assert.h is still loaded before /usr/include/assert.h and this is a problem for perl.h.

Possible resolution: rename Cyrus’ assert() and assert.h to cyassert() and cyassert.h or alike.

Skip blib/lib/Cyrus/SIEVE/managesieve.pm (unchanged)
Running Mkbootstrap for managesieve ()
chmod 644 "managesieve.bs"
"/usr/local/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- managesieve.bs blib/arch/auto/Cyrus/SIEVE/managesieve/managesieve.bs 644
"/usr/local/bin/perl" "/usr/local/lib/perl5/5.38.2/ExtUtils/xsubpp"  -typemap '/usr/local/lib/perl5/5.38.2/ExtUtils/typemap'  ../../../../perl/sieve/managesieve/managesieve.xs > managesieve.xsc && mv managesieve.xsc managesieve.c
cc -c  -I../../../../lib -I../../../../perl/sieve -I../../../../perl/sieve/lib  -I/usr/local/include -D_REENTRANT -D_GNU_SOURCE -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O2   -DVERSION=\"0.01\" -DXS_VERSION=\"0.01\" -fPIC "-I/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE"  -DPERL_POLLUTE managesieve.c
In file included from /usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/perl.h:4219,
                 from ../../../../perl/sieve/managesieve/managesieve.xs:46:
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/inline.h: In function ‘Perl_av_new_alloc’:
../../../../lib/assert.h:47:25: error: expected expression before ‘{’ token
   47 | #define assert(ex)      {if (!(ex))assertionfailed(__FILE__, __LINE__, #ex);}
      |                         ^
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/handy.h:2875:28: note: in expansion of macro ‘assert’
 2875 | #define perl_assert_ptr(p) assert( ((void*)(p)) != 0 )
      |                            ^~~~~~
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/handy.h:2880:47: note: in expansion of macro ‘perl_assert_ptr’
 2880 | #define Zero(d,n,t)     (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), (void)memzero((char*)(d), (n) * sizeof(t)))
      |                                               ^~~~~~~~~~~~~~~
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/inline.h:213:9: note: in expansion of macro ‘Zero’
  213 |         Zero(ary, size, SV*);
      |         ^~~~
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/inline.h: In function ‘Perl_savepvn’:
../../../../lib/assert.h:47:25: error: expected expression before ‘{’ token
   47 | #define assert(ex)      {if (!(ex))assertionfailed(__FILE__, __LINE__, #ex);}
      |                         ^
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/handy.h:2875:28: note: in expansion of macro ‘assert’
 2875 | #define perl_assert_ptr(p) assert( ((void*)(p)) != 0 )
      |                            ^~~~~~
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/handy.h:2884:47: note: in expansion of macro ‘perl_assert_ptr’
 2884 | #define CopyD(s,d,n,t)  (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), perl_assert_ptr(s), memcpy((char*)(d),(const char*)(s), (n) * sizeof(t)))
      |                                               ^~~~~~~~~~~~~~~
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/inline.h:3593:25: note: in expansion of macro ‘CopyD’
 3593 |         return (char *) CopyD(pv,newaddr,len,char);
      |                         ^~~~~
../../../../lib/assert.h:47:25: error: expected expression before ‘{’ token
   47 | #define assert(ex)      {if (!(ex))assertionfailed(__FILE__, __LINE__, #ex);}
      |                         ^
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/handy.h:2875:28: note: in expansion of macro ‘assert’
 2875 | #define perl_assert_ptr(p) assert( ((void*)(p)) != 0 )
      |                            ^~~~~~
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/handy.h:2885:47: note: in expansion of macro ‘perl_assert_ptr’
 2885 | #define ZeroD(d,n,t)    (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), memzero((char*)(d), (n) * sizeof(t)))
      |                                               ^~~~~~~~~~~~~~~
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/inline.h:3596:25: note: in expansion of macro ‘ZeroD’
 3596 |         return (char *) ZeroD(newaddr,len+1,char);
      |                         ^~~~~
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/inline.h: In function ‘Perl_savesvpv’:
../../../../lib/assert.h:47:25: error: expected expression before ‘{’ token
   47 | #define assert(ex)      {if (!(ex))assertionfailed(__FILE__, __LINE__, #ex);}
      |                         ^
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/handy.h:2875:28: note: in expansion of macro ‘assert’
 2875 | #define perl_assert_ptr(p) assert( ((void*)(p)) != 0 )
      |                            ^~~~~~
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/handy.h:2884:47: note: in expansion of macro ‘perl_assert_ptr’
 2884 | #define CopyD(s,d,n,t)  (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), perl_assert_ptr(s), memcpy((char*)(d),(const char*)(s), (n) * sizeof(t)))
      |                                               ^~~~~~~~~~~~~~~
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/inline.h:3624:21: note: in expansion of macro ‘CopyD’
 3624 |     return (char *) CopyD(pv,newaddr,len,char);
      |                     ^~~~~
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/sv_inline.h: In function ‘Perl_newSV_type’:
../../../../lib/assert.h:47:25: error: expected expression before ‘{’ token
   47 | #define assert(ex)      {if (!(ex))assertionfailed(__FILE__, __LINE__, #ex);}
      |                         ^
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/handy.h:2875:28: note: in expansion of macro ‘assert’
 2875 | #define perl_assert_ptr(p) assert( ((void*)(p)) != 0 )
      |                            ^~~~~~
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/handy.h:2880:47: note: in expansion of macro ‘perl_assert_ptr’
 2880 | #define Zero(d,n,t)     (MEM_WRAP_CHECK_(n,t) perl_assert_ptr(d), (void)memzero((char*)(d), (n) * sizeof(t)))
      |                                               ^~~~~~~~~~~~~~~
/usr/local/lib/perl5/5.38.2/x86_64-linux-thread-multi-ld/CORE/sv_inline.h:485:13: note: in expansion of macro ‘Zero’
  485 |             Zero(new_body, type_details->body_size, char);
      |             ^~~~
make: *** [Makefile:346: managesieve.o] Error 1
rm managesieve.c
@elliefm
Copy link
Contributor

elliefm commented Jan 21, 2024

There might be a workaround for this sort of thing in one of the other xs files, I think it's come up before, but I don't remember where.

That said, the assert name clash is always a nuisance. I'm in favour of just renaming it.

@elliefm elliefm self-assigned this Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants