[PATCH] util.c (string_quote): quote unprintable chars
Neil Campbell
lists at thebatcave.org.uk
Tue Oct 9 09:05:11 UTC 2007
Dmitry V. Levin wrote:
> On Wed, Sep 26, 2007 at 03:48:39PM +0100, Neil Campbell wrote:
>> Dmitry V. Levin wrote:
>>> On Wed, Sep 26, 2007 at 10:28:58AM +0100, Neil Campbell wrote:
>>>> Dmitry V. Levin wrote:
>>>>> On Sat, Aug 25, 2007 at 01:21:00PM +0100, Neil Campbell wrote:
>>>>>> I was tracing some applications and found that the output of strace
>>>>>> included some non-printable characters, leading various tools such as
>>>>>> 'file' and 'less' to refuse to recognise the file as text. It seemed
>>>>>> that this was due to some strange paths being included in unix domain
>>>>>> sockaddr structs.
>>>>> I propose another patch to avoid unprintable characters in output.
>>>> In most cases however this path will be a genuine path to a file, and
>>>> the current code in CVS will print this in full, which is consistent
>>>> with how paths are handled elsewhere.
>>> That is, you suggest to use printpathn() instead?
>> I'm not very familiar with the strace source, but this doesn't appear
>> to escape
>> the non-printable characters - if such support was added to printpath
>> then yes,
>> that would sound good to me.
>
> I see no reason why printpath() should not quote unprintable chars like
> printstr() does. For example, if open() is calles with unprintable file
> name, why shouldn't it be printed quoted?
>
> Here is proposed change. It may look a bit complicated due to code
> relocation from one function to another, though.
That looks good to me, thanks very much for all your help.
Neil
More information about the Strace-devel
mailing list