Uploaded image for project: 'CFEngine Community'
  1. CFEngine Community
  2. CFE-2507

storejson() should not truncate strings larger than 4096 bytes

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Done
    • Priority: Low
    • Resolution: Fixed
    • Affects Version/s: 3.10.0, 3.11.0, 3.10.2
    • Fix Version/s: 3.12.7, 3.15.4, 3.18.0
    • Component/s: None
    • Labels:
    • Story Points:
      0

      Description

      Slurping some docker API json I see:

      info: storejson: truncating data container image_info JSON data from 19990 bytes to 4096

      storejson() will truncate data to 4096 bytes.

      string_mustache() can render a data container to a string larger than 4096 bytes.

      bundle agent main
      {
        vars:
          "state" data => datastate();
          "state_dump" string => storejson( "state" ),
            unless => isvariable( $(this.promiser) );
          "state_dump3" string => string_mustache("{{%-top-}}", state),
            unless => isvariable( $(this.promiser) );
      
        reports:
          "storejson() doesnt match"
            unless => strcmp( $(state_dump3), $(state_dump) );
      
          "version ${sys.cf_version}";
      }
      
      > $ cf-agent -KIf ./datastate.cf                 
          info: storejson: truncating data container state JSON data from 36044 bytes to 4096
      R: storejson() doesnt match
      R: version 3.11.0
      

      Strings can contain more than 4096 bytes, there is no reason for storejson() to truncate the strings.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                larsewi Lars Erik Wik
                Reporter:
                neilhwatson Neil Watson
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Summary Panel