Strange behavior of MagickWriteImage

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
iSage
Posts: 14
Joined: 2015-03-02T13:03:49-07:00
Authentication code: 6789

Strange behavior of MagickWriteImage

Post by iSage » 2018-02-28T07:31:26-07:00

MagickWriteImage, when working with JPEG, calls open/close on file twice. E.G.:

Code: Select all

...
stat("test.jpeg", 0x14e0020)            = -1 ENOENT (No such file or directory)
open("test.jpeg", O_RDWR|O_CREAT|O_TRUNC, 0666) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
close(3)                                = 0
stat("test.jpeg", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
open("test.jpeg", O_RDWR|O_CREAT|O_TRUNC, 0666) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
mmap(NULL, 442368, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d48364000
mmap(NULL, 442368, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d482f8000
mmap(NULL, 1769472, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2d43319000
write(3, "\377\330\377\340\0\20JFIF\0\1\1\0\0\1\0\1\0\0\377\333\0C\0\3\2\2\3\2\2\3"..., 16384) = 16384
write(3, "\242\201\260\331\4|\36WE\326RIr\23Xr\216\231\351\314\r\16\33\321Ru\345\325)\315;*"..., 4096) = 4096
write(3, "8\272\236GR\267\201\352\251\343d\372\375\17\254\3278r\30\215\337\24n\5\216{\266sW\205\303\307"..., 12288) = 12288
write(3, "z\221n\326\\)mf)\351\313V\237-\346pS\0AR\373\261.}5;i) '\0275"..., 4096) = 4096
write(3, "IZ\315\314\225\ftP\361\35Tr\273.\326\373\276\37\271\257Z\316\263O\240\320\310\347\326\275\233\262"..., 12288) = 12288
write(3, "\255\311\27\233I{\203G2\237\n\351\4\20\340J\26Jv`\270\237u\6\265\263l\246\235J\23\210"..., 4096) = 4096
write(3, "\272\343\22\226\211\254\273q\263\360\250\203\235\203\275\10n\355l\325\323G\271\232\230\2426\224\353hS\331"..., 12288) = 12288
write(3, "\213g?\372\335\257\204]\305\255\314\241\331l\33Q\346!\24\377\0h\355\301\303k\215F\261\370\261\275"..., 4096) = 4096
write(3, "\233\30K\262\177\362T\200\270\321J\304\255XB\3\31\343\304\"\205\322\217\336\33t7\235\342\3#\360"..., 12288) = 12288
write(3, "\0\rb\210\374\324~?\210\277\1`\334)\25ZP\356X\20(}Gk\270\227o$)\3013g"..., 4096) = 4096
write(3, "3\5fV\30\366\304\v\203\22\316\340\22\334\303\210\311\2776\270%\237IA\360\216fK\0\23\271\345"..., 12288) = 12288
write(3, "\263\2238\3013\21\21\310\333\r'\1^\277\327\352d1\10\247\367\6\216\233\276\r?\334\26\320_\10"..., 4096) = 4096
write(3, "\263\324>P\25T\200\177+\314\313#\236\264\177\22\216\316JVE~\241E\202\214\2\5\374\316\v\233"..., 12288) = 12288
write(3, "l\356\30I\257\312\16\322\224\20\225$D\322\364\266\214\302\3652DE\322@c\340\t\304\3d\306Z"..., 4096) = 4096
write(3, "r\237\231h\267m\211r~y&\331w&\313\371\10v\367cf\r\217\33V\204\367\f-c\223o"..., 12288) = 12288
write(3, "\237\370\1\231\353\0\4\214\203\0\241\1Kp\217\301\203AC%V\200\212\f/\0\316\302\22cP\0"..., 4096) = 4096
write(3, "f\303\320@\25\364\0@\302.A\30\300\242\260~\264\4\10\10\2;P\374\206\1\0\240j\250\330I"..., 12288) = 12288
write(3, "\20\16\344\205B\202\222x0Z\3\334\310J.\342\344\213r\24\21\336,\25gs!\242\4 \274\362"..., 4096) = 4096
munmap(0x7f2d43319000, 1769472)         = 0
munmap(0x7f2d482f8000, 442368)          = 0
munmap(0x7f2d48364000, 442368)          = 0
write(3, "\31\363\320D@\213\256\21P0\210\213\316 \2\0\202\f\4.`\20A\0046=\25\243Q\250\334\267"..., 1502) = 1502
fstat(3, {st_mode=S_IFREG|0644, st_size=153054, ...}) = 0
close(3)                                = 0
...
This happens only when writing JPEG files. For PNG and GIF open/close is only called once.
While this doesn't seem like a critical bug, that's definitely strange.

Post Reply