After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 416221 - can't determine permissions of directories on ftp server
can't determine permissions of directories on ftp server
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: ftp backend
git master
Other All
: Normal enhancement
: ---
Assigned To: gvfs-maint
gvfs-maint
: 334955 (view as bug list)
Depends on:
Blocks: 565624
 
 
Reported: 2007-03-08 21:18 UTC by Alexander van Loon
Modified: 2011-05-18 19:26 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22


Attachments
Patch to parse attributes from POSIX ls -l compatible LIST output (3.63 KB, patch)
2010-08-31 13:17 UTC, Lawrence Rust
none Details | Review
Add ftp file attributes (7.77 KB, patch)
2011-01-23 17:48 UTC, Lawrence Rust
none Details | Review

Description Alexander van Loon 2007-03-08 21:18:22 UTC
Please describe the problem:
I use Nautilus via "Connect to Server..." to connect to my FTP server. When I want to change the permissions for a directory on my FTP server, I right click the dir, go to Properties, then go to the Permissions tab. There it says the "Permissions of <dirname/filename> could not be determined". This is always reproducible, and probably for all the files/directories on my FTP server (I haven't tried them all, but I assume so after randomly trying for about 30 dirs/files).

Steps to reproduce:


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Alexander van Loon 2008-03-23 09:47:52 UTC
Because Nautilus has recently been rewritten in GVFS I've checked to see if this bug is still reproducible. I can confirm this bug report is still valid. I'd appreciate a response, because it has been longer than a year ago since I first filed this bug report.
Comment 2 Cosimo Cecchi 2008-03-23 10:47:45 UTC
Hi Alexander, thanks for trying the new version of Nautilus and updating the status of your bugs.
I can reproduce this bug too, so I'm confirming it. CC-ing Benjamin.
Comment 3 Benjamin Otte (Company) 2008-03-23 10:52:34 UTC
Yeah, there's some fiddling required to extract permissions from FTP servers and gvfs doesn't attempt to do this yet.
Comment 4 Christoph Brill 2008-05-08 21:03:36 UTC
I'd really be happy if this is implemented. It's the last reason for the crappy gftp on my system ...
Comment 5 Andreas Henriksson 2009-01-22 13:56:02 UTC
*** Bug 334955 has been marked as a duplicate of this bug. ***
Comment 6 Peter Farkas 2009-08-25 09:51:49 UTC
I'm looking forward of this enhancement too! Can we help the development anyhow?
Comment 7 Haru 2009-09-04 10:41:20 UTC
September 2009, sadly still no progress to this...
Comment 8 Benjamin Otte (Company) 2009-09-04 13:40:19 UTC
Yeah, it seems noone wants to implement directory parsing in a maintainable way.

The only patches I've seen were modifying ParseFTPList.c and I want to keep that file as close to Mozilla's version as possible, because that file is not something I want to maintain. So I rejected the patch.

What should happen is that someone writes a GVfsFtpDirFuncs (see daemon/gvfsftpdircache.h) implementation for ls-style output that does not rely on the Mozilla code. The Mozilla code is only interested in the name and size of the file - so we only provide that. This implementation could then support parsing permissions, uid/gid etc.
Or someone could write a GVfsFtpDirFuncs implementation that supports MLST style directory listings.
Be warned though, that this is a non-trivial endeavour.

I've looked at various FTP clients (wget, WebKit, Filezilla, gftp, ...) and their implementations were either tremendously complex, not license compatible or didn't implement permissions either, so I didn't use them.
Comment 9 Tourneur Henry-Nicolas 2009-09-24 11:08:03 UTC
Are you sure about gftp ? It looks like it's written in C, under GPL and it's managing perms, don't know about complexity.

But anyway, reusing the gftp dir parser would be great :)
Comment 10 A. Walton 2009-09-24 11:13:11 UTC
Needs to be LGPL or compat. to be used in GVFS, else we'd just rip the relatively well-maintained FTP-list parsing code out of GNU wget.
Comment 11 Alexander Larsson 2009-09-25 15:21:22 UTC
Thats not quite correct. For the backend side of gvfs, GPL is possible, for instance libsbmclient is GPL. This is ok since apps are isolated from the backend process using a generic protocol with multiple implementations.
Comment 12 Tourneur Henry-Nicolas 2009-09-28 16:09:59 UTC
So we could use the wget parser, that would be great if somebody could do that :)
Comment 13 Benjamin Otte (Company) 2009-09-28 16:19:21 UTC
First of all, I have no clue about the quality of wget's parser. wget is not really known as a good FTP client. In particular I've never used wget to modify file permissions.
Second, while LGPL is not a hard requirement, I have a strong preference towards LGPL. The main reason here is not gvfs, but libsoup or other web-related libraries that might want to include FTP functionality in some form and they are LGPL.

