From dd1c9e09792b7fb6db59352cde7e0609601a4908 Mon Sep 17 00:00:00 2001
From: Francois-Rene Rideau <tunes@google.com>
Date: Thu, 7 Feb 2013 06:36:18 +0100
Subject: [PATCH] 2.28.6: make utf-8 the default encoding for with-input-file,
 and thus warnings

This should fix some issue seen in cl-test-grid.
---
 asdf.asd          |   2 +-
 header.lisp       |   2 +-
 lisp-build.lisp   |   4 +-
 stream.lisp       | 106 +++++++++++++++++++++++-----------------------
 upgrade.lisp      |   2 +-
 version.lisp-expr |   2 +-
 6 files changed, 60 insertions(+), 58 deletions(-)

diff --git a/asdf.asd b/asdf.asd
index a30b132c..92f7fe3e 100644
--- a/asdf.asd
+++ b/asdf.asd
@@ -74,7 +74,7 @@
   :licence "MIT"
   :description "Another System Definition Facility"
   :long-description "ASDF builds Common Lisp software organized into defined systems."
-  :version "2.28.5" ;; to be automatically updated by make bump-version
+  :version "2.28.6" ;; to be automatically updated by make bump-version
   :depends-on ()
   #+asdf3 :encoding #+asdf3 :utf-8
   ;; For most purposes, asdf itself specially counts as a builtin system.
diff --git a/header.lisp b/header.lisp
index b7794f8f..9efcb619 100644
--- a/header.lisp
+++ b/header.lisp
@@ -1,5 +1,5 @@
 ;;; -*- mode: Common-Lisp; Base: 10 ; Syntax: ANSI-Common-Lisp -*-
-;;; This is ASDF 2.28.5: Another System Definition Facility.
+;;; This is ASDF 2.28.6: Another System Definition Facility.
 ;;;
 ;;; Feedback, bug reports, and patches are all welcome:
 ;;; please mail to <asdf-devel@common-lisp.net>.
