Skip to content

sozip error not reported back to user code #12790

@eschnett

Description

@eschnett

What is the bug?

I am using GDAL to create a multidimensional zarr file that is sozip compressed. I see this error when creating the file:

ERROR 1: dish_positions.00000000.zarr/zarr.json already exists in ZIP file
ERROR 8: Open file /vsizip/data/fengine_init_pathfinder/cx66_dish_positions.00000000.zarr.zip/dish_positions.00000000.zarr/zarr.json to write failed

Everything is working fine when I do not use sozip compression. I enable sozip compression by adding a "/vsizip" prefix to the file name. Although there is an error reported on screen, I do not see an error code reported by the function creating or closing the multidimensional dataset. The resulting file ("*.zarr.zip") is created fine and looks almost correct, but all attributes seem to be missing.

A discussion on the mailing list told me that this is a real error, and GDAL is supposed to report it to the caller in user code. "Forgetting" the error seems to be an error in GDAL.

Some details:

I create the dataset (i.e. the file) via

            const auto driver_manager = GetGDALDriverManager();
            const auto driver = driver_manager->GetDriverByName("Zarr");
            const auto dataset = std::unique_ptr<GDALDataset>(driver->CreateMultiDimensional(
                full_path.c_str(), root_group_options_c.data(), options_c.data()));

where "full_path" is "/vsizip/data/fengine_init_pathfinder/cx66_dish_positions.00000000.zarr.zip/dish_positions.00000000.zarr".

I then create multiple attributes ("CreateAttribute") and then

            const auto mdarray = group->CreateMDArray(meta->get_name(), dimensions, datatype,
                                                      array_options_c.data());
                const bool success = mdarray->Write(
                    arrayStart.data(), count.data(), nullptr, bufferStride.data(), datatype,
                    frame + datatypesize * meta->offset, frame, buffer->frame_size);

and finish with

            const CPLErr err = dataset->Close();
            assert(!err);

The full code is available at https://github.com/kotekan/kotekan/blob/eschnett/updates-2/lib/stages/gdalFileWrite.cpp.

Steps to reproduce the issue

See above.

Versions and provenance

GDAL 3.11 build from source

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions