tramp-devel
[Top][All Lists]
Advanced

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

Re: Two problems with tramp & smb


From: Michael Albinus
Subject: Re: Two problems with tramp & smb
Date: Sat, 06 Dec 2003 23:00:59 +0100
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/20.7 (hpux)

Christoph Bauer <address@hidden> writes:

> Hi,

Hi,

>    * new files:
>         it is not possible to create a new file. I get just an useless 
> read-only
>         buffer.

The function `tramp-smb-handle-file-writable-p' did check existing
files only. The following patch should fix it:

diff -u tramp-smb.el.~1~ tramp-smb.el
--- tramp-smb.el.~1~    Sun Nov 30 18:43:32 2003
+++ tramp-smb.el        Sat Dec  6 22:51:14 2003
@@ -452,19 +452,23 @@
 
 (defun tramp-smb-handle-file-writable-p (filename)
   "Like `file-writable-p' for tramp files."
-;  (with-parsed-tramp-file-name filename nil
-  (let         (user host localname)
-    (with-parsed-tramp-file-name filename l
-      (setq user l-user host l-host localname l-localname))
-    (save-excursion
-      (let* ((share (tramp-smb-get-share localname))
-            (file (tramp-smb-get-localname localname nil))
-            (entries (tramp-smb-get-file-entries user host share file))
-            (entry (and entries
-                        (assoc (file-name-nondirectory file) entries))))
-       (and entry
-            (string-match "w" (nth 1 entry))
-            t)))))
+  (if (not (file-exists-p filename))
+      (let ((dir (file-name-directory filename)))
+       (and (file-exists-p dir)
+            (file-writable-p dir)))
+;    (with-parsed-tramp-file-name filename nil
+    (let (user host localname)
+      (with-parsed-tramp-file-name filename l
+       (setq user l-user host l-host localname l-localname))
+      (save-excursion
+       (let* ((share (tramp-smb-get-share localname))
+              (file (tramp-smb-get-localname localname nil))
+              (entries (tramp-smb-get-file-entries user host share file))
+              (entry (and entries
+                          (assoc (file-name-nondirectory file) entries))))
+         (and share entry
+              (string-match "w" (nth 1 entry))
+              t))))))
 
 (defun tramp-smb-handle-insert-directory
   (filename switches &optional wildcard full-directory-p)
@@ -735,7 +739,7 @@
 
 
        ;; Add directory itself
-       (add-to-list 'res '("" "dr-xr-xr-x" 0 (0 0)))
+       (add-to-list 'res '("" "drwxrwxrwx" 0 (0 0)))
 
        ;; Check for matching entries
        (delq nil (mapcar

> greetings,
> Christoph

Thanx for reporting the bug. Best regards, Michael.





reply via email to

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