bugGNU Octave - Bugs: bug #58320, [mxe-octave] Add ability to...

 
 

bug #58320: [mxe-octave] Add ability to specify a local or allusers install from the installer

Submitter:  John Donoghue <lostbard>
Submitted:  Thu 07 May 2020 01:19:53 PM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  lostbard
Originator Name:  lostbard Open/Closed:  * Closed
Release:  * dev Operating System:  * Microsoft Windows
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 30 May 2020 01:36:07 AM UTC, comment #28: 

Marking as closed

John Donoghue <lostbard>
Group Member
Fri 22 May 2020 12:05:40 PM UTC, comment #27: 

Sorry, my bad. Reverted that part again.

Markus Mützel <mmuetzel>
Group administrator
Fri 22 May 2020 11:46:56 AM UTC, comment #26: 

Does \$(^Name) show the users name? I was under the impression it is the app name?

John Donoghue <lostbard>
Group Member
Thu 21 May 2020 08:28:46 AM UTC, comment #25: 

That sounds reasonable to me. Please, go ahead.

I got the escaping of the double quote characters in the string wrong. This change should hopefully work better:

diff -r 779a4cf71d46 -r cdd4a283036a tools/makeinst-script.sh.in
--- a/tools/makeinst-script.sh.in        Sun May 17 22:15:34 2020 -0400
+++ b/tools/makeinst-script.sh.in        Thu May 21 10:22:10 2020 +0200
@@ -307,9 +307,9 @@

 \${if} \$MultiUser.Privileges == "Admin"
   # if admin, maybe was forced to admin from Add Remove Apps
-  MessageBox MB_ICONEXCLAMATION|MB_OK "Could not find matching install in registry.\$\nTry running the unistaller from the start menu or installed folder \$INSTDIR" /SD IDOK
+  MessageBox MB_ICONEXCLAMATION|MB_OK 'Could not find uninstallation information in registry.\$\nTry running the uninstaller from the start menu or from the installation folder "\$INSTDIR".' /SD IDOK
 \${Else}
-  MessageBox MB_ICONEXCLAMATION|MB_OK "Could not find matching install in registry for \$(^Name) using \$INSTDIR - Can not uninstall!" /SD IDOK
+  MessageBox MB_ICONEXCLAMATION|MB_OK 'Could not find uninstallation information in registry for GNU Octave installed in "\$INSTDIR" for user "\$(^Name)".\$\nCan not uninstall!' /SD IDOK
 \${EndIf}
   Abort


Markus Mützel <mmuetzel>
Group administrator
Wed 20 May 2020 08:17:01 PM UTC, comment #24: 

I can change the default easily enough and will update the message and push up to mxe unless there are any objections


John Donoghue <lostbard>
Group Member
Wed 20 May 2020 07:58:14 PM UTC, comment #23: 

Now everything seems to work as expected.
Maybe you could adapt the message (not the condition) to the one in comment #21?

Should the default better be an installation for all users if possible?

I also tried installing for the admin and for an unprivileged user (both local installs). Then I tried to uninstall for the unprivileged user with "Apps and Features". The uninstallation still fails with the new message. So everything works fine.

Markus Mützel <mmuetzel>
Group administrator
Wed 20 May 2020 07:15:36 PM UTC, comment #22: 

Forgot to configure again. D'oh.
Will report again after I did it right...

Markus Mützel <mmuetzel>
Group administrator
Wed 20 May 2020 06:38:02 PM UTC, comment #21: 

I tried with creating an installer with your latest patch from comment #19.
The installation as an unprivileged user works like before.
Also Octave seems to run fine.
When I try to uninstall from "Apps and Features", I am prompted to authenticate as an admin. After that, I still see the same dialog as with the previous patch.

I also tried with the following change on top of your patch:

diff -r 779a4cf71d46 -r 0911c7c8fb4d tools/makeinst-script.sh.in
--- a/tools/makeinst-script.sh.in        Sun May 17 22:15:34 2020 -0400
+++ b/tools/makeinst-script.sh.in        Wed May 20 20:00:13 2020 +0200
@@ -305,9 +305,9 @@
   # if 0 it couldnt find us
   StrCmp \$R0 0 0 uninst_check_local

