public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/2] moveconfig.py: add try…except
@ 2021-03-15 16:01 Trevor Woerner
  2021-03-15 16:01 ` [PATCH 2/2] moveconfig.py: add to the "do not process" list Trevor Woerner
  2021-04-07 17:15 ` [PATCH 1/2] moveconfig.py: add try…except Trevor Woerner
  0 siblings, 2 replies; 4+ messages in thread
From: Trevor Woerner @ 2021-03-15 16:01 UTC (permalink / raw)
  To: u-boot

I keep getting a UnicodeDecodeError from one of the header files while
modifying the headers:

	 Traceback (most recent call last):
	  File "tools/moveconfig.py", line 1953, in <module>
	    main()
	  File "tools/moveconfig.py", line 1927, in main
	    cleanup_headers(configs, options)
	  File "tools/moveconfig.py", line 675, in cleanup_headers
	    cleanup_one_header(header_path, patterns, options)
	  File "tools/moveconfig.py", line 599, in cleanup_one_header
	    lines = f.readlines()
	  File "/usr/lib64/python3.6/codecs.py", line 321, in decode
	    (result, consumed) = self._buffer_decode(data, self.errors, final)
	UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 9: invalid start byte

I'm curious to know which header file is causing the problem.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 tools/moveconfig.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index 9514d9a00c..dd92c00bb7 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -596,7 +596,12 @@ def cleanup_one_header(header_path, patterns, options):
       options: option flags.
     """
     with open(header_path) as f:
-        lines = f.readlines()
+        try:
+            lines = f.readlines()
+        except:
+            print("caught exception: ", sys.exc_info()[0])
+            print("header_path: ", header_path)
+            lines = ""
 
     matched = []
     for i, line in enumerate(lines):
-- 
2.30.0.rc0

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

* [PATCH 2/2] moveconfig.py: add to the "do not process" list
  2021-03-15 16:01 [PATCH 1/2] moveconfig.py: add try…except Trevor Woerner
@ 2021-03-15 16:01 ` Trevor Woerner
  2021-04-13 14:29   ` Tom Rini
  2021-04-07 17:15 ` [PATCH 1/2] moveconfig.py: add try…except Trevor Woerner
  1 sibling, 1 reply; 4+ messages in thread
From: Trevor Woerner @ 2021-03-15 16:01 UTC (permalink / raw)
  To: u-boot

Skip the processing of *.aml and *.dat files while iterating through the
source in order to process header files.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 tools/moveconfig.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/moveconfig.py b/tools/moveconfig.py
index dd92c00bb7..1e08b3cada 100755
--- a/tools/moveconfig.py
+++ b/tools/moveconfig.py
@@ -672,7 +672,7 @@ def cleanup_headers(configs, options):
                 continue
             for filename in filenames:
                 if not filename.endswith(('~', '.dts', '.dtsi', '.bin',
-                                          '.elf')):
+                                          '.elf','.aml','.dat')):
                     header_path = os.path.join(dirpath, filename)
                     # This file contains UTF-16 data and no CONFIG symbols
                     if header_path == 'include/video_font_data.h':
-- 
2.30.0.rc0

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

* [PATCH 1/2] moveconfig.py: add try…except
  2021-03-15 16:01 [PATCH 1/2] moveconfig.py: add try…except Trevor Woerner
  2021-03-15 16:01 ` [PATCH 2/2] moveconfig.py: add to the "do not process" list Trevor Woerner
@ 2021-04-07 17:15 ` Trevor Woerner
  1 sibling, 0 replies; 4+ messages in thread
From: Trevor Woerner @ 2021-04-07 17:15 UTC (permalink / raw)
  To: u-boot

It looks like Simon beat me to this one with 7570d9bb47be24d9d73518742703f32126af8113
but I'm hoping 2/2 can still make it in.

On Mon 2021-03-15 @ 12:01:32 PM, Trevor Woerner wrote:
> I keep getting a UnicodeDecodeError from one of the header files while
> modifying the headers:
> 
> 	 Traceback (most recent call last):
> 	  File "tools/moveconfig.py", line 1953, in <module>
> 	    main()
> 	  File "tools/moveconfig.py", line 1927, in main
> 	    cleanup_headers(configs, options)
> 	  File "tools/moveconfig.py", line 675, in cleanup_headers
> 	    cleanup_one_header(header_path, patterns, options)
> 	  File "tools/moveconfig.py", line 599, in cleanup_one_header
> 	    lines = f.readlines()
> 	  File "/usr/lib64/python3.6/codecs.py", line 321, in decode
> 	    (result, consumed) = self._buffer_decode(data, self.errors, final)
> 	UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 9: invalid start byte
> 
> I'm curious to know which header file is causing the problem.
> 
> Signed-off-by: Trevor Woerner <twoerner@gmail.com>
> ---
>  tools/moveconfig.py | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/moveconfig.py b/tools/moveconfig.py
> index 9514d9a00c..dd92c00bb7 100755
> --- a/tools/moveconfig.py
> +++ b/tools/moveconfig.py
> @@ -596,7 +596,12 @@ def cleanup_one_header(header_path, patterns, options):
>        options: option flags.
>      """
>      with open(header_path) as f:
> -        lines = f.readlines()
> +        try:
> +            lines = f.readlines()
> +        except:
> +            print("caught exception: ", sys.exc_info()[0])
> +            print("header_path: ", header_path)
> +            lines = ""
>  
>      matched = []
>      for i, line in enumerate(lines):
> -- 
> 2.30.0.rc0
> 

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

* [PATCH 2/2] moveconfig.py: add to the "do not process" list
  2021-03-15 16:01 ` [PATCH 2/2] moveconfig.py: add to the "do not process" list Trevor Woerner
@ 2021-04-13 14:29   ` Tom Rini
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2021-04-13 14:29 UTC (permalink / raw)
  To: u-boot

On Mon, Mar 15, 2021 at 12:01:33PM -0400, Trevor Woerner wrote:

> Skip the processing of *.aml and *.dat files while iterating through the
> source in order to process header files.
> 
> Signed-off-by: Trevor Woerner <twoerner@gmail.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210413/6fc5a6df/attachment.sig>

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

end of thread, other threads:[~2021-04-13 14:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-15 16:01 [PATCH 1/2] moveconfig.py: add try…except Trevor Woerner
2021-03-15 16:01 ` [PATCH 2/2] moveconfig.py: add to the "do not process" list Trevor Woerner
2021-04-13 14:29   ` Tom Rini
2021-04-07 17:15 ` [PATCH 1/2] moveconfig.py: add try…except Trevor Woerner

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