ftp bug
[1/3] from: rotenca::telvia::it at: 4-Jun-2002 22:02
I have a problem with a ftp read.
1) i did not chanage rebol code and it worked some time ago
2) a window ftp program reads the same site correctly
I think the problem is in the date format (year or time). Here it is raw data
read by Rebol ftp:
-rw-r--r-- 1 [otenc--tiscali--it] ftpuser 14940 Dec 21 13:13 GNU.txt
-rw-r--r-- 1 [otenc--tiscali--it] ftpuser 27709 Nov 10 2001 anamonitor.r
-rw-r--r-- 1 [otenc--tiscali--it] ftpuser 1545 Nov 16 2001 gcmask.r
-rw-r--r-- 1 [otenc--tiscali--it] ftpuser 3194 Jan 10 13:19 getpath.r
-rw-r--r-- 1 [otenc--tiscali--it] ftpuser 18353 Dec 21 13:27 gpl.txt
-rw-r--r-- 1 [otenc--tiscali--it] ftpuser 1103 Jan 13 18:42 index.r
-rw-r--r-- 1 [otenc--tiscali--it] ftpuser 3773 Nov 13 2001 memusage.r
-rw-r--r-- 1 [otenc--tiscali--it] ftpuser 1199 Dec 22 01:15 refine.r
The window ftp program set the time at 00:00:00 when it read the year (2001)
instead of the time.
Here it is the session after successfully handshake:
Net-log: ["Opening" "tcp" "for" "FTP"]
...
Net-log: "230 Quotas on: using 70.16 of 20480.00 kb"
Net-log: [
"SYST" "*"]
Net-log: "215 UNIX Type: L8"
Net-log: [
["PORT" port/locals/active-check] "200"]
Net-log: "200 PORT command successful."
Net-log: [
["CWD" either empty? port/path ["./"] [join "./" port/path]] "25*"]
Net-log: "250 CWD command successful."
Net-log: [
["TYPE A"] ["200"]]
Net-log: "200 Type set to A."
Net-log: [
["LIST"] ["150" "125"]]
Net-log: {150 Opening ASCII mode data connection for file list.}
Net-log: [
none "226"]
Net-log: "226-Transfer complete."
Net-log: "226 Quotas on: using 70.16 of 20480.00 kb"
** Script Error: parse expected input argument of type: series
** Where: parse-files
** Near: pdate: parse date none
add-date
---
Ciao
Romano
[2/3] from: gscottjones:mchsi at: 4-Jun-2002 19:05
Hi, Romano,
It is not often that I think I can help you, but I think I know what is
going on.
From: "Romano Paolo Tenca"
> I have a problem with a ftp read.
>
> 1) i did not chanage rebol code and it worked some time ago
> 2) a window ftp program reads the same site correctly
>
> I think the problem is in the date format (year or time). Here it is raw
data
> read by Rebol ftp:
>
> -rw-r--r-- 1 [otenc--tiscali--it] ftpuser 14940 Dec 21 13:13 GNU.txt
> -rw-r--r-- 1 [otenc--tiscali--it] ftpuser 27709 Nov 10 2001
anamonitor.r
> -rw-r--r-- 1 [otenc--tiscali--it] ftpuser 1545 Nov 16 2001 gcmask.r
> -rw-r--r-- 1 [otenc--tiscali--it] ftpuser 3194 Jan 10 13:19 getpath.r
> -rw-r--r-- 1 [otenc--tiscali--it] ftpuser 18353 Dec 21 13:27 gpl.txt
> -rw-r--r-- 1 [otenc--tiscali--it] ftpuser 1103 Jan 13 18:42 index.r
> -rw-r--r-- 1 [otenc--tiscali--it] ftpuser 3773 Nov 13 2001 memusage.r
> -rw-r--r-- 1 [otenc--tiscali--it] ftpuser 1199 Dec 22 01:15 refine.r
>
I think the "problem" lies in the owner name and the way that REBOL parses
the directory listing. With your sample listing, it appears that the owner
name is [otenc--tiscali--it] and then the group name is "ftpuser". Currently,
REBOL 2.5 and REBOL/View 1.2.1 set the parse rules as follows:
ftp-dir: [
copy attr 10 attrs sp
digits sp
copy owner chars sp
copy group chars sp
copy size digits sp
copy date [chars sp digits sp [digits some space | none]]
copy time [[digits ":" digits sp] | none]
file-rule
]
where "copy owner chars sp" look for the definition of "chars" as:
char: charset [#"a" - #"z" #"A" - #"Z" #"0" - #"9" "=+-_.:&$*',"]
chars: [any char]
Notice that there is no "@" symbol in the rule. A similar problem occurs
with REBOL when using pop with an account name that includes an "@" symbol.
The rule fails, and thereby throws off the parsing sequence where ultimately
the date parsing fails.
With my versions of REBOL, a little poking around gets to the definition
block as follows (watch for line wrap):
>> probe pick pick get in system/schemes/ftp/handler 'parse-files 2 9
[#"a" - #"z" #"A" - #"Z" #"0" - #"9" "=+-_.:&$*',"]
Assuming that you get this result, you can a simple fix in a newly started
REBOL console session as follows:
>> probe append last pick pick get in system/schemes/ftp/handler
'parse-files 2 9 "@"
=+-_.:&$*',@
== "=+-_.:&$*',@"
With this added character in place, then retry your ftp query. I would try
it myself, but I have no account using a similar "owner" name with an "@"
symbol.
Hope this helps. Please let me know either way.
--Scott Jones
[3/3] from: rotenca:telvia:it at: 5-Jun-2002 18:18
Thank you Scott, the problem was exactly that you have said.
I had already this patch in my script:
net-utils/url-parser/user-char: union net-utils/url-parser/user-char make
bitset! #"@"
it was not enough, but now all works adding also yours:
append last pick pick get in system/schemes/ftp/handler 'parse-files 2 9
@
---
Ciao
Romano