Package: swig
Version: 1.3.36-1
Severity: normal
Tags: unreproducible

This is a bug which makes libbuffy-perl unusable, but it seems to be
swig's fault. It *could* also be a hardware or local problem as we
fail to reproduce. However, I wanted to make sure there's a record
of it.

When trying to use libbuffy-perl 0.8 (with buffycli), I get:

  Bareword found where operator expected at /usr/lib/perl5/Buffy.pm line 636, 
near "*
    Check the"
    (Missing operator before the?)
  Semicolon seems to be missing at /usr/lib/perl5/Buffy.pm line 637.
  Operator or semicolon missing before *ty at /usr/lib/perl5/Buffy.pm line 639.
  Ambiguous use of * resolved as operator * at /usr/lib/perl5/Buffy.pm line 639.
  Operator or semicolon missing before *from at /usr/lib/perl5/Buffy.pm line 
645.
  Ambiguous use of * resolved as operator * at /usr/lib/perl5/Buffy.pm line 645.
  Operator or semicolon missing before *into at /usr/lib/perl5/Buffy.pm line 
645.
  Ambiguous use of * resolved as operator * at /usr/lib/perl5/Buffy.pm line 645.
  Operator or semicolon missing before *ty at /usr/lib/perl5/Buffy.pm line 653.
  Ambiguous use of * resolved as operator * at /usr/lib/perl5/Buffy.pm line 653.
  Operator or semicolon missing before *ptr at /usr/lib/perl5/Buffy.pm line 653.
  Ambiguous use of * resolved as operator * at /usr/lib/perl5/Buffy.pm line 653.
  Operator or semicolon missing before *ty at /usr/lib/perl5/Buffy.pm line 661.
  Ambiguous use of * resolved as operator * at /usr/lib/perl5/Buffy.pm line 661.
  Operator or semicolon missing before *ptr at /usr/lib/perl5/Buffy.pm line 661.
  Ambiguous use of * resolved as operator * at /usr/lib/perl5/Buffy.pm line 661.
  Operator or semicolon missing before *lastty at /usr/lib/perl5/Buffy.pm line 
662.
  Ambiguous use of * resolved as operator * at /usr/lib/perl5/Buffy.pm line 662.
  Bareword found where operator expected at /usr/lib/perl5/Buffy.pm line 666, 
near ") lastty"
    (Missing operator before lastty?)
  Unmatched ) in regex; marked by <-- HERE in m/ type->str; *s; s++) <-- HERE 
        if (*s / at /usr/lib/perl5/Buffy.pm line 694.
  Compilation failed in require at /usr/bin/buffycli line 61.
  BEGIN failed--compilation aborted at /usr/bin/buffycli line 61.

Looking at /usr/lib/perl5/Buffy.pm, I notice that it's a weird
congolmerate between C and Perl, as if the two had been randomly
concatenated. Look at lines 625-694:

  piper:~|master|% sed -n 625,694p /usr/lib/perl5/Buffy.pm                      
                      #130,10021
  package Buffy;

  1;
        \
        }                                                 \
        iter = iter->next;                                \
      }                                                   \
    }                                                     \
    return 0

  /*
    Check the typename
  */
  SWIGRUNTIME swig_cast_info *
  SWIG_TypeCheck(const char *c, swig_type_info *ty) {
    SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
  }

  /* Same as previous function, except strcmp is replaced with a pointer 
comparison */
  SWIGRUNTIME swig_cast_info *
  SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
    SWIG_TypeCheck_Template(iter->type == from, into);
  }

  /*
    Cast a pointer up an inheritance hierarchy
  */
  SWIGRUNTIMEINLINE void *
  SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
    return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
  }

  /* 
    Dynamic pointer casting. Down an inheritance hierarchy
  */
  SWIGRUNTIME swig_type_info *
  SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
    swig_type_info *lastty = ty;
    if (!ty || !ty->dcast) return ty;
    while (ty && (ty->dcast)) {
      ty = (*ty->dcast)(ptr);
      if (ty) lastty = ty;
    }
    return lastty;
  }

  /*
    Return the name associated with this type
  */
  SWIGRUNTIMEINLINE const char *
  SWIG_TypeName(const swig_type_info *ty) {
    return ty->name;
  }

  /*
    Return the pretty name associated with this type,
    that is an unmangled type name in a form presentable to the user.
  */
  SWIGRUNTIME const char *
  SWIG_TypePrettyName(const swig_type_info *type) {
    /* The "str" field contains the equivalent pretty names of the
      type, separated by vertical-bar characters.  We choose
      to print the last name, as it is often (?) the most
      specific. */
    if (!type) return NULL;
    if (type->str != NULL) {
      const char *last_name = type->str;
      const char *s;
      for (s = type->str; *s; s++)
        if (*s == '|') last_name = s+1;

Maybe Perl can do inline C, but the way it transitions just looks
wrong.

As Enrico puts it:

24 08:50 < enrico> madduck: yes, you can see the end of the perl
module ( "1;" ) and the rest looks like C stuff that was inside
a swig buffer

Simply removing everything after /^1;/ on line 626 makes the library
work. Sure seems like swig had a hickup.

-- 
 .''`.   martin f. krafft <[EMAIL PROTECTED]>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems

Attachment: digital_signature_gpg.asc
Description: Digital signature (see http://martin-krafft.net/gpg/)

Reply via email to