From: SourceForge.net <no...@so...> - 2008-01-05 23:09:36
|
Bugs item #1864507, was opened at 2008-01-05 15:59 Message generated for change (Comment added) made by joostverburg You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=373085&aid=1864507&group_id=22049 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Documentation Group: 2.0 Series Status: Open Resolution: None Priority: 5 Private: No Submitted By: Sebastian Pipping (hartwork) Assigned to: Joost Verburg (joostverburg) Summary: Dangerous example of MUI_STARTMENU_GETFOLDER macro Initial Comment: NSIS version 2.34 The Modern UI 1/2 documentation contains a quite dangerous example of using the MUI_STARTMENU_GETFOLDER macro: !insertmacro MUI_STARTMENU_GETFOLDER page_id $R0 Delete "$SMPROGRAMS\$R0\Your Shortcut.lnk" People copy-pasting this can actually delete the whole start menu if "Do not create shortcuts" was chosen, because that will return the empty string in the uninstaller. I strongly suggest to replace the example with !insertmacro MUI_STARTMENU_GETFOLDER page_id $R0 StrCmp $R0 "" NO_SHORTCUTS Delete "$SMPROGRAMS\$R0\Your Shortcut.lnk" NO_SHORTCUTS: Thank you! ---------------------------------------------------------------------- >Comment By: Joost Verburg (joostverburg) Date: 2008-01-06 00:09 Message: Logged In: YES user_id=604457 Originator: NO Can you provide a small script to reproduce this issue (the returned variable being empty)? I cannot reproduce it. ---------------------------------------------------------------------- Comment By: Sebastian Pipping (hartwork) Date: 2008-01-05 23:59 Message: Logged In: YES user_id=1022691 Originator: YES or to say it this way: if no shortcuts were created then executing !insertmacro MUI_STARTMENU_GETFOLDER page_id $R0 Delete "$SMPROGRAMS\$R0\Your Shortcut.lnk" can only do damage. ---------------------------------------------------------------------- Comment By: Sebastian Pipping (hartwork) Date: 2008-01-05 23:56 Message: Logged In: YES user_id=1022691 Originator: YES Well, the value returned was empty for NSIS 2.34 at my machine, I message-boxed it. I used RMDir /r on that folder. RMDir /r on a start menu folder should be fine since user don't put files in there. I opened this bug because I actually deleted a whole start menu this way by mistake. ---------------------------------------------------------------------- Comment By: Joost Verburg (joostverburg) Date: 2008-01-05 23:44 Message: Logged In: YES user_id=604457 Originator: NO It doesn't really look dangerous to me. First of all the default folder will be returned if the registry value is empty. The default for this default folder is the installer name, which again can never be empty because NSIS also has a default for that. So $R0 should never be empty. And even if $R0 would be empty, the uninstaller would just attempt to remove "Your Shortcut.lnk" from the main Start Menu programs folder instead of the subfolder for the application. Delete also won't remove folders nor their content. Only when using commands like RMDir /r you should really be careful with possible empty variables. By the way, using RMDir /r in an uninstaller is usually not a good idea. Please clarify if I misunderstood your report. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=373085&aid=1864507&group_id=22049 |