Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-7752

Update packing code according to documentation

    • Type: Icon: Documentation Documentation
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT10.0.1, 4.4.8, 5.0.2, 5.1.0-rc0
    • Affects Version/s: WT10.0.0, 3.2.1
    • Component/s: None
    • Labels:
      None
    • 2
    • Storage - Ra 2021-07-12, Storage - Ra 2021-07-26

      Documentation / implementation mismatch?

      In both documentations (3.2.1, 10.0.1) we can see the following format description:

      Format   C Type   Java type   Python type   Notes
      i        int32_t  int         int           signed 32-bit
      l        int32_t  int         int           signed 32-bit 
      

      However in the implementation those two types are handled differently:

      3.2.1: src/include/packing.i

       #define WT_PACK_GET(session, pv, ap))
       ...
           case 'i':
              (pv).u.i = va_arg(ap, int);
              break;
       ...
          case 'l':
              (pv).u.i = va_arg(ap, long);
              break;
       ...

       10.0.1 (develop branch): src/include/packing_inline.h

       #define WT_PACK_GET(session, pv, ap))
       ...
           case 'i':
              (pv).u.i = va_arg(ap, int);
              break;
       ...
          case 'l':
              (pv).u.i = va_arg(ap, long);
              break;
       ...

       
      The man page of the va_arg command states the following:

      If there is no next argument, or if type is not compatible with the type of the actual next argument (as promoted according to the default argument promotions), random errors will occur.

            Assignee:
            etienne.petrel@mongodb.com Etienne Petrel
            Reporter:
            akristo.jetapps@gmail.com akos kristo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: