Firefox fails to parse directory listing of Widnows CE and WEC7 FTP Server

RESOLVED FIXED in Firefox 40

Status

()

defect
RESOLVED FIXED
4 years ago
3 years ago

People

(Reporter: ilya.ilba, Assigned: ilya.ilba)

Tracking

40 Branch
mozilla40
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(firefox40 fixed)

Details

Attachments

(2 attachments, 1 obsolete attachment)

(Assignee)

Description

4 years ago
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0
Build ID: 20150108202552

Steps to reproduce:

This bug is similar to Bug 1094167.
Most Microsoft FTP Servers return the following directory listing in response to LIST.
10-10-14  10:10AM       <DIR>        FTP

However, Windows CE and other embedded platforms from Microsoft are shipped with FTP server wich returns time in 24 hour format:
12-23-14  14:49       <DIR>          Registry
01-18-12  19:00             30724571 testfile2.BIN

The exact line which does formatting (e.g. c:\WINCE600\PUBLIC\SERVERS\SDK\SAMPLES\FTPD\ftpsession.cpp, function void CFtpSession::SendDirLine(WIN32_FIND_DATA *pfd, BOOL bDetailed)
):
        StringCchPrintfW(szWFile, SVSUTIL_ARRLEN(szWFile), L"%02d-%02d-%02s  %02d:%02d% 12s% 9s %s\r\n",
            st.wMonth,st.wDay,&(szWYear[2]),st.wHour,st.wMinute,
            bDir ? L"<DIR>" : L"",
            bDir ? L"" : szSize,
            pfd->cFileName);



Actual results:

Firefox cannot parse this, and renders no directory listing.
Works fine in Internet Explorer. To be fair, I don't know any other browsers which support this type of output without extra fiddling.
(Assignee)

Updated

4 years ago
Component: Untriaged → Networking: FTP
Product: Firefox → Core
(Assignee)

Comment 2

4 years ago
Sorry, I meant that this bug is similar to Bug 1061898, not Bug 1094167 (which is just a duplicate).
(Assignee)

Comment 3

