Menu

ZIP service can't create file on Linux

2016-03-15
2016-03-15
  • Andrew Gronosky

    Andrew Gronosky - 2016-03-15

    I'm trying out the STAF ZIP service for the first time on Linux, and running into a basic error I don't understand.

    Let's start with /tmp as the working directory to ensure STAFProc has write permission to the working directory:

    ls -l /
    (irreleveant stuff omitted)
    drwxrwxrwt 11 root root 12288 Mar 15 08:52 tmp

    Then try to use STAF to create a ZIP file:

    STAF local ZIP ADD ZIPFILE foo.zip FILE server.log
    Error submitting request, RC: 4001
    Additional info


    STAFZipFile::STAFZipFile: Can't create file [foo.zip].

    I'm very puzzled by this. I know the ZIP service is registered

    STAF local service list
    Response


    Name Library Executable


    CONFIG <Internal> <None>
    DELAY <Internal> <None>
    DIAG <Internal> <None>
    ECHO <Internal> <None>
    FS <Internal> <None>
    HANDLE <Internal> <None>
    HELP <Internal> <None>
    LIFECYCLE <Internal> <None>
    MISC <Internal> <None>
    PING <Internal> <None>
    PROCESS <Internal> <None>
    QUEUE <Internal> <None>
    SEM <Internal> <None>
    SERVICE <Internal> <None>
    SHUTDOWN <Internal> <None>
    TRACE <Internal> <None>
    TRUST <Internal> <None>
    VAR <Internal> <None>
    ZIP STAFZip <None>

    and my machine trusts itself with trust level 5. The working directory is world-writeable.

    So what could be the problem? There's probably something obvious (to others).

    Thanks,

     
  • Sharon Lucas

    Sharon Lucas - 2016-03-15

    Fully qualify the name of the zip file that you want to create and the file that you want to add to it. A STAF service request runs within the STAFProc environment, not within the environment from which you are submitting the request. For example:

    # STAF local ZIP ADD ZIPFILE /tmp/foo.zip FILE /tmp/server.log
    Response
    --------
    
    # STAF local ZIP LIST ZIPFILE /tmp/foo.zip
    Response
    --------
    Length  Method Size    Ratio Date     Time  CRC-32   Name
    ------- ------ ------- ----- -------- ----- -------- --------------
       2321 Defl:X     868  37%  03-15-16 08:25 d93eedcb tmp/server.log
    
    #
    

    Or you may want to specify the RELATIVETO option. For example:

    # STAF local ZIP ADD ZIPFILE /tmp/foo.zip FILE /tmp/server.log RELATIVETO /tmp
    Response
    --------
    
    # STAF local ZIP LIST ZIPFILE /tmp/foo.zip
    Response
    --------
    Length  Method Size    Ratio Date     Time  CRC-32   Name
    ------- ------ ------- ----- -------- ----- -------- ----------
       2321 Defl:X     868  37%  03-15-16 08:25 d93eedcb server.log
    
    #
    

    See section "8.22.4 ADD (aka ZIP)" in the STAF User's Guide at http://staf.sourceforge.net/current/STAFUG.htm#HDRZIPSRV which describes the ZIP service's ADD request's options as follows and provides examples:

    • ZIPFILE contains the fully qualified name of a Zip archive file. If the Zip archive file does not exist, it will be created, but the directory path specified for it must already exist.
    • FILE contains the fully qualified file name you want to add into the ZIP archive.
    • RELATIVETO contains the prefix to be excluded from the fully qualified file name or directory name that is to be added into the ZIP archive.
     

    Last edit: Sharon Lucas 2016-03-15
    • Andrew Gronosky

      Andrew Gronosky - 2016-03-15

      Thank you for the prompt and complete reply! This worked, of course. RTFM always helps; I did try that but the significance of the phrase "fully qualified name of a Zip file" slipped past me the first time. :-)

       

Log in to post a comment.