unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH COMMITTED] scripts/check-obsolete-constructs.py: Process all headers as UTF-8.
@ 2019-03-14 13:49 Zack Weinberg
  2019-03-14 19:19 ` Carlos O'Donell
  0 siblings, 1 reply; 2+ messages in thread
From: Zack Weinberg @ 2019-03-14 13:49 UTC (permalink / raw)
  To: libc-alpha

A few of our installed headers contain UTF-8 in comments.
check-obsolete-constructs opened files without explicitly specifying
their encoding, so it would barf on these headers if “make check” was
run in a non-UTF-8 locale.

	* scripts/check-obsolete-constructs.py (HeaderChecker.check):
	Specify encoding="utf-8" when opening headers to check.
---
 ChangeLog                            | 5 +++++
 scripts/check-obsolete-constructs.py | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index f2cdcd7a66..f0281e5d10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-03-14  Zack Weinberg  <zackw@panix.com>
+
+	* scripts/check-obsolete-constructs.py (HeaderChecker.check):
+	Specify encoding="utf-8" when opening headers to check.
+
 2019-03-13  Joseph Myers  <joseph@codesourcery.com>
 
 	* scripts/build-many-glibcs.py (Context.checkout): Default Linux
diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py
index ce5c72251f..89d21dea6e 100755
--- a/scripts/check-obsolete-constructs.py
+++ b/scripts/check-obsolete-constructs.py
@@ -437,7 +437,7 @@ class HeaderChecker:
     def check(self, fname):
         self.fname = fname
         try:
-            with open(fname, "rt") as fp:
+            with open(fname, "rt", encoding="utf-8") as fp:
                 contents = fp.read()
         except OSError as e:
             sys.stderr.write("{}: {}\n".format(fname, e.strerror))
-- 
2.20.1


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

* Re: [PATCH COMMITTED] scripts/check-obsolete-constructs.py: Process all headers as UTF-8.
  2019-03-14 13:49 [PATCH COMMITTED] scripts/check-obsolete-constructs.py: Process all headers as UTF-8 Zack Weinberg
@ 2019-03-14 19:19 ` Carlos O'Donell
  0 siblings, 0 replies; 2+ messages in thread
From: Carlos O'Donell @ 2019-03-14 19:19 UTC (permalink / raw)
  To: Zack Weinberg, libc-alpha

On 3/14/19 9:49 AM, Zack Weinberg wrote:
> A few of our installed headers contain UTF-8 in comments.
> check-obsolete-constructs opened files without explicitly specifying
> their encoding, so it would barf on these headers if “make check” was
> run in a non-UTF-8 locale.
> 
> 	* scripts/check-obsolete-constructs.py (HeaderChecker.check):
> 	Specify encoding="utf-8" when opening headers to check.
> ---
>  ChangeLog                            | 5 +++++
>  scripts/check-obsolete-constructs.py | 2 +-
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/ChangeLog b/ChangeLog
> index f2cdcd7a66..f0281e5d10 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,8 @@
> +2019-03-14  Zack Weinberg  <zackw@panix.com>
> +
> +	* scripts/check-obsolete-constructs.py (HeaderChecker.check):
> +	Specify encoding="utf-8" when opening headers to check.
> +
>  2019-03-13  Joseph Myers  <joseph@codesourcery.com>
>  
>  	* scripts/build-many-glibcs.py (Context.checkout): Default Linux
> diff --git a/scripts/check-obsolete-constructs.py b/scripts/check-obsolete-constructs.py
> index ce5c72251f..89d21dea6e 100755
> --- a/scripts/check-obsolete-constructs.py
> +++ b/scripts/check-obsolete-constructs.py
> @@ -437,7 +437,7 @@ class HeaderChecker:
>      def check(self, fname):
>          self.fname = fname
>          try:
> -            with open(fname, "rt") as fp:
> +            with open(fname, "rt", encoding="utf-8") as fp:
>                  contents = fp.read()
>          except OSError as e:
>              sys.stderr.write("{}: {}\n".format(fname, e.strerror))
> 

Thanks for fixing this!

-- 
Cheers,
Carlos.

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

end of thread, other threads:[~2019-03-14 19:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-14 13:49 [PATCH COMMITTED] scripts/check-obsolete-constructs.py: Process all headers as UTF-8 Zack Weinberg
2019-03-14 19:19 ` Carlos O'Donell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).