emacs-diffs
[Top][All Lists]
Advanced

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

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


From: Michael Albinus
Subject: [Emacs-diffs] emacs/lisp/net tramp.el
Date: Sun, 06 Sep 2009 14:18:55 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       09/09/06 14:18:55

Modified files:
        lisp/net       : tramp.el 

Log message:
        * net/tramp.el (tramp-perl-file-attributes): Print "nil" when
        lstat fails.
        (tramp-do-file-attributes-with-ls): Check for file existence at
        remote end.
        (tramp-do-file-attributes-with-stat): Likewise.
        (tramp-convert-file-attributes): Return nil when attr is nil.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/tramp.el?cvsroot=emacs&r1=1.254&r2=1.255

Patches:
Index: tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.254
retrieving revision 1.255
diff -u -b -r1.254 -r1.255
--- tramp.el    4 Sep 2009 08:14:30 -0000       1.254
+++ tramp.el    6 Sep 2009 14:18:54 -0000       1.255
@@ -1593,6 +1593,10 @@
 (defconst tramp-perl-file-attributes
   "%s -e '
 @stat = lstat($ARGV[0]);
+if (address@hidden) {
+    print \"nil\\n\";
+    exit 0;
+}
 if (($stat[2] & 0170000) == 0120000)
 {
     $type = readlink($ARGV[0]);
@@ -2523,12 +2527,17 @@
     (tramp-message vec 5 "file attributes with ls: %s" localname)
     (tramp-send-command
      vec
-     (format "%s %s %s"
+     (format "(%s %s || %s -h %s) && %s %s %s"
+            (tramp-get-file-exists-command vec)
+            (tramp-shell-quote-argument localname)
+            (tramp-get-test-command vec)
+            (tramp-shell-quote-argument localname)
             (tramp-get-ls-command vec)
             (if (eq id-format 'integer) "-ildn" "-ild")
             (tramp-shell-quote-argument localname)))
     ;; parse `ls -l' output ...
     (with-current-buffer (tramp-get-buffer vec)
+      (when (> (buffer-size) 0)
       (goto-char (point-min))
       ;; ... inode
       (setq res-inode
@@ -2598,7 +2607,7 @@
        res-inode
        ;; 11. Device number.  Will be replaced by a virtual device number.
        -1
-       ))))
+         )))))
 
 (defun tramp-do-file-attributes-with-perl
   (vec localname &optional id-format)
@@ -2618,7 +2627,11 @@
   (tramp-send-command-and-read
    vec
    (format
-    "%s -c '((\"%%N\") %%h %s %s %%X.0 %%Y.0 %%Z.0 %%s.0 \"%%A\" t %%i.0 -1)' 
%s"
+    "((%s %s || %s -h %s) && %s -c '((\"%%N\") %%h %s %s %%X.0 %%Y.0 %%Z.0 
%%s.0 \"%%A\" t %%i.0 -1)' %s || echo nil)"
+    (tramp-get-file-exists-command vec)
+    (tramp-shell-quote-argument localname)
+    (tramp-get-test-command vec)
+    (tramp-shell-quote-argument localname)
     (tramp-get-remote-stat vec)
     (if (eq id-format 'integer) "%u" "\"%U\"")
     (if (eq id-format 'integer) "%g" "\"%G\"")
@@ -7054,6 +7067,7 @@
   "Convert file-attributes ATTR generated by perl script, stat or ls.
 Convert file mode bits to string and set virtual device number.
 Return ATTR."
+  (when attr
   ;; Convert last access time.
   (unless (listp (nth 4 attr))
     (setcar (nthcdr 4 attr)
@@ -7083,7 +7097,7 @@
   ;; Convert directory indication bit.
   (when (string-match "^d" (nth 8 attr))
     (setcar attr t))
-  ;; Convert symlink from `tramp-handle-file-attributes-with-stat'.
+    ;; Convert symlink from `tramp-do-file-attributes-with-stat'.
   (when (consp (car attr))
     (if (and (stringp (caar attr))
             (string-match ".+ -> .\\(.+\\)." (caar attr)))
@@ -7108,7 +7122,7 @@
   ;; Set virtual device number.
   (setcar (nthcdr 11 attr)
           (tramp-get-device vec))
-  attr)
+    attr))
 
 (defun tramp-get-inode (vec)
   "Returns the virtual inode number.




reply via email to

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