But in the end, the important thing is that someone provides code _and_ maintains it when somebody finds bugs with weird FTP servers.
Comment 14 Raffaello D. Di Napoli 2010-03-18 10:49:15 UTC
Hi all,
I also happen to be quite interested in gvfs’s full FTP support, and I have previously written HTTP, SMTP and FTP clients from scratch (as bot helpers for my PHP web sites).

I’m willing to rewrite the involved code entirely, as long as someone can give me some pointers regarding facilities the code is allowed to use, and (compatibility) criteria the resulting code is supposed to meet. And of course, I’ll need people with a broader FTP server knowledge than mine (for their quirks).
The only problem is I’m only mildly experienced with GTK+, but I do know my way with C.
Yes, I do see the message above, but it’s 6 months old now, so I want to make sure the pointers there are still valid.

So, let me know if someone is interested in getting me started.
Comment 15 Benjamin Otte (Company) 2010-03-18 13:16:11 UTC
Yeah, what I said in comment 8 is still pretty much accurate.
Comment 16 Raffaello D. Di Napoli 2010-03-18 15:00:54 UTC
Okay, so I did take a look at the files you mentioned.

I’m not sure I understand what you previously wrote: would it there be any need to rewrite any code other than the big parser by Mozilla?

I’m asking, since the mangling of LIST output I can totally rewrite from scratch, no matter how complicated and special-cased, provided I’m given enough examples; on the other hand, rewriting the gvfs implementation will require me to study how several things work, since the names don’t tell me much, and I assume to fully understand them I’d have to study gvfs from a more generic standpoint, seeing how the caching works, in what order functions get called... something paradoxically more complicated, for me, than just rewriting the parser.
Not that I’d not do it, I just want to make sure I’m not doing unnecessary work.
Comment 17 Benjamin Otte (Company) 2010-03-18 21:16:27 UTC
So here's the constraints:

1) The mozilla code must not be touched. It's ugly and there's noone who really understands what it does. We totally trust Mozilla to keep that one file updated and security-reviewed. And we trust them to make sure it works with virtually all FTP servers in the world. So we want a new parser.

2) There is no testsuite or examples or anything for the LIST parser. This isn't needed because we trust Mozilla's code (see above). So you will not be able to parse every listing with the new parser. So we need a way to say "hey, this parser doesn't work for this FTP server, let's take the Mozilla one" and fall back to the old one.

3) Most parsers contain code that is very hard to read and maintain. I'd be very happy if someone writing one would take of that. Also, this code is very security sensitive (just like all parsers everywhere) and I'd like a design that's careful about that, too.

So what I'd expect someone to do is write a parser that works for initially just one server, detects failures to parse and then falls back to the Mozilla one. Then we can enhance that parser later with new functionality.


That said, there's not a lot of code you need to write. Basically, it's just the process function. And you can have a look at g_vfs_ftp_dir_cache_funcs_process() to see how the current one works.
Comment 18 Lawrence Rust 2010-08-31 13:17:48 UTC
Created attachment 169163 [details] [review]
Patch to parse attributes from POSIX ls -l compatible LIST output
Comment 19 Lawrence Rust 2010-08-31 13:23:52 UTC
The above patch for gvfs v1.6.1 enables file attributes to be read by Nautilus.  To set the attributes requires a further simple addition.  If there is interest I can provide another patch.