4 years ago
I haven't tested this as I don't have tools to build the whole thing (and don't really want to install them). Is there any way to try it?
Attachment #8554588 - Flags: review?(jduell.mcbugs)
(Assignee)

Comment 4

4 years ago
There is also a duplicate Bug 839432

Comment 5

4 years ago
Comment on attachment 8554588 [details] [diff] [review]
fix 24-hour support for MS ftp directory list parse

Review of attachment 8554588 [details] [diff] [review]:
-----------------------------------------------------------------

Code looks fine.  One question about the 24 hour format--see below.  Also, this patch is for a file that doesn't exist!  The file (at least currently) is called ParseFTPList.cpp, not ftpparse.cpp.  It applies fine--I'll post a correct patch.

::: C:\temp\A\netwerk\streamconv\converters\ftpparse.cpp
@@ +732,5 @@
> +      // Microsoft FTP server with FtpDirBrowseShowLongDate set returns year
> +      // in 4-digit format:
> +      // "10-10-2014  10:10AM       <DIR>        FTP"
> +      // Windows CE FTP server returns time in 24-hour format:
> +      // "05-03-13  22:01       <DIR>          APPS"

I assume WinCE is using '09:25', ie leading 0 if needed so date will always have 5 digits?
Attachment #8554588 - Flags: review?(jduell.mcbugs) → feedback+

Comment 6

4 years ago
Ilya: I pushed a try build with your patch.  You should be able to download a copy here

   http://ftp.mozilla.org/pub/mozilla.org/firefox/try-builds/jduell@mozilla.com-6f1f1f892fab/try-win32-debug/firefox-38.0a1.en-US.win32.zip

If you could try it out that would be great.  Thanks.
(Assignee)

Comment 7

4 years ago
> The file (at least currently) is called ParseFTPList.cpp, not ftpparse.cpp.
Ah.. that was my attempt to build a standalone test app. Sorry about the confusion.

>I assume WinCE is using '09:25', ie leading 0 if needed so date will always have 5 digits?

Yes, you can see the format string is in my first message:
L"%02d-%02d-%02s  %02d:%02d% 12s% 9s %s\r\n"
                   ^^   ^^

Below is an example of the list

ftp> dir
200 Command okay.
150 File status okay; about to open data connection.
09-07-06  04:00               100464 LOADCEPC.EXE
09-07-06  04:00               105175 EBOOT.BIN
01-14-15  12:35                 4274 AUTOEXEC.BAT
12-23-14  14:16                  690 CONFIG.SYS
09-07-06  04:00                13591 README.TXT
09-07-06  04:00                27127 SBOOT.BIN
09-07-06  04:00                 7121 VESATEST.EXE
08-23-12  18:12                33191 HIMEM.SYS
08-24-12  02:13       <DIR>          Startup
11-07-07  03:20                41992 TcpConnectionA.dll
08-14-12  01:48               223744 app.exe
11-07-07  03:20                53240 eDbgTL.dll
07-30-08  16:32                33816 DeviceAgentTransport.dll
11-07-07  03:20                62984 ConmanClient2.exe
11-07-07  03:20                25600 CMAccept.exe
11-07-07  03:20                22536 clientshutdown.exe
08-31-12  23:28                   22 514c36bf-c13e-4091-a3a7-1e566227b20d
10-11-12  13:48              1026236 PORT.ILK
10-12-12  11:07                17000 SUPER.EXE
05-03-13  22:01       <DIR>          APPS
12-23-14  13:54             38912000 test.tmp
12-23-14  14:15       <DIR>          Windows
12-23-14  14:28             30078619 FTP16E9.tmp
12-23-14  14:31              2265088 FILE0001.CHK
12-23-14  14:49       <DIR>          Registry
01-18-12  19:00             30724571 testfile2.BIN
01-15-12  02:21             30722911 NKbk.BIN
01-23-15  13:35             43300859 NKEMGD.BIN
01-16-12  01:23                   72 NKCP.NSH
01-18-12  19:50             30707731 NK.BIN
226 Closing data connection.
ftp: 1669 bytes received in 0.01Seconds 111.27Kbytes/sec.

>Ilya: I pushed a try build with your patch.  You should be able to download a copy here
Thanks for that, I will try it as soon as I get this damn CE machine working again.
(Assignee)

Comment 8

4 years ago
I tested it on my windows CE server (screenshot attached), and possible regresssions against known MS servers.
Regular MS FTP: ftp://ftp.microsoft.com/developr/ 
Long date:      ftp://ftp.topsolid.com/public/topsolid/dvd/

Works well.
(Assignee)

Comment 9

4 years ago
Proposed fix tested against WEC7 FTP server returning dates in 24h format
(Assignee)

Comment 10

4 years ago
Comment on attachment 8555245 [details]
ms_ftp_24h_time_wec7.png

directory listing corresponding to the picture

ftp> dir
200 Command okay.
150 File status okay; about to open data connection.
01-01-98  04:00       <DIR>          Network
01-01-98  04:00       <DIR>          Hard Disk
01-01-98  04:00       <DIR>          USB Hard Disk
01-19-12  20:19       <DIR>          Application Data
01-19-12  12:19               147456 mxip_system.vol
01-19-12  12:19                   23 Control Panel.lnk
01-19-12  12:19       <DIR>          My Recent Documents
01-19-12  12:19       <DIR>          My Documents
01-19-12  12:19       <DIR>          Program Files
01-19-12  12:19                28672 mxip_swmgmt.vol
01-19-12  12:19       <DIR>          Temp
01-19-12  12:19       <DIR>          Windows
226 Closing data connection.
ftp: 615 bytes received in 0.00Seconds 615000.00Kbytes/sec.
(Assignee)

Comment 11

4 years ago
I've tested a try build, works fine on various MS servers.
Attachment #8554588 - Attachment is obsolete: true
Attachment #8557875 - Flags: review?(jduell.mcbugs)

Updated

4 years ago
Attachment #8557875 - Flags: review?(jduell.mcbugs) → review+
Why is this patch not landed yet?

Comment 13

4 years ago
Works on try--I'll land as soon as inbound opens up again.  Sorry for the delay--this is a good patch!

  https://treeherder.mozilla.org/#/jobs?repo=try&revision=71881f54fed2

Comment 15

4 years ago
Ilya: thanks for the patch, and sorry for the delay.  Assuming this lands on m-c soon (it should) this will be in Firefox 40.  We appreciate the contribution!
Version: 35 Branch → 40 Branch
https://hg.mozilla.org/mozilla-central/rev/304554a697fe
Assignee: nobody → ilya.ilba
Status: UNCONFIRMED → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Duplicate of this bug: 839432
You need to log in before you can comment on or make changes to this bug.