-\${if} \$MultiUser.Privileges == "Admin"
+\${if} \$MultiUser.InstallMode == "CurrentUser"
   # if admin, maybe was forced to admin from Add Remove Apps
-  MessageBox MB_ICONEXCLAMATION|MB_OK "Could not find matching install in registry.\$\nTry running the unistaller from the start menu or installed folder \$INSTDIR" /SD IDOK
+  MessageBox MB_ICONEXCLAMATION|MB_OK "Could not find matching install in registry.\$\nTry running the uninstaller from the start menu or from the installation folder \"\$INSTDIR\"." /SD IDOK
 \${Else}
   MessageBox MB_ICONEXCLAMATION|MB_OK "Could not find matching install in registry for \$(^Name) using \$INSTDIR - Can not uninstall!" /SD IDOK
 \${EndIf}


With an installer generated with that change, I still don't see the alternative error message when trying to uninstall from "Apps and Features".

Additionally: Do we have to somehow catch the case that both the unprivileged user and the admin have a local installation (that the admin does not want to uninstall)? Or is this use case too academic, and the current logic is good enough?

Alternatively, would it be possible to not register the uninstaller in the registry for a local installation? Providing the uninstall link in the start menu could be good enough imho.

Markus Mützel <mmuetzel>
Group administrator
Wed 20 May 2020 12:26:44 PM UTC, comment #20: 

That will only effect someone who is not an admin that installed it locally and is trying to uninstall from "Apps and Features"

John Donoghue <lostbard>
Group Member
Mon 18 May 2020 12:11:21 PM UTC, comment #19: 

So more reading up and I dont think its possible to get around the elevation issue from the apps and features window.

Running from the uninstall icon and directly works as should using the control panel uninstall (the old way of uninstalling)

I updated the patch to detect whther its running admin mode and cant  find the install info to suggest rerunning directly.

I also added the (Local) to the uninstall information.



(file #49113)

John Donoghue <lostbard>
Group Member
Fri 15 May 2020 02:18:47 PM UTC, comment #18: 

Ok after lots more poking around and reading I found a couple of things.

1. Even though it installs the local installation, if there is an all user one - thats what you will see - rather than the 2 different installs.

I can fix that by appending (Local) to the uninstall registry keys.


2. There is apparently a bug discussed on a few different sites that there is a bug in windows 10 control panel / add remove programs that always forces the uninstall to prompt for admin user credentials.

One of the issues at that point is then the installer is running at elevated status and so the local registry is the admin users rather than the user who installed it.

It seems the way to solve is to catch the fact that the elevated user isn't the user who started the uninstall and rerun the uninstall from the uninstall in a non elevated state.

The issue doesnt occur when running the uninstall from outside of add/remove programs.

So, I try adding that.

John Donoghue <lostbard>
Group Member
Thu 14 May 2020 07:11:55 PM UTC, comment #17: 

ok - then either path changes when running from the apps and features, or there is something when it runs with /currentuser

I will put up a new changeset with some dialogs in it soon that will hopefully shed some light on it

John Donoghue <lostbard>
Group Member
Thu 14 May 2020 06:52:49 PM UTC, comment #16: 

That seems to work: When I double-click the uninstaller.exe in the Octave directory, I am not prompted with the user credentials dialog and the uninstaller starts correctly. The uninstaller succeeds to remove all files (apart from the msys files in usr/bin that also remain for a regular installation).
After that the entry in "Apps & Features" also has disappeared (as expected).

Markus Mützel <mmuetzel>
Group administrator
Thu 14 May 2020 06:46:24 PM UTC, comment #15: 

and does it work running the ininstall from the octave directory rather than from APps and Features ?

John Donoghue <lostbard>
Group Member
Thu 14 May 2020 06:45:03 PM UTC, comment #14: 

Windows 10 Pro 1909 (German locale) with current updates.

Markus Mützel <mmuetzel>
Group administrator
Thu 14 May 2020 06:43:21 PM UTC, comment #13: 

what version ond build of windows ?

John Donoghue <lostbard>
Group Member
Thu 14 May 2020 06:40:18 PM UTC, comment #12: 

I created a new user (without any non-ASCII characters) but the behavior is the same: Octave installs fine. But when it comes to uninstalling it, I am prompted for admin user credentials and the uninstallation process fails with the same error as with the other user.

Markus Mützel <mmuetzel>
Group administrator
Thu 14 May 2020 01:36:20 PM UTC, comment #11: 

Ok with me with removing

I means InstallLocation not uninstalllocation.

It could be the non-ASCII characters, although it should work :)

I'll update the patch today to show a message box on what its looking at in the find - debugging the scripts is a pain!


John Donoghue <lostbard>
Group Member
Thu 14 May 2020 01:06:00 PM UTC, comment #10: 

For the test, I logged off as the user and logged back in as the same user to start the uninstall from the "Apps & Features" section of the control panel.

The "InstallLocation" key at that location in HKCU seems to be set correctly: "C:\Users\Mützel\AppData\Local\GNU Octave\Octave-7.0.0"
Also "UninstallString" seems to be right: "C:\Users\Mützel\AppData\Local\GNU Octave\Octave-7.0.0\uninstall.exe" /CurrentUser
I can't see a "uninstalllocation" key.

There is no "Octave-7.0.0" at the corresponding location in HKLM.

Maybe the problem is that the user I created contains a non-ASCII umlaut character. I'll try if I can replicate with a new user with only ASCII characters.

In the meantime, is it OK to remove the registry keys and the installation folder to free some disk space?

Markus Mützel <mmuetzel>
Group administrator
Thu 14 May 2020 12:40:56 PM UTC, comment #9: 

Ok - something not quite right then
How did you run the uninstall - from the uninstall exe, or from the windows  add/remove programs ?

What it 'should' do when running the installer, is find the matching  registry uninstall information in the registry

(in the uninstall code un.FindThisUninstallReg)

Looking first in hkey current user,  Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\Octave-$VERSION

get the "uninstalllocaltion" key and compare it to see if matches the location of uninstaller

If if doesn't find it there, it does the same thing for hkeylocal machine

and then if didn't find it in either on return from that function displays the dialog box you saw.

Whats the registry settings for the local install ?

I'm also assuming you tried to uninstall the local install using the same user as had installed it ?




John Donoghue <lostbard>
Group Member
Wed 13 May 2020 07:52:23 PM UTC, comment #8: 

I tested with a user that doesn't have administrative rights.
On running the installer, the elevated privileges dialog does not appear, the installer doesn't offer the new page and a local installation succeeds.
However, I'm not able to uninstall: When I select to uninstall Octave, I am prompted to select a user with admin rights and enter their password. But a window with the following error message appears:

> Could not find matching install in registry for GNU Octave using C:\Users\....\AddData\Local\GNU Octave\Octave-7.0.0 - Can not uninstall!



Markus Mützel <mmuetzel>
Group administrator
Sun 10 May 2020 09:03:13 PM UTC, comment #7: 

I believe that if you are a user that has admin priviledges, it will show the prompt etc and then in the installer allow to select between local and admin

If your user doesnt have admin priviledges, it wont prompt and only allow local install.

I can change the menus to also be (Local)




John Donoghue <lostbard>
Group Member
Sun 10 May 2020 12:52:28 PM UTC, comment #6: 

You're spot on, John. I didn't run configure again.

I re-ran the bootstrap script (just to be sure) and configured with:

./configure --enable-devel-tools --enable-windows-64 --enable-octave=default --enable-binary-packages --with-ccache --with-pkg-dir=../mxe-octave-pkg


After that, I re-build the installer.
With it, the first thing that appears on screen after starting it is still the elevated privileges dialog. If I answer with "No", the installer doesn't open.

Do I need to wipe anything else?

