Skip to contentSkip to conversation

QEMU help output broken

Qemu-devel Anthony Liguori 3 participants 4 messages Mar 28, 2009

lore
Share & tools
lore
#0 lore raw

DEFOPTION() is turning the \n into a 'n' so everything ends up on the same line.

gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)

Passing arbitrary text into a macro looks very fishy to me. CPP still uses a C tokenizer IIRC so you need at least lexically correct C.

Regards,

Anthony Liguori

#1 lore raw
Quoted 7 lines · Anthony Liguori

DEFOPTION() is turning the \n into a 'n' so everything ends up on the same line.

gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)

Passing arbitrary text into a macro looks very fishy to me. CPP still uses
a C tokenizer IIRC so you need at least lexically correct C.

No, it's a problem with the shell script parser hxtool. The text is already broken in the parsed file (for example sparc-softmmu/) qemu-options.h:

DEF("M", HAS_ARG, QEMU_OPTION_M,
"-M machine select emulated machine (-M ? for list)n")

I'm pretty certain that both Perl and C hxtool parsers did work.

#2 lore raw
Quoted 10 lines · Blue Swirl
Quoted 7 lines · Anthony Liguori

DEFOPTION() is turning the \n into a 'n' so everything ends up on the same line.

gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)

Passing arbitrary text into a macro looks very fishy to me. CPP still uses
a C tokenizer IIRC so you need at least lexically correct C.

Quoted 8 lines

No, it's a problem with the shell script parser hxtool. The text is
already broken in the parsed file (for example sparc-softmmu/) qemu-options.h:

DEF("M", HAS_ARG, QEMU_OPTION_M,
"-M machine select emulated machine (-M ? for list)n")

I'm pretty certain that both Perl and C hxtool parsers did work.

This patch fixes the problem, but only for sh == bash case.

hxtool +3 -3
Index: qemu/hxtool
===================================================================
@@ -3,14 +3,14 @@
 hxtoh()
 {
     flag=1
-    while read str; do
+    while read -r str; do
         case $str in
             HXCOMM*)
             ;;
             STEXI*|ETEXI*) flag=$(($flag^1))
             ;;
             *)
-            test $flag -eq 1 && echo $str
+            test $flag -eq 1 && echo "$str"
             ;;
         esac
     done
@@ -19,7 +19,7 @@
 hxtotexi()
 {
     flag=0
-    while read str; do
+    while read -r str; do
         case "$str" in
             HXCOMM*)
             ;;
#3 lore raw
Quoted 15 lines · Blue Swirl
Quoted 14 lines · Blue Swirl
Quoted 7 lines · Anthony Liguori

DEFOPTION() is turning the \n into a 'n' so everything ends up on the same line.

gcc version 4.3.2 20081105 (Red Hat 4.3.2-7) (GCC)

Passing arbitrary text into a macro looks very fishy to me. CPP still uses
a C tokenizer IIRC so you need at least lexically correct C.

No, it's a problem with the shell script parser hxtool. The text is
already broken in the parsed file (for example sparc-softmmu/) qemu-options.h:

Quoted 6 lines
Quoted 4 lines

DEF("M", HAS_ARG, QEMU_OPTION_M,
"-M machine select emulated machine (-M ? for list)n")

I'm pretty certain that both Perl and C hxtool parsers did work.

This patch fixes the problem, but only for sh == bash case.

No, it should be fine everywhere:
http://www.opengroup.org/onlinepubs/000095399/utilities/read.html

Signature · 1 line
mailto:[email protected]