Comments (21)
From [email protected] on October 30, 2007 06:49:45
Checked in a preliminary version of this into my branch in SVN and created a testbed
script called ls.py to play with this. Tested briefly on Linux and OS X platforms.
Will review and test on Windows platform also and check into main branch once
everything looks good.
Attachment: ls.py
from pyftpdlib.
From [email protected] on October 30, 2007 14:37:48
- rename "stat" variable to "stat_result"
- replace stat[int] with stat.value
- add number of links to inode as well instead of just using '1'
Attachment: ls.py
from pyftpdlib.
From [email protected] on October 30, 2007 15:19:56
Turns out tarfile.filemode() returns sane values for Windows too so we don't need to
set default values for Win platforms. removed unneeded code and use UID/GID for
Windows platforms where pwd/grp modules are not available
Attachment: ls.py
from pyftpdlib.
From [email protected] on October 30, 2007 15:51:06
Fixed typo, remove UID/GID and returned to default values since Windows always
returns 0 for those stat values. Added 10 space padding to the file size again to
restore some type of formatting also.
Still need to iron out a better way to do the formatting like ls does it but
otherwise should be most of the way there.
Attachment: ls.py
from pyftpdlib.
From [email protected] on October 30, 2007 18:59:19
- Moved tarfile, pwd and grp module imports outside format_list function.
- (posix) Used specific KeyError exception for catching pwd.getpwuid() and
grp.getgrgid() exceptions.
- (posix) If can't get user and group names use raw uid/gid instead.
- Where posix security model is nonsense use bogus "owner" and "group" values instead.
- (non-posix) Have nlinks = '1' if can't have a reliable number of links to the inode.
- Removed dir_perms variable which was useless.
- Added other space paddings to restore the output formatting as it was before as
long as we don't get a better way to emulate ls formatting.
- Can now use an optional cmd line argument to specify the directory to list.
Labels: Milestone-0.x.x
Attachment: ls.py
from pyftpdlib.
From [email protected] on October 30, 2007 22:33:39
Updated version incorporates some of the changes billiejoex submitted, but also adds
support for formatting the output in the same manner as ls. We will need to discuss
if the overhead is worth bothering with this and do some benchmarking on Linux,
Windows, and OS X systems to see what the actual performance is in real-life testing.
This version uses a similar method to the coreutils ls C code, storing meta
information about a directory listing in a class and then creating the output using
the meta info.
Attachment: ls.py
from pyftpdlib.
From [email protected] on November 01, 2007 09:33:27
A new problem came out. Please take a look at Issue 49 .
Labels: -Milestone-0.x.x
from pyftpdlib.
From [email protected] on November 01, 2007 11:41:33
Returned to fixed formatting after discussion, also fixed Issue 49 and a few other
bugs relating to the arguments passed to ls.py
Attachment: ls-fixed.py
from pyftpdlib.
From [email protected] on November 01, 2007 12:37:00
- updated comments and docstrings
- removed unnecessary str() call
- re-ordered code blocks for formatting order
Attachment: ls-fixed.py
from pyftpdlib.
From [email protected] on November 01, 2007 12:44:07
- added parens around except parameters
Attachment: ls-fixed.py
from pyftpdlib.
From [email protected] on November 01, 2007 12:50:57
- comment / docstring width to 79 chars
- added note about permissions on Windows platforms
Attachment: ls-fixed.py
from pyftpdlib.
From [email protected] on November 01, 2007 19:11:22
- used os.readlink(file) instead of os.path.basename(os.path.realpath(file)) to get
the real path to which the symbolic link points.
As far as I can tell, it should be definitively ok for inclusion now.
Attachment: ls-fixed.py
from pyftpdlib.
From [email protected] on November 02, 2007 10:27:19
Implemented in SVN revision 159
Status: Finished
from pyftpdlib.
From [email protected] on November 04, 2007 18:28:22
Labels: Milestone-0.2.1
from pyftpdlib.
From [email protected] on November 29, 2007 10:54:41
format_list doesn't format symlinks correctly.
The current implementation of format_list in AbstractedFS class always follows
symlinks.
This should NEVER be done. The linux ls command never does that.
For that reason os.lstat should be used instead of os.stat.
Using os.stat, the l flag in filemode rights is never displayed.
The link name will never be resolved as well [lines 1059-1060].
The solution is to replace [lines 1020-1023]:
try:
stat_result = os.stat(file)
except (OSError,AttributeError):
stat_result = os.lstat(file)
with a simple:
stat_result = os.lstat(file)
from pyftpdlib.
From [email protected] on November 29, 2007 13:51:46
Agreed.
My only concern is if it is available on all platforms.
As far as I know where symlinks are not supported os.lstat should be an alias for
os.stat but I'm not 100% sure.
from pyftpdlib.
From [email protected] on November 29, 2007 17:45:15
I decided to use hasattr() to make sure that os.lstat is available,
otherwise os.stat() will be used in replacement.
I also noticed that some module in the stdlib do the same.
This shouldn't be really necessary but, who knows...?
...As we say here in Italy: "'sure' is dead". ;)
Change applied in revision #179 .
from pyftpdlib.
From [email protected] on January 06, 2008 06:36:32
Labels: -Milestone-0.2.1 Milestone-0.3.0
from pyftpdlib.
From [email protected] on January 17, 2008 10:07:33
Fixed in version 0.3.0.
Status: Fixed
from pyftpdlib.
From [email protected] on May 02, 2008 11:26:20
Labels: Version-0.2.0
from pyftpdlib.
From [email protected] on October 13, 2008 12:13:14
Labels: Component-Library
from pyftpdlib.
Related Issues (20)
- unix curl ftp upload leads to corrupted zip file
- server.close_all() freeze the whole application
- Breaks with PyOpenSSL version 22.1.0 HOT 3
- Suggested fix for WSAENOTSOCK error in Windows 11/10 HOT 1
- Python 2.7 support? HOT 1
- Git tag for 1.5.7 is wrongly named HOT 1
- How to custom logging
- format_mlsx not within "run_as_current_user"
- windows add user
- Question: limit Max upload/download speed for each user account HOT 2
- Question: limit Max upload/download speed for user accounts
- Got 530 Authentication failed with tutorial sample HOT 1
- Uploads randomly truncated with TLS 1.3
- call: _do_ssl_shutdown() -> shutdown(), err: Error([('SSL routines', '', 'shutdown while in init')]) HOT 3
- pyftpdlib server resets client connection in PASV/EPSV mode: curl: (13) Bad PASV/EPSV response: 200
- Clarify license for `scripts/internal`
- FTP server stuck HOT 3
- After the open file is completed(fs.open), it seems that there is no call to close it(fd) when it is passed to FileProducer.
- Python blocks all disk access when no space left on device
- Unable to set custom home directory in `DummyAuthorizer().add_user()` HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyftpdlib.