[Pkg-mc-commits] r55 - in trunk/debian: . patches

winnie at alioth.debian.org winnie at alioth.debian.org
Tue Feb 26 13:27:37 UTC 2008


Author: winnie
Date: 2008-02-26 13:27:36 +0000 (Tue, 26 Feb 2008)
New Revision: 55

Added:
   trunk/debian/patches/57_abort_on_not_readable_file.patch
Modified:
   trunk/debian/changelog
Log:
Add patch for problem


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2008-02-25 19:55:56 UTC (rev 54)
+++ trunk/debian/changelog	2008-02-26 13:27:36 UTC (rev 55)
@@ -3,8 +3,10 @@
   * Rediffed the named/strace/dsc syntax and added them to the Makefile.
   * Create file with 0600 if preserve Attributes is unchecked.
     (Closes: #466370)
+  * Don't abort on file transfers of unreadable files over fish. 
+    (Closes: #447239)
 
- -- Patrick Winnertz <winnie at debian.org>  Mon, 25 Feb 2008 20:54:45 +0100
+ -- Patrick Winnertz <winnie at debian.org>  Tue, 26 Feb 2008 13:49:43 +0100
 
 mc (1:4.6.2~pre1-3) unstable; urgency=low
 

Added: trunk/debian/patches/57_abort_on_not_readable_file.patch
===================================================================
--- trunk/debian/patches/57_abort_on_not_readable_file.patch	                        (rev 0)
+++ trunk/debian/patches/57_abort_on_not_readable_file.patch	2008-02-26 13:27:36 UTC (rev 55)
@@ -0,0 +1,136 @@
+--- mc-4.6.2~pre1/vfs/fish.c	2007-08-23 15:16:40.000000000 +0200
++++ mc-4.6.2~pre1/vfs/fish.c	2008-02-26 13:47:51.000000000 +0100
+@@ -1,7 +1,8 @@
+ /* Virtual File System: FISH implementation for transfering files over
+    shell connections.
+ 
+-   Copyright (C) 1998 The Free Software Foundation
++   Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
++   2007 Free Software Foundation, Inc.
+    
+    Written by: 1998 Pavel Machek
+    Spaces fix: 2000 Michal Svec
+@@ -355,6 +356,7 @@
+     struct vfs_s_entry *ent = NULL;
+     FILE *logfile;
+     char *quoted_path;
++    int reply_code;
+ 
+     logfile = MEDATA->logfile;
+ 
+@@ -365,6 +367,8 @@
+     quoted_path = name_quote (remote_path, 0);
+     fish_command (me, super, NONE,
+ 	    "#LIST /%s\n"
++	    "if ls -1 /%s >/dev/null 2>&1 ;\n"
++	    "then\n"
+ 	    "ls -lLan /%s 2>/dev/null | grep '^[^cbt]' | (\n"
+ 	      "while read p l u g s m d y n; do\n"
+ 	        "echo \"P$p $u.$g\nS$s\nd$m $d $y\n:$n\n\"\n"
+@@ -375,8 +379,11 @@
+ 	        "echo \"P$p $u.$g\nE$a$i\nd$m $d $y\n:$n\n\"\n"
+ 	      "done\n"
+ 	    ")\n"
+-	    "echo '### 200'\n",
+-	    remote_path, quoted_path, quoted_path);
++	    "echo '### 200'\n"
++	    "else\n"
++	    "echo '### 500'\n"
++	    "fi\n",
++	    remote_path, quoted_path, quoted_path, quoted_path);
+     g_free (quoted_path);
+     ent = vfs_s_generate_entry(me, NULL, dir, 0);
+     while (1) {
+@@ -455,17 +462,21 @@
+     }
+     
+     vfs_s_free_entry (me, ent);
+-    me->verrno = E_REMOTE;
+-    if (fish_decode_reply(buffer+4, 0) == COMPLETE) {
++    reply_code = fish_decode_reply(buffer + 4, 0);
++    if (reply_code == COMPLETE) {
+ 	g_free (SUP.cwdir);
+ 	SUP.cwdir = g_strdup (remote_path);
+ 	print_vfs_message (_("%s: done."), me->name);
+ 	return 0;
++    } else if (reply_code == ERROR) {
++	me->verrno = EACCES;
++    } else {
++	me->verrno = E_REMOTE;
+     }
+ 
+ error:
+     print_vfs_message (_("%s: failure"), me->name);
+-    return 1;
++    return -1;
+ }
+ 
+ static int
+@@ -618,25 +629,39 @@
+     g_free (name);
+     name = quoted_name;
+     fh->u.fish.append = 0;
++
++    /*
++     * Check whether the remote file is readable by using `dd' to copy 
++     * a single byte from the remote file to /dev/null. If `dd' completes
++     * with exit status of 0 use `cat' to send the file contents to the
++     * standard output (i.e. over the network).
++     */
+     offset = fish_command (me, FH_SUPER, WANT_STRING,
+ 		"#RETR /%s\n"
++		"if dd if=/%s of=/dev/null bs=1 count=1 2>/dev/null ;\n"
++		"then\n"
+ 		"ls -ln /%s 2>/dev/null | (\n"
+ 		  "read p l u g s r\n"
+ 		  "echo \"$s\"\n"
+ 		")\n"
+ 		"echo '### 100'\n"
+ 		"cat /%s\n"
+-		"echo '### 200'\n", 
+-		name, name, name );
++		"echo '### 200'\n"
++		"else\n"
++		"echo '### 500'\n" 
++		"fi\n",
++		name, name, name, name );
+     g_free (name);
+     if (offset != PRELIM) ERRNOR (E_REMOTE, 0);
+     fh->linear = LS_LINEAR_OPEN;
+     fh->u.fish.got = 0;
+-#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64 || (defined _LARGE_FILES && _LARGE_FILES)
+-    if (sscanf( reply_str, "%llu", &fh->u.fish.total )!=1)
++    errno = 0;
++#if SIZEOF_OFF_T == SIZEOF_LONG
++    fh->u.fish.total = strtol (reply_str, NULL, 10);
+ #else
+-    if (sscanf( reply_str, "%u", &fh->u.fish.total )!=1)
++    fh->u.fish.total = strtoll (reply_str, NULL, 10);
+ #endif
++    if (errno != 0)
+ 	ERRNOR (E_REMOTE, 0);
+     return 1;
+ }
+@@ -760,7 +785,7 @@
+     POSTFIX(OPT_FLUSH);
+ }
+ 
+-#define FISH_OP(name, chk, string) \
++#define FISH_OP(name, string) \
+ static int fish_##name (struct vfs_class *me, const char *path1, const char *path2) \
+ { \
+     char buf[BUF_LARGE]; \
+@@ -786,11 +811,10 @@
+     return fish_send_command(me, super2, buf, OPT_FLUSH); \
+ }
+ 
+-#define XTEST if (bucket1 != bucket2) { ERRNOR (EXDEV, -1); }
+-FISH_OP(rename, XTEST, "#RENAME /%s /%s\n"
++FISH_OP(rename, "#RENAME /%s /%s\n"
+ 		       "mv /%s /%s 2>/dev/null\n"
+ 		       "echo '### 000'" )
+-FISH_OP(link,   XTEST, "#LINK /%s /%s\n"
++FISH_OP(link,   "#LINK /%s /%s\n"
+ 		       "ln /%s /%s 2>/dev/null\n"
+ 		       "echo '### 000'" )
+ 




More information about the Pkg-mc-commits mailing list