[PATCH v2.5/6] tools/pygrub: Fix expression before it's copied elsewhere

Andrew Cooper posted 1 patch 5 months, 1 week ago
Failed in applying to current master (apply log)
tools/pygrub/src/pygrub | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v2.5/6] tools/pygrub: Fix expression before it's copied elsewhere
Posted by Andrew Cooper 5 months, 1 week ago
This has an identical meaning, and is the more pythonic way of writing it.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Wei Liu <wl@xen.org>
CC: Anthony PERARD <anthony.perard@citrix.com>
CC: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
 tools/pygrub/src/pygrub | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
index 327cf51774fc..2c06684d6532 100755
--- a/tools/pygrub/src/pygrub
+++ b/tools/pygrub/src/pygrub
@@ -88,7 +88,7 @@ def downgrade_rlimits():
     # filesystem we set RLIMIT_FSIZE to a high bound, so that the file
     # write permissions are bound.
     fsize = LIMIT_FSIZE
-    if "PYGRUB_MAX_FILE_SIZE_MB" in os.environ.keys():
+    if "PYGRUB_MAX_FILE_SIZE_MB" in os.environ:
         fsize = int(os.environ["PYGRUB_MAX_FILE_SIZE_MB"]) << 20
 
     resource.setrlimit(resource.RLIMIT_FSIZE, (fsize, fsize))
-- 
2.30.2
Re: [PATCH v2.5/6] tools/pygrub: Fix expression before it's copied elsewhere
Posted by Alejandro Vallejo 5 months, 1 week ago
On 22/11/2023 20:07, Andrew Cooper wrote:
> This has an identical meaning, and is the more pythonic way of writing it.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> ---
> CC: Wei Liu <wl@xen.org>
> CC: Anthony PERARD <anthony.perard@citrix.com>
> CC: Alejandro Vallejo <alejandro.vallejo@cloud.com>
> ---
>   tools/pygrub/src/pygrub | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
> index 327cf51774fc..2c06684d6532 100755
> --- a/tools/pygrub/src/pygrub
> +++ b/tools/pygrub/src/pygrub
> @@ -88,7 +88,7 @@ def downgrade_rlimits():
>       # filesystem we set RLIMIT_FSIZE to a high bound, so that the file
>       # write permissions are bound.
>       fsize = LIMIT_FSIZE
> -    if "PYGRUB_MAX_FILE_SIZE_MB" in os.environ.keys():
> +    if "PYGRUB_MAX_FILE_SIZE_MB" in os.environ:
>           fsize = int(os.environ["PYGRUB_MAX_FILE_SIZE_MB"]) << 20
>   
>       resource.setrlimit(resource.RLIMIT_FSIZE, (fsize, fsize))

LGTM.

Cheers,
Alejandro
Re: [PATCH v2.5/6] tools/pygrub: Fix expression before it's copied elsewhere
Posted by Alejandro Vallejo 5 months, 1 week ago
On 23/11/2023 16:50, Alejandro Vallejo wrote:
> On 22/11/2023 20:07, Andrew Cooper wrote:
>> This has an identical meaning, and is the more pythonic way of writing 
>> it.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> ---
>> CC: Wei Liu <wl@xen.org>
>> CC: Anthony PERARD <anthony.perard@citrix.com>
>> CC: Alejandro Vallejo <alejandro.vallejo@cloud.com>
>> ---
>>   tools/pygrub/src/pygrub | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
>> index 327cf51774fc..2c06684d6532 100755
>> --- a/tools/pygrub/src/pygrub
>> +++ b/tools/pygrub/src/pygrub
>> @@ -88,7 +88,7 @@ def downgrade_rlimits():
>>       # filesystem we set RLIMIT_FSIZE to a high bound, so that the file
>>       # write permissions are bound.
>>       fsize = LIMIT_FSIZE
>> -    if "PYGRUB_MAX_FILE_SIZE_MB" in os.environ.keys():
>> +    if "PYGRUB_MAX_FILE_SIZE_MB" in os.environ:
>>           fsize = int(os.environ["PYGRUB_MAX_FILE_SIZE_MB"]) << 20
>>       resource.setrlimit(resource.RLIMIT_FSIZE, (fsize, fsize))
> 
> LGTM.
> 
> Cheers,
> Alejandro

... and

Reviewed-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>

Cheers,
Alejandro

Re: [PATCH v2.5/6] tools/pygrub: Fix expression before it's copied elsewhere
Posted by Andrew Cooper 5 months, 1 week ago
On 23/11/2023 4:50 pm, Alejandro Vallejo wrote:
> On 22/11/2023 20:07, Andrew Cooper wrote:
>> This has an identical meaning, and is the more pythonic way of
>> writing it.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
>> ---
>> CC: Wei Liu <wl@xen.org>
>> CC: Anthony PERARD <anthony.perard@citrix.com>
>> CC: Alejandro Vallejo <alejandro.vallejo@cloud.com>
>> ---
>>   tools/pygrub/src/pygrub | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub
>> index 327cf51774fc..2c06684d6532 100755
>> --- a/tools/pygrub/src/pygrub
>> +++ b/tools/pygrub/src/pygrub
>> @@ -88,7 +88,7 @@ def downgrade_rlimits():
>>       # filesystem we set RLIMIT_FSIZE to a high bound, so that the file
>>       # write permissions are bound.
>>       fsize = LIMIT_FSIZE
>> -    if "PYGRUB_MAX_FILE_SIZE_MB" in os.environ.keys():
>> +    if "PYGRUB_MAX_FILE_SIZE_MB" in os.environ:
>>           fsize = int(os.environ["PYGRUB_MAX_FILE_SIZE_MB"]) << 20
>>         resource.setrlimit(resource.RLIMIT_FSIZE, (fsize, fsize))
>
> LGTM.

Can I take that as a R-by then?

~Andrew