Sapling generator requires root privileges when saving presets #46718

Closed
opened 2015-11-07 13:13:54 +01:00 by Torbjörn Rathsman · 22 comments

System Information
Any system with blender installed by root

Blender Version
Broken: 2.76b 2015-11-03 10:56 f336fea

Short description of error
When trying to save presets for the sapling add-on, attempts are made to write to directories outside the current user's home directory. As a result, the preset is not saved, because of file permissions.

See also http://blender.stackexchange.com/questions/38172/error-while-exporting-preset-in-saplingadd-tree/41156#41156

Exact steps for others to reproduce the error
In object mode: Add/Curve/Add Tree, then try to "Export Preset"

**System Information** Any system with blender installed by root **Blender Version** Broken: 2.76b 2015-11-03 10:56 f336fea **Short description of error** When trying to save presets for the sapling add-on, attempts are made to write to directories outside the current user's home directory. As a result, the preset is not saved, because of file permissions. See also http://blender.stackexchange.com/questions/38172/error-while-exporting-preset-in-saplingadd-tree/41156#41156 **Exact steps for others to reproduce the error** In object mode: Add/Curve/Add Tree, then try to "Export Preset"

Changed status to: 'Open'

Changed status to: 'Open'

Added subscriber: @Torbjorn-Rathsman

Added subscriber: @Torbjorn-Rathsman
Member

Added subscribers: @Abpy, @Blendify

Added subscribers: @Abpy, @Blendify
Member

@Abpy does this happen with your newer version of the addon?

@Abpy does this happen with your newer version of the addon?

Here is a patch solving the problem:

https://developer.blender.org/differential/diff/5408/

Here is a patch solving the problem: https://developer.blender.org/differential/diff/5408/
Member

Added subscriber: @BrendonMurphy

Added subscriber: @BrendonMurphy
Member

hi, I confirm this bug & run some further tests.
I had thought this issue was fixed.
@Torbjorn-Rathsman could you test this version please: https://developer.blender.org/T46559 & make comment there. It would be preferred to fix this issue in @Abpy version & update in one go.

This is also somewhat of a known issue on windows, the use of appdata folder requires admin permissions.
Thanks for your help..

hi, I confirm this bug & run some further tests. I had thought this issue was fixed. @Torbjorn-Rathsman could you test this version please: https://developer.blender.org/T46559 & make comment there. It would be preferred to fix this issue in @Abpy version & update in one go. This is also somewhat of a known issue on windows, the use of appdata folder requires admin permissions. Thanks for your help..

So the problem is that windows will not write to the application folder?
Is the solution to write the preset somewhere else, or to just prevent saving if it does not work?

So the problem is that windows will not write to the application folder? Is the solution to write the preset somewhere else, or to just prevent saving if it does not work?

Added subscribers: @ideasman42, @Sergey

Added subscribers: @ideasman42, @Sergey

While the patch might solve issue with particular addon, other addons will still be buggy? Also, the preset system itself should choose whether to use blender's application folder or user's config folder to store the presets.

@ideasman42, can you comment on this?

While the patch might solve issue with particular addon, other addons will still be buggy? Also, the preset system itself should choose whether to use blender's application folder or user's config folder to store the presets. @ideasman42, can you comment on this?

Here is my solution.
user presets are saved to:
os.path.join(bpy.utils.script_path_user(), 'presets', 'operator', 'add_curve_sapling_3')

https://github.com/abpy/improved-sapling-tree-generator

Here is my solution. user presets are saved to: ```os.path.join(bpy.utils.script_path_user(), 'presets', 'operator', 'add_curve_sapling_3')``` https://github.com/abpy/improved-sapling-tree-generator

Added subscriber: @aaron-14

Added subscriber: @aaron-14

@aaron-14 This solution works. However, it is not a good idea to test if a file exists first, and then open it. since the file can be created between the calls That's why I replaced open(...,'w') with open(...,'x'). Also I want the ability to overwrite my own presets, so perhaps the test can be removed.

@aaron-14 This solution works. However, it is not a good idea to test if a file exists first, and then open it. since the file can be created between the calls That's why I replaced open(...,'w') with open(...,'x'). Also I want the ability to overwrite my own presets, so perhaps the test can be removed.

I added an option to overwrite the file. It still uses os.path.exists though, because with the option to overwrite it doesn't make sense to use open(...,'x'), and it has to check that its not in the builtin presets.

(also, sorry its on github rather than a diff here. It would be a lot of extra work to make a diff between the blender version and mine)

I added an option to overwrite the file. It still uses os.path.exists though, because with the option to overwrite it doesn't make sense to use open(...,'x'), and it has to check that its not in the builtin presets. (also, sorry its on github rather than a diff here. It would be a lot of extra work to make a diff between the blender version and mine)

@aaron-14, that will be fine. Hope the changes will go into the main branch soon

@aaron-14, that will be fine. Hope the changes will go into the main branch soon

@Sergey, this addon handles presets its self, other addons which use blender's preset system wont have issues.

@Abpy, are your interested to take over maintaining the sapling generator bundled with Blender?

That, or I can fix the bug in master, and we can investigate including your changes later.
I just dont want the code to converge too far if we're going to eventually have to merge back.

@Sergey, this addon handles presets its self, other addons which use blender's preset system wont have issues. @Abpy, are your interested to take over maintaining the sapling generator bundled with Blender? That, or I can fix the bug in master, and we can investigate including your changes later. I just dont want the code to converge too far if we're going to eventually have to merge back.
Member

@ideasman42
Yes, @Abpy the goal here is to replace current sapling addon entirely with the new updated version.

@ideasman42 Yes, @Abpy the goal here is to replace current sapling addon entirely with the new updated version.

Added subscriber: @mont29

Added subscriber: @mont29
Brendon Murphy was assigned by Bastien Montagne 2016-01-22 12:18:19 +01:00

Any news here? If merging new work takes too much time let's at least fix the bug in master…

Any news here? If merging new work takes too much time let's at least fix the bug in master…
Member

@ideasman42 @mont29
Yes, @Abpy the goal here is to replace current sapling addon entirely with the new updated version.
What has happened here? I may take this over soon.

@ideasman42 @mont29 Yes, @Abpy the goal here is to replace current sapling addon entirely with the new updated version. What has happened here? I may take this over soon.
Member

closing as archived.
If problem still exists in the new version (available in buildbot builds from tomorrow) please create a new task.
Note: Running Blender as Administrator on Windows fixes this problem.

closing as archived. If problem still exists in the new version (available in buildbot builds from tomorrow) please create a new task. Note: Running Blender as Administrator on Windows fixes this problem.
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Sign in to join this conversation.
No Milestone
No project
No Assignees
7 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-addons#46718
No description provided.