Ticket #2800 (closed defect: fixed)

Opened 5 years ago

Last modified 5 years ago

Garbage directory listing in ftpfs

Reported by: szaszg Owned by: slavazanko
Priority: major Milestone: 4.8.4
Component: mc-vfs Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master committed-stable

Description

When I open an ftp connection i got a garbage directory list:

+<- ftp://gergely@localhost/ -.[^]>++<- ~ ------------------------.[^]>+
|'n    Name     | Size  |Permission||'n   Name    | Size  |Modify time |
|/..            |UP--DIR|drwxr-xr-x||/..          |UP--DIR|Aug 13  2011|
|/bin           |   4096|drwxr-xr-x||/.adobe      |   4096|Sep  4  2009|
|?.BALLView     |      0|----------||/.cache      |   4096|May  1 17:51|
|?.FRD          |      0|----------||/.cddb       |   4096|Feb  2  2010|
|?.FontForge    |      0|----------||/.config     |   4096|May  1 17:51|
|?.PgcEdit      |      0|----------||/.dbus       |   4096|Sep  3  2009|
...

On the ftp server there is a default directory for the user (his home dir).
In the list we see the users home directory in a strange mode.
We see a "normal" bin directory, because there is a bin directory in the root '/' and in the home dir too.

Now, if i press ctrl+R to refresh the list, i see the ftp server root directory in a "normal" way:

+<- ftp://gergely@localhost/ -.[^]>++<- ~ ------------------------.[^]>+
|'n    Name     | Size  |Permission||'n   Name    | Size  |Modify time |
|/..            |UP--DIR|drwxr-xr-x||/..          |UP--DIR|Aug 13  2011|
|/bin           |   4096|drwxr-xr-x||/.adobe      |   4096|Sep  4  2009|
|/boot          |   4096|drwxr-xr-x||/.cache      |   4096|May  1 17:51|
|/dev           |   3600|drwxr-xr-x||/.cddb       |   4096|Feb  2  2010|
|/etc           |  12288|drwxr-xr-x||/.config     |   4096|May  1 17:51|
|/home          |   4096|drwxr-xr-x||/.dbus       |   4096|Sep  3  2009|
|/lib           |   4096|drwxr-xr-x||/.dvdcss     |   4096|Jul  8  2010|
|/lost+found    |  16384|drwx------||/.fontconfig |   4096|Jan 30  2010|
|/media         |   4096|drwxrwxrwx||/.gegl-0.0   |   4096|Sep  4  2009|
...

If a press ctrl+R again i see the ftp server 'boot' directory:

+<- ftp://gergely@localhost/ -.[^]>++<- ~ ------------------------.[^]>+
|'n    Name     | Size  |Permission||'n   Name    | Size  |Modify time |
|/..            |UP--DIR|drwxr-xr-x||/..          |UP--DIR|Aug 13  2011|
|/lost+found    |  16384|drwx------||/.adobe      |   4096|Sep  4  2009|
|?System.~6stanc|      0|----------||/.cache      |   4096|May  1 17:51|
|?System.~-3-686|      0|----------||/.cddb       |   4096|Feb  2  2010|
|?System.~1stanc|      0|----------||/.config     |   4096|May  1 17:51|
|?System.~2stanc|      0|----------||/.dbus       |   4096|Sep  3  2009|
|?System.~4stanc|      0|----------||/.dvdcss     |   4096|Jul  8  2010|
|?System.~8stanc|      0|----------||/.fontconfig |   4096|Jan 30  2010|
|?System.~tanc32|      0|----------||/.gegl-0.0   |   4096|Sep  4  2009|

Now, if i cd somwhere in the ftpfs, everithing looks OK (after cd home/gergely):

+<- ...ocalhost/home/gergely -.[^]>++<- ~ ------------------------.[^]>+
|'n    Name     | Size  |Permission||'n   Name    | Size  |Modify time |
|/..            |UP--DIR|drwxr-xr-x||/..          |UP--DIR|Aug 13  2011|
|/.FRD          |   4096|drwxr-xr-x||/.adobe      |   4096|Sep  4  2009|
|/.FontForge    |   4096|drwx------||/.cache      |   4096|May  1 17:51|
|/.PgcEdit      |   4096|drwxr-xr-x||/.cddb       |   4096|Feb  2  2010|