The patch is to gvfsftpdircache.c and only adds code to the function g_vfs_ftp_dir_cache_funcs_process().  This should make the patch easy to maintain.
Comment 20 Felix Möller 2011-01-23 14:13:46 UTC
I hit the issue of Nautilus not beeing able to see and edit file permissions. What is the status on this bug?

Lawrence: It would certainly be nice if you could attach your patch for storing here too. Just for others to try...
Comment 21 Lawrence Rust 2011-01-23 17:47:05 UTC
I use the following patch, which adds attribute r/w capability, to gvfs v1.6.4.  Works great on Ubuntu 10.04 to maintain my web server.
Comment 22 Lawrence Rust 2011-01-23 17:48:35 UTC
Created attachment 179086 [details] [review]
Add ftp file attributes

For gvfs 1.6.4
Comment 23 Felix Möller 2011-01-23 18:14:52 UTC
Applies cleanly against gvfs-1.6.6-1.fc14.i386 on my Fedora 14 system. If somebody wants to test I can provide an F14 src.rpm.

I have just tested it and verified all modifications by gftp, it works perfectly for me.

@Benjamin? Any chance to have this included?
Comment 24 Benjamin Otte (Company) 2011-01-23 20:56:33 UTC
Woah, that patch is cool. I like it. In particular because it doesn't modify the parser. Why did I not notice that in August?

One thing though: Is there a way to detect chmod support? I don't want to advertise it when it's not supported and the patch seems to always advertise it.
Comment 25 Felix Möller 2011-01-23 23:51:47 UTC
On http://www.phpbuddy.eu/ftp-klasse.html there is a FTP class.

It checks for for the Server OS as in case of WIN there is no SITE CHMOD support. 

More information on http://www.xav.com/scripts/installer/3008.html

This is the log of not supportted CHMOD: http://www.smartftp.com/support/kb/site-chmod-errors-f18.html.
Comment 26 Benjamin Otte (Company) 2011-01-24 02:04:18 UTC
commit 7ad211bf67c3953f349e4adf911cce8c630e4890
Author: Lawrence Rust <lvr@softsystem.co.uk>
Date:   Mon Jan 24 02:54:19 2011 +0100

    ftp: Implement chmod
    
    https://bugzilla.gnome.org/show_bug.cgi?id=416221

commit 6da46f05d75a2017d1fb745ab389c7ad1019e4ad
Author: Lawrence Rust <lvr@softsystem.co.uk>
Date:   Mon Jan 24 01:26:24 2011 +0100

    ftp: Parse mode, user and group for unix listings
    
    https://bugzilla.gnome.org/show_bug.cgi?id=416221

commit 9a4f327cdc9dde66e7417c2c4b426d936b407f02
Author: Benjamin Otte <otte@redhat.com>
Date:   Sun Jan 23 23:55:01 2011 +0100

    ftp: Parse SITE HELP output to detect chmod support
    
    Support for it will come in later patches.
    
    The patch also detects chgrp support, but we're not intending to use it
    yet.
Comment 27 Benjamin Otte (Company) 2011-01-24 02:09:19 UTC
Just FYI: It would have been nice if the patch had been closer to the glib coding standards. The biggest issue I had was with the reversal in checks. Nobody says "if 2 is the response group", everyone says "if the response group is 2", so "if (2 == RESPONSE_GROUP (res))" doesn't read very fluently.
And the "might write = instead of == accidentally" argument doesn't hold anymore these days either, because gcc catches that.
Comment 28 Benjamin Otte (Company) 2011-01-24 02:11:49 UTC
Oh yeah, one last comment:
I implemented the feature check for chmod using the "SITE HELP" command. I checked vsftpd, pure-ftpd, proftpd and ms-ftpd, and implemented something that can parse all those outputs. If there's other servers where this detection method does not work, please open bugs about them.
Comment 29 Guido 2011-05-18 19:26:32 UTC
On gvfs 1.8.1 (Ubuntu Oneiric) setting ftp permission doesn't work. It the feature been implemented in it?