t/pmc/packfile.t: Warning about invalid Parrot bytecode file

Jonathan Leto jaleto at gmail.com
Thu Aug 5 17:21:15 UTC 2010


Howdy,

It seems that test 6, which tests for invalid data, is printing that
to STDERR. The test could redirect STDERR
to prevent that.

Duke


On Wed, Aug 4, 2010 at 6:54 PM, James E Keenan <jkeen at verizon.net> wrote:
> James E Keenan wrote:
>>
>> ok 4 - bytecode_major set
>> PackFile_unpack: This is not a valid Parrot bytecode file
>> ok 5 - set_string_native with invalid data throws
>> ok 6 - get_string(uuid)
>
> Here's the relevant source code:
>
> src/packfile.c
>
>  993 PARROT_EXPORT
>  994 PARROT_WARN_UNUSED_RESULT
>  995 opcode_t
>  996 PackFile_unpack(PARROT_INTERP, ARGMOD(PackFile *self),
>  997     ARGIN(const opcode_t *packed), size_t packed_size)
>  998 {
>  999     ASSERT_ARGS(PackFile_unpack)
> 1000     PackFile_Header * const header = self->header;
> 1001     const opcode_t         *cursor;
> 1002     int                     header_read_length;
> 1003     opcode_t                padding;
> 1004 #if TRACE_PACKFILE
> 1005     PackFile        * const pf  = self;
> 1006 #endif
> 1007
> 1008     if (packed_size < PACKFILE_HEADER_BYTES) {
> 1009         Parrot_io_eprintf(NULL, "PackFile_unpack: "
> 1010             "Buffer length %d is shorter than PACKFILE_HEADER_BYTES
> %d\n",
> 1011             packed_size, PACKFILE_HEADER_BYTES);
> 1012         return 0;
> 1013     }
> 1014
> 1015     self->src  = packed;
> 1016     self->size = packed_size;
> 1017
> 1018     /* Extract the header. */
> 1019     memcpy(header, packed, PACKFILE_HEADER_BYTES);
> 1020
> 1021     /* Ensure the magic is correct. */
> 1022     if (memcmp(header->magic, "\376PBC\r\n\032\n", 8) != 0) {
> 1023         Parrot_io_eprintf(NULL, "PackFile_unpack: "
> 1024             "This is not a valid Parrot bytecode file\n");
> 1025         return 0;
> 1026     }
>
>
> _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-dev
>



-- 
Jonathan "Duke" Leto
jonathan at leto.net
http://leto.net


More information about the parrot-dev mailing list