After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 581953 - Array partitioning is not verified!
Array partitioning is not verified!
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: General
git master
Other Linux
: Normal major
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2009-05-09 03:13 UTC by Andreas J. Guelzow
Modified: 2009-05-09 07:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andreas J. Guelzow 2009-05-09 03:13:03 UTC
When an ods file (created by gnumeric or OOo) contains an array formula over 2 or more cells, the formula is only imported in the first cell. the otehrs only show the stored value.
Comment 1 Andreas J. Guelzow 2009-05-09 05:41:04 UTC
Hmm, the problem is that while in oo_cell_start we are setting the formula for the whole array, when we encounter the values for the non-corner cells  gnm_cell_is_nonsingleton_array (cell) returns FALSE when it should be TRUE. THis causes the expressions in those cells to be destroyed.
Comment 2 Andreas J. Guelzow 2009-05-09 05:54:11 UTC
Wow. I don't really understand everything about our expressions, but:

GnmExprArrayCorner const *
gnm_expr_top_get_array_corner (GnmExprTop const *texpr)
{
	g_return_val_if_fail (IS_GNM_EXPR_TOP (texpr), NULL);
	return GNM_EXPR_GET_OPER (texpr->expr) == GNM_EXPR_OP_ARRAY_CORNER
		? &texpr->expr->array_corner
		: NULL;
}

from expr.c looks wrong to me. Shouldn't this be:

GnmExprArrayCorner const *
gnm_expr_top_get_array_corner (GnmExprTop const *texpr)
{
	g_return_val_if_fail (IS_GNM_EXPR_TOP (texpr), NULL);
	return ((GNM_EXPR_GET_OPER (texpr->expr) == GNM_EXPR_OP_ARRAY_CORNER)
                || (GNM_EXPR_GET_OPER (texpr->expr) == GNM_EXPR_OP_ARRAY_ELEM))
		? &texpr->expr->array_corner
		: NULL;
}

at least as we use it in 

GnmExprArrayCorner const *
gnm_cell_is_array_corner (GnmCell const *cell)
{
	return cell && gnm_cell_has_expr (cell)
		? gnm_expr_top_get_array_corner (cell->base.texpr)
		: NULL;
}

which according to the use in 

/**
 * gnm_cell_is_nonsingleton_array :
 * @cell : #GnmCell const *
 *
 * Return TRUE is @cell is part of an array larger than 1x1
 **/
gboolean
gnm_cell_is_nonsingleton_array (GnmCell const *cell)
{
	GnmExprArrayCorner const *corner = gnm_cell_is_array_corner (cell);

	return corner && (corner->cols > 1 || corner->rows > 1);
}

should yield the corner of the array containing the given cell.
Comment 3 Andreas J. Guelzow 2009-05-09 06:45:46 UTC
Looking at the other uses of gnm_cell_is_array_corner, it is clear that that function and gnm_expr_top_get_array_corner are correct. It is gnm_cell_is_nonsingleton_array that has a problem.
Comment 4 Andreas J. Guelzow 2009-05-09 06:54:37 UTC
It is defintiely gnm_cell_is_nonsingleton_array that is wrong since we are having other related problems:

Create any non 1 by 1 array. Change the value of the non-corner cell. THis should not be possible but it is now allowed!!!
Comment 5 Andreas J. Guelzow 2009-05-09 07:15:37 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.