Bug 227410 - [ftp] need listing parser for HFS (on z/os)
Summary: [ftp] need listing parser for HFS (on z/os)
Status: NEW
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: Future   Edit
Assignee: David McKnight CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2008-04-16 15:31 EDT by David McKnight CLA
Modified: 2009-06-16 09:03 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David McKnight CLA 2008-04-16 15:31:58 EDT
Although there is an MVS listing parser, there is no listing parser that works for HFS (the unix file system on z/os).
Comment 1 Martin Oberhuber CLA 2008-04-16 15:37:02 EDT
Writing a listing parser is pretty simple once the listing format is known. I suppose, though, that there are not too many people around who have a zOS machine with HFS under their desk.

To give us a basic idea what this is going to be like, can you do a sample session with a commandline ftp client and copy&paste the log here:

ftp hfs.your.zos.org
user> ######
pass> ######
ftp> quote syst
ftp> quote feat
ftp> pwd
ftp> dir
ftp> cd some.dir
ftp> dir
ftp> cd /some/dir
ftp> dir
ftp> bye

Thanks
Comment 2 David McKnight CLA 2008-04-16 16:25:12 EDT
Here's what I get.  Note that I have to do a "cd /" to switch systems.  If I had done dir before that, then I would have been looking at datasets from MVS.


