SOURCES: mc-userhost.patch (NEW), mc-uglydir.patch (NEW), mc-symcr...

arekm arekm at pld-linux.org
Tue Sep 20 00:00:36 CEST 2005


Author: arekm                        Date: Mon Sep 19 22:00:35 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- new from fc4

---- Files affected:
SOURCES:
   mc-userhost.patch (NONE -> 1.1)  (NEW), mc-uglydir.patch (NONE -> 1.1)  (NEW), mc-symcrash.patch (NONE -> 1.1)  (NEW), mc-ftpcrash.patch (NONE -> 1.1)  (NEW), mc-fish-upload.patch (NONE -> 1.1)  (NEW), mc-64bit.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/mc-userhost.patch
diff -u /dev/null SOURCES/mc-userhost.patch:1.1
--- /dev/null	Tue Sep 20 00:00:35 2005
+++ SOURCES/mc-userhost.patch	Tue Sep 20 00:00:30 2005
@@ -0,0 +1,33 @@
+--- mc-4.6.1-pre5/src/main.c.userhost	2005-07-08 11:04:37.718907992 +0200
++++ mc-4.6.1-pre5/src/main.c	2005-07-08 11:07:53.888085744 +0200
+@@ -33,6 +33,7 @@
+ #   include <unistd.h>
+ #endif
+ 
++#include <pwd.h>
+ #include <errno.h>
+ #include <ctype.h>
+ #include <signal.h>
+@@ -1607,9 +1608,22 @@ void
+ update_xterm_title_path (void)
+ {
+     unsigned char *p, *s;
++    char h[64];
++    struct passwd *pw;
+ 
+     if (xterm_flag && xterm_title) {
+ 	p = s = g_strdup (strip_home_and_password (current_panel->cwd));
++        if ( !gethostname (h, 64) ) {
++                h[63] = '\0'; /* Be sure the hostname is NUL terminated */
++                s = g_strdup_printf ("%s:%s", h, s);
++                g_free (p);
++                p = s;
++        }
++        if ( (pw = getpwuid(getuid())) ) {
++                s = g_strdup_printf ("%s@%s", pw->pw_name, s);
++                g_free (p);
++                p = s;
++        }
+ 	do {
+ #ifndef UTF8
+ 	    if (!is_printable (*s))

================================================================
Index: SOURCES/mc-uglydir.patch
diff -u /dev/null SOURCES/mc-uglydir.patch:1.1
--- /dev/null	Tue Sep 20 00:00:36 2005
+++ SOURCES/mc-uglydir.patch	Tue Sep 20 00:00:30 2005
@@ -0,0 +1,55 @@
+--- mc-4.6.1-20041105/src/screen.c.uglydir	2004-11-05 17:21:19.159284328 +0100
++++ mc-4.6.1-20041105/src/screen.c	2004-11-05 17:37:27.076138600 +0100
+@@ -864,8 +864,27 @@ show_dir (WPanel *panel)
+     tmp = g_malloc (panel->widget.cols + 1);
+     tmp[panel->widget.cols] = '\0';
+ 
++#ifndef UTF8
+     trim (strip_home_and_password (panel->cwd), tmp,
+ 	 min (max (panel->widget.cols - 7, 0), panel->widget.cols) );
++
++    if (tmp && *tmp) {
++        char *s = tmp;
++        do {
++            if (!is_printable (*s))
++            *s = '?';
++        } while (*++s);
++    }
++#else
++    {
++        char *tmp2 = g_strdup(panel->cwd);
++        fix_utf8(tmp2);
++        trim (strip_home_and_password (tmp2), tmp,
++             min(max (panel->widget.cols - 7, 0), panel->widget.cols) );
++        g_free(tmp2);
++    }
++#endif
++
+     addstr (tmp);
+     g_free (tmp);
+     widget_move (&panel->widget, 0, 1);
+--- mc-4.6.1-20041105/src/subshell.c.uglydir	2004-11-03 20:43:17.000000000 +0100
++++ mc-4.6.1-20041105/src/subshell.c	2004-11-05 17:21:19.245271256 +0100
+@@ -954,6 +954,22 @@ feed_subshell (int how, int fail_on_erro
+ 
+ 	    subshell_cwd[bytes - 1] = 0;	/* Squash the final '\n' */
+ 
++	    if (*subshell_cwd && current_panel && current_panel->cwd && strcmp(current_panel->cwd, subshell_cwd) &&
++			strchr(current_panel->cwd, '\n'))
++	    {
++                /* Expected CWD is diffrent and it contains line break. 
++	         * We need to read rest of CWD, because previous read() 
++	         * returns first line only.
++	         */
++	        int rbytes;
++	
++	        subshell_cwd[bytes-1] = '\n';  
++                rbytes = read(subshell_pipe[READ], (subshell_cwd+bytes), 
++			                              MC_MAXPATHLEN-bytes);
++	        if (rbytes)
++		     subshell_cwd[bytes+rbytes-1] = 0;  /* Squash the final '\n' */
++	    }
++	
+ 	    synchronize ();
+ 
+ 	    subshell_ready = TRUE;

================================================================
Index: SOURCES/mc-symcrash.patch
diff -u /dev/null SOURCES/mc-symcrash.patch:1.1
--- /dev/null	Tue Sep 20 00:00:36 2005
+++ SOURCES/mc-symcrash.patch	Tue Sep 20 00:00:30 2005
@@ -0,0 +1,42 @@
+--- mc-4.6.1/src/util.c.symcrash	2005-09-13 12:41:54.000000000 +0200
++++ mc-4.6.1/src/util.c	2005-09-13 12:41:54.000000000 +0200
+@@ -1406,21 +1406,23 @@
+  * as needed up in first and then goes down using second */
+ char *diff_two_paths (const char *first, const char *second) 
+ {
+-    char *p, *q, *r, *s, *buf = 0;
++    char *p, *q, *r, *s, *buf = NULL;
+     int i, j, prevlen = -1, currlen;
+     char *my_first = NULL, *my_second = NULL;
+     
+     my_first = resolve_symlinks (first);
+     if (my_first == NULL)
+         return NULL;
++    my_second= resolve_symlinks (second);
++    if (my_second == NULL) {
++	g_free (my_first);
++	return NULL;
++    }
+     for (j = 0; j < 2; j++) {
+ 	p = my_first;
+ 	if (j) {
+-	    my_second = resolve_symlinks (second);
+-	    if (my_second == NULL) {
+-		g_free (my_first);
++	    if (my_second == NULL)
+ 	        return buf;
+-	    }
+ 	}
+ 	q = my_second;
+ 	for (;;) {
+--- mc-4.6.1/src/file.c.symcrash	2005-09-13 12:41:54.000000000 +0200
++++ mc-4.6.1/src/file.c	2005-09-13 12:51:44.000000000 +0200
+@@ -389,7 +389,7 @@
+ 	const char *r = strrchr (src_path, PATH_SEP);
+ 
+ 	if (r) {
+-	    p = g_strndup (src_path, r - src_path);
++	    p = g_strndup (src_path, r - src_path + 1);
+ 	    if (*dst_path == PATH_SEP)
+ 		q = g_strdup (dst_path);
+ 	    else

================================================================
Index: SOURCES/mc-ftpcrash.patch
diff -u /dev/null SOURCES/mc-ftpcrash.patch:1.1
--- /dev/null	Tue Sep 20 00:00:36 2005
+++ SOURCES/mc-ftpcrash.patch	Tue Sep 20 00:00:30 2005
@@ -0,0 +1,52 @@
+--- mc-2004-12-01-22/vfs/ftpfs.c	2004-11-03 03:54:00.000000000 +0200
++++ mc-2004-12-01-22-new/vfs/ftpfs.c	2005-02-07 17:34:25.000000000 +0200
+@@ -316,6 +316,8 @@
+     va_list ap;
+     char *cmdstr;
+     int status, cmdlen;
++    static int retry = 0;
++    static int level = 0;	/* ftpfs_login_server() use ftpfs_command() */
+ 
+     va_start (ap, fmt);
+     cmdstr = g_strdup_vprintf (fmt, ap);
+@@ -343,7 +345,6 @@
+ 	code = 421;
+ 
+ 	if (errno == EPIPE) {	/* Remote server has closed connection */
+-	    static int level = 0;	/* ftpfs_login_server() use ftpfs_command() */
+ 	    if (level == 0) {
+ 		level = 1;
+ 		status = ftpfs_reconnect (me, super);
+@@ -359,14 +360,30 @@
+ 	disable_interrupt_key ();
+ 	return TRANSIENT;
+     }
++    retry = 0;
+   ok:
+-    g_free (cmdstr);
+     disable_interrupt_key ();
+ 
+     if (wait_reply)
+-	return ftpfs_get_reply (me, SUP.sock,
++    {
++	status = ftpfs_get_reply (me, SUP.sock,
+ 			  (wait_reply & WANT_STRING) ? reply_str : NULL,
+ 			  sizeof (reply_str) - 1);
++	if ((wait_reply & WANT_STRING) && !retry && !level && code == 421)
++	{
++	    retry = 1;
++	    level = 1;
++    	    status = ftpfs_reconnect (me, super);	    
++	    level = 0;
++	    if (status && (write (SUP.sock, cmdstr, cmdlen) > 0)) {
++	        goto ok;
++	    }
++	}
++	retry = 0;
++        g_free (cmdstr);	
++	return status;
++    }
++    g_free (cmdstr);    
+     return COMPLETE;
+ }
+ 

================================================================
Index: SOURCES/mc-fish-upload.patch
diff -u /dev/null SOURCES/mc-fish-upload.patch:1.1
--- /dev/null	Tue Sep 20 00:00:36 2005
+++ SOURCES/mc-fish-upload.patch	Tue Sep 20 00:00:30 2005
@@ -0,0 +1,86 @@
+diff -Nrbu mc-4.6.1-20041201-pre1a/vfs/fish.c mc-4.6.1-20041201-OK/vfs/fish.c
+--- mc-4.6.1-20041201-pre1a/vfs/fish.c	2004-12-08 16:19:25.000000000 +0300
++++ mc-4.6.1-20041201-OK/vfs/fish.c	2004-12-08 17:03:28.000000000 +0300
+@@ -502,7 +502,31 @@
+ 	close (h);
+ 	ERRNOR (EIO, -1);
+     }
+-    /* Use this as stor: ( dd block ; dd smallblock ) | ( cat > file; cat > /dev/null ) */
++
++    /* First, try this as stor:
++     *
++     *     ( head -c number ) | ( cat > file; cat >/dev/null )
++     *
++     *  If `head' is not present on the remote system, `dd' will be used.
++     * Unfortunately, we cannot trust most non-GNU `head' implementations
++     * even if `-c' options is supported. Therefore, we separate GNU head
++     * (and other modern heads?) using `-q' and `-' . This causes another
++     * implementations to fail (because of "incorrect options").
++     *
++     *	Fallback is:
++     *
++     *	   rest=<number>
++     *	   while [ $rest -gt 0 ]
++     *	   do
++     *	      cnt=`expr \( $rest + 255 \) / 256`
++     *	      n=`dd bs=256 count=$cnt | tee -a <target_file> | wc -c`
++     *	      rest=`expr $rest - $n`
++     *	   done
++     *
++     *	`dd' was not designed for full filling of input buffers,
++     *	and does not report exact number of bytes (not blocks).
++     *	Therefore a more complex shell script is needed.
++     */
+ 
+     print_vfs_message(_("fish: store %s: sending command..."), name );
+     quoted_name = name_quote (name, 0);
+@@ -513,25 +537,45 @@
+ 		 "#STOR %lu /%s\n"
+ 		 "> /%s\n"
+ 		 "echo '### 001'\n"
++                 "res=`exec 3>&1\n"
+ 		 "(\n"
+-		   "dd bs=1 count=%lu\n"
++		   "head -c %lu -q - || echo DD >&3\n"
+ 		 ") 2>/dev/null | (\n"
+ 		   "cat > /%s\n"
+ 		   "cat > /dev/null\n"
+-		 "); echo '### 200'\n",
++		 ")`; [ \"$res\" = DD ] && {\n"
++			"rest=%lu\n"
++			"while [ $rest -gt 0 ]\n"
++			"do\n"
++			"    cnt=`expr \\( $rest + 255 \\) / 256`\n"
++			"    n=`dd bs=256 count=$cnt | tee -a /%s | wc -c`\n"
++			"    rest=`expr $rest - $n`\n"
++			"done\n"
++		 "}; echo '### 200'\n",
+ 		 (unsigned long) s.st_size, name, quoted_name,
++		 (unsigned long) s.st_size, quoted_name,
+ 		 (unsigned long) s.st_size, quoted_name);
+     else
+ 	n = fish_command (me, super, WAIT_REPLY,
+ 		 "#STOR %lu /%s\n"
+ 		 "echo '### 001'\n"
++		 "res=`exec 3>&1\n"
+ 		 "(\n"
+-		   "dd bs=1 count=%lu\n"
++		   "head -c %lu -q - || echo DD >&3\n"
+ 		 ") 2>/dev/null | (\n"
+ 		   "cat >> /%s\n"
+ 		   "cat > /dev/null\n"
+-		 "); echo '### 200'\n",
++		 ")`; [ \"$res\" = DD ] && {\n"
++			"rest=%lu\n"
++			"while [ $rest -gt 0 ]\n"
++			"do\n"
++			"    cnt=`expr \\( $rest + 255 \\) / 256`\n"
++			"    n=`dd bs=256 count=$cnt | tee -a /%s | wc -c`\n"
++			"    rest=`expr $rest - $n`\n"
++			"done\n"
++		 "}; echo '### 200'\n",
+ 		 (unsigned long) s.st_size, name,
++		 (unsigned long) s.st_size, quoted_name,
+ 		 (unsigned long) s.st_size, quoted_name);
+ 
+     g_free (quoted_name);

================================================================
Index: SOURCES/mc-64bit.patch
diff -u /dev/null SOURCES/mc-64bit.patch:1.1
--- /dev/null	Tue Sep 20 00:00:36 2005
+++ SOURCES/mc-64bit.patch	Tue Sep 20 00:00:30 2005
@@ -0,0 +1,65 @@
+--- mc-4.6.1a/src/mountlist.c.64bit	2005-02-08 23:33:52.000000000 +0100
++++ mc-4.6.1a/src/mountlist.c	2005-05-10 17:09:24.122853504 +0200
+@@ -131,11 +131,19 @@ struct mount_entry
+ 
+ struct fs_usage
+ {
++#ifndef HAVE_SYS_STATVFS_H
+   long fsu_blocks;		/* Total blocks. */
+   long fsu_bfree;		/* Free blocks available to superuser. */
+   long fsu_bavail;		/* Free blocks available to non-superuser. */
+   long fsu_files;		/* Total file nodes. */
+   long fsu_ffree;		/* Free file nodes. */
++#else	/* We have sys/statvfs.h, use proper data types when _FILE_OFFSET_BITS=64 */
++  fsblkcnt_t fsu_blocks;
++  fsblkcnt_t fsu_bfree;
++  fsblkcnt_t fsu_bavail;
++  fsblkcnt_t fsu_files;
++  fsblkcnt_t fsu_ffree;
++#endif /* HAVE_SYS_STATVFS_H */
+ };
+ 
+ static int get_fs_usage (char *path, struct fs_usage *fsp);
+@@ -665,6 +673,7 @@ my_statfs (struct my_statfs *myfs_stats,
+    BLOCKS FROMSIZE-byte blocks, rounding away from zero.
+    TOSIZE must be positive.  Return -1 if FROMSIZE is not positive.  */
+ 
++#if !defined(HAVE_SYS_STATFS_H) || !defined(STAT_STATVFS)
+ static long
+ fs_adjust_blocks (long blocks, int fromsize, int tosize)
+ {
+@@ -672,13 +681,21 @@ fs_adjust_blocks (long blocks, int froms
+ 	abort ();
+     if (fromsize <= 0)
+ 	return -1;
+-
++#else
++static fsblkcnt_t
++fs_adjust_blocks (fsblkcnt_t blocks, unsigned long fromsize, unsigned long tosize)
++{
++    if (!tosize)
++        abort ();
++    if (!fromsize)
++        return -1;
++#endif
+     if (fromsize == tosize)	/* E.g., from 512 to 512.  */
+ 	return blocks;
+     else if (fromsize > tosize)	/* E.g., from 2048 to 512.  */
+ 	return blocks * (fromsize / tosize);
+     else			/* E.g., from 256 to 512.  */
+-	return (blocks + (blocks < 0 ? -1 : 1)) / (tosize / fromsize);
++	return (blocks + 1) / (tosize / fromsize);
+ }
+ 
+ #if defined(_AIX) && defined(_I386)
+--- mc-4.6.1a/acinclude.m4.64bit	2005-05-10 17:09:24.084859280 +0200
++++ mc-4.6.1a/acinclude.m4	2005-05-10 17:09:24.124853200 +0200
+@@ -501,7 +501,7 @@ dnl job is to detect a method to get fil
+       if test $ac_cv_func_statvfs = yes; then
+ 	space=yes
+ 	AC_DEFINE(STAT_STATVFS, 1,
+-		  [Define if function `statfs' can be used])
++		  [Define if function `statvfs' can be used])
+       fi
+     fi
+ 
================================================================



More information about the pld-cvs-commit mailing list