I found this in mod_perl but the issue can be demonstrated without Perl.
Attempting to open a file for append using the following flags:
APR_BINARY | APR_CREATE | APR_APPEND
will not work. The apr_file_open()
function returns APR_EACCES
If the following flags are used:
APR_BINARY | APR_CREATE | APR_WRITE | APR_APPEND
it works fine. In a vacuum this behavior is debatable. On the one
could be seen to imply APR_WRITE
On the other hand, it might be argued that the first case is incomplete
In the context of Perl, however, particularly when using the APR PerlIO
filter, this becomes problematic. Perl uses special character
sequences which are converted to the proper flags down underneath the
covers. So in Perl '>'
(write to a new file) converts properly but '>>'
(append to an
existing file or create a new one if necessary) does not. There is no
message either, AFAIK, it just fails silently.