Re: [BUG] Segmentation fault when copy symlink with checked Stable Symlinks

2005-09-13 Thread Jindrich Novy
Hello Marcin,

On Tue, 2005-09-13 at 01:05 +0200, Marcin Garski wrote:
 Hi,
 
 mc-4.6.1a-0.11.FC4 from Fedora Core 4 on x86_64.
 
 1. Create mc directory
 2. Change directory to mc
 3. Create .eDonkey2000 directory
 4. Create .overnet symlink pointing to .eDonkey2000
 5. Copy .overnet symlink to /tmp BUT check Stable Symlinks in copy 
 dialog.
 6. Watch mc crash
 
 If you want more info, just write :)

I cannot reproduce it either on i386 or x86_64 box. My mc doesn't crash
even if I have Stable Symlinks checked or not.

rpm -q mc
mc-4.6.1a-0.11.FC4

Some special setup is needed? Do you see this only on your machine or
have you reproduced it on some other machine as well?

Jindrich

-- 
Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/
(o_   _o)
//\  The worst evil in the world is refusal to think. //\
V_/_ _\_V


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [BUG] Segmentation fault when copy symlink with checked Stable Symlinks

2005-09-13 Thread Pavel Tsekov
Hello,

On Tue, 13 Sep 2005, Jindrich Novy wrote:

  1. Create mc directory
  2. Change directory to mc
  3. Create .eDonkey2000 directory
  4. Create .overnet symlink pointing to .eDonkey2000
  5. Copy .overnet symlink to /tmp BUT check Stable Symlinks in copy
  dialog.
  6. Watch mc crash
 
  If you want more info, just write :)

 I cannot reproduce it either on i386 or x86_64 box. My mc doesn't crash
 even if I have Stable Symlinks checked or not.

 rpm -q mc
 mc-4.6.1a-0.11.FC4

 Some special setup is needed? Do you see this only on your machine or
 have you reproduced it on some other machine as well?

Doesn't seem so - see below:

My setup: FC3 + MC from latest cvs

[EMAIL PROTECTED] mc]$ ls -la
total 52
drwxrwxr-x   3 ptsekov ptsekov  4096 Sep 13 10:38 .
drwxr-xrwt  16 ptsekov ptsekov 40960 Sep 13 10:38 ..
drwxrwxr-x   2 ptsekov ptsekov  4096 Sep 13 10:36 .eDonkey2000
lrwxrwxrwx   1 ptsekov ptsekov12 Sep 13 10:38 .overnet - .eDonkey2000

Look at frame number 1

Program received signal SIGSEGV, Segmentation fault.
0x00467603 in strchr () from /lib/tls/libc.so.6
(gdb) bt
#0  0x00467603 in strchr () from /lib/tls/libc.so.6
#1  0x0808fbb4 in diff_two_paths (first=0x946e000 /tmp/,
second=0xbff8bc40 /tmp/mc.eDonkey2000) at ../../mc/src/util.c:1173
#2  0x08065ab8 in make_symlink (ctx=0x9475210,
src_path=0x946de90 /tmp/mc/.overnet, dst_path=0x946dfe8
/tmp/.overnet)
at ../../mc/src/file.c:397
#3  0x08065f11 in copy_file_file (ctx=0x9475210,
src_path=0x946de90 /tmp/mc/.overnet, dst_path=0x946dfe8
/tmp/.overnet,
ask_overwrite=1, progress_count=0xbff8ce28, progress_bytes=0xbff8ce20,
is_toplevel_file=1) at ../../mc/src/file.c:542
#4  0x08068b08 in panel_operate (source_panel=0x9465b98,
operation=OP_COPY,
force_single=0) at ../../mc/src/file.c:1894
#5  0x0805a929 in copy_cmd () at ../../mc/src/cmd.c:308
#6  0x0809bed4 in buttonbar_call (bb=0x9473ae0, i=4)
at ../../mc/src/widget.c:2286
#7  0x0809bf90 in buttonbar_callback (w=0x9473ae0, msg=WIDGET_HOTKEY,
parm=269)
at ../../mc/src/widget.c:2308
#8  0x08061167 in dlg_try_hotkey (h=0x9464538, d_key=269)
at ../../mc/src/dialog.c:626
#9  0x08061242 in dlg_key_event (h=0x9464538, d_key=269)
at ../../mc/src/dialog.c:664
#10 0x08061564 in dlg_process_event (h=0x9464538, key=269,
event=0xbff8d040)
at ../../mc/src/dialog.c:765

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [BUG] Segmentation fault when copy symlink with checked Stable Symlinks

