GNU bug report logs - #23952
25.0.95; Regression: vc (git) over TRAMP doesn't work anymore

Previous Next

Package: emacs;

Reported by: Dima Kogan <dima <at> secretsauce.net>

Date: Tue, 12 Jul 2016 05:40:02 UTC

Severity: normal

Found in version 25.0.95

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23952 in the body.
You can then email your comments to 23952 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#23952; Package emacs. (Tue, 12 Jul 2016 05:40:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dima Kogan <dima <at> secretsauce.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 12 Jul 2016 05:40:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dima Kogan <dima <at> secretsauce.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 25.0.95; Regression: vc (git) over TRAMP doesn't work anymore
Date: Mon, 11 Jul 2016 22:38:41 -0700
Hi. I'm running a very recent emacs built from git (658daf9). In the
last two weeks or so, remote VC mode stopped working. Recipe:

1. emacs -Q
2. C-x C-f /127.0.0.1:emacs (or any other remote path that has a git
   repo)
3. C-x C-v D (or any other VC-mode function)

Instead of seeing VC mode do its thing it now throws an error:

  env: ‘GIT_DIR’: No such file or directory




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23952; Package emacs. (Tue, 12 Jul 2016 07:45:01 GMT) Full text and rfc822 format available.

Message #8 received at 23952 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Dima Kogan <dima <at> secretsauce.net>
Cc: 23952 <at> debbugs.gnu.org
Subject: Re: bug#23952: 25.0.95;
 Regression: vc (git) over TRAMP doesn't work anymore
Date: Tue, 12 Jul 2016 09:43:58 +0200
Dima Kogan <dima <at> secretsauce.net> writes:

> Hi.

Hi,

> I'm running a very recent emacs built from git (658daf9). In the
> last two weeks or so, remote VC mode stopped working. Recipe:
>
> 1. emacs -Q
> 2. C-x C-f /127.0.0.1:emacs (or any other remote path that has a git
>    repo)
> 3. C-x C-v D (or any other VC-mode function)
>
> Instead of seeing VC mode do its thing it now throws an error:
>
>   env: ‘GIT_DIR’: No such file or directory

This is due to Bug#23769, adding "GIT_DIR" to `process-environment'.
Tramp handles properly entries like "key=value" and "key=", entries like
"key" are not handled properly yet.

The following patch towards the emacs-25 branch fixes this:

--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/emacs-25/lisp/net/tramp-sh.el.~f981b3136742a8597674dd4915afeb1b220a0464~	2016-07-12 09:41:08.663542129 +0200
--- /home/albinus/src/emacs-25/lisp/net/tramp-sh.el	2016-07-12 09:41:03.843470688 +0200
***************
*** 3034,3040 ****
  		 (cons prompt (nreverse (copy-sequence process-environment)))
  		 env)
  	      (or (member elt (default-toplevel-value 'process-environment))
! 		  (setq env (cons elt env)))))
  	   (command
  	    (when (stringp program)
  	      (format "cd %s && exec %s env %s %s"
--- 3034,3043 ----
  		 (cons prompt (nreverse (copy-sequence process-environment)))
  		 env)
  	      (or (member elt (default-toplevel-value 'process-environment))
!                   (setq env
!                         (if (string-match "=" elt)
!                             (append env `(,elt))
!                           (append `("-u" ,elt) env))))))
  	   (command
  	    (when (stringp program)
  	      (format "cd %s && exec %s env %s %s"
***************
*** 3135,3141 ****
        (setq env
  	    (dolist (elt (nreverse (copy-sequence process-environment)) env)
  	      (or (member elt (default-toplevel-value 'process-environment))
! 		  (setq env (cons elt env)))))
        (when env
  	(setq command
  	      (format
--- 3138,3147 ----
        (setq env
  	    (dolist (elt (nreverse (copy-sequence process-environment)) env)
  	      (or (member elt (default-toplevel-value 'process-environment))
!                   (setq env
!                         (if (string-match "=" elt)
!                             (append env `(,elt))
!                           (append `("-u" ,elt) env))))))
        (when env
  	(setq command
  	      (format
--8<---------------cut here---------------end--------------->8---

Should this be pushed to the emacs-25 branch, or to master?

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23952; Package emacs. (Tue, 12 Jul 2016 07:50:02 GMT) Full text and rfc822 format available.

Message #11 received at 23952 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 23952 <at> debbugs.gnu.org, dima <at> secretsauce.net
Subject: Re: bug#23952: 25.0.95;
 Regression: vc (git) over TRAMP doesn't work anymore
Date: Tue, 12 Jul 2016 10:49:11 +0300
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Date: Tue, 12 Jul 2016 09:43:58 +0200
> Cc: 23952 <at> debbugs.gnu.org
> 
> Should this be pushed to the emacs-25 branch, or to master?

emacs-25, please.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23952; Package emacs. (Tue, 12 Jul 2016 07:53:01 GMT) Full text and rfc822 format available.

Message #14 received at 23952 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> suse.de>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 23952 <at> debbugs.gnu.org, Dima Kogan <dima <at> secretsauce.net>
Subject: Re: bug#23952: 25.0.95;
 Regression: vc (git) over TRAMP doesn't work anymore
Date: Tue, 12 Jul 2016 09:52:01 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

> !                   (setq env
> !                         (if (string-match "=" elt)
> !                             (append env `(,elt))
> !                           (append `("-u" ,elt) env))))))

env -u is a GNU extension.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab <at> suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23952; Package emacs. (Tue, 12 Jul 2016 14:54:02 GMT) Full text and rfc822 format available.

Message #17 received at 23952 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Andreas Schwab <schwab <at> suse.de>
Cc: 23952 <at> debbugs.gnu.org, Dima Kogan <dima <at> secretsauce.net>
Subject: Re: bug#23952: 25.0.95;
 Regression: vc (git) over TRAMP doesn't work anymore
Date: Tue, 12 Jul 2016 16:53:15 +0200
Andreas Schwab <schwab <at> suse.de> writes:

> env -u is a GNU extension.

Indeed. The following patch should care for non-gnu remote systems:

--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/emacs-25/lisp/net/tramp-sh.el.~f981b3136742a8597674dd4915afeb1b220a0464~	2016-07-12 16:47:21.714648048 +0200
--- /home/albinus/src/emacs-25/lisp/net/tramp-sh.el	2016-07-12 16:36:03.505265390 +0200
***************
*** 3027,3044 ****
  			   tramp-initial-end-of-output))
  	   ;; We use as environment the difference to toplevel
  	   ;; `process-environment'.
! 	   env
! 	   (env
! 	    (dolist
! 		(elt
! 		 (cons prompt (nreverse (copy-sequence process-environment)))
! 		 env)
! 	      (or (member elt (default-toplevel-value 'process-environment))
! 		  (setq env (cons elt env)))))
  	   (command
  	    (when (stringp program)
! 	      (format "cd %s && exec %s env %s %s"
  		      (tramp-shell-quote-argument localname)
  		      (if heredoc (format "<<'%s'" tramp-end-of-heredoc) "")
  		      (mapconcat 'tramp-shell-quote-argument env " ")
  		      (if heredoc
--- 3027,3049 ----
  			   tramp-initial-end-of-output))
  	   ;; We use as environment the difference to toplevel
  	   ;; `process-environment'.
! 	   env uenv
! 	   (env (dolist (elt (cons prompt process-environment) env)
!                   (or (member elt (default-toplevel-value 'process-environment))
!                       (if (string-match "=" elt)
!                           (setq env (append env `(,elt)))
!                         (if (tramp-get-env-with-u-option v)
!                             (setq env (append `("-u" ,elt) env))
!                           (setq uenv (cons elt uenv)))))))
  	   (command
  	    (when (stringp program)
! 	      (format "cd %s && %s exec %s env %s %s"
  		      (tramp-shell-quote-argument localname)
+                       (if uenv
+                           (format
+                            "unset %s &&"
+                            (mapconcat 'tramp-shell-quote-argument uenv " "))
+                         "")
  		      (if heredoc (format "<<'%s'" tramp-end-of-heredoc) "")
  		      (mapconcat 'tramp-shell-quote-argument env " ")
  		      (if heredoc
***************
*** 3127,3146 ****
      (error "Implementation does not handle immediate return"))
  
    (with-parsed-tramp-file-name default-directory nil
!     (let (command env input tmpinput stderr tmpstderr outbuf ret)
        ;; Compute command.
        (setq command (mapconcat 'tramp-shell-quote-argument
  			       (cons program args) " "))
        ;; We use as environment the difference to toplevel `process-environment'.
!       (setq env
! 	    (dolist (elt (nreverse (copy-sequence process-environment)) env)
! 	      (or (member elt (default-toplevel-value 'process-environment))
! 		  (setq env (cons elt env)))))
        (when env
  	(setq command
  	      (format
  	       "env %s %s"
  	       (mapconcat 'tramp-shell-quote-argument env " ") command)))
        ;; Determine input.
        (if (null infile)
  	  (setq input "/dev/null")
--- 3132,3159 ----
      (error "Implementation does not handle immediate return"))
  
    (with-parsed-tramp-file-name default-directory nil
!     (let (command env uenv input tmpinput stderr tmpstderr outbuf ret)
        ;; Compute command.
        (setq command (mapconcat 'tramp-shell-quote-argument
  			       (cons program args) " "))
        ;; We use as environment the difference to toplevel `process-environment'.
!       (dolist (elt process-environment)
!         (or (member elt (default-toplevel-value 'process-environment))
!             (if (string-match "=" elt)
!                 (setq env (append env `(,elt)))
!               (if (tramp-get-env-with-u-option v)
!                   (setq env (append `("-u" ,elt) env))
!                 (setq uenv (cons elt uenv))))))
        (when env
  	(setq command
  	      (format
  	       "env %s %s"
  	       (mapconcat 'tramp-shell-quote-argument env " ") command)))
+       (when uenv
+         (setq command
+               (format
+                "unset %s && %s"
+                (mapconcat 'tramp-shell-quote-argument uenv " ") command)))
        ;; Determine input.
        (if (null infile)
  	  (setq input "/dev/null")
***************
*** 5695,5700 ****
--- 5708,5720 ----
         ((and (equal id-format 'string) (not (stringp res))) "UNKNOWN")
         (t res)))))
  
+ (defun tramp-get-env-with-u-option (vec)
+   (with-tramp-connection-property vec "env-u-option"
+     (tramp-message vec 5 "Checking, whether `env -u' works")
+     ;; Option "-u" is a GNU extension.
+     (tramp-send-command-and-check
+      vec "env FOO=foo env -u FOO 2>/dev/null | grep -qv FOO" t)))
+ 
  ;; Some predefined connection properties.
  (defun tramp-get-inline-compress (vec prop size)
    "Return the compress command related to PROP.
--8<---------------cut here---------------end--------------->8---

Should this still go to the emacs-25 branch?

> Andreas.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23952; Package emacs. (Tue, 12 Jul 2016 15:09:02 GMT) Full text and rfc822 format available.

Message #20 received at 23952 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 23952 <at> debbugs.gnu.org, schwab <at> suse.de, dima <at> secretsauce.net
Subject: Re: bug#23952: 25.0.95;
 Regression: vc (git) over TRAMP doesn't work anymore
Date: Tue, 12 Jul 2016 18:07:57 +0300
> From: Michael Albinus <michael.albinus <at> gmx.de>
> Date: Tue, 12 Jul 2016 16:53:15 +0200
> Cc: 23952 <at> debbugs.gnu.org, Dima Kogan <dima <at> secretsauce.net>
> 
> Should this still go to the emacs-25 branch?

Do you consider it safe enough for the release branch?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23952; Package emacs. (Tue, 12 Jul 2016 15:38:02 GMT) Full text and rfc822 format available.

Message #23 received at 23952 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 23952 <at> debbugs.gnu.org, schwab <at> suse.de, dima <at> secretsauce.net
Subject: Re: bug#23952: 25.0.95;
 Regression: vc (git) over TRAMP doesn't work anymore
Date: Tue, 12 Jul 2016 17:37:12 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Should this still go to the emacs-25 branch?
>
> Do you consider it safe enough for the release branch?

Well, I've tested it here in several variants, for GNU "env -u", and for
the non-GNU "env" variant. In both cases, `vc-dir' works again for a
remote git-controlled directory. So I regard it as safe, yes.

Maybe Dima could recheck the patch?

I would also add some few tests to tramp-tests.el. Tomorrow.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23952; Package emacs. (Tue, 12 Jul 2016 16:09:01 GMT) Full text and rfc822 format available.

Message #26 received at 23952 <at> debbugs.gnu.org (full text, mbox):

From: Dima Kogan <lists <at> dima.secretsauce.net>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 23952 <at> debbugs.gnu.org, schwab <at> suse.de, Eli Zaretskii <eliz <at> gnu.org>
Subject: Re: bug#23952: 25.0.95;
 Regression: vc (git) over TRAMP doesn't work anymore
Date: Tue, 12 Jul 2016 09:08:43 -0700
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> Should this still go to the emacs-25 branch?
>>
>> Do you consider it safe enough for the release branch?
>
> Well, I've tested it here in several variants, for GNU "env -u", and for
> the non-GNU "env" variant. In both cases, `vc-dir' works again for a
> remote git-controlled directory. So I regard it as safe, yes.
>
> Maybe Dima could recheck the patch?

I just tested it on my machine (fairly vanilla Debian/sid install) and
it fixes the issue. Thank you, Michael.

dima




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#23952; Package emacs. (Tue, 12 Jul 2016 17:49:02 GMT) Full text and rfc822 format available.

Message #29 received at 23952 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dima Kogan <lists <at> dima.secretsauce.net>
Cc: 23952 <at> debbugs.gnu.org, schwab <at> suse.de, michael.albinus <at> gmx.de
Subject: Re: bug#23952: 25.0.95;
 Regression: vc (git) over TRAMP doesn't work anymore
Date: Tue, 12 Jul 2016 20:47:17 +0300
> From: Dima Kogan <lists <at> dima.secretsauce.net>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, schwab <at> suse.de, 23952 <at> debbugs.gnu.org
> Date: Tue, 12 Jul 2016 09:08:43 -0700
> 
> Michael Albinus <michael.albinus <at> gmx.de> writes:
> 
> > Eli Zaretskii <eliz <at> gnu.org> writes:
> >
> >>> Should this still go to the emacs-25 branch?
> >>
> >> Do you consider it safe enough for the release branch?
> >
> > Well, I've tested it here in several variants, for GNU "env -u", and for
> > the non-GNU "env" variant. In both cases, `vc-dir' works again for a
> > remote git-controlled directory. So I regard it as safe, yes.
> >
> > Maybe Dima could recheck the patch?
> 
> I just tested it on my machine (fairly vanilla Debian/sid install) and
> it fixes the issue. Thank you, Michael.

OK, thanks.  Let's push to emacs-25, then.




Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Tue, 12 Jul 2016 18:16:02 GMT) Full text and rfc822 format available.

Notification sent to Dima Kogan <dima <at> secretsauce.net>:
bug acknowledged by developer. (Tue, 12 Jul 2016 18:16:02 GMT) Full text and rfc822 format available.

Message #34 received at 23952-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Dima Kogan <lists <at> dima.secretsauce.net>, schwab <at> suse.de,
 23952-done <at> debbugs.gnu.org
Subject: Re: bug#23952: 25.0.95;
 Regression: vc (git) over TRAMP doesn't work anymore
Date: Tue, 12 Jul 2016 20:15:42 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> > Maybe Dima could recheck the patch?
>> 
>> I just tested it on my machine (fairly vanilla Debian/sid install) and
>> it fixes the issue. Thank you, Michael.
>
> OK, thanks.  Let's push to emacs-25, then.

Done, closing the bug.

"make -C test/automated tramp-tests" passes also all tests, at least
there is no obvious regression. As promised, I'll add another test for
environment variables, tomorrow.

Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 11 Aug 2016 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 313 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.