Hello All,
(Don't know what the OS400/EBCDIC port is about? See:
http://svn.haxx.se/dev/archive-2006-02/0519.shtml)
The log should hopefully explain what this one is all about, but there is
one thing I want to expand upon once you read that:
This patch blocks AS400 dependent code in two places like this:
SVN_ERR(svn_path_cstring_from_utf8(&unique_name_apr, unique_name,
pool));
#ifdef AS400
apr_err = os400_file_create_prep(unique_name_apr, &flag,
APR_OS_DEFAULT, pool);
if (!apr_err)
#endif
apr_err = apr_file_open(&file, unique_name_apr, flag | APR_BINARY,
APR_OS_DEFAULT, pool);
This obviously is improperly indented code, but is something like this
ever acceptable considering the alternative would result in redundant code
and generally be more intrusive? Like this:
SVN_ERR(svn_path_cstring_from_utf8(&unique_name_apr, unique_name,
pool));
#ifdef AS400
apr_err = os400_file_create_prep(unique_name_apr, &flag,
APR_OS_DEFAULT, pool);
if (!apr_err)
apr_err = apr_file_open(&file, unique_name_apr, flag | APR_BINARY,
APR_OS_DEFAULT, pool);
#else
apr_err = apr_file_open(&file, unique_name_apr, flag | APR_BINARY,
APR_OS_DEFAULT, pool);
#endif
It gets worse in svn_io_open_unique_file2() since there are different code
paths depending on the status returned by apr_file_open().
Let me know what you think, thanks,
Paul B.
----------------------------------------------------------------------
[[[
Every file in OS400 is tagged with a CCSID which represents its
character encoding. On OS400 V5R4 when apr_file_open() creates a
file, its CCSID varies depending if the APR_BINARY flag is passed or
not. If APR_BINARY is passed, the file is created with CCSID 37
(EBCDIC), if not, it has CCSID 1209 (UTF-8).
Since subversion creates files with either binary or UTF-8 content and
all calls to apr_file_open() in subversion use APR_BINARY, these files
are incorrectly tagged.
Simply not using APR_BINARY on OS400 when opening a file isn't an
option, because in this case the OS attempts to convert the file's
contents from its CCSID to UTF-8 when reading the file and vice-versa
when writing to it. This has obvious problems if the file contains
binary data.
This patch ensures files *created* via svn_io_file_open() and
svn_io_open_unique_file2() are tagged with a CCSID of 1208.
======================================================================
* subversion/libsvn_subr/io.c
(os400_file_create_prep): New function.
(svn_io_open_unique_file2, svn_io_file_open): Call new function
prior to calls to apr_file_open() that may create a new file.
]]]
_____________________________________________________________________________
Scanned for SoftLanding Systems, Inc. and SoftLanding Europe Plc by IBM Email Security Management Services powered by MessageLabs.
_____________________________________________________________________________
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Feb 22 18:24:34 2006