public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v1 0/1] UncrustifyCheck: use stat instead of os.stat
@ 2024-01-22 23:21 Joey Vagedes via groups.io
  2024-01-22 23:21 ` [edk2-devel] [PATCH v1 1/1] .pytool/Plugin: " Joey Vagedes via groups.io
  0 siblings, 1 reply; 4+ messages in thread
From: Joey Vagedes via groups.io @ 2024-01-22 23:21 UTC (permalink / raw)
  To: devel; +Cc: Liming Gao, Michael D Kinney, Sean Brogan

When UncrustifyCheck attempts to update the permissions of a file
( Only happens when a different error occurs ), it incorrectly uses
os.stat.S_IWRITE, which does not exist. The correct value is 
stat.S_IWRITE.

see os.chmod documentation: https://docs.python.org/3/library/os.html#os.chmod

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>

Joey Vagedes (1):
  .pytool/Plugin: UncrustifyCheck: use stat instead of os.stat

 .pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.40.1.vfs.0.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114152): https://edk2.groups.io/g/devel/message/114152
Mute This Topic: https://groups.io/mt/103898980/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [edk2-devel] [PATCH v1 1/1] .pytool/Plugin: UncrustifyCheck: use stat instead of os.stat
  2024-01-22 23:21 [edk2-devel] [PATCH v1 0/1] UncrustifyCheck: use stat instead of os.stat Joey Vagedes via groups.io
@ 2024-01-22 23:21 ` Joey Vagedes via groups.io
  2024-01-22 23:25   ` Michael D Kinney
  0 siblings, 1 reply; 4+ messages in thread
From: Joey Vagedes via groups.io @ 2024-01-22 23:21 UTC (permalink / raw)
  To: devel; +Cc: Liming Gao, Michael D Kinney, Sean Brogan

The UncrustifyCheck plugin passes os.stat.S_IWRITE to os.chmod, when
attempting to change file permissions. os.stat.S_IWRITE does not exist
as os.stat is a function. The correct value is stat.S_IWRITE.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
---
 .pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py b/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py
index 9aeef5a5a3..73dc03c0dc 100644
--- a/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py
+++ b/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py
@@ -12,6 +12,7 @@ import logging
 import os
 import pathlib
 import shutil
+import stat
 import timeit
 from edk2toolext.environment import version_aggregator
 from edk2toolext.environment.plugin_manager import PluginManager
@@ -628,7 +629,7 @@ class UncrustifyCheck(ICiBuildPlugin):
             """
             Private function to attempt to change permissions on file/folder being deleted.
             """
-            os.chmod(path, os.stat.S_IWRITE)
+            os.chmod(path, stat.S_IWRITE)
             func(path)
 
         for _ in range(3):  # retry up to 3 times
-- 
2.40.1.vfs.0.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114153): https://edk2.groups.io/g/devel/message/114153
Mute This Topic: https://groups.io/mt/103898982/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH v1 1/1] .pytool/Plugin: UncrustifyCheck: use stat instead of os.stat
  2024-01-22 23:21 ` [edk2-devel] [PATCH v1 1/1] .pytool/Plugin: " Joey Vagedes via groups.io
@ 2024-01-22 23:25   ` Michael D Kinney
  2024-01-23 15:56     ` Joey Vagedes via groups.io
  0 siblings, 1 reply; 4+ messages in thread
From: Michael D Kinney @ 2024-01-22 23:25 UTC (permalink / raw)
  To: Joey Vagedes, devel@edk2.groups.io
  Cc: Liming Gao, Sean Brogan, Kinney, Michael D

Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

> -----Original Message-----
> From: Joey Vagedes <joey.vagedes@gmail.com>
> Sent: Monday, January 22, 2024 3:21 PM
> To: devel@edk2.groups.io
> Cc: Liming Gao <gaoliming@byosoft.com.cn>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Sean Brogan <sean.brogan@microsoft.com>
> Subject: [PATCH v1 1/1] .pytool/Plugin: UncrustifyCheck: use stat
> instead of os.stat
> 
> The UncrustifyCheck plugin passes os.stat.S_IWRITE to os.chmod, when
> attempting to change file permissions. os.stat.S_IWRITE does not exist
> as os.stat is a function. The correct value is stat.S_IWRITE.
> 
> Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> ---
>  .pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py
> b/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py
> index 9aeef5a5a3..73dc03c0dc 100644
> --- a/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py
> +++ b/.pytool/Plugin/UncrustifyCheck/UncrustifyCheck.py
> @@ -12,6 +12,7 @@ import logging
>  import os
> 
>  import pathlib
> 
>  import shutil
> 
> +import stat
> 
>  import timeit
> 
>  from edk2toolext.environment import version_aggregator
> 
>  from edk2toolext.environment.plugin_manager import PluginManager
> 
> @@ -628,7 +629,7 @@ class UncrustifyCheck(ICiBuildPlugin):
>              """
> 
>              Private function to attempt to change permissions on
> file/folder being deleted.
> 
>              """
> 
> -            os.chmod(path, os.stat.S_IWRITE)
> 
> +            os.chmod(path, stat.S_IWRITE)
> 
>              func(path)
> 
> 
> 
>          for _ in range(3):  # retry up to 3 times
> 
> --
> 2.40.1.vfs.0.0



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114154): https://edk2.groups.io/g/devel/message/114154
Mute This Topic: https://groups.io/mt/103898982/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [edk2-devel] [PATCH v1 1/1] .pytool/Plugin: UncrustifyCheck: use stat instead of os.stat
  2024-01-22 23:25   ` Michael D Kinney
@ 2024-01-23 15:56     ` Joey Vagedes via groups.io
  0 siblings, 0 replies; 4+ messages in thread
From: Joey Vagedes via groups.io @ 2024-01-23 15:56 UTC (permalink / raw)
  To: Michael D Kinney, devel

[-- Attachment #1: Type: text/plain, Size: 709 bytes --]

Thanks Mike,

I've prepared a Pull request with your Reviewed-By Tag. Feel free to add the push tag at your convenience. I appreciate your time!

.pytool/Plugin: UncrustifyCheck: use stat instead of os.stat by Javagedes · Pull Request #5287 · tianocore/edk2 (github.com) ( https://github.com/tianocore/edk2/pull/5287 )

Thanks,
Joey


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114213): https://edk2.groups.io/g/devel/message/114213
Mute This Topic: https://groups.io/mt/103898982/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 1202 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-23 15:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-22 23:21 [edk2-devel] [PATCH v1 0/1] UncrustifyCheck: use stat instead of os.stat Joey Vagedes via groups.io
2024-01-22 23:21 ` [edk2-devel] [PATCH v1 1/1] .pytool/Plugin: " Joey Vagedes via groups.io
2024-01-22 23:25   ` Michael D Kinney
2024-01-23 15:56     ` Joey Vagedes via groups.io

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox