Skip to contentSkip to conversation

trace: Fix 'char **' compilation error in simple backend

PATCH In review Fam Zheng 3 participants 3 messages Oct 26, 2016 – Oct 28, 2016

lore
Share & tools
lore

Fam Zheng

author
#0 lore raw

PATCH v2 1/1 trace: Fix 'char **' compilation error in simple backend

Currently, the generated function body will do "strlen(arg)" but the argument could be 'char **' or 'char * const *'. Avoid that by excluding such cases in is_string check.

Reported by patchew's "make docker-test-mingw@fedora".

---

v2: Fix typo in commit message and "yeah we'll be counting stars". [Eric]

---
 scripts/tracetool/backend/simple.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/tracetool/backend/simple.py +2 -1
index 9885e83..85f6102 100644
@@ -21,7 +21,8 @@ PUBLIC = True
 
 def is_string(arg):
     strtype = ('const char*', 'char*', 'const char *', 'char *')
-    if arg.lstrip().startswith(strtype):
+    arg_strip = arg.lstrip()
+    if arg_strip.startswith(strtype) and arg_strip.count('*') == 1:
         return True
     else:
         return False
Signature · 1 line
2.7.4
Reviewed-by on v2 1/1
#1 lore raw
Quoted 4 lines · Fam Zheng

Currently, the generated function body will do "strlen(arg)" but the argument could be 'char **' or 'char * const *'. Avoid that by excluding such cases in is_string check.

Quoted 8 lines

Reported by patchew's "make docker-test-mingw@fedora".

---

v2: Fix typo in commit message and "yeah we'll be counting stars". [Eric]

I may have had the vague idea, but you eloquently framed it into code, and let me learn in the process :)

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#2 lore raw
Quoted 10 lines · Eric Blake
Quoted 9 lines · Fam Zheng

Currently, the generated function body will do "strlen(arg)" but the argument could be 'char **' or 'char * const *'. Avoid that by excluding such cases in is_string check.

Reported by patchew's "make docker-test-mingw@fedora".

Quoted 8 lines
Quoted 3 lines

---

v2: Fix typo in commit message and "yeah we'll be counting stars". [Eric]

I may have had the vague idea, but you eloquently framed it into code, and let me learn in the process :)

Applied to master as a buildfix, thanks (though it looks like there is also a trace related compile failure for the UST backend, so this alone won't be enough to bring travis back to all-green).

-- PMM