Backed out changeset 0c5da403b68e
authorKyle Huey <khuey@kylehuey.com>
Sat, 19 Mar 2011 07:59:37 -0400
changeset 63523 226949e0ba864f10fad39219d229ef8182dddf61
parent 63483 0c5da403b68e4db66a1a708486ef9f05cd0d81b4
child 63524 f171aeef4da1d7838db54e53b69a3a75a6a30618
push idunknown
push userunknown
push dateunknown
milestone2.0b13pre
backs out0c5da403b68e4db66a1a708486ef9f05cd0d81b4
Backed out changeset 0c5da403b68e
config/Makefile.in
config/config.mk
config/nsinstall_win.c
js/src/config/config.mk
js/src/config/nsinstall_win.c
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -47,17 +47,16 @@ include $(DEPTH)/config/autoconf.mk
 # For sanity's sake, we compile nsinstall without the wrapped system
 # headers, so that we can use it to set up the wrapped system headers.
 VISIBILITY_FLAGS =
 
 HOST_PROGRAM	= nsinstall$(HOST_BIN_SUFFIX)
 
 ifeq (WINNT,$(HOST_OS_ARCH))
 HOST_CSRCS	= nsinstall_win.c
-HOST_EXTRA_LIBS = $(call EXPAND_LIBNAME,shlwapi)
 else
 HOST_CSRCS	= nsinstall.c pathsub.c
 endif
 
 PLSRCS		= nfspwd.pl
 
 TARGETS		= $(HOST_PROGRAM) $(PLSRCS:.pl=) $(SIMPLE_PROGRAMS)
 
--- a/config/config.mk
+++ b/config/config.mk
@@ -733,17 +733,17 @@ else
 ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH))
 NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall
 else
 NSINSTALL = $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)
 endif # OS2
 endif # NSINSTALL_BIN
 
 
-ifeq (,$(CROSS_COMPILE)$(filter-out OS2, $(OS_ARCH)))
+ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
 INSTALL		= $(NSINSTALL)
 else
 ifeq ($(NSDISTMODE),copy)
 # copy files, but preserve source mtime
 INSTALL		= $(NSINSTALL) -t
 else
 ifeq ($(NSDISTMODE),absolute_symlink)
 # install using absolute symbolic links
--- a/config/nsinstall_win.c
+++ b/config/nsinstall_win.c
@@ -6,56 +6,41 @@
  * taken from shmsdos.c
  */
 
 #include <direct.h>
 #include <stdio.h>
 #include <string.h>
 #include <assert.h>
 #include <windows.h>
-#include <shlwapi.h>
 #pragma hdrstop
 
 /*
  * sh_FileFcn --
  *
  * A function that operates on a file.  The pathname is either
  * absolute or relative to the current directory, and contains
  * no wildcard characters such as * and ?.   Additional arguments
  * can be passed to the function via the arg pointer.
  */
 
 typedef BOOL (*sh_FileFcn)(
         wchar_t *pathName,
         WIN32_FIND_DATA *fileData,
         void *arg);
-typedef BOOL (*sh_DoFcn)(
-        wchar_t *srcFileName,
-        DWORD srcFileAttributes,
-        wchar_t *dstFileName,
-        DWORD dstFileAttributes,
-        int force,
-        int recursive);
 
-static int shellDo (wchar_t **pArgv, sh_FileFcn, sh_DoFcn);
+static int shellCp (wchar_t **pArgv); 
 static int shellNsinstall (wchar_t **pArgv);
 static int shellMkdir (wchar_t **pArgv); 
 static BOOL sh_EnumerateFiles(const wchar_t *pattern, const wchar_t *where,
         sh_FileFcn fileFcn, void *arg, int *nFiles);
 static const char *sh_GetLastErrorMessage(void);
-static BOOL sh_DoLnk(wchar_t *srcFileName, DWORD srcFileAttributes,
-        wchar_t *dstFileName, DWORD dstFileAttributes,
-        int force, int recursive);
 static BOOL sh_DoCopy(wchar_t *srcFileName, DWORD srcFileAttributes,
         wchar_t *dstFileName, DWORD dstFileAttributes,
         int force, int recursive);
