Skip to content

Commit dd92743

Browse files
committed
news
1 parent be47e79 commit dd92743

File tree

4 files changed

+40
-4
lines changed

4 files changed

+40
-4
lines changed

NEWS.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
Version 1.7.2
1+
Version 1.7.4
2+
-------------
3+
4+
- As `fork` and `wait` do not exist on Windows writing compressed files
5+
through `pipe/fork/exec/wait` has to be disabled for Windows cross
6+
compilation to go through, which has the effect that compressed
7+
file writing is not supported for Windows anymore. Alternatively
8+
one could go back to `popen` for writing compressed files on Windows
9+
which however is not safe and therefore we simply decided to disable
10+
that feature for windows. Compressed file reading still (and as far
11+
we now safely) uses `popen` and thus also compiles for Windows.
12+
13+
Version 1.7.3
214
-------------
315

416
- Replaced the unsafe `popen` approach for compressed file writing

src/file.cpp

+16-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@ extern "C" {
1111
#include <string.h>
1212
#include <sys/stat.h>
1313
#include <sys/types.h>
14-
#include <sys/wait.h>
1514
#include <unistd.h>
1615
}
1716

17+
#ifndef _WIN32
18+
19+
extern "C" {
20+
#include <sys/wait.h>
21+
};
22+
23+
#endif
24+
1825
/*------------------------------------------------------------------------*/
1926

2027
namespace CaDiCaL {
@@ -243,6 +250,8 @@ FILE *File::read_pipe (Internal *internal, const char *fmt, const int *sig,
243250
return open_pipe (internal, fmt, path, "r");
244251
}
245252

253+
#ifndef _WIN32
254+
246255
FILE *File::write_pipe (Internal *internal, const char *command,
247256
const char *path, int &child_pid) {
248257
assert (command[0] && command[0] != ' ');
@@ -286,6 +295,8 @@ FILE *File::write_pipe (Internal *internal, const char *command,
286295
return res;
287296
}
288297

298+
#endif
299+
289300
/*------------------------------------------------------------------------*/
290301

291302
File *File::read (Internal *internal, FILE *f, const char *n) {
@@ -334,6 +345,7 @@ File *File::read (Internal *internal, const char *path) {
334345
File *File::write (Internal *internal, const char *path) {
335346
FILE *file;
336347
int close_output = 3, child_pid = 0;
348+
#ifndef _WIN32
337349
if (has_suffix (path, ".xz"))
338350
file = write_pipe (internal, "xz -c", path, child_pid);
339351
else if (has_suffix (path, ".bz2"))
@@ -343,6 +355,7 @@ File *File::write (Internal *internal, const char *path) {
343355
else if (has_suffix (path, ".7z"))
344356
file = write_pipe (internal, "7z a -an -txz -si -so", path, child_pid);
345357
else
358+
#endif
346359
file = write_file (internal, path), close_output = 1;
347360

348361
if (!file)
@@ -364,11 +377,13 @@ void File::close () {
364377
MSG ("closing input pipe to read '%s'", name ());
365378
pclose (file);
366379
}
380+
#ifndef _WIN32
367381
if (close_file == 3) {
368382
MSG ("closing output pipe to write '%s'", name ());
369383
fclose (file);
370384
waitpid (child_pid, 0, 0);
371385
}
386+
#endif
372387
file = 0; // mark as closed
373388

374389
// TODO what about error checking for 'fclose', 'pclose' or 'waitpid'?

src/file.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ class File {
5858
const char *mode);
5959
static FILE *read_pipe (Internal *, const char *fmt, const int *sig,
6060
const char *path);
61+
#ifndef __WIN32
6162
static FILE *write_pipe (Internal *, const char *fmt, const char *path,
6263
int &child_pid);
64+
#endif
6365

6466
public:
6567
static char *find_program (const char *prg); // search in 'PATH'

src/mobical.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -2227,13 +2227,20 @@ void Mobical::print_statistics () {
22272227

22282228
extern "C" {
22292229
#include <fcntl.h>
2230-
#include <sys/resource.h>
22312230
#include <sys/stat.h>
22322231
#include <sys/time.h>
22332232
#include <sys/types.h>
2234-
#include <sys/wait.h>
22352233
}
22362234

2235+
#ifndef _WIN32
2236+
2237+
extern "C" {
2238+
#include <sys/resource.h>
2239+
#include <sys/wait.h>
2240+
};
2241+
2242+
#endif
2243+
22372244
int64_t Trace::generated;
22382245
int64_t Trace::executed;
22392246
int64_t Trace::failed;

0 commit comments

Comments
 (0)