[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

WG: FTPAPI does not accept § in file names



Hi Scott,

some additional information on my problem:
I have simplified it by a test program with following content:

0004.00 D TSTLSTAT        PR                  ExtPgm('TSTLSTAT')
0005.00 D  p$Path                       50A   Const             
0006.00                                                         
0007.00  **/COPY LIBFTP/QRPGLESRC,FTPAPI_H                       
0008.00  /copy LIBFTP/QRPGLESRC,SOCKET_H                        
0009.00  /copy LIBFTP/QRPGLESRC,IFSIO_H                         
0010.00  /copy LIBFTP/QRPGLESRC,FTPAPI_H                        
0011.00  /copy LIBFTP/QRPGLESRC,RECIO_H                         
0012.00                                                         
0013.00 D geterror        PR            10I 0                   
0014.00 D   peErrMsg                   256A   options(*nopass)  
0015.00                                                         
0016.00 D wwPath          S            257A                     
0017.00 D wwBuf           S            256A                     
0018.00 D wwErrMsg        S            256A                     
0019.00                                                         
0020.00 D TSTLSTAT        PI

0021.00 D  p$Path                       50A   Const

0022.00

0023.00  /free

0024.00   wwPath = %trim(p$Path)+x'00';

0025.00   p_statds64 = %addr(wwBuf);

0026.00   If lstat64(%addr(wwPath): p_statds64) < 0;

0027.00      CallP geterror(wwErrMsg);

0028.00   EndIf;

0029.00

0030.00   *inLR = *on;

0031.00   Return;

0032.00  /end-free

0033.00
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
0034.00  *  geterror, gets the error message number "errno" as well as

0035.00  *     (optionally) the text of the error message.

0036.00
*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
0037.00 P geterror        B

0038.00 D geterror        PI            10I 0

0039.00 D   peErrMsg                   256A   options(*nopass)


etc. ..  this is your original procedure from FTPAPIR4.


When I call the test program TSTLSTAT with parameter
'/QSYS.LIB/GASS.LIB/QRPGLESRC.FILE/GR$AA00.MBR' there is no error.

When I call the test program TSTLSTAT with parameter
'/QSYS.LIB/GASS.LIB/QRPGLESRC.FILE/GR§AA00.MBR' error 'No such path or
directory.' is returned.

What does the § sign effect?

Kind regards,

Werner Noll
Gesellschaft für Individual-Software mbH
Ludwigstrasse 15
63739 Aschaffenburg
Germany
Geschäftsführer: Werner Noll, Bernd Schröder
HR Aschaffenburg HRB 6020
Phone: +49-6021-299880
Fax: +49-6021-299882
e-mail: werner.noll@xxxxxxxxx
-----Ursprüngliche Nachricht-----
Von: Werner Noll (Gefis) [mailto:werner.noll@xxxxxxxxx] 
Gesendet: Montag, 13. September 2010 11:19
An: 'HTTPAPI and FTPAPI Projects'
Betreff: AW: FTPAPI does not accept § in file names

Hi Scott,

I tried your advice but I get still the same error.
I found out by debugging where the error really occurs.
It's in the procedure 'fixpath' where the pathname is passed to the
procedure 'lstat64'. This procedure can obviously not handle the § sign and
returns an error message (see DEBUG snippets below).  

8517  *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8518  *  This fixes the pathname to a file so that it'll contain 
8519  *   full, true pathname (not a symlink or relative pathname
8520  *++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
8521 P fixpath         B                                         
8522 D fixpath         PI           256A                         
8523 D   pePath                     256A   const                 
8524 D   peObjType                   10A                         
8525 D   peCodePg                    10I 0                       

etc.

8541  ************************************************
8542   Resolve wwPath to a real link (not a symlink)  
8543    and get the statds for it                                        
8544  ************************************************                   
8545                    dou       wwSymlink = *Off                       
8546                                                                     
8547                    eval      wwSymLink = *Off                       
DEBUG: WWPATH = '/QSYS.LIB/GASS.LIB/QRPGLESRC.FILE/GR§AA00.MBR'
8548                    if        lstat64(%addr(wwPath): p_statds64) < 0 
8549                    callp     geterror(wwErrMsg)                     
DEBUG: WWERRMSG =  'No such path or directory.'
8550                    callp     SetError(FTP_LSTAT: wwErrMsg)          
8551                    leave                                            
8552                    endif                                            

I also tried to use the former 'lstat' procedure but there was no
difference.
Somewhere in an other code I have seen the use of EXTPROC('QLGLSTAT') for
the LSTAT operation. Do you know the difference? Would make it sense to
replace 'LSTAT64' by 'QLGLSTAT'? 

Kind regards,

Werner Noll
Gesellschaft für Individual-Software mbH
Ludwigstrasse 15
63739 Aschaffenburg
Germany
Geschäftsführer: Werner Noll, Bernd Schröder
HR Aschaffenburg HRB 6020
Phone: +49-6021-299880
Fax: +49-6021-299882
e-mail: werner.noll@xxxxxxxxx
-----Ursprüngliche Nachricht-----
Von: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] Im Auftrag von Scott Klement
Gesendet: Freitag, 10. September 2010 19:45
An: HTTPAPI and FTPAPI Projects
Betreff: Re: FTPAPI does not accept § in file names

Hi Werner,

My guess is that there's a problem in the ParsePath() routine in 
FTPAPIR4. I haven't looked at it in years, but now that I'm looking at 
it, I see that the CCSID in that routine is hard-coded to 37 -- I 
suspect that's the cause of your issue.

Honestly, I don't understand why it was written that way. (It's stupid 
code!)  Frustratingly, it's probably my fault.

