Gentoo Archives: gentoo-commits

From: David Seifert <soap@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/graphviz/, media-gfx/graphviz/files/
Date: Sat, 25 Jun 2022 20:33:04
Message-Id: 1656189165.2882a4e42336fdcbc7d82476327a99e1f369d4dc.soap@gentoo
1 commit: 2882a4e42336fdcbc7d82476327a99e1f369d4dc
2 Author: David Seifert <soap <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jun 25 20:32:45 2022 +0000
4 Commit: David Seifert <soap <AT> gentoo <DOT> org>
5 CommitDate: Sat Jun 25 20:32:45 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2882a4e4
7
8 media-gfx/graphviz: fix -D_FORTIFY_SOURCE=2 with Clang
9
10 * Rebased patch by Nicholas Vinson <nvinson234 <AT> gmail.com>
11
12 Closes: https://bugs.gentoo.org/853175
13 Signed-off-by: David Seifert <soap <AT> gentoo.org>
14
15 .../files/graphviz-4.0.0-clang-printf-alike.patch | 221 +++++++++++++++++++++
16 ...phviz-4.0.0.ebuild => graphviz-4.0.0-r1.ebuild} | 5 +
17 2 files changed, 226 insertions(+)
18
19 diff --git a/media-gfx/graphviz/files/graphviz-4.0.0-clang-printf-alike.patch b/media-gfx/graphviz/files/graphviz-4.0.0-clang-printf-alike.patch
20 new file mode 100644
21 index 000000000000..ef213bccd8ab
22 --- /dev/null
23 +++ b/media-gfx/graphviz/files/graphviz-4.0.0-clang-printf-alike.patch
24 @@ -0,0 +1,221 @@
25 +diff --git a/CHANGELOG.md b/CHANGELOG.md
26 +index f38cc8ff5..4f1a127a2 100644
27 +--- a/CHANGELOG.md
28 ++++ b/CHANGELOG.md
29 +@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
30 +
31 + ## [Unreleased (4.0.1)]
32 +
33 ++### Fixed
34 ++
35 ++- **Breaking**: The 4.0.0 change replacing the `Agiodisc_t` struct member
36 ++ `putstr` by `printf` has been reverted
37 ++
38 + ## [4.0.0] – 2022-05-29
39 +
40 + ### Changed
41 +diff --git a/cmd/gvpr/gvprmain.c b/cmd/gvpr/gvprmain.c
42 +index 188cfdf94..92872f8cd 100644
43 +--- a/cmd/gvpr/gvprmain.c
44 ++++ b/cmd/gvpr/gvprmain.c
45 +@@ -47,14 +47,17 @@ static int iofread(void *chan, char *buf, int bufsize)
46 + return (int)fread(buf, 1, (size_t)bufsize, chan);
47 + }
48 +
49 ++static int ioputstr(void *chan, const char *str)
50 ++{
51 ++ return fputs(str, chan);
52 ++}
53 ++
54 + static int ioflush(void *chan)
55 + {
56 + return fflush(chan);
57 + }
58 +
59 +-typedef int (*printfn)(void *chan, const char *format, ...);
60 +-
61 +-static Agiodisc_t gprIoDisc = { iofread, (printfn)fprintf, ioflush };
62 ++static Agiodisc_t gprIoDisc = { iofread, ioputstr, ioflush };
63 +
64 + static Agdisc_t gprDisc = { &AgMemDisc, &AgIdDisc, &gprIoDisc };
65 +
66 +diff --git a/lib/cgraph/cgraph.3 b/lib/cgraph/cgraph.3
67 +index ed7392c06..67e35c2e9 100644
68 +--- a/lib/cgraph/cgraph.3
69 ++++ b/lib/cgraph/cgraph.3
70 +@@ -487,14 +487,14 @@ The I/O discipline provides an abstraction for the reading and writing of graphs
71 + .P0
72 + struct Agiodisc_s {
73 + int (*fread)(void *chan, char *buf, int bufsize);
74 +- int (*printf)(void *chan, const char *format, ...);
75 ++ int (*putstr)(void *chan, char *str);
76 + int (*flush)(void *chan); /* sync */
77 + } ;
78 + .P1
79 + Normally, the \fBFILE\fP structure and its related functions are used for I/O. At times, though,
80 + an application may need to use a totally different type of character source. The associated
81 + state or stream information is provided by the \fIchan\fP argument to \fBagread\fP or \fBagwrite\fP.
82 +-The discipline function \fIfread\fP and \fIprintf\fP provide the corresponding functions for
83 ++The discipline function \fIfread\fP and \fIputstr\fP provide the corresponding functions for
84 + read and writing.
85 +
86 + .SH "MEMORY DISCIPLINE"
87 +diff --git a/lib/cgraph/cgraph.h b/lib/cgraph/cgraph.h
88 +index 7b005c442..cbec3bbe6 100644
89 +--- a/lib/cgraph/cgraph.h
90 ++++ b/lib/cgraph/cgraph.h
91 +@@ -169,7 +169,7 @@ struct Agiddisc_s { /* object ID allocator */
92 +
93 + struct Agiodisc_s {
94 + int (*afread) (void *chan, char *buf, int bufsize);
95 +- int (*printf)(void *chan, const char *format, ...);
96 ++ int (*putstr) (void *chan, const char *str);
97 + int (*flush) (void *chan); /* sync */
98 + /* error messages? */
99 + };
100 +diff --git a/lib/cgraph/io.c b/lib/cgraph/io.c
101 +index d8b136804..66c605ae6 100644
102 +--- a/lib/cgraph/io.c
103 ++++ b/lib/cgraph/io.c
104 +@@ -24,15 +24,17 @@ static int iofread(void *chan, char *buf, int bufsize)
105 + }
106 +
107 + /* default IO methods */
108 ++static int ioputstr(void *chan, const char *str)
109 ++{
110 ++ return fputs(str, chan);
111 ++}
112 +
113 + static int ioflush(void *chan)
114 + {
115 + return fflush(chan);
116 + }
117 +
118 +-typedef int (*printfn)(void *chan, const char *format, ...);
119 +-
120 +-Agiodisc_t AgIoDisc = { iofread, (printfn)fprintf, ioflush };
121 ++Agiodisc_t AgIoDisc = { iofread, ioputstr, ioflush };
122 +
123 + typedef struct {
124 + const char *data;
125 +@@ -78,7 +80,7 @@ static Agraph_t *agmemread0(Agraph_t *arg_g, const char *cp)
126 + rdr_t rdr;
127 + Agdisc_t disc;
128 +
129 +- memIoDisc.printf = AgIoDisc.printf;
130 ++ memIoDisc.putstr = AgIoDisc.putstr;
131 + memIoDisc.flush = AgIoDisc.flush;
132 + rdr.data = cp;
133 + rdr.len = strlen(cp);
134 +diff --git a/lib/cgraph/write.c b/lib/cgraph/write.c
135 +index e14f7d835..9e72d2c5c 100644
136 +--- a/lib/cgraph/write.c
137 ++++ b/lib/cgraph/write.c
138 +@@ -26,7 +26,7 @@ typedef void iochan_t;
139 +
140 + static int ioput(Agraph_t * g, iochan_t * ofile, char *str)
141 + {
142 +- return AGDISC(g, io)->printf(ofile, "%s", str);
143 ++ return AGDISC(g, io)->putstr(ofile, str);
144 +
145 + }
146 +
147 +diff --git a/lib/gvpr/compile.c b/lib/gvpr/compile.c
148 +index a7fe27bf5..3704f51d9 100644
149 +--- a/lib/gvpr/compile.c
150 ++++ b/lib/gvpr/compile.c
151 +@@ -66,14 +66,17 @@ static int iofread(void *chan, char *buf, int bufsize)
152 + return (int)read(sffileno(chan), buf, bufsize);
153 + }
154 +
155 ++static int ioputstr(void *chan, const char *str)
156 ++{
157 ++ return sfputr(chan, str, -1);
158 ++}
159 ++
160 + static int ioflush(void *chan)
161 + {
162 + return sfsync(chan);
163 + }
164 +
165 +-typedef int (*printfn)(void *chan, const char *format, ...);
166 +-
167 +-static Agiodisc_t gprIoDisc = { iofread, (printfn)sfprintf, ioflush };
168 ++static Agiodisc_t gprIoDisc = { iofread, ioputstr, ioflush };
169 +
170 + #ifdef GVDLL
171 + static Agdisc_t gprDisc = { 0, 0, &gprIoDisc };
172 +diff --git a/plugin/core/gvrender_core_dot.c b/plugin/core/gvrender_core_dot.c
173 +index c45563460..63eb5e535 100644
174 +--- a/plugin/core/gvrender_core_dot.c
175 ++++ b/plugin/core/gvrender_core_dot.c
176 +@@ -511,7 +511,7 @@ static void xdot_end_graph(graph_t* g)
177 + textflags[EMIT_GLABEL] = 0;
178 + }
179 +
180 +-typedef int (*printfn)(void *chan, const char *format, ...);
181 ++typedef int (*putstrfn) (void *chan, const char *str);
182 + typedef int (*flushfn) (void *chan);
183 + static void dot_end_graph(GVJ_t *job)
184 + {
185 +@@ -521,7 +521,7 @@ static void dot_end_graph(GVJ_t *job)
186 +
187 + if (io.afread == NULL) {
188 + io.afread = AgIoDisc.afread;
189 +- io.printf = (printfn)gvprintf;
190 ++ io.putstr = (putstrfn)gvputs;
191 + io.flush = (flushfn)gvflush;
192 + }
193 +
194 +diff --git a/plugin/core/gvrender_core_json.c b/plugin/core/gvrender_core_json.c
195 +index bab5d64af..88715a93a 100644
196 +--- a/plugin/core/gvrender_core_json.c
197 ++++ b/plugin/core/gvrender_core_json.c
198 +@@ -693,7 +693,7 @@ static void write_graph(Agraph_t * g, GVJ_t * job, int top, state_t* sp)
199 + gvputs(job, "}");
200 + }
201 +
202 +-typedef int (*printfn)(void *chan, const char *format, ...);
203 ++typedef int (*putstrfn) (void *chan, const char *str);
204 + typedef int (*flushfn) (void *chan);
205 +
206 + static void json_end_graph(GVJ_t *job)
207 +@@ -704,7 +704,7 @@ static void json_end_graph(GVJ_t *job)
208 +
209 + if (io.afread == NULL) {
210 + io.afread = AgIoDisc.afread;
211 +- io.printf = (printfn)gvprintf;
212 ++ io.putstr = (putstrfn)gvputs;
213 + io.flush = (flushfn)gvflush;
214 + }
215 +
216 +diff --git a/tclpkg/tcldot/tcldot.c b/tclpkg/tcldot/tcldot.c
217 +index 335d8e469..b747124cf 100644
218 +--- a/tclpkg/tcldot/tcldot.c
219 ++++ b/tclpkg/tcldot/tcldot.c
220 +@@ -163,7 +163,7 @@ int Tcldot_Init(Tcl_Interp * interp)
221 + /* build disciplines dynamically so we can selectively replace functions */
222 +
223 + ictx->myioDisc.afread = NULL; /* set in dotread() or dotstring() according to need */
224 +- ictx->myioDisc.printf = AgIoDisc.printf; /* no change */
225 ++ ictx->myioDisc.putstr = AgIoDisc.putstr; /* no change */
226 + ictx->myioDisc.flush = AgIoDisc.flush; /* no change */
227 +
228 + ictx->mydisc.mem = &AgMemDisc; /* no change */
229 +diff --git a/lib/common/output.c b/lib/common/output.c
230 +index c91dfe41e..648409c5a 100644
231 +--- a/lib/common/output.c
232 ++++ b/lib/common/output.c
233 +@@ -80,11 +80,11 @@ void write_plain(GVJ_t *job, graph_t *g,
234 + bezier bz;
235 + pointf pt;
236 + char *lbl;
237 + char* fillcolor;
238 +
239 +- print = g->clos->disc.io->printf;
240 ++ print = g->clos->disc.io->putstr;
241 + // setup_graph(job, g);
242 + setYInvert(g);
243 + pt = GD_bb(g).UR;
244 + print(f, "graph %.5g %.5g %.5g\n", job->zoom, PS2INCH(pt.x), PS2INCH(pt.y));
245 + for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
246
247 diff --git a/media-gfx/graphviz/graphviz-4.0.0.ebuild b/media-gfx/graphviz/graphviz-4.0.0-r1.ebuild
248 similarity index 98%
249 rename from media-gfx/graphviz/graphviz-4.0.0.ebuild
250 rename to media-gfx/graphviz/graphviz-4.0.0-r1.ebuild
251 index 1f4507432c23..53c156b50c4b 100644
252 --- a/media-gfx/graphviz/graphviz-4.0.0.ebuild
253 +++ b/media-gfx/graphviz/graphviz-4.0.0-r1.ebuild
254 @@ -138,6 +138,11 @@ BDEPEND="
255 # sci-libs/gts, x11-libs/gtk. Also needs 'gtk','glade','glut','gts' and 'png'
256 # with flags enabled at configure time
257
258 +PATCHES=(
259 + # backport, remove on bump (bug #853175)
260 + "${FILESDIR}"/${P}-clang-printf-alike.patch
261 +)
262 +
263 pkg_setup() {
264 use python && python-single-r1_pkg_setup
265 }