Commit | Line | Data |
---|---|---|
8c0dcf3e JN |
1 | From d8f361705325cf91fc6c2ec84f281cdcd6bfa8b1 Mon Sep 17 00:00:00 2001 |
2 | From: Jan Nieuwenhuizen <janneke@gnu.org> | |
3 | Date: Tue, 3 Dec 2019 21:23:24 +0100 | |
4 | Subject: [PATCH] core: Remove MES_PKGDATADIR. | |
5 | ||
6 | * configure: Do not add MES_PKGDATADIR to config.h. | |
7 | * configure.sh: Likewise. | |
8 | * simple.sh: Likewise. | |
9 | * src/mes.c (open_boot): Do not use MES_PKGDATADIR; rely on | |
10 | MES_PREFIX or cwd. | |
11 | --- | |
12 | configure | 1 - | |
13 | configure.sh | 1 - | |
14 | simple.sh | 2 -- | |
15 | src/mes.c | 13 ------------- | |
16 | 4 files changed, 17 deletions(-) | |
17 | ||
18 | diff --git a/configure b/configure | |
19 | index 8edb2ce7b..12d8323f2 100755 | |
20 | --- a/configure | |
21 | +++ b/configure | |
22 | @@ -666,7 +666,6 @@ See \"Porting GNU Mes\" in the manual, or try --with-courage\n" mes-system) | |
23 | ")) | |
24 | (display (string-append " | |
25 | #define MES_VERSION \"" VERSION "\" | |
26 | -#define MES_PKGDATADIR \"" pkgdatadir "\" | |
27 | "))))) | |
28 | (substitute (string-append srcdest "build-aux/config.make.in") pairs #:target ".config.make")) | |
29 | ||
30 | diff --git a/configure.sh b/configure.sh | |
31 | index 947ddd851..0139cbc36 100755 | |
32 | --- a/configure.sh | |
33 | +++ b/configure.sh | |
34 | @@ -244,7 +244,6 @@ EOF | |
35 | fi | |
36 | cat >> include/mes/config.h <<EOF | |
37 | #define MES_VERSION "$VERSION" | |
38 | -#define MES_PKGDATADIR "$pkgdatadir" | |
39 | EOF | |
40 | ||
41 | cat <<EOF | |
42 | diff --git a/simple.sh b/simple.sh | |
43 | index db6950354..b54398a59 100755 | |
44 | --- a/simple.sh | |
45 | +++ b/simple.sh | |
46 | @@ -33,7 +33,6 @@ mes_bits=64 | |
47 | cat > include/mes/config.h <<EOF | |
48 | #define SYSTEM_LIBC 1 | |
49 | #define MES_VERSION "git" | |
50 | -#define MES_PKGDATADIR "/usr/local/share/mes" | |
51 | EOF | |
52 | ||
53 | ## Build ## | |
54 | @@ -126,7 +125,6 @@ mes_cpu=x86_64 | |
55 | cat > include/mes/config.h <<EOF | |
56 | // #define SYSTEM_LIBC 0 | |
57 | #define MES_VERSION "git" | |
58 | -#define MES_PKGDATADIR "/usr/local/share/mes" | |
59 | EOF | |
60 | ||
61 | ## Build ## | |
62 | diff --git a/src/mes.c b/src/mes.c | |
63 | index d9760fad6..a5e7f2b69 100644 | |
64 | --- a/src/mes.c | |
65 | +++ b/src/mes.c | |
66 | @@ -1775,12 +1775,6 @@ open_boot () | |
67 | char boot[1024]; | |
68 | char file_name[1024]; | |
69 | strcpy (g_datadir, "."); | |
70 | - if (g_debug > 1) | |
71 | - { | |
72 | - eputs (";;; pkgdatadir="); | |
73 | - eputs (MES_PKGDATADIR); | |
74 | - eputs ("\n"); | |
75 | - } | |
76 | if (getenv ("MES_BOOT")) | |
77 | strcpy (boot, getenv ("MES_BOOT")); | |
78 | else | |
79 | @@ -1801,13 +1795,6 @@ open_boot () | |
80 | __stdin = try_open_boot (file_name, boot, "MES_PREFIX/share/mes"); | |
81 | } | |
82 | } | |
83 | - if (__stdin < 0) | |
84 | - { | |
85 | - strcpy (g_datadir, MES_PKGDATADIR); | |
86 | - strcpy (file_name, g_datadir); | |
87 | - strcpy (file_name + strlen (file_name), "/module/mes/"); | |
88 | - __stdin = try_open_boot (file_name, boot, "pkgdatadir"); | |
89 | - } | |
90 | if (__stdin < 0) | |
91 | { | |
92 | g_datadir[0] = 0; | |
93 | -- | |
94 | 2.24.0 | |
95 | ||
96 | commit 2f6fab05b3f09df02aba70c3e21d5fedb45dc567 | |
97 | Author: Jan Nieuwenhuizen <janneke@gnu.org> | |
98 | Date: Sun Nov 24 23:12:29 2019 +0100 | |
99 | ||
100 | core: Throw instead of segfault on non-existing input file. WIP. | |
101 | ||
102 | Reported by theruran. | |
103 | ||
104 | * src/posix.c (open_input_file): Call error instead of failing silently. | |
105 | ||
106 | diff --git a/src/posix.c b/src/posix.c | |
107 | index 7ba2e9915..fd753232d 100644 | |
108 | --- a/src/posix.c | |
109 | +++ b/src/posix.c | |
110 | @@ -188,7 +188,10 @@ current_input_port () | |
111 | SCM | |
112 | open_input_file (SCM file_name) | |
113 | { | |
114 | - return MAKE_NUMBER (mes_open (CSTRING (file_name), O_RDONLY, 0)); | |
115 | + int filedes = mes_open (CSTRING (file_name), O_RDONLY, 0); | |
116 | + if (filedes == -1) | |
117 | + error (cell_symbol_system_error, cons (MAKE_STRING0 ("No such file or directory"), file_name)); | |
118 | + return MAKE_NUMBER (filedes); | |
119 | } | |
120 | ||
121 | SCM |