commit daab2d3a62ac8fb1c74987e614cee93dc79fab74 (HEAD, refs/remotes/origin/master) Author: Paul Eggert Date: Tue May 5 00:48:48 2020 -0700 Fix typos in recent attribute.h simplification Problem reported by Andreas Schwab in: https://lists.gnu.org/r/emacs-devel/2020-05/msg00650.html * src/conf_post.h (HAS_ATTR_no_sanitize): Define to false in case cpp is picky, fixing a longstanding glitch here. (ATTRIBUTE_NO_SANITIZE_ADDRESS, ATTRIBUTE_NO_SANITIZE_UNDEFINED): Use HAS_ATTRIBUTE, not __has_attribute. diff --git a/src/conf_post.h b/src/conf_post.h index 953b783ebe..1ef4ff3342 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -77,6 +77,7 @@ typedef bool bool_bf; # define HAS_ATTRIBUTE(a) HAS_ATTR_##a # define HAS_ATTR_cleanup GNUC_PREREQ (3, 4, 0) # define HAS_ATTR_no_address_safety_analysis false +# define HAS_ATTR_no_sanitize false # define HAS_ATTR_no_sanitize_address GNUC_PREREQ (4, 8, 0) # define HAS_ATTR_no_sanitize_undefined GNUC_PREREQ (4, 9, 0) #endif @@ -294,10 +295,10 @@ extern int emacs_setenv_TZ (char const *); /* Attribute of functions whose code should not have addresses sanitized. */ -#if __has_attribute (no_sanitize_address) +#if HAS_ATTRIBUTE (no_sanitize_address) # define ATTRIBUTE_NO_SANITIZE_ADDRESS \ __attribute__ ((no_sanitize_address)) ADDRESS_SANITIZER_WORKAROUND -#elif __has_attribute (no_address_safety_analysis) +#elif HAS_ATTRIBUTE (no_address_safety_analysis) # define ATTRIBUTE_NO_SANITIZE_ADDRESS \ __attribute__ ((no_address_safety_analysis)) ADDRESS_SANITIZER_WORKAROUND #else @@ -306,9 +307,9 @@ extern int emacs_setenv_TZ (char const *); /* Attribute of functions whose undefined behavior should not be sanitized. */ -#if __has_attribute (no_sanitize_undefined) +#if HAS_ATTRIBUTE (no_sanitize_undefined) # define ATTRIBUTE_NO_SANITIZE_UNDEFINED __attribute__ ((no_sanitize_undefined)) -#elif __has_attribute (no_sanitize) +#elif HAS_ATTRIBUTE (no_sanitize) # define ATTRIBUTE_NO_SANITIZE_UNDEFINED \ __attribute__ ((no_sanitize ("undefined"))) #else commit 2db70edd9cc8b52cb32c97fe2ff0ae008f02a31c Author: Michael Albinus Date: Mon May 4 13:09:32 2020 +0200 Adapt Tramp tests * test/lisp/net/tramp-tests.el (tramp-test33-environment-variables): Adapt test. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 75a0167da7..28d20e39f8 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4869,65 +4869,71 @@ INPUT, if non-nil, is a string sent to the process." (envvar (concat "VAR_" (upcase (md5 (current-time-string))))) kill-buffer-query-functions) - (unwind-protect - ;; Set a value. - (let ((process-environment - (cons (concat envvar "=foo") process-environment))) - ;; Default value. - (should - (string-match - "foo" - (funcall - this-shell-command-to-string - (format "echo -n ${%s:-bla}" envvar)))))) - - (unwind-protect - ;; Set the empty value. - (let ((process-environment - (cons (concat envvar "=") process-environment))) - ;; Value is null. - (should - (string-match - "bla" - (funcall - this-shell-command-to-string - (format "echo -n ${%s:-bla}" envvar)))) - ;; Variable is set. - (should - (string-match - (regexp-quote envvar) - (funcall this-shell-command-to-string "set"))))) + ;; Check INSIDE_EMACS. + (should + (string-equal + (format "%s,tramp:%s" emacs-version tramp-version) + (funcall this-shell-command-to-string "echo -n ${INSIDE_EMACS:-bla}"))) + (let ((process-environment + (cons (format "INSIDE_EMACS=%s,foo" emacs-version) + process-environment))) + (should + (string-equal + (format "%s,foo,tramp:%s" emacs-version tramp-version) + (funcall + this-shell-command-to-string "echo -n ${INSIDE_EMACS:-bla}")))) + + ;; Set a value. + (let ((process-environment + (cons (concat envvar "=foo") process-environment))) + ;; Default value. + (should + (string-match + "foo" + (funcall + this-shell-command-to-string (format "echo -n ${%s:-bla}" envvar))))) + + ;; Set the empty value. + (let ((process-environment + (cons (concat envvar "=") process-environment))) + ;; Value is null. + (should + (string-match + "bla" + (funcall + this-shell-command-to-string (format "echo -n ${%s:-bla}" envvar)))) + ;; Variable is set. + (should + (string-match + (regexp-quote envvar) + (funcall this-shell-command-to-string "set")))) ;; We force a reconnect, in order to have a clean environment. (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password) - (unwind-protect - ;; Unset the variable. - (let ((tramp-remote-process-environment - (cons (concat envvar "=foo") - tramp-remote-process-environment))) - ;; Set the initial value, we want to unset below. - (should - (string-match - "foo" - (funcall - this-shell-command-to-string - (format "echo -n ${%s:-bla}" envvar)))) - (let ((process-environment - (cons envvar process-environment))) - ;; Variable is unset. - (should - (string-match - "bla" - (funcall - this-shell-command-to-string - (format "echo -n ${%s:-bla}" envvar)))) - ;; Variable is unset. - (should-not - (string-match - (regexp-quote envvar) - ;; We must remove PS1, the output is truncated otherwise. - (funcall - this-shell-command-to-string "printenv | grep -v PS1"))))))))) + ;; Unset the variable. + (let ((tramp-remote-process-environment + (cons (concat envvar "=foo") tramp-remote-process-environment))) + ;; Set the initial value, we want to unset below. + (should + (string-match + "foo" + (funcall + this-shell-command-to-string (format "echo -n ${%s:-bla}" envvar)))) + (let ((process-environment (cons envvar process-environment))) + ;; Variable is unset. + (should + (string-match + "bla" + (funcall + this-shell-command-to-string + (format "echo -n ${%s:-bla}" envvar)))) + ;; Variable is unset. + (should-not + (string-match + (regexp-quote envvar) + ;; We must remove PS1, the output is truncated otherwise. + (funcall + this-shell-command-to-string "printenv | grep -v PS1")))))))) ;; This test is inspired by Bug#27009. (ert-deftest tramp-test33-environment-variables-and-port-numbers () commit 221e6a9bcdd50a3a134f09840f4a894ff73fb3e6 Author: Michael Albinus Date: Mon May 4 10:43:58 2020 +0200 Fix setting of INSIDE_EMACS in Tramp * lisp/net/tramp-sh.el (tramp-sh-handle-make-process) (tramp-sh-handle-process-file, tramp-open-shell): Set proper INSIDE_EMACS environment variable. diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 21ef1efa0d..592dcf6715 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2912,6 +2912,11 @@ STDERR can also be a file name." (setq uenv (cons elt uenv))))))) (command (when (stringp program) + (setenv-internal + env "INSIDE_EMACS" + (concat (or (getenv "INSIDE_EMACS") emacs-version) + ",tramp:" tramp-version) + 'keep) (format "cd %s && %s exec %s %s env %s %s" (tramp-shell-quote-argument localname) (if uenv @@ -3061,6 +3066,11 @@ STDERR can also be a file name." (if (tramp-get-env-with-u-option v) (setq env (append `("-u" ,elt) env)) (setq uenv (cons elt uenv)))))) + (setenv-internal + env "INSIDE_EMACS" + (concat (or (getenv "INSIDE_EMACS") emacs-version) + ",tramp:" tramp-version) + 'keep) (when env (setq command (format @@ -4169,7 +4179,7 @@ file exists and nonzero exit status otherwise." "exec env TERM='%s' INSIDE_EMACS='%s,tramp:%s' " "ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s")) tramp-terminal-type - emacs-version tramp-version ; INSIDE_EMACS + (or (getenv "INSIDE_EMACS") emacs-version) tramp-version (or (getenv-internal "ENV" tramp-remote-process-environment) "") (if (stringp tramp-histfile-override) (format "HISTFILE=%s"