diff --git a/lisp-build.lisp b/lisp-build.lisp
index 49f8f87a..139670bb 100644
--- a/lisp-build.lisp
+++ b/lisp-build.lisp
@@ -330,7 +330,9 @@ One of three functions required for deferred-warnings support in ASDF."
   (defun save-deferred-warnings (warnings-file)
     "Save forward reference conditions so they may be issued at a latter time,
 possibly in a different process."
-    (with-open-file (s warnings-file :direction :output :if-exists :supersede)
+    (with-open-file (s warnings-file :direction :output :if-exists :supersede
+                       :element-type *default-stream-element-type*
+                       :external-format *utf-8-external-format*)
       (with-safe-io-syntax ()
         (write (reify-deferred-warnings) :stream s :pretty t :readably t)
         (terpri s))))
diff --git a/stream.lisp b/stream.lisp
index 617991f5..c7c0b0ad 100644
--- a/stream.lisp
+++ b/stream.lisp
@@ -6,6 +6,9 @@
   (:use :asdf/common-lisp :asdf/package :asdf/utility :asdf/os :asdf/pathname :asdf/filesystem)
   (:export
    #:*default-stream-element-type* #:*stderr* #:setup-stderr
+   #:detect-encoding #:*encoding-detection-hook* #:always-default-encoding
+   #:encoding-external-format #:*encoding-external-format-hook* #:default-encoding-external-format
+   #:*default-encoding* #:*utf-8-external-format*
    #:with-safe-io-syntax #:call-with-safe-io-syntax
    #:with-output #:output-string #:with-input
    #:with-input-file #:call-with-input-file
@@ -16,9 +19,6 @@
    #:slurp-stream-forms #:slurp-stream-form
    #:read-file-string #:read-file-lines #:read-file-forms #:read-file-form #:safe-read-file-form
    #:eval-input #:eval-thunk #:standard-eval-thunk
-   #:detect-encoding #:*encoding-detection-hook* #:always-default-encoding
-   #:encoding-external-format #:*encoding-external-format-hook* #:default-encoding-external-format
-   #:*default-encoding* #:*utf-8-external-format*
    ;; Temporary files
    #:*temporary-directory* #:temporary-directory #:default-temporary-directory
    #:setup-temporary-directory
@@ -42,6 +42,55 @@
   (setup-stderr))
 
 
+;;; Encodings (mostly hooks only; full support requires asdf-encodings)
+(with-upgradability ()
+  (defvar *default-encoding* :default
+    "Default encoding for source files.
+The default value :default preserves the legacy behavior.
+A future default might be :utf-8 or :autodetect
+reading emacs-style -*- coding: utf-8 -*- specifications,
+and falling back to utf-8 or latin1 if nothing is specified.")
+
+  (defparameter *utf-8-external-format*
+    #+(and asdf-unicode (not clisp)) :utf-8
+    #+(and asdf-unicode clisp) charset:utf-8
+    #-asdf-unicode :default
+    "Default :external-format argument to pass to CL:OPEN and also
+CL:LOAD or CL:COMPILE-FILE to best process a UTF-8 encoded file.
+On modern implementations, this will decode UTF-8 code points as CL characters.
+On legacy implementations, it may fall back on some 8-bit encoding,
+with non-ASCII code points being read as several CL characters;
+hopefully, if done consistently, that won't affect program behavior too much.")
+
+  (defun always-default-encoding (pathname)
+    (declare (ignore pathname))
+    *default-encoding*)
+
+  (defvar *encoding-detection-hook* #'always-default-encoding
+    "Hook for an extension to define a function to automatically detect a file's encoding")
+
+  (defun detect-encoding (pathname)
+    (if (and pathname (not (directory-pathname-p pathname)) (probe-file* pathname))
+        (funcall *encoding-detection-hook* pathname)
+        *default-encoding*))
+
+  (defun default-encoding-external-format (encoding)
+    (case encoding
+      (:default :default) ;; for backward-compatibility only. Explicit usage discouraged.
+      (:utf-8 *utf-8-external-format*)
+      (otherwise
+       (cerror "Continue using :external-format :default" (compatfmt "~@<Your ASDF component is using encoding ~S but it isn't recognized. Your system should :defsystem-depends-on (:asdf-encodings).~:>") encoding)
+       :default)))
+
+  (defvar *encoding-external-format-hook*
+    #'default-encoding-external-format
+    "Hook for an extension to define a mapping between non-default encodings
+and implementation-defined external-format's")
+
+  (defun encoding-external-format (encoding)
+    (funcall *encoding-external-format-hook* encoding)))
+
+
 ;;; Safe syntax
 (with-upgradability ()
   (defvar *standard-readtable* (copy-readtable nil))
@@ -116,7 +165,7 @@ as per CALL-WITH-INPUT, and evaluate BODY within the scope of this binding."
   (defun call-with-input-file (pathname thunk
                                &key
                                  (element-type *default-stream-element-type*)
-                                 (external-format :default)
+                                 (external-format *utf-8-external-format*)
                                  (if-does-not-exist :error))
     "Open FILE for input with given recognizes options, call THUNK with the resulting stream.
 Other keys are accepted but discarded."
@@ -308,55 +357,6 @@ If a string, repeatedly read and evaluate from it, returning the last values."
           (eval-thunk thunk))))))
 
 
-;;; Encodings (mostly hooks only; full support requires asdf-encodings)
-(with-upgradability ()
-  (defvar *default-encoding* :default
-    "Default encoding for source files.
-The default value :default preserves the legacy behavior.
-A future default might be :utf-8 or :autodetect
-reading emacs-style -*- coding: utf-8 -*- specifications,
-and falling back to utf-8 or latin1 if nothing is specified.")
-
-  (defparameter *utf-8-external-format*
-    #+(and asdf-unicode (not clisp)) :utf-8
-    #+(and asdf-unicode clisp) charset:utf-8
-    #-asdf-unicode :default
-    "Default :external-format argument to pass to CL:OPEN and also
-CL:LOAD or CL:COMPILE-FILE to best process a UTF-8 encoded file.
-On modern implementations, this will decode UTF-8 code points as CL characters.
-On legacy implementations, it may fall back on some 8-bit encoding,
-with non-ASCII code points being read as several CL characters;
-hopefully, if done consistently, that won't affect program behavior too much.")
-
-  (defun always-default-encoding (pathname)
-    (declare (ignore pathname))
-    *default-encoding*)
-
-  (defvar *encoding-detection-hook* #'always-default-encoding
-    "Hook for an extension to define a function to automatically detect a file's encoding")
-
-  (defun detect-encoding (pathname)
-    (if (and pathname (not (directory-pathname-p pathname)) (probe-file* pathname))
-        (funcall *encoding-detection-hook* pathname)
-        *default-encoding*))
-
-  (defun default-encoding-external-format (encoding)
-    (case encoding
-      (:default :default) ;; for backward-compatibility only. Explicit usage discouraged.
-      (:utf-8 *utf-8-external-format*)
-      (otherwise
-       (cerror "Continue using :external-format :default" (compatfmt "~@<Your ASDF component is using encoding ~S but it isn't recognized. Your system should :defsystem-depends-on (:asdf-encodings).~:>") encoding)
-       :default)))
-
-  (defvar *encoding-external-format-hook*
-    #'default-encoding-external-format
-    "Hook for an extension to define a mapping between non-default encodings
-and implementation-defined external-format's")
-
-  (defun encoding-external-format (encoding)
-    (funcall *encoding-external-format-hook* encoding)))
-
-
 ;;; Using temporary files
 (with-upgradability ()
   (defun default-temporary-directory ()
diff --git a/upgrade.lisp b/upgrade.lisp
index f37ad13d..9c243210 100644
--- a/upgrade.lisp
+++ b/upgrade.lisp
@@ -52,7 +52,7 @@ You can compare this string with e.g.: (ASDF:VERSION-SATISFIES (ASDF:ASDF-VERSIO
          ;; "3.4.5.67" would be a development version in the official upstream of 3.4.5.
          ;; "3.4.5.0.8" would be your eighth local modification of official release 3.4.5
          ;; "3.4.5.67.8" would be your eighth local modification of development version 3.4.5.67
-         (asdf-version "2.28.5")
+         (asdf-version "2.28.6")
          (existing-version (asdf-version)))
     (setf *asdf-version* asdf-version)
     (when (and existing-version (not (equal asdf-version existing-version)))
diff --git a/version.lisp-expr b/version.lisp-expr
index 93cb37ac..afdb4999 100644
--- a/version.lisp-expr
+++ b/version.lisp-expr
@@ -1 +1 @@
-"2.28.5"
+"2.28.6"
-- 
GitLab