Closed
Bug 799180
Opened 12 years ago
Closed 12 years ago
Same stub installer can be launched multiple times
Categories
(Firefox :: Installer, defect)
Tracking
()
VERIFIED
FIXED
Firefox 19
Tracking | Status | |
---|---|---|
firefox18 | --- | verified |
People
(Reporter: Mardak, Assigned: robert.strong.bugs)
References
Details
(Whiteboard: [stub=])
Attachments
(1 file, 2 obsolete files)
(deleted),
patch
|
bbondy
:
review+
akeybl
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
Could be the user is double-clicking too much or has set things to launch on single click but still double-clicks things.
Installation seemed to go fine in both and it ended up launching two instances of Nightly when both finished.
Updated•12 years ago
|
Blocks: StubInstaller
Assignee | ||
Comment 1•12 years ago
|
||
Though it isn't unusual for an installer to allow multiple launches I don't have a problem with blocking this ability.
Updated•12 years ago
|
Whiteboard: [stub-]
Comment 2•12 years ago
|
||
(In reply to Edward Lee :Mardak from comment #0)
> Could be the user is double-clicking too much or has set things to launch on
> single click but still double-clicks things.
>
> Installation seemed to go fine in both and it ended up launching two
> instances of Nightly when both finished.
Hmm...I actually hit a case just now that also causes the installer to never finish installing Nightly if you enter the "installing" phase of the stub installer at the exact same time with 2 stub installers. Although this took some timing to get it to work though.
Assignee | ||
Comment 3•12 years ago
|
||
Assignee: nobody → robert.bugzilla
Status: NEW → ASSIGNED
Attachment #670201 -
Flags: review?(netzen)
Assignee | ||
Comment 4•12 years ago
|
||
Changed to create the mutex earlier.
Attachment #670201 -
Attachment is obsolete: true
Attachment #670201 -
Flags: review?(netzen)
Attachment #670216 -
Flags: review?
Assignee | ||
Updated•12 years ago
|
Attachment #670216 -
Flags: review? → review?(netzen)
Assignee | ||
Comment 5•12 years ago
|
||
Changed to wanted but not blocking based on comment #2
Whiteboard: [stub-] → [stub=]
Comment 6•12 years ago
|
||
Comment on attachment 670216 [details] [diff] [review]
patch rev2
Review of attachment 670216 [details] [diff] [review]:
-----------------------------------------------------------------
What about using the brand name instead of the path?
::: browser/installer/windows/nsis/stub.nsi
@@ +184,5 @@
> + ; multiple times.
> + StrCpy $1 "$EXEPATH"
> + ; Backslashes are illegal in a mutex name so replace all occurences of a
> + ; backslash with a forward slash.
> + ${WordReplace} "$1" "\" "/" "+" $1
I'm fine with this, but just wondering if you know the difference between ${WordReplace} with + and with +*
; + : replace all found
; +* : multiple-replace all found
@@ +190,5 @@
> +
> + ; The lpName parameter for CreateMutexW is limited to MAX_PATH characters so
> + ; use the characters at the end since they are more likely to be unique.
> + ${If} $2 > ${MAX_PATH}
> + IntOp $3 $2 - ${MAX_PATH}
nit: I don't thinkt his line is needed since $3 is not used.
@@ +193,5 @@
> + ${If} $2 > ${MAX_PATH}
> + IntOp $3 $2 - ${MAX_PATH}
> + StrCpy $1 "$1" ${MAX_PATH} -${MAX_PATH}
> + ${EndIf}
> + System::Call "kernel32::CreateMutexW(i 0, i 0, w '$1') i .r0 ?e"
If you want to protect against people in other logged on sessions starting from the same path then prefix with Global\
@@ +204,5 @@
> + ; executable but that is an uninteresting edge case.
> + FindWindow $1 "#32770" "$(WIN_CAPTION)" 0
> + ${If} $1 != 0
> + ; Restore the window if it is minimized and make it the foreground window
> + System::Call "user32::ShowWindow(i r1, i 9) i."
nit: Add comment SW_RESTORE
@@ +207,5 @@
> + ; Restore the window if it is minimized and make it the foreground window
> + System::Call "user32::ShowWindow(i r1, i 9) i."
> + System::Call "user32::SetForegroundWindow(i r1) i."
> + ${EndIf}
> + Abort
Don't we want Quit here?
Assignee | ||
Comment 7•12 years ago
|
||
(In reply to Brian R. Bondy [:bbondy] from comment #6)
> Comment on attachment 670216 [details] [diff] [review]
> patch rev2
>
> Review of attachment 670216 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> What about using the brand name instead of the path?
I considered that but I kind of prefer this since if the mutex uses the path the call to Findwindow with the window caption will always find the window and bring it to front whereas there may be developers or people getting squirrelly that launch the stub to install multiple copies. I wouldn't be at all surprised if a bug gets filed to allow this at some point and the patch prevents the case this bug is about.
> ::: browser/installer/windows/nsis/stub.nsi
> @@ +184,5 @@
> > + ; multiple times.
> > + StrCpy $1 "$EXEPATH"
> > + ; Backslashes are illegal in a mutex name so replace all occurences of a
> > + ; backslash with a forward slash.
> > + ${WordReplace} "$1" "\" "/" "+" $1
>
> I'm fine with this, but just wondering if you know the difference between
> ${WordReplace} with + and with +*
> ; + : replace all found
> ; +* : multiple-replace all found
So, using replace with the string "a b" replacing " " with " " will result in " ".
So, using multiple-replace with the string "a b" replacing " " with " " will result in " ".
>
> @@ +190,5 @@
> > +
> > + ; The lpName parameter for CreateMutexW is limited to MAX_PATH characters so
> > + ; use the characters at the end since they are more likely to be unique.
> > + ${If} $2 > ${MAX_PATH}
> > + IntOp $3 $2 - ${MAX_PATH}
>
> nit: I don't thinkt his line is needed since $3 is not used.
Yep. Saw that earlier and forgot to remove it. Done
> @@ +193,5 @@
> > + ${If} $2 > ${MAX_PATH}
> > + IntOp $3 $2 - ${MAX_PATH}
> > + StrCpy $1 "$1" ${MAX_PATH} -${MAX_PATH}
> > + ${EndIf}
> > + System::Call "kernel32::CreateMutexW(i 0, i 0, w '$1') i .r0 ?e"
>
> If you want to protect against people in other logged on sessions starting
> from the same path then prefix with Global\
Right and I think that would be confusing for those people.
> @@ +204,5 @@
> > + ; executable but that is an uninteresting edge case.
> > + FindWindow $1 "#32770" "$(WIN_CAPTION)" 0
> > + ${If} $1 != 0
> > + ; Restore the window if it is minimized and make it the foreground window
> > + System::Call "user32::ShowWindow(i r1, i 9) i."
>
> nit: Add comment SW_RESTORE
I'll add a define if it isn't already available and use it.
> @@ +207,5 @@
> > + ; Restore the window if it is minimized and make it the foreground window
> > + System::Call "user32::ShowWindow(i r1, i 9) i."
> > + System::Call "user32::SetForegroundWindow(i r1) i."
> > + ${EndIf}
> > + Abort
>
> Don't we want Quit here?
Abort in oninit exits.
Assignee | ||
Comment 8•12 years ago
|
||
I moved the code to after elevation since the unelevated code it unable to bring an instance that is elevated to the front.
Attachment #670216 -
Attachment is obsolete: true
Attachment #670216 -
Flags: review?(netzen)
Attachment #670230 -
Flags: review?(netzen)
Comment 9•12 years ago
|
||
Comment on attachment 670230 [details] [diff] [review]
patch rev3
Review of attachment 670230 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good, thanks for the info in the last comment.
Attachment #670230 -
Flags: review?(netzen) → review+
Comment 10•12 years ago
|
||
If it's not too late, please also add a call to close the mutex handle.
Comment 11•12 years ago
|
||
... inside the ${Unless} $0 == 0.
Otherwise the OS has to clean it up and it might not work correctly if you launch the app again right away before the OS cleans it up.
Assignee | ||
Comment 12•12 years ago
|
||
Agreed that the OS has to clean it up though I haven't had an issue ever with it doing so and I am ok on waiting on having it wait until the OS cleans it up.
Assignee | ||
Comment 13•12 years ago
|
||
Pushed to mozilla-inbound
https://hg.mozilla.org/integration/mozilla-inbound/rev/20f9a0406524
Comment 14•12 years ago
|
||
(In reply to Robert Strong [:rstrong] (do not email) from comment #12)
> Agreed that the OS has to clean it up though I haven't had an issue ever
> with it doing so and I am ok on waiting on having it wait until the OS
> cleans it up.
The only time I've had a problem with this is in terms of automated scripts with repeated launches of the application.
Comment 15•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 19
Assignee | ||
Updated•12 years ago
|
Attachment #670230 -
Flags: approval-mozilla-aurora?
Updated•12 years ago
|
Attachment #670230 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Assignee | ||
Comment 17•12 years ago
|
||
Pushed to mozilla-aurora
https://hg.mozilla.org/releases/mozilla-aurora/rev/2c27ae268b7d
status-firefox18:
--- → fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•