httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 52975] New: Receiving files is suboptimal
Date Fri, 23 Mar 2012 00:57:03 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=52975

             Bug #: 52975
           Summary: Receiving files is suboptimal
           Product: Apache httpd-2
           Version: 2.2.22
          Platform: PC
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_ftp
        AssignedTo: bugs@httpd.apache.org
        ReportedBy: mi+apache@aldan.algebra.com
    Classification: Unclassified


While a new file is being received, its mode is set to 0, but its name is
already that of the new file. If, for whatever reason, httpd dies during
transmission, a zero-mode file under the desired name will remain on the
filesystem.

Also, sites, which mirror FTP-content periodically can occasionally suffer from
races -- if the mirroring program (such as rsync) runs, while a file-upload is
in progress, it will try, but fail to mirror it.

A possible solution would be to open new files under a different name. For
example, if the (new) keyword specifies a prefix:

FTPTemporaryFilePrefix       .in-flight-

the new file foo/bar can be opened as (using apr_file_mktemp()):

foo/.in-flight-35CH21bar

Then, upon completion of upload, it can be renamed into foo/bar, if the
uploaded was successful, or deleted, if the upload failed. (The renaming is
conveniently atomic.)

The existing files can be similarly-handled, when a complete overwrite is
requested:

1. Receive under new (temporary) name.
2. Rename the existing name into another temporary name.
3. Rename the temporary name from 1. into the desired name.
4. Unlink the temporary name from 2.

This approach will help preserve file-integrity during the (potentially
lengthy) uploads and also help tools like rsync, who can be told to skip any
file, that matches certain pattern (such as ".in-flight-*").

If this is deemed acceptable in principle, I can begin working on a patch.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


Mime
View raw message