Share the Knowledge
RSS icon Home icon
  • Apache 2.2: Partial results are valid but processing is incomplete, unable to stat file (X-Sendfile)

    Posted on June 9th, 2011 webmaster 5 comments         Print Print

    Error Message:

    (70008) Partial results are valid but processing is incomplete: xsendfile: unable to stat file: //server_name/folder/file

    I deployed my code to our development box over the weekend which uses the X-Sendfile module for Apache to serve files but ran into this issue when I tried to download a file.  The X-Sendfile module worked fine on my local machine.  The only difference I could find was our development box was running Windows XP 64-bit and I’m running 32-bit (this is why it’s a good idea to try to have the machines in all your environments to be identical, VMs are great for this).

    I couldn’t find a solution for my exact problem so I decided to check out the source code and searched for the error message “unable to stat file”:

      /* stat (for etag/cache/content-length stuff) */
      if ((rv = apr_file_info_get(&finfo, APR_FINFO_NORM, fd)) != APR_SUCCESS) {
        ap_log_rerror(
          APLOG_MARK,
          APLOG_ERR,
          rv,
          r,
          "xsendfile: unable to stat file: %s",
          translated
          );
        apr_file_close(fd);
        ap_remove_output_filter(f);
        ap_die(HTTP_FORBIDDEN, r);
        return HTTP_FORBIDDEN;
      }
    

    It appears that the apr_file_info_get() function was not returning APR_SUCCESS on our development box for some reason.  I did some research on that function and found an old article that mentions something about one of the arguments may be beyond the OS file system support and would always return APR_INCOMPLETE (http://dev.ariel-networks.com/apr/apr-tutorial/html/apr-tutorial-5.html).

    I put a quick fix/hack to make it work in our environment by simply checking for both APR_SUCCESS and APR_INCOMPLETE and only throw the error when the status is neither of those.

    I simply changed:

    if ((rv = apr_file_info_get(&finfo, APR_FINFO_NORM, fd)) != APR_SUCCESS)
    

    to

    if ((rv = apr_file_info_get(&finfo, APR_FINFO_NORM, fd)) != APR_SUCCESS	  && (rv = apr_file_info_get(&finfo, APR_FINFO_NORM, fd)) != APR_INCOMPLETE)
    

    I then did a compile/build on Windows (this is another story), redeployed the module, and it finally worked!  I also checked the MD5 and SHA-1 hashes of a couple of files served through mod_xsendfile just to make sure it’s working properly and they matched the original hashes.

    You can download the source and the .so file (if you trust me enough :) ) with the fix from here.

  • VirtualBox: USB devices grayed out on Ubuntu 10.04 LTS

    Posted on April 24th, 2011 webmaster No comments         Print Print

    I bought a new GPS recently (Garmin nuvi 1350LMT) and wanted to upload new maps to it using Garmin’s MapSource software.  However, the software only supports Windows and Mac so I had no choice but to do it on Windows.  Since I already have a Windows XP virtual machine running on VirtualBox (which I use for work as our company’s remote access software doesn’t support Linux either) I figured I could probably just allow the VM to access the host’s USB devices.

    This is very easy to do on VirtualBox, you just go to your VM’s settings -> USB -> Enable USB/USB 2.0 controllers, which is probably already set by default.  To use USB 2.0 you will need to download and install the VirtualBox Extension Pack.

    Now the issue I ran into was when I tried to attach the USB device to my VM.  The device was detected but the option was grayed out.  This turned out to be just insufficient permission.  To allow your account to be able to do this simply go to System -> Administration -> Users and Groups.  Then select your account, click Advanced Settings, click the User Privileges tab, then check Use VirtualBox virtualization solution.  Log out and log back in and you should now be able to attach USB devices to your VM! MapSource was able to detect my nuvi and I was able to send map data to it.

  • Rename multiple files with Metamorphose

    Posted on November 28th, 2010 webmaster 1 comment         Print Print

    I’ve taken a lot of pictures lately and I sometimes mistakenly just copied the contents of the memory card directly to my hard drive instead of using the “Import Pictures…” option where you can specify the name of the files and they will be numbered for you automatically.

    In Windows, you can select multiple files and right-click and rename the first file and the rest of the files will be named the same way with “(1)…(n)” numbers at the end to differentiate them.

    Multiple files renamed in Windows

    Some people, like myself, might not like this numbering, because they won’t sort by name properly in other systems.  In my case, I wanted the numbers to be “001…n” and Metamorphose lets me do just that easily.

    Read the rest of this entry »