Fossil

Check-in [0eb08b860c]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Change more system() calls into portable_system() in an effort to fix path quoting problems on windows.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0eb08b860c5b851c074113fd459d1cd0671f4805
User & Date: drh 2009-09-16 21:29:18.000
References
2009-10-10
10:06 Ticket [bfb8427cdd] Cloning and syncing an URL with no repository or misconfigured CGI repository fails silently. status still Open with 1 other change ... (artifact: 82d4a349fb user: anonymous)
09:13 Ticket [bfb8427cdd]: 4 changes ... (artifact: e1925b83ec user: anonymous)
2009-09-19
02:07 New ticket [bfb8427cdd]. ... (artifact: bbe9ff42f8 user: anonymous)
2009-09-17
14:08 New ticket [2384764107] Make the http command working on Windows.. ... (artifact: 1052b0c4dc user: anonymous)
Context
2009-09-18
20:58
On the "checkout" command, make sure the argument specifies a check-in and not some other object. Ticket [867f23ff79]. ... (check-in: c774e298c3 user: drh tags: trunk)
2009-09-16
21:29
Change more system() calls into portable_system() in an effort to fix path quoting problems on windows. ... (check-in: 0eb08b860c user: drh tags: trunk)
14:50
Make sure that bringing up the "/xfer" URL in a web-browser does something sensible (it redirects to the homepage.) Ticket [1d7bbe30aad51]. ... (check-in: 39a144eb5c user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/allrepo.c.
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
      printf("%s\n", zFilename);
      continue;
    }
    zQFilename = quoteFilename(zFilename);
    zSyscmd = mprintf("%s %s %s", zFossil, zCmd, zQFilename);
    printf("%s\n", zSyscmd);
    fflush(stdout);
    system(zSyscmd);
    free(zSyscmd);
    free(zQFilename);
  }
  
  /* If any repositories hows names appear in the ~/.fossil file could not
  ** be found, remove those names from the ~/.fossil file.
  */







|







125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
      printf("%s\n", zFilename);
      continue;
    }
    zQFilename = quoteFilename(zFilename);
    zSyscmd = mprintf("%s %s %s", zFossil, zCmd, zQFilename);
    printf("%s\n", zSyscmd);
    fflush(stdout);
    portable_system(zSyscmd);
    free(zSyscmd);
    free(zQFilename);
  }
  
  /* If any repositories hows names appear in the ~/.fossil file could not
  ** be found, remove those names from the ~/.fossil file.
  */
Changes to src/checkin.c.
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
                   g.zLocalRoot);
#ifdef __MINGW32__
  blob_add_cr(&text);
#endif
  blob_write_to_file(&text, zFile);
  zCmd = mprintf("%s \"%s\"", zEditor, zFile);
  printf("%s\n", zCmd);
  if( system(zCmd) ){
    fossil_panic("editor aborted");
  }
  blob_reset(&text);
  blob_read_from_file(&text, zFile);
  blob_remove_cr(&text);
  unlink(zFile);
  free(zFile);







|







288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
                   g.zLocalRoot);
#ifdef __MINGW32__
  blob_add_cr(&text);
#endif
  blob_write_to_file(&text, zFile);
  zCmd = mprintf("%s \"%s\"", zEditor, zFile);
  printf("%s\n", zCmd);
  if( portable_system(zCmd) ){
    fossil_panic("editor aborted");
  }
  blob_reset(&text);
  blob_read_from_file(&text, zFile);
  blob_remove_cr(&text);
  unlink(zFile);
  free(zFile);
Changes to src/clearsign.c.
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
    return 0;
  }
  zRand = db_text(0, "SELECT hex(randomblob(10))");
  zOut = mprintf("out-%s", zRand);
  zIn = mprintf("in-%z", zRand);
  blob_write_to_file(pIn, zOut);
  zCmd = mprintf("%s %s %s", zBase, zIn, zOut);
  rc = system(zCmd);
  free(zCmd);
  if( rc==0 ){
    if( pOut==pIn ){
      blob_reset(pIn);
    }
    blob_zero(pOut);
    blob_read_from_file(pOut, zIn);







|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
    return 0;
  }
  zRand = db_text(0, "SELECT hex(randomblob(10))");
  zOut = mprintf("out-%s", zRand);
  zIn = mprintf("in-%z", zRand);
  blob_write_to_file(pIn, zOut);
  zCmd = mprintf("%s %s %s", zBase, zIn, zOut);
  rc = portable_system(zCmd);
  free(zCmd);
  if( rc==0 ){
    if( pOut==pIn ){
      blob_reset(pIn);
    }
    blob_zero(pOut);
    blob_read_from_file(pOut, zIn);
Changes to src/diffcmd.c.
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
      printf("Index: %s\n======================================="
             "============================\n",
             zPathname
      );
      shell_escape(&cmd, zFullName);
      printf("%s\n", blob_str(&cmd));
      fflush(stdout);
      system(blob_str(&cmd));
    }
    free(zFullName);
  }
  db_finalize(&q);
}

/*







|







98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
      printf("Index: %s\n======================================="
             "============================\n",
             zPathname
      );
      shell_escape(&cmd, zFullName);
      printf("%s\n", blob_str(&cmd));
      fflush(stdout);
      portable_system(blob_str(&cmd));
    }
    free(zFullName);
  }
  db_finalize(&q);
}

/*
219
220
221
222
223
224
225
226

227
228
229
230
231
232
233
234
235
236
237
238

239
  }
  blob_reset(&fname);
}

/*
** This function implements a cross-platform "system()" interface.
*/
void portable_system(char *zOrigCmd){

#ifdef __MINGW32__
  /* On windows, we have to put double-quotes around the entire command.
  ** Who knows why - this is just the way windows works.
  */
  char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
  system(zNewCmd);
  free(zNewCmd);
#else
  /* On unix, evaluate the command directly.
  */
  system(zOrigCmd);
#endif  

}







|
>





|




|
|
>

219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
  }
  blob_reset(&fname);
}

/*
** This function implements a cross-platform "system()" interface.
*/
int portable_system(char *zOrigCmd){
  int rc;
#ifdef __MINGW32__
  /* On windows, we have to put double-quotes around the entire command.
  ** Who knows why - this is just the way windows works.
  */
  char *zNewCmd = mprintf("\"%s\"", zOrigCmd);
  rc = system(zNewCmd);
  free(zNewCmd);
#else
  /* On unix, evaluate the command directly.
  */
  rc = system(zOrigCmd);
#endif 
  return rc; 
}
Changes to src/http_transport.c.
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
  if( g.urlIsFile ){
    char *zCmd;
    fclose(transport.pFile);
    zCmd = mprintf("\"%s\" http \"%s\" \"%s\" \"%s\" 127.0.0.1",
       g.argv[0], g.urlName, transport.zOutFile, transport.zInFile
    );
    portable_system(zCmd);
    system(zCmd);
    free(zCmd);
    transport.pFile = fopen(transport.zInFile, "rb");
  }
}

/*
** This routine is called when the inbound message has been received







<







161
162
163
164
165
166
167

168
169
170
171
172
173
174
  if( g.urlIsFile ){
    char *zCmd;
    fclose(transport.pFile);
    zCmd = mprintf("\"%s\" http \"%s\" \"%s\" \"%s\" 127.0.0.1",
       g.argv[0], g.urlName, transport.zOutFile, transport.zInFile
    );
    portable_system(zCmd);

    free(zCmd);
    transport.pFile = fopen(transport.zInFile, "rb");
  }
}

/*
** This routine is called when the inbound message has been received