I don't know much about NSIS or how it determines if it needs admin privileges. So this might not help much:
In the nsis.log, I see 2 warnings. Maybe they have anything to do with it:

2 warnings:
  6012: label "uninst_check_installs" not used
  6012: label "find_check_reg_hkcu" not used


In octave.nsi, there is the following line:

!define MULTIUSER_EXECUTIONLEVEL Highest



Back to the installation process: If I answer with "Yes", the installer opens. During the installation, I see the new page where I selected "Install just for me".

The default installation location doesn't point to %ProgramData% here but to %LocalAppData% (which seems the better location imho).

Octave seems to work correctly. (Though I didn't bother to wait for the test suite to finish. It is veeeery slow here. But unrelated to this change here.)

The folder in the start menu has "(Local)" at the end. Could that also (or instead) be added to the actual program links?
The background is that I often don't bother to scroll down the start menu in search for the program I'd like to start. But instead I hit the Windows key and enter "oct". That lists the actual links only (and not the containing folders). It would be nice to have an indication which of the links is which.

Markus Mützel <mmuetzel>
Group administrator
Sun 10 May 2020 11:02:51 AM UTC, comment #5: 

It also appends '(Local') to the start menu folder if it was a local install, so its possible to have a local and allusers install showing up in the start menu.

John Donoghue <lostbard>
Group Member
Sun 10 May 2020 11:00:46 AM UTC, comment #4: 

From both descriptions I am thinking that you did run configure after applying the patch to regenerate the makeinst-script.sh file

I guess I should have mentioned that :)

When it creates a installer with the new installer, if you have permisions it should show an additional page to select all users or local user. The checkbox on the options page should be gone (replaced by the other page) 

On a local install, it sets the loclation of the install to the users program data directory. For all users, installs in program files.


John Donoghue <lostbard>
Group Member
Sat 09 May 2020 08:35:01 PM UTC, comment #3: 

The "Install for all users" check box has always been there on the top of the 3rd? page; I have been overlooking it for ages :-(

Yeah it would be good if elevated privs would not be required for installing outside C:\Program Files. A consequence is that the Start Menu entries need to be in the Local user's Start Menu, same for desktop icon. I suppose NSIS manages that automatically?

Philip Nienhuis <philipnienhuis>
Group Member
Sat 09 May 2020 08:24:25 PM UTC, comment #2: 

I built an installer with this patch.
When running the installer, first thing is that Windows asks for elevated privileges. If I answer with no, the installer doesn't start.
I can only continue if I grant elevated privileges.
On the page with install options, there is a new checkbox with "Install for all users" which is checked by default. I am not sure what that does though.

For the test I unchecked the box and continued installing at the default location (in "Program Files"). The installation continued as usual, and Octave seems to run normally.

What is the difference between checking or unchecking that box?
Is there anything specific that should be tested?

Markus Mützel <mmuetzel>
Group administrator
Thu 07 May 2020 09:08:05 PM UTC, comment #1: 

Patch to update the installer generation to support local / allusers installation

It will allow the same installer to be installed as once or the other or both at the same time, and I am hoping for users with limited permissions will allow them to install without admin perms required.





(file #49035)

John Donoghue <lostbard>
Group Member
Thu 07 May 2020 01:19:53 PM UTC, original submission:  

Patch to follow

John Donoghue <lostbard>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #49113:  multiuser2.patch added by lostbard (28KiB - text/x-patch)
file #49035:  multi-nsis-install.patch added by lostbard (24KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by lostbard
  • -email is unavailable- added by lostbard
  • -email is unavailable- added by lostbard (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-05-30 lostbard StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2020-05-22 mmuetzel StatusPatch Submitted Ready For Test
    2020-05-18 lostbard Attached File- Added multiuser2.patch, #49113
    2020-05-07 lostbard Attached File- Added multi-nsis-install.patch, #49035
        StatusNone Patch Submitted
    2020-05-07 lostbard Carbon-Copy- Added mmuetzel
    2020-05-07 lostbard Carbon-Copy- Added philipnienhuis

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code