[Patchew-devel] [PATCH] tester: another fix for log truncation

Paolo Bonzini posted 1 patch 5 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/patchew next tags/patchew/20190218140409.10750-1-pbonzini@redhat.com
patchew-cli | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Patchew-devel] [PATCH] tester: another fix for log truncation
Posted by Paolo Bonzini 5 years, 8 months ago
max_size / 10 returns a float.  Use // to return an integer, because
floats cannot be used as slice indices.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 patchew-cli | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/patchew-cli b/patchew-cli
index c8e8351..a069b8e 100755
--- a/patchew-cli
+++ b/patchew-cli
@@ -598,7 +598,7 @@ class TesterCommand(SubCommand):
                             prefixed = True
                             log = 'WARNING: Log truncated!\n\n' + log
                         log = log[:max_size]
-                        max_size = max_size / 10
+                        max_size = max_size // 10
                     else:
                         break
                 if prefixed:
-- 
2.20.1

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel
Re: [Patchew-devel] [PATCH] tester: another fix for log truncation
Posted by Philippe Mathieu-Daudé 5 years, 8 months ago
On 2/18/19 3:04 PM, Paolo Bonzini wrote:
> max_size / 10 returns a float.  Use // to return an integer, because
> floats cannot be used as slice indices.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> ---
>  patchew-cli | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/patchew-cli b/patchew-cli
> index c8e8351..a069b8e 100755
> --- a/patchew-cli
> +++ b/patchew-cli
> @@ -598,7 +598,7 @@ class TesterCommand(SubCommand):
>                              prefixed = True
>                              log = 'WARNING: Log truncated!\n\n' + log
>                          log = log[:max_size]
> -                        max_size = max_size / 10
> +                        max_size = max_size // 10
>                      else:
>                          break
>                  if prefixed:
> 

_______________________________________________
Patchew-devel mailing list
Patchew-devel@redhat.com
https://www.redhat.com/mailman/listinfo/patchew-devel