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

Ruslan Kuprieiev kupruser at gmail.com
Tue Jul 21 11:01:19 PDT 2015


And one more thing

On 07/21/2015 08:57 PM, 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).
>

This is also the reason why this patch would ruin backward compatibility for
those scripts.


> 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.
>
> Pavel?
>
> Thanks,
> Ruslan
>
> On 07/21/2015 08:06 PM, Tycho Andersen wrote:
>> This is probably what everyone wants anyway :). This patch also adds a
>> --no-pretty option if people really want to disable it.
>>
>> Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
>> ---
>>   crit | 7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/crit b/crit
>> index 350362c..3d0ee04 100755
>> --- a/crit
>> +++ b/crit
>> @@ -52,15 +52,20 @@ def main():
>>       decode_parser = subparsers.add_parser('decode',
>>               help = 'convert criu image from binary type json')
>>       decode_parser.add_argument('--pretty',
>> +            dest = 'pretty',
>>               help = 'Multiline with indents and some numerical 
>> fields in field-specific format',
>>               action = 'store_true')
>> +    decode_parser.add_argument('--no-pretty',
>> +            dest = 'pretty',
>> +            help = 'Disable indenting and formatting.',
>> +            action = 'store_false')
>>       decode_parser.add_argument('-i',
>>                   '--in',
>>               help = 'criu image in binary format to be decoded 
>> (stdin by default)')
>>       decode_parser.add_argument('-o',
>>                   '--out',
>>               help = 'where to put criu image in json format (stdout 
>> by default)')
>> -    decode_parser.set_defaults(func=decode)
>> +    decode_parser.set_defaults(func=decode, pretty=True)
>>         # Encode
>>       encode_parser = subparsers.add_parser('encode',
>



More information about the CRIU mailing list