Very Strange FTP upload bug!
Hi all, I've compiled a user version of Zope 2.5.0 in order to test this bug on the latest release. Here's how I can reproduce it: 1. I've compiled 2.5.0 from source and run ./start. 2. I have this file (attached, 21380 bytes) on a local computer: news 3. I attempt to upload the file using lftp-ssl 2.4.1-1 or gftp and this is the outcome: 426 Error creating file. If I edit the file and replace every '<' with an '_' then I can upload it! Regards, Adam PS: Here's how I discovered the problem: I attempt to upload the directory/file structure http/www/news using lftp-ssl 2.4.1-1 (Debian package): lftp user@host:ftpport lftp...> mirror --verbose=3 -R http /openphd/site/References/LinuxToday_2002-01-28/http And this was the bizarre outcome: Making remote directory `www' Mirroring directory `www' Sending local file `www/news' `news' at 21380 (100%) 220.7K/s eta:0s [Waiting for transfer to complete] And that's how it stays. The correct directory structure has been created in the zope database but the file 'news' has not been uploaded. So then I test a dummy file: ./http2/www/test where test is a 22KiB block of zeros (also tested urandom): dd if=/dev/zero of=test count=44 And it uploads without a hitch: mirror --verbose=3 -R http2 /openphd/site/References/LinuxToday_2002-01-28/http2 Here's some more of the upload in action (pressing enter so the messages aren't overwriten): lftp...> mirror --verbose=3 -R http /openphd/site/References/LinuxToday_2002-01-28/http Mirroring directory `www' Sending local file `www/news' `news' at 0 (0%) [Sending data] `news' at 21380 (100%) [Logging in...] `news' at 21380 (100%) 132.2K/s eta:0s [Logging in...] `news' at 21380 (100%) 153.8K/s eta:0s [Waiting for transfer to complete] `news' at 21380 (100%) 167.0K/s eta:0s [Changing remote directory...] `news' at 0 (0%) 163.6K/s eta:0s [Waiting for response...] `news' at 21380 (100%) 171.4K/s eta:0s [Waiting for transfer to complete] `news' at 21380 (100%) 178.7K/s eta:0s [Waiting for transfer to complete] `news' at 21380 (100%) 183.3K/s eta:0s [Changing remote directory...] `news' at 21380 (100%) 186.8K/s eta:0s [Waiting for transfer to complete] `news' at 21380 (100%) 188.8K/s eta:0s [Waiting for transfer to complete] `news' at 21380 (100%) 191.4K/s eta:0s [TLS negotiation...] `news' at 21380 (100%) 193.5K/s eta:0s [Waiting for transfer to complete] `news' at 21380 (100%) 195.4K/s eta:0s [Changing remote directory...] `news' at 21380 (100%) 196.9K/s eta:0s [Waiting for transfer to complete] `news' at 21380 (100%) 197.6K/s eta:0s [Waiting for transfer to complete] `news' at 21380 (100%) 199.7K/s eta:0s [Waiting for transfer to complete] `news' at 21380 (100%) 200.3K/s eta:0s [Waiting for transfer to complete] `news' at 21380 (100%) 200.8K/s eta:0s [Waiting for transfer to complete] Interrupt
Adam Warner wrote:
426 Error creating file.
If I edit the file and replace every '<' with an '_' then I can upload it!
Sounds like your file is being uploaded into a DTML method which the DTML parser doesn't like. I'm sure someone had patches to make this error message more useful, I just don't know where they went :-S If someone can dig the patches up, I'd be happy to integrate them... cheers, Chris
On Sat, 2002-02-02 at 01:13, Chris Withers wrote:
Adam Warner wrote:
426 Error creating file.
If I edit the file and replace every '<' with an '_' then I can upload it!
Sounds like your file is being uploaded into a DTML method which the DTML parser doesn't like. I'm sure someone had patches to make this error message more useful, I just don't know where they went :-S
If someone can dig the patches up, I'd be happy to integrate them...
Chris, I think the issue is deeper than just a more informative error message. If I can't robustly upload files to a zope database using FTP then I may have to reevaluate this specific use of zope. All I uploaded was some HTML source. If zope can't cope with that then I can't easily use it to archive HTML source material. If I was uploading to a filesystem this problem wouldn't arise. Sure I'd still have an issue about serving the correct MIME type but I could solve that using Apache defaults. It appears that Zope's trying to be too clever. Textual content should be able to be uploaded via FTP. Not rejected because of an overly exuberant DTML parser. Regards, Adam
Adam Warner wrote:
If I can't robustly upload files to a zope database using FTP then I may have to reevaluate this specific use of zope. All I uploaded was some HTML source. If zope can't cope with that then I can't easily use it to archive HTML source material.
Look at PUT_factory, it'll probably solve both your MIEM type and uploading problems...
If I was uploading to a filesystem this problem wouldn't arise.
Well, why _are_ you using Zope?! cheers, Chris
At 02.02.2002 02:27 +1300, Adam Warner wrote:
If I can't robustly upload files to a zope database using FTP then I may have to reevaluate this specific use of zope. All I uploaded was some HTML source. If zope can't cope with that then I can't easily use it to archive HTML source material.
It appears that Zope's trying to be too clever. Textual content should be able to be uploaded via FTP. Not rejected because of an overly exuberant DTML parser.
No, it appears you are trying to be too lazy ;-) Zope will by default create DTML Documents when text files are uploaded. You can however use a PUT_factory to make it create whatever you heart desires. An example PUT_factory can be found here: <http://www.zope.org/Members/shh/Patches/PUT_factory.py> What it basically does is mapping a MIME type to a Zope object type. Please also read <http://dev.zope.org/Wikis/DevSite/Proposals/HookablePUTCreation> HTH, Stefan
On Sat, 2002-02-02 at 02:45, Stefan H. Holek wrote:
At 02.02.2002 02:27 +1300, Adam Warner wrote:
If I can't robustly upload files to a zope database using FTP then I may have to reevaluate this specific use of zope. All I uploaded was some HTML source. If zope can't cope with that then I can't easily use it to archive HTML source material.
It appears that Zope's trying to be too clever. Textual content should be able to be uploaded via FTP. Not rejected because of an overly exuberant DTML parser.
No, it appears you are trying to be too lazy ;-)
Zope will by default create DTML Documents when text files are uploaded. You can however use a PUT_factory to make it create whatever you heart desires.
Thanks guys. I can sleep easier now :-) Here's what was 'wrong' with the HTML document: Document Template Parse Error Unexpected tag, for tag <!--#CONFIG TIMEFMT="%Y" -->, on line 266 of news
An example PUT_factory can be found here: <http://www.zope.org/Members/shh/Patches/PUT_factory.py>
What it basically does is mapping a MIME type to a Zope object type.
OK.
Please also read <http://dev.zope.org/Wikis/DevSite/Proposals/HookablePUTCreation>
"For objects which do not yet exist in a given container, Zope creates a NullResourcex object with the given id, which then handles the 'PUT 'by creating one a "stock" Zope object (a DTMLDocumentx for text-like content, an OFS.Image for image-like content, or an OFS.Image.File for all others)." Well that makes perfect sense. So all I need to do is redefine the default text-like content. Using an External Method. So I just have to figure out how to make the default MIME type text/html.
HTH,
Yes, thanks. Regards, Adam
Adam Warner wrote:
On Sat, 2002-02-02 at 01:13, Chris Withers wrote:
Adam Warner wrote:
426 Error creating file.
If I edit the file and replace every '<' with an '_' then I can upload it!
Sounds like your file is being uploaded into a DTML method which the DTML parser doesn't like. I'm sure someone had patches to make this error message more useful, I just don't know where they went :-S
If someone can dig the patches up, I'd be happy to integrate them...
Chris, I think the issue is deeper than just a more informative error message.
If I can't robustly upload files to a zope database using FTP then I may have to reevaluate this specific use of zope. All I uploaded was some HTML source. If zope can't cope with that then I can't easily use it to archive HTML source material.
If I was uploading to a filesystem this problem wouldn't arise. Sure I'd still have an issue about serving the correct MIME type but I could solve that using Apache defaults.
It appears that Zope's trying to be too clever. Textual content should be able to be uploaded via FTP. Not rejected because of an overly exuberant DTML parser.
Regards, Adam
The automatic type determination of the document sets what the object is when you do an upload. Some folks are adding features to use extensions to help recognize types by intent. However, if you upload something that looks HTML-like, it will probably be converted to a DTML document -- at this stage, you probably want a page template instead. You can append ".pt" to the name and it should be stored as a page template (unless I dont know what I'm talking about, which is probability 0.5).
participants (4)
-
Adam Warner -
Chris Withers -
Matthew T. Kromer -
Stefan H. Holek