Anyway, in the ParsePath subprocedure, you'll see this:

c                   eval      Qlg_Path_Name_T = *ALLx'00'
c                   eval      CCSID = 37
c                   eval      Country_ID = 'US'
c                   eval      Language_ID = 'ENU'

Please try commenting out those 3 last lines, so that it looks like this:

c                   eval      Qlg_Path_Name_T = *ALLx'00'
c***                eval      CCSID = 37
c***                eval      Country_ID = 'US'
c***                eval      Language_ID = 'ENU'

Please keep the *ALLx'00' line intact, as setting the CCSID, Country_Id 
and Language_Id fields to hex zeros should mean "use the job defaults", 
which is probably what we want.

Try recompiling FTPAPI and running your program again.  Does it work better?


On 9/10/2010 7:34 AM, Werner Noll (Gefis) wrote:
>
>     Hi all,
>
>
>     we use FTPAPI for transferring source files vom one system to another.
>
>     Now we have member names with an embedded § sign.
>
>     In this case the FTP_PUT procedure fails with error at the OpnFile:
>
>
>     open the file to send
>
>                      eval      wwFD = OpnFile(wwLocal: 'R': p_read:
>
>                                            p_close: peSocket)
>
>                      if        wwFD<  0
>
>                      return    -1
>
>                      endif
>
>
>     The pathname in wwLocal is:
>     /QSYS.LIB/GASS.LIB/QRPGLESRC.FILE/GR§AA00.MBR
>
>     The return value in wwFD is  -1.
>
>
>     The problem is surely caused by the § sign.
>
>
>     Is there any work around (except changing file names)?
>
>
>     Man thanks in advance.
>
>     Regards,
>
>
>     Werner Noll
>     Gesellschaft für Individual-Software mbH
>     Ludwigstrasse 15
>
>     63739 Aschaffenburg
>
>     Germany
>
>     Geschäftsführer: Werner Noll, Bernd Schröder
>
>     HR Aschaffenburg HRB 6020
>     Phone: +49-6021-299880
>     Fax: +49-6021-299882
>
>     e-mail: werner.noll@xxxxxxxxx
>
>
>
>
> -----------------------------------------------------------------------
> This is the FTPAPI mailing list.  To unsubscribe, please go to:
> http://www.scottklement.com/mailman/listinfo/ftpapi
> -----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------