You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't save files in version 1.3.11 - Windows without admin privileges #1052
Synfig version & platform:
1.3.11 - windows 10 64bit
Issue description:
A regular user account in a enterprise environment can't save any Synfig animation file.
Temporary and 'dangerous' workaround: administrators give permission to write on Synfig install folder.
Something related to temp dir/files maybe?
To be honest this is a problem with Windows crazy permissions. Krita was having issues with this as reported in the release notes for v4.2.8, although this was a problem with the Qt framework fileaccess on windows. Pencil2D is also having issues with this. It's just a pain in the arse 😒
The first way to workaround this is to be the system admin and install everything as admin. I know most people care about security and all, but this is 100% what I always have to do, I don't even care to setup a "user" account for my home computer anymore due to this problem.
The other way is for Synfig to sign the release binaries as Windows systems tend to reject any unsigned application and it also actively blocks them when it's downloaded from the internet. At first is sort of a soft lock, but sometimes this can extend itself to blocking the dynamic library files and plugins like FFMPEG.
So you have to unblock the zip file or msi installer where Synfig comes in before extracting / installing it.
When installing you do have to use the admin powers to install to avoid potential issues, but it's recommended to lower the UAC security rating system during installation, and you should install the program on C:\ Program Files . No other folder will give you enough flexibility in the Windows Security scheme as far as I know.
I personally tend to run my programs from a separate folder on Windows 7, but for Windows 10 this has been actively enforced so you have to install them there if the app is not signed.
There's also as you mentioned the possibility of the temp folder being actively blocked when the program files are trying to write, however this should be solved by installing to Program Files 90% of the time (you can google about this specific issue actually, there are a lot of people that have had this and it's been never solved by microsoft 😋 ).
Lastly, if you have Windows10, make sure the default antivirus has a rule setup to exclude Synfig install folder from real-time scans. This can also prevent files from writing randomly.
Other than this it boils down to either you ask or give full access to yourself, or for users that don't have admin access they have to take all of these cautionary steps before using Synfig.
However If after doing this you still can't save the files themselves, then something must have changed in the FileSystem API's for Windows itself. I personally started reading about users having similar problems about 6 to 7 months ago mostly on Win10, so it can't be merely a coincidence.
if (char* synfig_user_settings_dir = getenv("SYNFIG_USER_SETTINGS")) {
dir = Glib::locale_from_utf8(String(synfig_user_settings_dir));
} else {
dir = Glib::get_home_dir()+ETL_DIRECTORY_SEPARATOR+SYNFIG_USER_APP_DIR;
}
return dir;
}
So, get_user_app_directory() uses Glib::get_home_dir() and from Glib's sourcesL
/** Gets the current user's home directory.
* @return The current user's home directory or an empty string if not defined.
*/
std::string get_home_dir();
--> an empty string if not defined
Should we check output of get_home_dir()?
On the other hand, i do not see how "config/tmp" could appear in the code - it constructs different path.
Yep. This path is just copied from process monitor.
The main problem was that I could not reproduce the problem using my own local build. Everything just works fine. So I continued digging and noticed that if I run synfigstudio from the bin folder, everything works fine.
Then I looked inside synfigstudio.bat.
And voila:
cd "%~dp0\"
set SYNFIG_USER_SETTINGS=%~dp0\config
start "" "%~dp0\bin\synfigstudio.exe" --console
So I think you can reproduce the problem on Linux if you set SYNFIG_USER_SETTINGS to read-only folder.
classFilePath {
/// Returns the full path for a temp file including its filename/// It doesn't check if it exists, just creates the string
std::string get_temp_filepath(std::string filename);
/// Returns the full path for a temp dir for the Synfig./// Read and write access
std::string get_temp_dir();
enum DataType {
IMAGES,
ICONS, // maybeBRUSHES,
SOUND,
UI,
LOCALE,
PLUGINS,
MODULES// current in /etc . Should it be under a new get_system_app_config_filepath()?
};
/// Returns the full path for a data file including its filename in a system-wide directory/// It doesn't check if it exists, just creates the string
std::string get_system_app_data_filepath(DataType data_type, std::string filename);
/// Returns the full path for a data file including its filename in a user-scope directory/// It doesn't check if it exists, just creates the string
std::string get_user_app_data_filepath(DataType data_type, std::string filename);
/// Returns the full path for a data file, including its filename/// It searches for it first in current user directory and then in system one if not found/// Returns an empty string if not found in any place
std::string get_app_data_filepath(DataType data_type, std::string filename);
/// Returns the full path for an app data dir for the Synfig./// Read-only access
std::string get_system_app_data_dir(DataType data_type);
/// Returns the full path for an app data dir for the Synfig./// Read-only access
std::string get_user_app_data_dir(DataType data_type);
std::string get_app_config_filepath(std::string filename);
/// Returns the full path for the dir for the Synfig settings./// Read and write access
std::string get_app_config_dir();
std::string get_app_cache_filepath(std::string filename);
/// Returns the full path for the dir for the Synfig backups./// Read and write access
std::string get_app_cache_dir();
};
Another case for Linux that can be resolved with a relative path (like on Windows):
When we compile synfig using the IDE / CMake, we do not do the install step before starting it.
This currently works because we are creating the same directory structure (as for Windows) inside the build directory.
Therefore, we also need the ability to search on relative paths (from binary).
For instance:
../etc/
../share/
Linux software (sadly or not) don't rely on this path resolution like Windows does (current dir first, then system dir): it tries .local, /usr/local and /usr normally.
But we could allow that in those methods I propose like get_app_data_filepath(). It could search for a file in these dirs: "current" dir first, then .local, then /usr/local and finally /usr , stopping where it finds first.
Maybe creating an environment variable to limit it to "current" directory only: helpful to check if it has all inside the current strutcture
Is Synfig writes any temporary files? I can remember only backups, but this seems to be a separate section. ^__^"
It seem it does:
Synfig tries to create file: C:\Users\user\Downloads\SynfigStudio-1.5.0-testing-2020.02.29-win64-478b0\config\tmp\synfig_instance_9D09952C5A99F75295558C2EAB0F6FF0
This is a part of autobackup system.
When Synfig opens/creates any file it wraps the file into temporary filesystem, which is used for keeping autobackups and embed resources (which are not saved yet, i.e. embedded images).
This is how saving works:
app --> saved to temporary filesystem --> contents of saved filesystem dumped to real file location.
For autosave there are no last step:
app --> saved to temporary filesystem
So, this is a part of backup infrastructure and should be stored in ~/.cache.
Well, so I'd split the class into both scope: core and studio, the latter derived from former.
I'd move into this class related methods like: synfig::FileSystem::fix_slashes(), etl::relative_path(), etl::solve_relative_path(), etl::cleanup_path(), etl::basename()…
I think they're misplaced anyway. It is strange they're at "etl/stringf.h"
Activity
Jose-Moreno commentedon Dec 24, 2019
To be honest this is a problem with Windows crazy permissions. Krita was having issues with this as reported in the release notes for v4.2.8, although this was a problem with the Qt framework fileaccess on windows. Pencil2D is also having issues with this. It's just a pain in the arse 😒
The first way to workaround this is to be the system admin and install everything as admin. I know most people care about security and all, but this is 100% what I always have to do, I don't even care to setup a "user" account for my home computer anymore due to this problem.
The other way is for Synfig to sign the release binaries as Windows systems tend to reject any unsigned application and it also actively blocks them when it's downloaded from the internet. At first is sort of a soft lock, but sometimes this can extend itself to blocking the dynamic library files and plugins like FFMPEG.
So you have to unblock the zip file or msi installer where Synfig comes in before extracting / installing it.
When installing you do have to use the admin powers to install to avoid potential issues, but it's recommended to lower the UAC security rating system during installation, and you should install the program on
C:\ Program Files. No other folder will give you enough flexibility in the Windows Security scheme as far as I know.I personally tend to run my programs from a separate folder on Windows 7, but for Windows 10 this has been actively enforced so you have to install them there if the app is not signed.
There's also as you mentioned the possibility of the temp folder being actively blocked when the program files are trying to write, however this should be solved by installing to
Program Files90% of the time (you can google about this specific issue actually, there are a lot of people that have had this and it's been never solved by microsoft 😋 ).Lastly, if you have Windows10, make sure the default antivirus has a rule setup to exclude Synfig install folder from real-time scans. This can also prevent files from writing randomly.
Other than this it boils down to either you ask or give full access to yourself, or for users that don't have admin access they have to take all of these cautionary steps before using Synfig.
However If after doing this you still can't save the files themselves, then something must have changed in the FileSystem API's for Windows itself. I personally started reading about users having similar problems about 6 to 7 months ago mostly on Win10, so it can't be merely a coincidence.
I leave this MSDN Article on Win32 File System permissions here in case it can help you get a better idea on how to track this issue on your computer.
https://docs.microsoft.com/en-us/windows/win32/fileio/file-security-and-access-rights
morevnaproject commentedon Apr 30, 2020
It would be nice to try run Synfig through processmonitor app and look where it makes attempt to write.
@rodolforg Do you still have access to environment where this issue is reproducible?
rodolforg commentedon Apr 30, 2020
@morevnaproject no I don't, due to quarantine and I don't use Windows at home.
But IT crew had to enable a write permission on synfig folder in c:[I don't remember the path] as far as I remember
ice0 commentedon May 1, 2020
Confirmed. I removed the write permissions on the Synfig folder, and I got this:
Synfig tries to create file: C:\Users\user\Downloads\SynfigStudio-1.5.0-testing-2020.02.29-win64-478b0\config\tmp\synfig_instance_9D09952C5A99F75295558C2EAB0F6FF0
morevnaproject commentedon May 1, 2020
ice0 commentedon May 1, 2020
I think the problem is here:
synfig/synfig-studio/src/gui/app.cpp
Lines 3865 to 3869 in 251f37a
morevnaproject commentedon May 1, 2020
synfig/synfig-studio/src/synfigapp/main.cpp
Lines 434 to 444 in 251f37a
So,
get_user_app_directory()usesGlib::get_home_dir()and from Glib's sourcesL--> an empty string if not defined
Should we check output of
get_home_dir()?On the other hand, i do not see how "config/tmp" could appear in the code - it constructs different path.
@ice0 are you sure you've got exactly this path?
rodolforg commentedon May 1, 2020
synfig/synfig-studio/src/gui/app.cpp
Line 3878 in 251f37a
synfig/synfig-core/src/synfig/filesystemtemporary.cpp
Lines 58 to 67 in 251f37a
synfig/synfig-core/src/synfig/filesystemtemporary.cpp
Lines 87 to 91 in 251f37a
morevnaproject commentedon May 1, 2020
@rodolforg that part of code generate last part of save path (filename) -
synfig_instance_9D09952C5A99F75295558C2EAB0F6FF0.I wonder where does
tmp/configpart comes from...rodolforg commentedon May 1, 2020
SYNFIG_USER_APP_DIR?
rodolforg commentedon May 1, 2020
Anyway, I think we should avoid duplicated methods for retrieving temporary dir (and with different results!). Maybe merge with:
synfig/synfig-core/src/synfig/filesystemtemporary.cpp
Lines 76 to 85 in 251f37a
Actually, it should have a (static?) class for deal with filesystem dirs and filenames.
Dirs:
Did I miss any possible folder?
ice0 commentedon May 2, 2020
Yep. This path is just copied from process monitor.
The main problem was that I could not reproduce the problem using my own local build. Everything just works fine. So I continued digging and noticed that if I run
synfigstudiofrom thebinfolder, everything works fine.Then I looked inside
synfigstudio.bat.And voila:
So I think you can reproduce the problem on Linux if you set SYNFIG_USER_SETTINGS to read-only folder.
P.S. Changed it to
and now all works fine.
13 remaining items
morevnaproject commentedon May 12, 2020
That's all subdirectories of "$PREFIX/share/synfig", where
$PREFIXis Synfig installation.rodolforg commentedon May 12, 2020
It seem it does:
I updated the proposal comment: #1052 (comment)
rodolforg commentedon May 13, 2020
Something like this (but static):
ice0 commentedon May 13, 2020
Another case for Linux that can be resolved with a relative path (like on Windows):
When we compile synfig using the IDE / CMake, we do not do the
installstep before starting it.This currently works because we are creating the same directory structure (as for Windows) inside the build directory.
Therefore, we also need the ability to search on relative paths (from binary).
For instance:
../etc/
../share/
rodolforg commentedon May 13, 2020
Linux software (sadly or not) don't rely on this path resolution like Windows does (current dir first, then system dir): it tries .local, /usr/local and /usr normally.
But we could allow that in those methods I propose like
get_app_data_filepath(). It could search for a file in these dirs: "current" dir first, then .local, then /usr/local and finally /usr , stopping where it finds first.Maybe creating an environment variable to limit it to "current" directory only: helpful to check if it has all inside the current strutcture
rodolforg commentedon May 14, 2020
If I code such class… should be at
synfigorstudio?I ask it because some data are useless to core:
IMAGES,
ICONS,
SOUND,
UI,
?? PLUGINS,
Argh
morevnaproject commentedon May 14, 2020
That's all resources only for studio ^__^
morevnaproject commentedon May 14, 2020
This is a part of autobackup system.
When Synfig opens/creates any file it wraps the file into temporary filesystem, which is used for keeping autobackups and embed resources (which are not saved yet, i.e. embedded images).
This is how saving works:
app --> saved to temporary filesystem --> contents of saved filesystem dumped to real file location.
For autosave there are no last step:
app --> saved to temporary filesystem
So, this is a part of backup infrastructure and should be stored in
~/.cache.rodolforg commentedon May 14, 2020
Ops ;)
Well, so I'd split the class into both scope: core and studio, the latter derived from former.
I'd move into this class related methods like:
synfig::FileSystem::fix_slashes(),etl::relative_path(),etl::solve_relative_path(),etl::cleanup_path(),etl::basename()…I think they're misplaced anyway. It is strange they're at "etl/stringf.h"
What do you think?
ice0 commentedon May 16, 2020
Agree. I think they must be moved outside stringf.
ice0 commentedon May 16, 2020
I think you can use SYNFIG_ROOT_DIR for this.
rodolforg commentedon Nov 14, 2020
This should be fixed soon, otherwise Windows users won't be able to save their work (if not using portable version)!
morevnaproject commentedon Nov 16, 2020
@rodolforg This issue is specific to portable build, installer do not use .bat file.
Please see my #1052 (comment).