Bug ID 1231165
Summary Incorrect process exist value in xmlstarlet format when "-omit-decl" flag given
Classification openSUSE
Product openSUSE Distribution
Version Leap 15.5
Hardware All
OS openSUSE Leap 15.5
Status NEW
Severity Normal
Priority P5 - None
Component Other
Assignee screening-team-bugs@suse.de
Reporter archie.cobbs@gmail.com
QA Contact qa-bugs@suse.de
Target Milestone ---
Found By ---
Blocker ---

This xmlstarlet command gives the wrong exit value:

    $ echo '<abcde/>' | xml fo -s 4 -o ; echo EXIT=$?
    <abcde/>
    EXIT=9

Instead of exiting with exit value zero as it should, the program is exiting
with a value equal to the number of characters output modulo 256.

I think this should fix it:

--- xmlstarlet-1.6.1.orig/src/xml_format.c      2013-03-16 18:27:48.000000000
-0500
+++ xmlstarlet-1.6.1/src/xml_format.c   2024-09-30 17:45:52.603161768 -0500
@@ -339,7 +339,7 @@
                 child = child->next;
             }
         }
-        ret = xmlOutputBufferClose(buf);
+        ret = xmlOutputBufferClose(buf) >= 0 ? 0 : 1;
     }

     xmlFreeDoc(doc);

The bug is that xmlOutputBufferClose() returns the number of characters
written, not a boolean for success/failure.

OBS project: https://build.opensuse.org/package/show/Publishing/xmlstarlet


You are receiving this mail because: