There are a bunch of different ways we may want to upgrade the users configuration:
- Changes to $WINEPREFIX (~/.wine), for example:
- Introducing faked DLL headers - Improved drive detection - Changing the way the registry is stored - Adding stuff to the virtual Windows drive
- Modifying the registry
- Adding new keys - Adding new appdefaults (default config options should be in the code itself). While we have a policy of not having app-specific hacks in Wine, some situations are very hard to resolve without custom overrides. The Internet Explorer installer does a bunch of things we really don't want it to do. The DCOM installer needs custom overrides to convince it to install. And so on. - Registering new COM DLLs
(these all boil down to rerunning wine.inf)
- Adding new binaries such as fonts, PE DLLs (think Moz AX control), and so on. These may be placed somewhere in the Wine install directory and then symlinked or copied (presumably linked) into drive C.
This leads to the following questions:
- How do we know when to upgrade the users wineprefix? - How do we avoid disturbing the users configuration? - What implementation do we use to upgrade it?
One potential implementation for knowing when to upgrade the wineprefix is to version it in a similar manner to how we version the wineserver protocol: with a simple incrementing integer. This could be stored in the registry, and Wines initialization sequence changed to be:
...
Does $WINEPREFIX exist? No, call wineprefixcreate - Continue with startup + Yes? Check the wineprefix version key, if it is < the + version compiled into the source run + "wineprefixcreate --upgrade $oldversion $newversion", which then + performs the upgrade. If it exits with a zero exit code, the + version key is set to the number compiled into the source. + Then continue with startup
If registry access is too difficult here, a simpler implementation could be used: just store the number in a .version file.
How do we avoid disturbing the users configuration? Alexandre already laid out the plan for this, which is to have HKLM (HKEY_LOCAL_MACHINE) devoted to the defaults we cunningly choose for maximum kewlness, and HKCU (HKEY_CURRENT_USER) is where the users settings are stored. These override the defaults, meaning we can change the default settings by altering wine.inf, then bumping the wineprefix version so triggering a remerge of the default registry contents.
This means modifying each piece of code where we read the registry to figure out a user-configurable option. The algorithm becomes:
* Check the relevant key in HKCU, if it exists use it * Otherwise, if it's an appdefault, check the same key in HKLM * Otherwise, use the hardcoded default
In most cases, there's no point in duplicating the points at which we can control the defaults, doing it in the code is fine. So, it basically means grepping the source to find out where we read settings from, and changing them to use HKCU instead of HKLM, perhaps also reading HKLM depending on the context of the setting (settings that can be used in appdefaults should check both).
I don't know how common these settings are but it might be worth having a utility function either in a DLL or inline in a header to do this. Registry code isn't complicated but it is tedious and easy to mess up, so we might as well reduce code duplication at the same time.
I think the best implementation is to keep the code responsible for managing WINEPREFIX in wineprefixcreate, and simply extend this program to handle upgrades as well. OK, so the name will be a bit inaccurate but let's not change it - users are already discovering the new program and getting used to it, no need to modify it now especially as it's mostly an internal program.
In the above example the old version and new version numbers were passed to wineprefixcreate but most of the time that information wouldn't be needed, for instance if we were to introduce fake DLL headers we could simply check if they already existed and skip that part if so. I think there's no harm in running wine.inf multiple times, so we could just do that every time for both creation and upgrade.
I *think* this addresses most of the issues with upgrades, though I'm sure Alexandre can think of more :) Potential unresolved problems:
- [How] do we lock wineprefix during upgrade so other processes that are run hang about until it's done?
- Currently moving registry keys about is done actually in the code itself: we copy it across then print a message telling the user to delete the old setting manually. There's a fair bit of evidence that some users simply don't spot/understand these warnings. Also, we want to allow people to upgrade Wine with quite long intervals in between yet eventually this code gets deleted.
Maybe a better solution is just to have wineprefixcreate understand how to move registry keys around in response to bumping the version. If the script gets too unwieldy, we could split particular upgrades into separate scripts in $prefix/share/wine.
- Are there any wierd setups where parts of wineprefix are shared between different users/systems that we need to take into account?
Thoughts? Comments?
thanks -mike
Mike Hearn wrote:
There are a bunch of different ways we may want to upgrade the users configuration:
Changes to $WINEPREFIX (~/.wine), for example:
- Introducing faked DLL headers
- Improved drive detection
- Changing the way the registry is stored
- Adding stuff to the virtual Windows drive
Modifying the registry
- Adding new keys
- Adding new appdefaults (default config options should be in the code itself). While we have a policy of not having app-specific hacks in Wine, some situations are very hard to resolve without custom overrides. The Internet Explorer installer does a bunch of things we really don't want it to do. The DCOM installer needs custom overrides to convince it to install. And so on.
- Registering new COM DLLs
(these all boil down to rerunning wine.inf)
Adding new binaries such as fonts, PE DLLs (think Moz AX control), and so on. These may be placed somewhere in the Wine install directory and then symlinked or copied (presumably linked) into drive C.
This leads to the following questions:
- How do we know when to upgrade the users wineprefix?
- How do we avoid disturbing the users configuration?
- What implementation do we use to upgrade it?
One potential implementation for knowing when to upgrade the wineprefix is to version it in a similar manner to how we version the wineserver protocol: with a simple incrementing integer. This could be stored in the registry, and Wines initialization sequence changed to be:
... Does $WINEPREFIX exist? No, call wineprefixcreate
- Continue with startup
- Yes? Check the wineprefix version key, if it is < the
- version compiled into the source run
- "wineprefixcreate --upgrade $oldversion $newversion", which then
- performs the upgrade. If it exits with a zero exit code, the
- version key is set to the number compiled into the source.
- Then continue with startup
If registry access is too difficult here, a simpler implementation could be used: just store the number in a .version file.
How do we avoid disturbing the users configuration? Alexandre already laid out the plan for this, which is to have HKLM (HKEY_LOCAL_MACHINE) devoted to the defaults we cunningly choose for maximum kewlness, and HKCU (HKEY_CURRENT_USER) is where the users settings are stored. These override the defaults, meaning we can change the default settings by altering wine.inf, then bumping the wineprefix version so triggering a remerge of the default registry contents.
This means modifying each piece of code where we read the registry to figure out a user-configurable option. The algorithm becomes:
- Check the relevant key in HKCU, if it exists use it
- Otherwise, if it's an appdefault, check the same key in HKLM
- Otherwise, use the hardcoded default
In most cases, there's no point in duplicating the points at which we can control the defaults, doing it in the code is fine. So, it basically means grepping the source to find out where we read settings from, and changing them to use HKCU instead of HKLM, perhaps also reading HKLM depending on the context of the setting (settings that can be used in appdefaults should check both).
I don't know how common these settings are but it might be worth having a utility function either in a DLL or inline in a header to do this. Registry code isn't complicated but it is tedious and easy to mess up, so we might as well reduce code duplication at the same time.
I think the best implementation is to keep the code responsible for managing WINEPREFIX in wineprefixcreate, and simply extend this program to handle upgrades as well. OK, so the name will be a bit inaccurate but let's not change it - users are already discovering the new program and getting used to it, no need to modify it now especially as it's mostly an internal program.
In the above example the old version and new version numbers were passed to wineprefixcreate but most of the time that information wouldn't be needed, for instance if we were to introduce fake DLL headers we could simply check if they already existed and skip that part if so. I think there's no harm in running wine.inf multiple times, so we could just do that every time for both creation and upgrade.
I *think* this addresses most of the issues with upgrades, though I'm sure Alexandre can think of more :) Potential unresolved problems:
[How] do we lock wineprefix during upgrade so other processes that are run hang about until it's done?
Currently moving registry keys about is done actually in the code itself: we copy it across then print a message telling the user to delete the old setting manually. There's a fair bit of evidence that some users simply don't spot/understand these warnings. Also, we want to allow people to upgrade Wine with quite long intervals in between yet eventually this code gets deleted.
Maybe a better solution is just to have wineprefixcreate understand how to move registry keys around in response to bumping the version. If the script gets too unwieldy, we could split particular upgrades into separate scripts in $prefix/share/wine.
Are there any wierd setups where parts of wineprefix are shared between different users/systems that we need to take into account?
Thoughts? Comments?
thanks -mike
You did address most of the situations right. I have some scenarios that should be taken into account. 1. It is more than common to use more than one wine version on the same prefix. So what will the older version do. is it always future compatible?
2. Please do not silently touch a user's wineprefix. Users are used to have their wineprefix untouched. It is common practice to have a good solid production environment. And than try a new wine to see if a particular issue was fixed. The last thing they need is to later see that something was broken. Just have the check in place. and do a big FIXME. Than if the user uses a --upgrade command line switch. The actual upgrade is made. Or Just have the FIXME instruct the user to directly use wineprefixcreate for the upgrade. This way the user knows he/she needs to backup before running the new wine.
Free Life Boaz
- It is more than common to use more than one wine version on the same
prefix. So what will the older version do. is it always future compatible?
Yes, hopefully. There are limits to what we can do here though, I suspect.
- Please do not silently touch a user's wineprefix. Users are used to
have their wineprefix untouched. It is common practice to have a good solid production environment. And than try a new wine to see if a particular issue was fixed. The last thing they need is to later see that something was broken.
What if the fix they need is actually a change to the wineprefix?
Just have the check in place. and do a big FIXME. Than if the user uses a --upgrade command line switch.
There is evidence that users don't see or ignore such warnings :(
The actual upgrade is made. Or Just have the FIXME instruct the user to directly use wineprefixcreate for the upgrade. This way the user knows he/she needs to backup before running the new wine.
If you aren't confident that an upgrade won't break stuff you can always manually back up the wineprefix before running the new version, I don't think we need to do anything ourselves. Most users won't be administering production environments, and for them automatic upgrades would be helpful.
thanks -mike
Mike Hearn wrote:
There is evidence that users don't see or ignore such warnings :(
If you aren't confident that an upgrade won't break stuff you can always manually back up the wineprefix before running the new version, I don't think we need to do anything ourselves. Most users won't be administering production environments, and for them automatic upgrades would be helpful.
I don't know, better safe than sorry. You are touching users Data here. they should have an informed choice. A message box, something? maybe refuse to run, than he will notice. So a first time newbie installs wine and is very happy with it. After 1/2 a year he feels more confident and the new release fixes a game he likes or something, He tries it out and his old setup is broken. Than what he think off wine? Unless we state it in bold letters in every possible documentation (and have a cancel flag like --noupgrade) than you must confirm with the user.
thanks -mike
Thanks -Boaz
I don't know, better safe than sorry. You are touching users Data here. they should have an informed choice. A message box, something? maybe refuse to run, than he will notice.
So a first time newbie installs wine and is very happy with it. After 1/2 a year he feels more confident and the new release fixes a game he likes or something, He tries it out and his old setup is broken. Than what he think off wine? Unless we state it in bold letters in every possible documentation (and have a cancel flag like --noupgrade) than you must confirm with the user.
Wouldn't it be better to do good testing and have, ooh, I don't know, a beta testing program? In other words, to ensure we *don't* mangle the users data?
I'm not sure we should design this system on the assumption that we suck and will probably blow things up. I don't know of any other programs that use such a mechanism when upgrading!
thanks -mike
Mike Hearn wrote:
Wouldn't it be better to do good testing and have, ooh, I don't know, a beta testing program? In other words, to ensure we *don't* mangle the users data?
Yep that too.
I'm not sure we should design this system on the assumption that we suck and will probably blow things up. I don't know of any other programs that use such a mechanism when upgrading!
I am not saying that. I'm Just saying. Give me the --noupgrade potability. for checking out stuff. Some programs cannot survive side by side with multiple versions of them selfs. And the Installer will remove the old version. Those who do. take measures to protect users. Even new version of WORD will prompts you when you try to save an old version file. If wine was installed from rpm and is updated - it is one case. The old version is gone the new one is replacing it. But if the old version is still alive. The new one should not take hold. In my opinion you should have the upgrade option in wineprefixcreate by all means. Than it is the packager/Installer responsibility to run it when appropriate. But it should not be left to wine-run to decide, unless you keep some kind of reference count on installations which is hard and complicated.
Any way sorry for this flame . I Just wanted for you to see the commonly used scenario of 2 version running side by side and to let us geeks have that possibility in the future. The Upgrade option is commendable and highly needed, Just not automatically, for me.
thanks Boaz
I'm not sure we should design this system on the assumption that we suck and will probably blow things up. I don't know of any other programs that use such a mechanism when upgrading!
Well, Service Packs on Windows have the option (on by default) to back up all changed files just in case Microsoft suck and blow things up; a Wine upgrade could be considered roughly equivalent to installing a SP if the gap between versions is big enough.
Perhaps backing up the old wineprefix and telling the user that it's been upgraded would be a good idea. Will the wineprefix be upgraded with every new Wine release, or just when something actually has to be changed?
On Tue, Sep 28, 2004 at 12:46:12PM +0100, Mike Hearn wrote:
There are a bunch of different ways we may want to upgrade the users configuration:
I was always a fan of upgrades, but in the meantime I am more a follower of:
"If you upgrade to this new version, please re-setup your whole wine configuration and merge over your data."
This should only very seldom be the case anyway.
This causes less work for us and less work for the user due to us breaking his update.
Ciao, Marcus
I was always a fan of upgrades, but in the meantime I am more a follower of:
"If you upgrade to this new version, please re-setup your whole wine configuration and merge over your data."
This should only very seldom be the case anyway.
This causes less work for us and less work for the user due to us breaking his update.
It does rather discourage us from making improvements to the Wine configuration that could improve compatibility though, because everybody hates the hassle of upgrading and 99% of users will forget anyway. So, I think there's value in making it automatic.
thanks -mike