Overwriting TIFF fails when file being overwritten have different band count (.msk conflict)
- Dominant language
- C++
- Stars
- 245
- Forks
- 181
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 15
Description
**ISIS version(s) affected**: 10.0.0, 10.1.0_RC1
**Description**
Looks like the TIFF-writer isn't quite reliable at overwriting existing TIFFs that it created. If there is an existing .tif.msk file for the filename that's being written to, and it's from a TIFF with a different number of bands (different numbers of lines/samples and different bit depths seem to be fine), the writing process crashes:
```
rm -f t1.tif* t2.tif* tout.tif*
makecube to=t1.tif+gtiff line=100 samp=100 band=1
cubeatt from=t1.tif to=tout.tif
makecube to=t2.tif+gtiff line=10 samp=100 band=2
cubeatt from=t2.tif to=tout.tif
```
Output from last line:
```
**ERROR** Failure when trying to write msk file in GdalIoHandler.cpp at 240.
```
Deleting `tout.tif.msk` solves the problem:
```
rm -f t1.tif* t2.tif* tout.tif*
makecube to=t1.tif+gtiff line=100 samp=100 band=1
cubeatt from=t1.tif to=tout.tif
makecube to=t2.tif+gtiff line=10 samp=100 band=2
rm -f tout.tif.msk
cubeatt from=t2.tif to=tout.tif
```
Contributor guide
Research direction
Reproduce the reported makecube and cubeatt sequence, including the existing tout.tif.msk from a different band count. Then inspect GdalIoHandler.cpp around line 240 and the TIFF mask overwrite path. Done means the second cubeatt completes without deleting tout.tif.msk.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100