[CRIU] [PATCH] crit: enable --pretty by default

Pavel Emelyanov xemul at parallels.com
Wed Jul 22 08:30:00 PDT 2015


On 07/22/2015 12:48 AM, Tycho Andersen wrote:
> On Tue, Jul 21, 2015 at 05:28:19PM -0400, Christopher Covington wrote:
>> On 07/21/2015 02:32 PM, Tycho Andersen wrote:
>>> On Tue, Jul 21, 2015 at 09:17:20PM +0300, Ruslan Kuprieiev wrote:
>>>>
>>>>
>>>> On 07/21/2015 09:06 PM, Tycho Andersen wrote:
>>>>> On Tue, Jul 21, 2015 at 08:57:26PM +0300, Ruslan Kuprieiev wrote:
>>>>>> Hi Tycho,
>>>>>>
>>>>>> We did that on purpose, as we thought that crit should be used in various
>>>>>> scripts and they might be not happy with --pretty option, as it does some
>>>>>> unusual transformations with data(i.e. int to string in hex) which scripts
>>>>>> might be not happy about, as they use json tools(i.e. they might expect int
>>>>>> but get string in hex format).
>>>>>>
>>>>>> I'm not sure that we should enable it always by default.
>>>>>> That being said, I believe we used to have "pretty for stdout by default"
>>>>>> behavior and I can't remember why it is gone. Though, we might
>>>>>> think of resurrecting it.
>>>>> You mean "pretty when stdout is a terminal"?
>>>>
>>>> Well, we used to do that in a lazy way, just checking if -o option is not
>>>> specified. =)
>>>> But your way sounds a lot better=).
>>>>
>>>>> That sounds ok with me,
>>>>> all I'm trying to do is avoid having to type --pretty when I use crit
>>>>> to inspect the images :)
>>>>>
>>>>> I know this will break things, but I was hoping it might be early
>>>>> enough in the lifetime that there weren't a lot of scripts around that
>>>>> depend on it.
>>>>
>>>> To be honest, I haven't heard about none of those scripts =).
>>>> Maybe you're right and it is still early enough indeed.
>>>>
>>>> But maybe the best way to solve it would be to combine both ideas described
>>>> above.
>>>> Add "pretty when stdout is a terminal" and add --no-pretty to force
>>>> non-pretty
>>>> output even for terminal.
>>>> What do you think?
>>>
>>> I think my #1 would be to just take this patch and break things
>>> for people, #2 would be to do some sort of fancy detection, but I
>>> guess this is why we have Pavel :)
>>
>> Would such an implementation mean piping to less could change the output
>> format? If so, that's not a behavior I would expect or be pleased to discover.
> 
> Yep, agreed. I'd much rather just change the default behavior.

Yes, typing --pretty all the time is annoying :( I agree that we should make it
ON by default for standard use-case. At the same time backward compatibility is
important, even though the crit was announced not so long ago. And Christopher 
is right, having crit decode versus crit decode | something producing different 
result is also not good.

So how about introducing the "show" action that will be equal to "decode --pretty"?
This will satisfy all the parties and will even save some more keystrokes :)

-- Pavel


More information about the CRIU mailing list