Forward compatibility after D113 #51260

Closed
opened 2017-04-20 10:49:10 +02:00 by Alexander Romanov · 5 comments

The issue was found during #51198 investigation.

PropertyType RNA_property_type(PropertyRNA *prop)
{
	return rna_ensure_property(prop)->type;
}

rna_ensure_property always returns NULL for IDP_ID for Blender builds before D113

There is discussion in #51198 about the issue.
Since the issue described in #51198 was solved, I've created this separate task.
@mont29, @Sergey, @ideasman42

The issue was found during #51198 investigation. ``` PropertyType RNA_property_type(PropertyRNA *prop) { return rna_ensure_property(prop)->type; } ``` rna_ensure_property always returns NULL for IDP_ID for Blender builds before [D113](https://archive.blender.org/developer/D113) There is discussion in #51198 about the issue. Since the issue described in #51198 was solved, I've created this separate task. @mont29, @Sergey, @ideasman42
Author
Member

Changed status to: 'Open'

Changed status to: 'Open'
Author
Member
Added subscribers: @mont29, @Sergey, @ideasman42, @AlexanderRomanov

Copy of comments from #51198 regarding that issue:

@mont29:

But P465 is a no-go for me, imho it is totally unacceptable to twist that way our .blend file just to ensure forward compat (not to mention how evil it is to change actual data, even if only for a few micro seconds, in writefile!). I’m tempted to consider this a bug in previous blender (if a function can return NULL and is not checked, then bug is in code using it). Can only think about protecting against this for future (e.g. by nuking IDProps of unknown type at read time, keeping them around is call for issues anyway at some point)… Would not mind @Sergey Sharybin (sergey) or @Campbell Barton (campbellbarton) input here though.

@Sergey:

@Bastien Montagne (mont29), we indeed should not modify anything from the main database during file save. This was known for giving issues in the past. What i remember happening at some point is that we were constructing temp copy of the objects and made modifications on those. Need to be careful tho, because that will modify pointers of the struct itself.

@mont29:

@Sergey Sharybin (sergey) yes, temp structs is the way to go here - while keeping orig pointer one as 'uuid' (pointer value in file), to ensure re-allocating temp memory later in write process does not re-use same mem pointer…

But that’s not the main issue here, main issue is that P465 horribly tweaks IDProps to save them in a way that new pointer IDProps do not make older blender crash when loading a file saved with those new properties. Imho this is not really acceptable, especially since the root of the issue remains - should we introduce a new IDProp type in the future, it will again make older Blender crash. So to me this is a bug in current code, that is trivial to fix (e.g. by removing any unknown IDProp type at read time), but we should not try to fix this for previous versions… As ugly as it is :(

Copy of comments from #51198 regarding that issue: @mont29: > But [P465](https://archive.blender.org/developer/P465.txt) is a no-go for me, imho it is totally unacceptable to twist that way our .blend file just to ensure forward compat (not to mention how evil it is to change actual data, even if only for a few micro seconds, in writefile!). I’m tempted to consider this a bug in previous blender (if a function can return NULL and is not checked, then bug is in code using it). Can only think about protecting against this for future (e.g. by nuking IDProps of unknown type at read time, keeping them around is call for issues anyway at some point)… Would not mind @Sergey Sharybin (sergey) or @Campbell Barton (campbellbarton) input here though. @Sergey: > @Bastien Montagne (mont29), we indeed should not modify anything from the main database during file save. This was known for giving issues in the past. What i remember happening at some point is that we were constructing temp copy of the objects and made modifications on those. Need to be careful tho, because that will modify pointers of the struct itself. @mont29: > @Sergey Sharybin (sergey) yes, temp structs is the way to go here - while keeping orig pointer one as 'uuid' (pointer value in file), to ensure re-allocating temp memory later in write process does not re-use same mem pointer… > > But that’s not the main issue here, main issue is that [P465](https://archive.blender.org/developer/P465.txt) horribly tweaks IDProps to save them in a way that new pointer IDProps do not make older blender crash when loading a file saved with those new properties. Imho this is not really acceptable, especially since the root of the issue remains - should we introduce a new IDProp type in the future, it will again make older Blender crash. So to me this is a bug in current code, that is trivial to fix (e.g. by removing any unknown IDProp type at read time), but we should not try to fix this for previous versions… As ugly as it is :(

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Bastien Montagne self-assigned this 2017-05-03 17:43:06 +02:00

After quick chat on IRC with @Sergey and @ideasman42, we agreed that we couldn’t find any way to fix this for forward compatibility. This is to be considered as a bug of existing code, which cannot be worked around in any acceptable way. 15189baa52 only prevents us from hitting the same problem in the future.

After quick chat on IRC with @Sergey and @ideasman42, we agreed that we couldn’t find any way to fix this for forward compatibility. This is to be considered as a bug of existing code, which cannot be worked around in any acceptable way. 15189baa52 only prevents us from hitting the same problem in the future.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#51260
No description provided.