emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs-diffs] emacs/lisp/net tramp.el


From: Karl Fogel
Subject: Re: [Emacs-diffs] emacs/lisp/net tramp.el
Date: Mon, 23 Nov 2009 15:49:32 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux)

Michael Albinus <address@hidden> writes:
> CVSROOT:      /sources/emacs
> Module name:  emacs
> Changes by:   Michael Albinus <albinus>       09/11/23 15:58:50
>
> Modified files:
>       lisp/net       : tramp.el 
>
> Log message:
>       * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
>       return.
>       (tramp-handle-make-symbolic-link)
>       (tramp-handle-dired-compress-file, tramp-handle-expand-file-name):
>       Quote file names.
>       (tramp-send-command-and-check): New argument DONT-SUPPRESS-ERR.
>       (tramp-handle-process-file): Use it.

It looks like this is a collection of unrelated fixes that you happened
to commit all at once.  Is that right?  (A summary line at the top would
be useful, because it would help the reader put herself in the right
frame of mind for absorbing the detailed changes.)

See http://lists.gnu.org/archive/html/emacs-devel/2009-11/msg00988.html
and the thread preceding it for why I'm making a point of asking, btw.

Best,
-Karl

> CVSWeb URLs:
> http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/tramp.el?cvsroot=emacs&r1=1.269&r2=1.270
>
> Patches:
> Index: tramp.el
> ===================================================================
> RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
> retrieving revision 1.269
> retrieving revision 1.270
> diff -u -b -r1.269 -r1.270
> --- tramp.el  19 Nov 2009 09:25:19 -0000      1.269
> +++ tramp.el  23 Nov 2009 15:58:49 -0000      1.270
> @@ -1030,7 +1030,7 @@
>  (defcustom tramp-shell-prompt-pattern
>    ;; Allow a prompt to start right after a ^M since it indeed would be
>    ;; displayed at the beginning of the line (and Zsh uses it).
> -  "\\(?:^\\|
> \\)[^#$%>\n]*[#$%>] *\\(\e\\[[0-9;]*[a-zA-Z] *\\)*"
> +  "\\(?:^\\|\r\\)[^#$%>\n]*[#$%>] *\\(\e\\[[0-9;]*[a-zA-Z] *\\)*"
>    "Regexp to match prompts from remote shell.
>  Normally, Tramp expects you to configure `shell-prompt-pattern'
>  correctly, but sometimes it happens that you are connecting to a
> @@ -2429,7 +2429,14 @@
>        ;; that FILENAME belongs to.
>        (zerop
>         (tramp-send-command-and-check
> -     l (format "cd %s && %s -sf %s %s" cwd ln filename l-localname) t)))))
> +     l
> +     (format
> +      "cd %s && %s -sf %s %s"
> +      (tramp-shell-quote-argument cwd)
> +      ln
> +      (tramp-shell-quote-argument filename)
> +      (tramp-shell-quote-argument l-localname))
> +     t)))))
>  
>  (defun tramp-handle-load (file &optional noerror nomessage nosuffix 
> must-suffix)
>    "Like `load' for Tramp files."
> @@ -3957,7 +3964,8 @@
>              ;; We found an uncompression rule.
>              (tramp-message v 0 "Uncompressing %s..." file)
>              (when (zerop (tramp-send-command-and-check
> -                          v (concat (nth 2 suffix) " " localname)))
> +                          v (concat (nth 2 suffix) " "
> +                                    (tramp-shell-quote-argument localname))))
>                (tramp-message v 0 "Uncompressing %s...done" file)
>                ;; `dired-remove-file' is not defined in XEmacs
>                (funcall (symbol-function 'dired-remove-file) file)
> @@ -3968,7 +3976,8 @@
>              ;; Try gzip.
>              (tramp-message v 0 "Compressing %s..." file)
>              (when (zerop (tramp-send-command-and-check
> -                          v (concat "gzip -f " localname)))
> +                          v (concat "gzip -f "
> +                                    (tramp-shell-quote-argument localname))))
>                (tramp-message v 0 "Compressing %s...done" file)
>                ;; `dired-remove-file' is not defined in XEmacs
>                (funcall (symbol-function 'dired-remove-file) file)
> @@ -4127,10 +4136,12 @@
>           (setq uname (concat uname user)))
>         (setq uname
>           (with-connection-property v uname
> -           (tramp-send-command v (format "cd %s; pwd" uname))
> +               (tramp-send-command
> +                v (format "cd %s; pwd" (tramp-shell-quote-argument uname)))
>             (with-current-buffer (tramp-get-buffer v)
>               (goto-char (point-min))
> -             (buffer-substring (point) (tramp-compat-line-end-position)))))
> +                 (buffer-substring
> +                  (point) (tramp-compat-line-end-position)))))
>         (setq localname (concat uname fname))))
>        ;; There might be a double slash, for example when "~/"
>        ;; expands to "/".  Remove this.
> @@ -4357,7 +4368,8 @@
>                      (tramp-send-command-and-check
>                       v (format "\\cd %s; %s"
>                                 (tramp-shell-quote-argument localname)
> -                               command)))
> +                               command)
> +                  nil t))
>           ;; We should show the output anyway.
>           (when outbuf
>             (with-current-buffer outbuf
> @@ -6892,7 +6904,8 @@
>                 (unless (zerop (tramp-send-command-and-check
>                                 vec
>                                 (format "echo %s | %s | %s"
> -                                       magic rem-enc rem-dec) t))
> +                                       magic rem-enc rem-dec)
> +                               t))
>                   (throw 'wont-work-remote nil))
>  
>                 (with-current-buffer (tramp-get-buffer vec)
> @@ -7250,20 +7263,22 @@
>        ;; Return value is whether end-of-output sentinel was found.
>        found)))
>  
> -(defun tramp-send-command-and-check (vec command &optional subshell)
> +(defun tramp-send-command-and-check
> +  (vec command &optional subshell dont-suppress-err)
>    "Run COMMAND and check its exit status.
>  Sends `echo $?' along with the COMMAND for checking the exit status.  If
>  COMMAND is nil, just sends `echo $?'.  Returns the exit status found.
>  
> -If the optional argument SUBSHELL is non-nil, the command is executed in
> -a subshell, ie surrounded by parentheses."
> +If the optional argument SUBSHELL is non-nil, the command is
> +executed in a subshell, ie surrounded by parentheses.  If
> +DONT-SUPPRESS-ERR is non-nil, stderr won't be sent to /dev/null."
>    (tramp-send-command
>     vec
>     (concat (if subshell "( " "")
>          command
> -        (if command " 2>/dev/null; " "")
> +        (if command (if dont-suppress-err "; " " 2>/dev/null; ") "")
>          "echo tramp_exit_status $?"
> -        (if subshell " )" " ")))
> +        (if subshell " )" "")))
>    (with-current-buffer (tramp-get-connection-buffer vec)
>      (goto-char (point-max))
>      (unless (re-search-backward "tramp_exit_status [0-9]+" nil t)
>
>
> _______________________________________________
> Emacs-diffs mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-diffs




reply via email to

[Prev in Thread] Current Thread [Next in Thread]