2005-09-13 Thread Jindrich Novy
On Tue, 2005-09-13 at 10:44 +0300, Pavel Tsekov wrote:
 Hello,
 
 On Tue, 13 Sep 2005, Jindrich Novy wrote:
 
   1. Create mc directory
   2. Change directory to mc
   3. Create .eDonkey2000 directory
   4. Create .overnet symlink pointing to .eDonkey2000
   5. Copy .overnet symlink to /tmp BUT check Stable Symlinks in copy
   dialog.
   6. Watch mc crash
  
   If you want more info, just write :)
 
  I cannot reproduce it either on i386 or x86_64 box. My mc doesn't crash
  even if I have Stable Symlinks checked or not.
 
  rpm -q mc
  mc-4.6.1a-0.11.FC4
 
  Some special setup is needed? Do you see this only on your machine or
  have you reproduced it on some other machine as well?
 
 Doesn't seem so - see below:
 
 My setup: FC3 + MC from latest cvs
 
 [EMAIL PROTECTED] mc]$ ls -la
 total 52
 drwxrwxr-x   3 ptsekov ptsekov  4096 Sep 13 10:38 .
 drwxr-xrwt  16 ptsekov ptsekov 40960 Sep 13 10:38 ..
 drwxrwxr-x   2 ptsekov ptsekov  4096 Sep 13 10:36 .eDonkey2000
 lrwxrwxrwx   1 ptsekov ptsekov12 Sep 13 10:38 .overnet - .eDonkey2000

Yes, it crashes only with relative symlinks. When the symlink is created
from within mc, the symlink is absolute so mc won't crash. Now I see the
segfault.

Marcin, could you please file a bug in bugzilla.redhat.com? The patch is
comming soon.

Thanks,
Jindrich

-- 
Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/
(o_   _o)
//\  The worst evil in the world is refusal to think. //\
V_/_ _\_V


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [BUG] Segmentation fault when copy symlink with checked Stable Symlinks

2005-09-13 Thread Pavel Tsekov
Hello,

On Tue, 13 Sep 2005, Jindrich Novy wrote:

 Marcin, could you please file a bug in bugzilla.redhat.com? The patch is
 comming soon.

Why use RedHat's bugzilla ? What's the problem with the one at savannah -
after all this bug is not RH specific.

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [BUG] Segmentation fault when copy symlink with checked Stable Symlinks

2005-09-13 Thread Jindrich Novy
On Tue, 2005-09-13 at 12:18 +0300, Pavel Tsekov wrote:
 Hello,
 
 On Tue, 13 Sep 2005, Jindrich Novy wrote:
 
  Marcin, could you please file a bug in bugzilla.redhat.com? The patch is
  comming soon.
 
 Why use RedHat's bugzilla ? What's the problem with the one at savannah -
 after all this bug is not RH specific.

Because Marcin wrote he had problems with FC4 mc. Don't worry, I'd send
the patch here first ;)

Jindrich

-- 
Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/
(o_   _o)
//\  The worst evil in the world is refusal to think. //\
V_/_ _\_V


___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [BUG] Segmentation fault when copy symlink with checked Stable Symlinks

2005-09-13 Thread Pavel Tsekov
Hello,

On Tue, 13 Sep 2005, Jindrich Novy wrote:

 On Tue, 2005-09-13 at 12:18 +0300, Pavel Tsekov wrote:
  Hello,
 
  On Tue, 13 Sep 2005, Jindrich Novy wrote:
 
   Marcin, could you please file a bug in bugzilla.redhat.com? The patch is
   comming soon.
 
  Why use RedHat's bugzilla ? What's the problem with the one at savannah -
  after all this bug is not RH specific.

 Because Marcin wrote he had problems with FC4 mc. Don't worry, I'd send
 the patch here first ;)

Well, of course, but we both know that it is not specific to FC4, don't we
? I am not worried at all.
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [BUG] Segmentation fault when copy symlink with checked Stable Symlinks

2005-09-13 Thread Jindrich Novy
Hello,

On Tue, 2005-09-13 at 01:05 +0200, Marcin Garski wrote:
 Hi,
 
 mc-4.6.1a-0.11.FC4 from Fedora Core 4 on x86_64.
 
 1. Create mc directory
 2. Change directory to mc
 3. Create .eDonkey2000 directory
 4. Create .overnet symlink pointing to .eDonkey2000
 5. Copy .overnet symlink to /tmp BUT check Stable Symlinks in copy 
 dialog.
 6. Watch mc crash
 
 If you want more info, just write :)

The attached patch fixes two nasty bugs in file.c and util.c. The first
one is the off-by-one error in path indexing what causes a generation of
dangled symlinks. The second one is the culprit of the segfault you
presented. It applies cleanly to 4.6.1 release.

Jindrich

-- 
Jindrich Novy [EMAIL PROTECTED], http://people.redhat.com/jnovy/
(o_   _o)
//\  The worst evil in the world is refusal to think. //\
V_/_ _\_V

--- mc-4.6.1/src/util.c.jn	2005-05-27 16:19:18.0 +0200
+++ mc-4.6.1/src/util.c	2005-09-13 12:57:02.0 +0200
@@ -1140,21 +1140,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.jn	2005-05-27 16:19:18.0 +0200
+++ mc-4.6.1/src/file.c	2005-09-13 12:57:02.0 +0200
@@ -382,7 +382,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
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


Re: [BUG] Segmentation fault when copy symlink with checked Stable Symlinks

2005-09-13 Thread Marcin Garski

Jindrich Novy wrote:

Marcin, could you please file a bug in bugzilla.redhat.com? The patch is
comming soon.


As you wish :)
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=168184

Thanks for fixing the bug!

--
Marcin Garski
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel