Skip to content

Conversation

@wiredfool
Copy link

@wiredfool wiredfool commented May 23, 2025

@radarhere
Copy link
Owner

Two questions.

  1. This doesn't make any real functional difference, right? It would only come into play if there was an error within ImageFile.load and the Python readonly flag wasn't set? So this PR is just tidying things up to keep the C flag correct, perhaps because you'd one day like to remove the Python flag?
  2. Under what circumstances would view not be readonly? If there is some scenario, then maybe the Python flag shouldn't always be set to 1 in ImageFile.load() when using memory mapping.

@wiredfool
Copy link
Author

At the moment, we're marking the image read-only in the python layer for anything that's mapped. (There's 2 instances of explicitly mmaping with the read only flag, and we're setting the python read only in frombuffer, no matter the actual buffer permissions). The fact that this is a segfault level issue makes me think that we should be enforcing this at the c level, where the readonly flag is (umm) readonly, and can't be written from python. And prior to 11.2, we didn't have this c level flag. (mainly because there wasn't a convenient place to add this in arrow at the python layer)

So right now, this is not going to change anything. However, there's nothing preventing plugins (that we don't write) from using core. map_buffer with a read/write map. There's also a long-standing PR to make mmap not read-only.

@radarhere radarhere merged commit 0eef5e2 into radarhere:tiff_mmap May 26, 2025
24 of 53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants