MozillaSecurity / lithium

Line-based testcase reducer
Mozilla Public License 2.0
94 stars 25 forks source link

timed_run assumes logPrefix to be a string when deciding when to create log files #61

Closed nth10sd closed 6 years ago

nth10sd commented 6 years ago

When debugging funfuzz PR 168 I realised that this line in timed_run was only creating log files when logPrefix is a str.

Which means it fails if logPrefix is of the bytes type.

@jschwartzentruber, what do you think is the right way forward? Should it remain as-is, or should it change to a bool-like check? Or should the str type be enforced in other projects?

i.e. useLogFiles = logPrefix if logPrefix else False

nth10sd commented 6 years ago

Do you think this method may be a more elegant way of checking if it is a string/unicode?

isinstance(x, ("".__class__, u"".__class__))

nth10sd commented 6 years ago

fwiw I fixed a similar bug in funfuzz using the above method in the previous comment successfully.

nth10sd commented 6 years ago

@jschwartzentruber dug deeper, who found that 025fa958abf97573c242f623d5144aec7ea2684e was likely the cause. There seems to no longer be a use for log_prefix so we should raise if log_prefix is not a string, and always create "-out.txt" and "-err.txt" log files.