Author: stefan2 Date: Sat Apr 11 10:59:48 2015 New Revision: 1672857 URL: http://svn.apache.org/r1672857 Log: On the fsx-1.10 branch: Correct the enhanced format check.
* subversion/libsvn_fs_x/fs_x.c (check_format): Don't simply accept any non-experimental format. Correctly report the supported version range. Found by: danielsh Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs_x.c Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs_x.c URL: http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs_x.c?rev=1672857&r1=1672856&r2=1672857&view=diff ============================================================================== --- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs_x.c (original) +++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs_x.c Sat Apr 11 10:59:48 2015 @@ -95,21 +95,28 @@ check_format(int format) { /* Put blacklisted versions here. */ - /* We don't support experimental formats except when it matches the - * current format. */ - if ( SVN_FS_X__EXPERIMENTAL_FORMAT_NUMBER < format - || format == SVN_FS_X__FORMAT_NUMBER) + /* We support any format if it matches the current format. */ + if (format == SVN_FS_X__FORMAT_NUMBER) + return SVN_NO_ERROR; + + /* Experimental formats are only supported if they match the current, but + * that case has already been handled. So, reject any experimental format. + */ + if (SVN_FS_X__EXPERIMENTAL_FORMAT_NUMBER >= format) + return svn_error_createf(SVN_ERR_FS_UNSUPPORTED_FORMAT, NULL, + _("Unsupported experimental FSX format '%d' found; current format is '%d'"), + format, SVN_FS_X__FORMAT_NUMBER); return SVN_NO_ERROR; /* By default, we will support any non-experimental format released so far. */ - if ( SVN_FS_X__EXPERIMENTAL_FORMAT_NUMBER < format - && format <= SVN_FS_X__FORMAT_NUMBER) + if (format <= SVN_FS_X__FORMAT_NUMBER) return SVN_NO_ERROR; return svn_error_createf(SVN_ERR_FS_UNSUPPORTED_FORMAT, NULL, - _("Expected FS format between '1' and '%d'; found format '%d'"), - SVN_FS_X__FORMAT_NUMBER, format); + _("Expected FSX format between '%d' and '%d'; found format '%d'"), + SVN_FS_X__EXPERIMENTAL_FORMAT_NUMBER + 1, SVN_FS_X__FORMAT_NUMBER, + format); } /* Read the format file at PATH and set *PFORMAT to the format version found