Connected to stplex4b.svl.ibm.com.
220-FTPD1 IBM FTP CS V1R9 at STPLEX4B.SVL.IBM.COM, 20:20:47 on 2008-04-16.
220 Connection will close if idle for more than 60 minutes.
User (stplex4b.svl.ibm.com:(none)): ####
331 Send password please.
Password:
230 MASAO is logged on.  Working directory is "MASAO.".
ftp> quote syst
215 MVS is the operating system of this server. FTP Server is running on z/OS.
ftp> quote feat
211 no Extensions supported
ftp> pwd
257 "'MASAO.'" is working directory.
ftp> cd /
250 HFS directory / is the current working directory
ftp> quote syst
215 UNIX is the operating system of this server. FTP Server is running on z/OS.
ftp> quote feat
211 no Extensions supported
ftp> pwd
257 "/" is the HFS working directory.
ftp> dir
200 Port request OK.
125 List started OK
total 368
drwxr-xr-x   8 BPXOINIT SYSSTC      8192 Nov 18  2003 MVSPP
dr-xr-xr-x   2 BPXOINIT OMVSTTY        0 Apr 16 00:44 SERVICE
drwxr-xr-x   6 BPXOINIT SYSSTC      8192 Jan 25  2000 SYSTEM
drwxr-xr-x   4 BPXOINIT SYSSTC     40960 Apr 16 00:44 bin
dr-xr-xr-x   2 BPXOINIT OMVSTTY        0 Apr 16 00:44 cognos
drwxr-xr-x   2 BPXOINIT SYSSTC     36864 May 14  2005 dev
drwxr-xr-x  13 BPXOINIT SYSSTC      8192 Apr 16 00:45 etc
lrwxrwxrwx   1 BPXOINIT SYSSTC        16 May  6  2004 krb5 -> etc/dce/var/krb5
drwxr-xr-x   2 BPXOINIT SYSSTC      8192 May  3  2007 lib
d---------   2 BPXOINIT SYSSTC      8192 Jun 25  1999 olap
drwxr-xr-x   2 BPXOINIT SYSSTC      8192 Apr 11  2002 opt
dr-xr-xr-x   2 BPXOINIT OMVSTTY        0 Apr 16 00:44 postserv
drwxr-xr-x   4 BPXOINIT SYSSTC      8192 May 21  2007 samples
drwxrwxrwx   3 BPXOINIT SYSSTC      8192 Apr 16 19:43 tmp
dr-xr-xr-x   2 BPXOINIT OMVSTTY        0 Apr 16 00:44 tuna
dr-xr-xr-x  16 BPXOINIT OMVSTTY        0 Apr 16 18:16 u
drwxr-xr-x  12 BPXOINIT SYSSTC      8192 May  3  2007 usr
drwxrwxrwt   3 BPXOINIT SYSSTC      8192 Dec 10  2003 var
lrwxrwxrwx   1 BPXOINIT SYSSTC        12 May  6  2004 wsdb -> ../tuna/wsdb
lrwxrwxrwx   1 BPXOINIT SYSSTC        13 May  6  2004 wsdb3 -> ../tuna/wsdb3
lrwxrwxrwx   1 BPXOINIT SYSSTC        13 May  6  2004 wsdb4 -> ../tuna/wsdb4
dr-xr-xr-x   3 BPXOINIT SYSSTC      8192 May  4  2002 zFS
250 List completed successfully.
ftp: 1406 bytes received in 0.00Seconds 1406000.00Kbytes/sec.
ftp>
Comment 3 Martin Oberhuber CLA 2008-04-16 16:33:52 EDT
Looks like this should be working out of the box, provided that a "cd /" init command is sent.
Try it out by creating an FTP parser extension named "z/OS HFS Mode" parser which is copied from the UNIX parser but adds the "cd /" init command, can you?
Comment 4 David McKnight CLA 2008-04-16 18:38:26 EDT
(In reply to comment #3)
> Looks like this should be working out of the box, provided that a "cd /" init
> command is sent.
> Try it out by creating an FTP parser extension named "z/OS HFS Mode" parser
> which is copied from the UNIX parser but adds the "cd /" init command, can you?

I did try fiddling with this yesterday:

       
      <parser
            class="org.apache.commons.net.ftp.parser.UnixFTPEntryParser"
            systemTypeRegex=".*[Hh][Ff][Ss].*"
            id="org.eclipse.rse.ftp.parser.HFS"
            label="HFS"
            priority="100">
           <initCommand
              cmd="cd /usr/bin">
            </initCommand>
      </parser>

What I found is that, first, "cd /" never switched the modes.  Also, I had to create a filter that went inside /usr in order to get anything HFS.  The Root filter didn't work and My Home pointed to something MVS.
Comment 5 Martin Oberhuber CLA 2008-04-17 05:30:03 EDT
The extension looks good. Can you paste the FTP Console Log from a session inside RSE? I'm surprised that "cd /" doesn't switch modes. Perhaps the wrong parser is taken after all. Did you try manually picking your newly contributed parser in the new connection wizard / connectorservice property set, rather than have it auto-detected?
Comment 6 David McKnight CLA 2008-04-17 07:59:20 EDT
(In reply to comment #5)
> The extension looks good. Can you paste the FTP Console Log from a session
> inside RSE? I'm surprised that "cd /" doesn't switch modes. Perhaps the wrong
> parser is taken after all. Did you try manually picking your newly contributed
> parser in the new connection wizard / connectorservice property set, rather
> than have it auto-detected?

Here's the log I get:

220-FTPD1 IBM FTP CS V1R9 at STPLEX4B.SVL.IBM.COM, 11:44:27 on 2008-04-17.

220 Connection will close if idle for more than 60 minutes.

USER masao
331 Send password please.

PASS ******
230 MASAO is logged on.  Working directory is "MASAO.".

SYST
215 MVS is the operating system of this server. FTP Server is running on z/OS.

TYPE I
200 Representation type is Image

NOOP
200 OK

CWD /
250 HFS directory / is the current working directory

PORT 9,26,94,24,10,120
200 Port request OK.

LIST
125 List started OK

250 List completed successfully.

NOOP
200 OK

CWD /usr
250 HFS directory /usr is the current working directory

PORT 9,26,94,24,10,121
200 Port request OK.

LIST
125 List started OK

250 List completed successfully.

drwxr-xr-x   2 BPXOINIT SYSSTC      8192 Nov 12  2001 bin
drwxr-xr-x  12 BPXOINIT SYSSTC     36864 Mar 21 17:57 include
drwxr-xr-x   9 BPXOINIT SYSSTC     28672 Mar  7 19:11 lib
drwxr-xr-x   2 BPXOINIT SYSSTC      8192 May  3  2007 local
drwxr-xr-x  25 BPXOINIT SYSSTC      8192 Jan 29 22:41 lpp
drwxrwxr-x   2 BPXOINIT SYSSTC      8192 Aug 15  1994 mail
drwxr-xr-x   5 BPXOINIT SYSSTC      8192 Dec 11  1998 man
drwxr-xr-x   3 BPXOINIT SYSSTC      8192 Sep  7  2007 sbin
drwxr-xr-x   3 BPXOINIT SYSSTC      8192 Apr 28  1995 share
drwxr-xr-x   6 BPXOINIT SYSSTC      8192 Jul 12  1996 spool

Comment 7 Martin Oberhuber CLA 2008-04-17 09:43:50 EDT
(In reply to comment #6)
> SYST
> 215 MVS is the operating system of this server. FTP Server is running on z/OS.

Your SystemTypeRegex won't match this "SYST" return string:
     systemTypeRegex=".*[Hh][Ff][Ss].*"

So your parser will not be chosen automatically.

Was the Console Log you posted from a session where you had selected the HFS parser manually?
Comment 8 David McKnight CLA 2008-04-17 10:10:45 EDT
(In reply to comment #7)
> (In reply to comment #6)
> > SYST
> > 215 MVS is the operating system of this server. FTP Server is running on z/OS.
> Your SystemTypeRegex won't match this "SYST" return string:
>      systemTypeRegex=".*[Hh][Ff][Ss].*"
> So your parser will not be chosen automatically.
> Was the Console Log you posted from a session where you had selected the HFS
> parser manually?

Yes, I selected it manually.  I guess it ought to be [Mm][Vv][Ss] for auto..but then there's also the mvs parser.
Comment 9 Martin Oberhuber CLA 2008-04-17 10:25:53 EDT
Yes. No chance picking it automatically here, because the single server can operate in dual modes.

Still, do you think it makes sense that you commit your HFS parser?
Comment 10 David McKnight CLA 2008-04-17 10:49:32 EDT
(In reply to comment #9)
> Yes. No chance picking it automatically here, because the single server can
> operate in dual modes.
> Still, do you think it makes sense that you commit your HFS parser?

I don't know whether it makes sense or not.  I didn't actually write a parser; I just pointed to the unix one.  If there's a way to set this up so that all filters resolve things as expected, then it would be good to have this.
Comment 11 Martin Oberhuber CLA 2008-04-17 10:54:18 EDT
Well you did write a parser config, because your config sends the "cd /" command which asks the ftp server to switch into hfs mode, right?

I don't understand why it doesn't stay in hfs mode and why the "my home" filter doesn't resolve properly. I guess that this will need some debugging. 
Comment 12 Ivan iorentini CLA 2009-06-16 09:03:33 EDT
When the 'SYST' FTP command is used for the z/OS server, the reply is determined by the current working directory at the server. 

- If the current working directory is an hfs directory, the reply is: 
215 UNIX is the operating system of this server. FTP Server is running on z/OS. 
- Otherwise, the reply is: 
215 MVS is the operating system of this server. FTP Server is running on z/OS.

The working directory type sets the ouput of the 'LIST' ftp command and the proper parser need to be used.

The intial current working directory type (after the login to the server) can be customized in the FTP.DATA configuration file using the configuration statement: 'STARTDIRECTORY HFS'.
After the login phase, the working directory type can be changed using the CD command: if the specified directory is an hfs filename the working directory type is automatically set to hfs.

The main real problem is that when the directory type is hfs than the FTP parser extension for UNIX enviroment doesn't work, ad 'IT SHOULD WORK !!'.

In org.eclipse.rse.subsystems.files.ftp.xxxxxxxx.jar the plugin.XML file contains: 

      <parser
            class="org.apache.commons.net.ftp.parser.UnixFTPEntryParser"
            id="org.eclipse.rse.ftp.parser.Unix"
            label="%FTPParser.UNIX"
            listCommandModifiers="-a"
            priority="100"
            systemTypeRegex=".*[Uu][Nn][Ii][Xx].*">
      </parser>


and the listCommandModifiers="-a" cause the 'LIST -a' to be issued to obtain the list of files... 

in z/OS the 'LIST -a' displays only the filenames (whithout any other information) and so the parser is unable to parse the output correcty.

if you change the plugin.XML as:

      <parser
            class="org.apache.commons.net.ftp.parser.UnixFTPEntryParser"
            id="org.eclipse.rse.ftp.parser.Unix"
            label="%FTPParser.UNIX"
            listCommandModifiers="-al"
            priority="100"
            systemTypeRegex=".*[Uu][Nn][Ii][Xx].*">
      </parser>

the problem seems resolved; so we can ask if it possible to change the distribution of the plugin.xml file.