Closed Bug 506696 Opened 15 years ago Closed 15 years ago

[WinCE] updater.exe doesn't use the working directory when applying the update

Categories

(Toolkit :: Application Update, defect, P1)

ARM
Windows CE
defect

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: robert.strong.bugs, Assigned: robert.strong.bugs)

References

Details

(Whiteboard: [nv])

Attachments

(1 file, 6 obsolete files)

There are also a few return codes that aren't correct for the functions they emulate in updater_wince.cpp
Whiteboard: [nv]
Priority: -- → P1
Attached patch Updated tests (obsolete) — Splinter Review
Attached patch Updated tests rev2 (obsolete) — Splinter Review
Attachment #391220 - Attachment is obsolete: true
Attached patch patch in progress (obsolete) — Splinter Review
Comment on attachment 391306 [details] [diff] [review]
patch in progress

Benjamin, the updater on WinCE / WinMo needs to use the working-dir command line arg since they don't have a concept of a working directory. Since the arg is a WCHAR I went ahead and converted XP_WIN to use WCHAR where applicable. I've tested this on WinMo / Vista (I'll verify it works on WinCE tomorrow) and I sent the patch to the try server. There is some cleanup of updater_wince.cpp that I haven't done yet.
Attachment #391306 - Flags: review?(benjamin)
Comment on attachment 391306 [details] [diff] [review]
patch in progress

note to self: don't request review when half asleep
Attachment #391306 - Attachment is obsolete: true
Attachment #391306 - Flags: review?(benjamin)
Attached patch patch rev1 (obsolete) — Splinter Review
Benjamin, the updater on WinCE / WinMo needs to use the working-dir command line arg since they don't have a concept of a working directory. Since the arg is a WCHAR I went ahead and converted XP_WIN to use WCHAR where applicable. I've tested this on WinMo / WinCE / WinVista and I sent the patch to the try server.
Attachment #391311 - Attachment is obsolete: true
Attachment #391423 - Flags: review?(benjamin)
Status: NEW → ASSIGNED
Comment on attachment 391423 [details] [diff] [review]
patch rev1

At a rather skimming pace this looks correct.
Attachment #391423 - Flags: review?(benjamin) → review+
Comment on attachment 391423 [details] [diff] [review]
patch rev1

Brad, could I get you to review these changes? Thanks
Attachment #391423 - Flags: review?(bugmail)
note: this passed the Linux try unit tests
Also passed the Mac OS X try unit tests
Also passed the WINNT try unit tests
Comment on attachment 391423 [details] [diff] [review]
patch rev1


>-# define mkdir(path, perms) _mkdir(path)
>+# define mkdir(path, perms) _wmkdir(path)

perhaps this should be tmkdir since it will be wide on some platforms and narrow on others

>   // Run from the specified working directory (see bug 312360).
>   if(NS_tchdir(workingDir) != 0)
>     LOG(("Warning: chdir failed"));
> 
>+  // Run from the specified working directory (see bug 312360).
>+  NS_tchdir(workingDir);
>+

why are you calling NS_tchdir(workingDir) twice?  Also, we don't need the comment twice
Attachment #391423 - Flags: review?(bugmail) → review+
Thanks Brad!

(In reply to comment #13)
> (From update of attachment 391423 [details] [diff] [review])
> 
> >-# define mkdir(path, perms) _mkdir(path)
> >+# define mkdir(path, perms) _wmkdir(path)
> 
> perhaps this should be tmkdir since it will be wide on some platforms and
> narrow on others
Agreed and will change

> >   // Run from the specified working directory (see bug 312360).
> >   if(NS_tchdir(workingDir) != 0)
> >     LOG(("Warning: chdir failed"));
> > 
> >+  // Run from the specified working directory (see bug 312360).
> >+  NS_tchdir(workingDir);
> >+
> 
> why are you calling NS_tchdir(workingDir) twice?  Also, we don't need the
> comment twice
I had a bad merge and will fix this
Attached patch patch with comments addressed (obsolete) — Splinter Review
Carrying forward r+
Attachment #391229 - Attachment is obsolete: true
Attachment #391423 - Attachment is obsolete: true
Attachment #391468 - Flags: review+
Attached patch patchSplinter Review
The previous patch was with -w and this cleans up a couple of bracket inconsistencies that have crept in over time. I'll check this in as soon as the tree is green.
Attachment #391468 - Attachment is obsolete: true
Attachment #391525 - Flags: review+
Pushed to mozilla-central
http://hg.mozilla.org/mozilla-central/rev/b4a6eaf4a569

along with updated tests
http://hg.mozilla.org/mozilla-central/rev/04a7efa84f87
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
Comment on attachment 391525 [details] [diff] [review]
patch

>+# define stat _stat
Out of interest, what is this supposed to do? (VC7.1 doesn't like it.)
On Windows _stat and _wstat takes the struct _stat as a param and iirc some of the WinCE work in one of the other file (archivereader.cpp I believe) required this for non WinCE.
http://msdn.microsoft.com/en-us/library/14h5k7ff%28VS.80%29.aspx

I'll take a look at reworking this in the next day or two.
I was able to work around the problem by moving the #define stat _stat after the #include <sys/stat.h> and I also had to #define fstat _fstat too.
@@
-#ifndef WINCE
-# define stat _stat
-#endif
@@
 #ifdef WINCE
 #include updater_wince.h
+#elif defined(XP_WIN)
+#define stat _stat
+#define fstat _fstat
 #endif
Depends on: 508746
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: