<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"><html><head><meta name="qrichtext" content="1" /><style type="text/css">p, li { white-space: pre-wrap; }</style></head><body style=" font-family:'Bitstream Vera Sans'; font-size:10pt; font-weight:400; font-style:normal;">In data domenica 26 aprile 2009 12:11:31, MailingList SVR ha scritto:<br>
: > Hi Stefan,<br>
> <br>
> <br>
> <br>
> thanks for your answer, the problem only appear when there is a link to a folder the same directory as the link and it begin with "./" that is a valid path in the unix world, so a workaround would be to replace './' with '../' if _st_target begin with "./". For now I solved with my own code, do you think you can add this workaround for the next ftputil version?<br>
> <br>
> <br>
> <br>
> regards<br>
> Nicola<br>
> <br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>additionally I tested standard ftp clients (filezilla and cli linux ftp client) and they resolve the link and then show the content<br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p>> <br>
> <br>
> In data domenica 26 aprile 2009 10:23:52, Stefan Schwarzer ha scritto:<br>
> : > Hi Nicola,<br>
> > <br>
> > thanks for your report.<br>
> > <br>
> > On 2009-04-26 00:55, MailingList SVR wrote:<br>
> > > ftputil seems unable to follow links, go for example to:<br>
> > ><br>
> > > ftp.heanet.ie with an anonymous user,<br>
> > ><br>
> > > >>> conn.path.islink('/pub/apache')<br>
> > > True<br>
> > > >>> conn.listdir('/pub/apache')<br>
> > > ['/pub/apache']<br>
> > ><br>
> > > so listdir doesn't follow the link. Is there a workaround ?<br>
> > <br>
> > I can't reproduce this with my local FTP test server:<br>
> > <br>
> > >>> h = ftputil.FTPHost("localhost", 'ftptest', ...)<br>
> > >>> h.path.islink("blah")<br>
> > True<br>
> > >>> h.listdir("blah")<br>
> > ['second dir', 'some file', 'some_file']<br>
> > <br>
> > The server is PureFTPd version 1.0.21-11.2ubuntu1. This server<br>
> > setup is used for all the tests in the file _test_real_ftp.py.<br>
> > Here, I only added the link.<br>
> > <br>
> > In your specific case, I can repeat the behavior, though.<br>
> > <br>
> > Since ftputil just displays the directory contents it gets from<br>
> > the server, I think the result has something to do with the<br>
> > server. Let's examine the situation:<br>
> > <br>
> > >>> h = ftputil.FTPHost("ftp.heanet.ie", "anonymous", "sschwarzer@sschwarzer.net")<br>
> > >>> stat_result = h.lstat("/pub/apache")<br>
> > >>> stat_result._st_name<br>
> > 'apache'<br>
> > >>> stat_result._st_target<br>
> > './www.apache.org'<br>
> > <br>
> > (_st_name and _st_target have a leading underscore because<br>
> > "native" stat result objects don't have those attributes either.<br>
> > When I introduced the "stat-ing", I wanted to keep ftputil as<br>
> > similar as possible to Python's native file system interface, so<br>
> > I didn't disclose the attributes. ftputil uses them internally,<br>
> > though.)<br>
> > <br>
> > If the link is resolved manually (the workaround you asked for),<br>
> > this causes a traceback:<br>
> > <br>
> > >>> stat_result = h.lstat("/pub/apache")<br>
> > >>> h.path.join("/pub/apache", stat_result._st_target)<br>
> > '/pub/apache/./www.apache.org'<br>
> > >>> h.listdir(h.path.join("/pub/apache", stat_result._st_target))<br>
> > Traceback (most recent call last):<br>
> > File "<ipython console>", line 1, in <module><br>
> > File "ftputil.py", line 805, in listdir<br>
> > return self._stat.listdir(path)<br>
> > File "ftp_stat.py", line 565, in listdir<br>
> > return self.__call_with_parser_retry(self._real_listdir, path)<br>
> > File "ftp_stat.py", line 543, in __call_with_parser_retry<br>
> > result = method(*args, **kwargs)<br>
> > File "ftp_stat.py", line 406, in _real_listdir<br>
> > path)<br>
> > PermanentError: 550 /pub/apache/www.apache.org: no such directory or wrong directory parser used<br>
> > Debugging info: ftputil 2.4, Python 2.5.2 (linux2)<br>
> > <br>
> > I guess the selected parser, hinted at in the message, is ok<br>
> > because I can list the root directory on the server and can get<br>
> > the stat result for /pub/apache.<br>
> > <br>
> > So I assume the link on the server points to a non-existent or<br>
> > otherwise invalid directory and the server upon the listdir call<br>
> > decides to just return the path of the link.<br>
> > <br>
> > > thanks<br>
> > <br>
> > You're welcome. :-)<br>
> > <br>
> > Best regards,<br>
> > Stefan<br>
> > <br>
> > _______________________________________________<br>
> > ftputil mailing list<br>
> > ftputil@codespeak.net<br>
> > http://codespeak.net/mailman/listinfo/ftputil<br>
> > <br>
> <br>
> <br>
> <br>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"><br></p></body></html>