-static BOOL sh_LnkFileCmd(wchar_t *pathName, WIN32_FIND_DATA *findData,
-                          void *cpArg);
-static BOOL sh_CpFileCmd(wchar_t *pathName, WIN32_FIND_DATA *findData,
-                         void *cpArg);
 
 #define LONGPATH_PREFIX L"\\\\?\\"
 #define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
 #define STR_LEN(a) (ARRAY_LEN(a) - 1)
 
 /* changes all forward slashes in token to backslashes */
 void changeForwardSlashesToBackSlashes ( wchar_t *arg )
 {
@@ -74,33 +59,30 @@ int wmain(int argc, wchar_t *argv[ ])
     return shellNsinstall ( argv + 1 );
 }
 
 static int
 shellNsinstall (wchar_t **pArgv)
 {
     int retVal = 0;     /* exit status */
     int dirOnly = 0;    /* 1 if and only if -D is specified */
-    int linkFiles = 0;  /* 1 iff -R is specified */
     wchar_t **pSrc;
     wchar_t **pDst;
 
     /*
      * Process the command-line options.  We ignore the
-     * options except for -D and -R.  Some options, such as -m,
+     * options except for -D.  Some options, such as -m,
      * are followed by an argument.  We need to skip the
      * argument too.
      */
     while ( *pArgv && **pArgv == '-' ) {
         wchar_t c = (*pArgv)[1];  /* The char after '-' */
 
         if ( c == 'D' ) {
             dirOnly = 1;
-        } else if ( c == 'R' ) {
-            linkFiles = 1;
         } else if ( c == 'm' ) {
             pArgv++;  /* skip the next argument */
         }
         pArgv++;
     }
 
     if ( !dirOnly ) {
         /* There are files to install.  Get source files */
@@ -124,23 +106,18 @@ shellNsinstall (wchar_t **pArgv)
         return 3;
     }
     while ( *pArgv ) 
         pDst = pArgv++;
 
     retVal = shellMkdir ( pDst );
     if ( retVal )
         return retVal;
-    if ( !dirOnly ) {
-        if ( linkFiles) {
-            retVal = shellDo ( pSrc, sh_LnkFileCmd, sh_DoLnk );
-        } else {
-            retVal = shellDo ( pSrc, sh_CpFileCmd, sh_DoCopy );
-        }
-    }
+    if ( !dirOnly )
+        retVal = shellCp ( pSrc );
     return retVal;
 }
 
 static int
 shellMkdir (wchar_t **pArgv) 
 {
     int retVal = 0; /* assume valid return */
     wchar_t *arg;
@@ -244,63 +221,16 @@ sh_RecordFileData(wchar_t *pathName, WIN
     struct sh_FileData *fData = (struct sh_FileData *) arg;
 
     wcscpy(fData->pathName, pathName);
     fData->dwFileAttributes = findData->dwFileAttributes;
     return TRUE;
 }
 
 static BOOL
-sh_DoLnk(wchar_t *srcFileName,
-         DWORD srcFileAttributes,
-         wchar_t *dstFileName,
-         DWORD dstFileAttributes,
-         int force,
-         int recursive
-)
-{
-    BOOL willDeleteFile = (dstFileAttributes != 0xFFFFFFFF) ? TRUE : FALSE;
-
-    if (srcFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
-        fprintf(stderr, "nsinstall: %ls is a directory\n",
-                srcFileName);
-        return FALSE;
-    } else {
-        DWORD r;
-        wchar_t longSrc[1004] = LONGPATH_PREFIX;
-        wchar_t longDst[1004] = LONGPATH_PREFIX;
-        r = GetFullPathName(srcFileName, 1000, longSrc + STR_LEN(LONGPATH_PREFIX), NULL);
-        if (!r) {
-            fprintf(stderr, "nsinstall: couldn't get full path of %ls: %s\n",
-                    srcFileName, sh_GetLastErrorMessage());
-            return FALSE;
-        }
-        r = GetFullPathName(dstFileName, 1000, longDst + ARRAY_LEN(LONGPATH_PREFIX) - 1, NULL);
-        if (!r) {
-            fprintf(stderr, "nsinstall: couldn't get full path of %ls: %s\n",
-                    dstFileName, sh_GetLastErrorMessage());
-            return FALSE;
-        }
-
-        if (willDeleteFile) {
-            DeleteFile(dstFileName);
-        }
-
-        if (!CreateHardLink(longDst, longSrc, NULL)) {
-            fprintf(stderr, "nsinstall: warning! cannot link %ls to %ls: %s\n",
-                    srcFileName, dstFileName, sh_GetLastErrorMessage());
-            return sh_DoCopy(srcFileName, srcFileAttributes,
-                             dstFileName, dstFileAttributes,
-                             force, recursive);
-        }
-    }
-    return TRUE;
-}
-
-static BOOL
 sh_DoCopy(wchar_t *srcFileName,
           DWORD srcFileAttributes,
           wchar_t *dstFileName,
           DWORD dstFileAttributes,
           int force,
           int recursive
 )
 {
@@ -328,18 +258,16 @@ sh_DoCopy(wchar_t *srcFileName,
         r = GetFullPathName(dstFileName, 1000, longDst + ARRAY_LEN(LONGPATH_PREFIX) - 1, NULL);
         if (!r) {
             fprintf(stderr, "nsinstall: couldn't get full path of %ls: %s\n",
                     dstFileName, sh_GetLastErrorMessage());
             return FALSE;
         }
 
         if (!CopyFile(longSrc, longDst, FALSE)) {
-            if (!wcscmp(PathFindExtension(longSrc), L".chk"))
-              return TRUE; // Incredibly ugly hack to work around Bug 539689
             fprintf(stderr, "nsinstall: cannot copy %ls to %ls: %s\n",
                     srcFileName, dstFileName, sh_GetLastErrorMessage());
             return FALSE;
         }
     }
     return TRUE;
 }
 
@@ -383,30 +311,18 @@ sh_CpFileCmd(wchar_t *pathName, WIN32_FI
     struct sh_CpCmdArg *arg = (struct sh_CpCmdArg *) cpArg;
 
     wcscpy(arg->dstFileNameMarker, findData->cFileName);
     return sh_DoCopy(pathName, findData->dwFileAttributes,
             arg->dstFileName, GetFileAttributes(arg->dstFileName),
             arg->force, arg->recursive);
 }
 
-static BOOL
-sh_LnkFileCmd(wchar_t *pathName, WIN32_FIND_DATA *findData, void *cpArg)
-{
-    BOOL retVal = TRUE;
-    struct sh_CpCmdArg *arg = (struct sh_CpCmdArg *) cpArg;
-
-    wcscpy(arg->dstFileNameMarker, findData->cFileName);
-    return sh_DoLnk(pathName, findData->dwFileAttributes,
-            arg->dstFileName, GetFileAttributes(arg->dstFileName),
-            arg->force, arg->recursive);
-}
-
 static int
-shellDo (wchar_t **pArgv, sh_FileFcn doFooCmd, sh_DoFcn doFoo)
+shellCp (wchar_t **pArgv) 
 {
     int retVal = 0;
     wchar_t **pSrc;
     wchar_t **pDst;
     struct sh_CpCmdArg arg;
     struct sh_FileData dstData;
     int dstIsDir = 0;
     int n;
@@ -532,30 +448,30 @@ shellDo (wchar_t **pArgv, sh_FileFcn doF
                     *pSrc);
             retVal = 3;
         } else if (n > 1) {
             fprintf(stderr, "nsinstall: cannot copy more than one file or "
                     "directory to the same destination\n");
             retVal = 3;
         } else {
             assert(n == 1);
-            if ((*doFoo)(srcData.pathName, srcData.dwFileAttributes,
+            if (sh_DoCopy(srcData.pathName, srcData.dwFileAttributes,
                     dstData.pathName, dstData.dwFileAttributes,
                     arg.force, arg.recursive) == FALSE) {
                 retVal = 3;
             }
         }
         return retVal;
     }
 
     for ( ; *pSrc != *pDst; pSrc++) {
         BOOL rv;
 
         changeForwardSlashesToBackSlashes(*pSrc);
-        rv = sh_EnumerateFiles(*pSrc, *pSrc, doFooCmd, &arg, &n);
+        rv = sh_EnumerateFiles(*pSrc, *pSrc, sh_CpFileCmd, &arg, &n);
         if (rv == FALSE) {
             retVal = 3;
         } else {
             if (n == 0) {
                 fprintf(stderr, "nsinstall: %ls: No such file or directory\n",
                         *pSrc);
                 retVal = 3;
             }
--- a/js/src/config/config.mk
+++ b/js/src/config/config.mk
@@ -733,17 +733,17 @@ else
 ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH))
 NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall
 else
 NSINSTALL = $(CONFIG_TOOLS)/nsinstall$(HOST_BIN_SUFFIX)
 endif # OS2
 endif # NSINSTALL_BIN
 
 
-ifeq (,$(CROSS_COMPILE)$(filter-out OS2, $(OS_ARCH)))
+ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
 INSTALL		= $(NSINSTALL)
 else
 ifeq ($(NSDISTMODE),copy)
 # copy files, but preserve source mtime
 INSTALL		= $(NSINSTALL) -t
 else
 ifeq ($(NSDISTMODE),absolute_symlink)
 # install using absolute symbolic links
--- a/js/src/config/nsinstall_win.c
+++ b/js/src/config/nsinstall_win.c
@@ -21,40 +21,26 @@
  * no wildcard characters such as * and ?.   Additional arguments
  * can be passed to the function via the arg pointer.
  */
 
 typedef BOOL (*sh_FileFcn)(
         wchar_t *pathName,
         WIN32_FIND_DATA *fileData,
         void *arg);
-typedef BOOL (*sh_DoFcn)(
-        wchar_t *srcFileName,
-        DWORD srcFileAttributes,
-        wchar_t *dstFileName,
-        DWORD dstFileAttributes,
-        int force,
-        int recursive);
 
-static int shellDo (wchar_t **pArgv, sh_FileFcn, sh_DoFcn);
+static int shellCp (wchar_t **pArgv); 
 static int shellNsinstall (wchar_t **pArgv);
 static int shellMkdir (wchar_t **pArgv); 
 static BOOL sh_EnumerateFiles(const wchar_t *pattern, const wchar_t *where,
         sh_FileFcn fileFcn, void *arg, int *nFiles);
 static const char *sh_GetLastErrorMessage(void);
-static BOOL sh_DoLnk(wchar_t *srcFileName, DWORD srcFileAttributes,
-        wchar_t *dstFileName, DWORD dstFileAttributes,
-        int force, int recursive);
 static BOOL sh_DoCopy(wchar_t *srcFileName, DWORD srcFileAttributes,
         wchar_t *dstFileName, DWORD dstFileAttributes,
         int force, int recursive);
-static BOOL sh_LnkFileCmd(wchar_t *pathName, WIN32_FIND_DATA *findData,
-                          void *cpArg);
-static BOOL sh_CpFileCmd(wchar_t *pathName, WIN32_FIND_DATA *findData,
-                         void *cpArg);
 
 #define LONGPATH_PREFIX L"\\\\?\\"
 #define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
 #define STR_LEN(a) (ARRAY_LEN(a) - 1)
 
 /* changes all forward slashes in token to backslashes */
 void changeForwardSlashesToBackSlashes ( wchar_t *arg )
 {
@@ -73,33 +59,30 @@ int wmain(int argc, wchar_t *argv[ ])
     return shellNsinstall ( argv + 1 );
 }
 
 static int
 shellNsinstall (wchar_t **pArgv)
 {
     int retVal = 0;     /* exit status */
     int dirOnly = 0;    /* 1 if and only if -D is specified */
-    int linkFiles = 0;  /* 1 iff -R is specified */
     wchar_t **pSrc;
     wchar_t **pDst;
 
     /*
      * Process the command-line options.  We ignore the
-     * options except for -D and -R.  Some options, such as -m,
+     * options except for -D.  Some options, such as -m,
      * are followed by an argument.  We need to skip the
      * argument too.
      */
     while ( *pArgv && **pArgv == '-' ) {
         wchar_t c = (*pArgv)[1];  /* The char after '-' */
 
         if ( c == 'D' ) {
             dirOnly = 1;
-        } else if ( c == 'R' ) {
-            linkFiles = 1;
         } else if ( c == 'm' ) {
             pArgv++;  /* skip the next argument */
         }
         pArgv++;
     }
 
     if ( !dirOnly ) {
         /* There are files to install.  Get source files */
@@ -123,23 +106,18 @@ shellNsinstall (wchar_t **pArgv)
         return 3;
     }
     while ( *pArgv ) 
         pDst = pArgv++;
 
     retVal = shellMkdir ( pDst );
     if ( retVal )
         return retVal;
-    if ( !dirOnly ) {
-        if ( linkFiles) {
-            retVal = shellDo ( pSrc, sh_LnkFileCmd, sh_DoLnk );
-        } else {
-            retVal = shellDo ( pSrc, sh_CpFileCmd, sh_DoCopy );
-        }
-    }
+    if ( !dirOnly )
+        retVal = shellCp ( pSrc );
     return retVal;
 }
 
 static int
 shellMkdir (wchar_t **pArgv) 
 {
     int retVal = 0; /* assume valid return */
     wchar_t *arg;
@@ -243,63 +221,16 @@ sh_RecordFileData(wchar_t *pathName, WIN
     struct sh_FileData *fData = (struct sh_FileData *) arg;
 
     wcscpy(fData->pathName, pathName);
     fData->dwFileAttributes = findData->dwFileAttributes;
     return TRUE;
 }
 
 static BOOL
-sh_DoLnk(wchar_t *srcFileName,
-         DWORD srcFileAttributes,
-         wchar_t *dstFileName,
-         DWORD dstFileAttributes,
-         int force,
-         int recursive
-)
-{
-    BOOL willDeleteFile = (dstFileAttributes != 0xFFFFFFFF) ? TRUE : FALSE;
-
-    if (srcFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
-        fprintf(stderr, "nsinstall: %ls is a directory\n",
-                srcFileName);
-        return FALSE;
-    } else {
-        DWORD r;
-        wchar_t longSrc[1004] = LONGPATH_PREFIX;
-        wchar_t longDst[1004] = LONGPATH_PREFIX;
-        r = GetFullPathName(srcFileName, 1000, longSrc + STR_LEN(LONGPATH_PREFIX), NULL);
-        if (!r) {
-            fprintf(stderr, "nsinstall: couldn't get full path of %ls: %s\n",
-                    srcFileName, sh_GetLastErrorMessage());
-            return FALSE;
-        }
-        r = GetFullPathName(dstFileName, 1000, longDst + ARRAY_LEN(LONGPATH_PREFIX) - 1, NULL);
-        if (!r) {
-            fprintf(stderr, "nsinstall: couldn't get full path of %ls: %s\n",
-                    dstFileName, sh_GetLastErrorMessage());
-            return FALSE;
-        }
-
-        if (willDeleteFile) {
-            DeleteFile(dstFileName);
-        }
-
-        if (!CreateHardLink(longDst, longSrc, NULL)) {
-            fprintf(stderr, "nsinstall: warning! cannot link %ls to %ls: %s\n",
-                    srcFileName, dstFileName, sh_GetLastErrorMessage());
-            return sh_DoCopy(srcFileName, srcFileAttributes,
-                             dstFileName, dstFileAttributes,
-                             force, recursive);
-        }
-    }
-    return TRUE;
-}
-
-static BOOL
 sh_DoCopy(wchar_t *srcFileName,
           DWORD srcFileAttributes,
           wchar_t *dstFileName,
           DWORD dstFileAttributes,
           int force,
           int recursive
 )
 {
@@ -380,30 +311,18 @@ sh_CpFileCmd(wchar_t *pathName, WIN32_FI
     struct sh_CpCmdArg *arg = (struct sh_CpCmdArg *) cpArg;
 
     wcscpy(arg->dstFileNameMarker, findData->cFileName);
     return sh_DoCopy(pathName, findData->dwFileAttributes,
             arg->dstFileName, GetFileAttributes(arg->dstFileName),
             arg->force, arg->recursive);
 }
 
-static BOOL
-sh_LnkFileCmd(wchar_t *pathName, WIN32_FIND_DATA *findData, void *cpArg)
-{
-    BOOL retVal = TRUE;
-    struct sh_CpCmdArg *arg = (struct sh_CpCmdArg *) cpArg;
-
-    wcscpy(arg->dstFileNameMarker, findData->cFileName);
-    return sh_DoLnk(pathName, findData->dwFileAttributes,
-            arg->dstFileName, GetFileAttributes(arg->dstFileName),
-            arg->force, arg->recursive);
-}
-
 static int
-shellDo (wchar_t **pArgv, sh_FileFcn doFooCmd, sh_DoFcn doFoo)
+shellCp (wchar_t **pArgv) 
 {
     int retVal = 0;
     wchar_t **pSrc;
     wchar_t **pDst;
     struct sh_CpCmdArg arg;
     struct sh_FileData dstData;
     int dstIsDir = 0;
     int n;
@@ -529,30 +448,30 @@ shellDo (wchar_t **pArgv, sh_FileFcn doF
                     *pSrc);
             retVal = 3;
         } else if (n > 1) {
             fprintf(stderr, "nsinstall: cannot copy more than one file or "
                     "directory to the same destination\n");
             retVal = 3;
         } else {
             assert(n == 1);
-            if ((*doFoo)(srcData.pathName, srcData.dwFileAttributes,
+            if (sh_DoCopy(srcData.pathName, srcData.dwFileAttributes,
                     dstData.pathName, dstData.dwFileAttributes,
                     arg.force, arg.recursive) == FALSE) {
                 retVal = 3;
             }
         }
         return retVal;
     }
 
     for ( ; *pSrc != *pDst; pSrc++) {
         BOOL rv;
 
         changeForwardSlashesToBackSlashes(*pSrc);
-        rv = sh_EnumerateFiles(*pSrc, *pSrc, doFooCmd, &arg, &n);
+        rv = sh_EnumerateFiles(*pSrc, *pSrc, sh_CpFileCmd, &arg, &n);
         if (rv == FALSE) {
             retVal = 3;
         } else {
             if (n == 0) {
                 fprintf(stderr, "nsinstall: %ls: No such file or directory\n",
                         *pSrc);
                 retVal = 3;
             }