But if i go back to (ftpfs) root directory, i see again the garbage boot directory list...

The FTP server is a Pure-ftpd (debian 1.0.35-1)

Change History

comment:1 Changed 5 years ago by slavazanko

  • Status changed from new to accepted
  • Owner set to slavazanko

comment:2 follow-up: ↓ 3 Changed 5 years ago by slavazanko

  • Keywords stable-candidate added
  • Branch state changed from no branch to on review
  • Milestone set to 4.8.4

This related to #2779

Created branch 2800_ftpfs_dir_listing

Review, please.

comment:3 in reply to: ↑ 2 Changed 5 years ago by szaszg

Replying to slavazanko:
Branch 2800_ftpfs_dir_listing looks good for me.

BTW is there any way to ftpfs respect "home/default" directory? e.g. ftpuser[@]ftp.org -> start in user default dir, ftpuser[@]ftp.org/ -> start in root dir

comment:4 Changed 5 years ago by andrew_b

  • Votes for changeset set to andrew_b

comment:5 Changed 5 years ago by rovocz

Hi, my solution is here for actual git version : .... (patch)

diff -Naur mc-4.8.3-git-current.old/src/vfs/ftpfs/ftpfs.c mc-4.8.3-git-current/src/vfs/ftpfs/ftpfs.c
--- mc-4.8.3-git-current.old/src/vfs/ftpfs/ftpfs.c	2012-05-14 13:27:45.000000000 +0200
+++ mc-4.8.3-git-current/src/vfs/ftpfs/ftpfs.c	2012-05-17 10:16:53.052296149 +0200
@@ -1677,7 +1677,7 @@
         }
         ent->ino->st.st_nlink = i;      /* Ouch, we need to preserve our counts :-( */
         num_entries++;
-        vfs_s_store_filename_leading_spaces (ent, count_spaces);
+        vfs_s_store_filename_leading_spaces (ent, 0); // don't use count_spaces or fix it better
         vfs_s_insert_entry (me, dir, ent);
     }

comment:6 Changed 5 years ago by slavazanko

No, this bug isn't related to the calculating of leading spaces. this bug was raised because feature described in #2779 isn't properly realized. As fact, branch for this ticket have correct reimplementation of #2779

comment:7 Changed 5 years ago by slavazanko

BTW is there any way to ftpfs respect "home/default" directory? e.g. ftpuser[@]ftp.org -> start in user default dir, ftpuser[@]ftp.org/ -> start in root dir

See #2809

comment:8 Changed 5 years ago by angel_il

  • Votes for changeset changed from andrew_b to andrew_b angel_il
  • Branch state changed from on review to approved

comment:9 Changed 5 years ago by slavazanko

  • Status changed from accepted to testing
  • Votes for changeset changed from andrew_b angel_il to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

merged to master:

git log --pretty=oneline 328abc2..21d1f61

comment:10 Changed 5 years ago by slavazanko

  • Status changed from testing to closed
  • Keywords stable-candidate removed
  • Votes for changeset changed from committed-master to committed-master committed-stable

merged to stable:

git log --pretty=oneline  4619723..e9f3b4d

comment:11 Changed 5 years ago by gv

  • Status changed from closed to reopened
  • Resolution fixed deleted

mc crash with this patch applied (e9f3b4dfd0f2252ee004473c812f957d8150a72a) when entering into compressed tar.gz / tar.bz2 archives.

Tested with 4.8.3 and patched for: #2784, #2787, #2783, #2805, #2795, #2785, #2800

interface.c, line 716:

super = vfs_get_super_by_vpath (vpath);
if (super != NULL)
{

g_free (super->path_element->path); <==== Here.
super->path_element->path = g_strdup (path_element->path);

}

comment:12 Changed 5 years ago by slavazanko

  • Status changed from reopened to closed
  • Resolution set to fixed

try to use latest master/stable

Note: See TracTickets for help on using tickets.