~jamesodhunt/ubuntu/trusty/libnih/fix-test-output-crash

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
1.0.3  2010-12-23

	* Support for passing file descriptors over D-Bus added to
	  nih-dbus-tool.  Due to code limitations, to avoid leaking the
	  file descriptor in case of error it must be the last input
	  argument to any method being implemented and within your
	  function you are responsible for closing it on error.

1.0.2  2010-04-27

	* AC_COPYRIGHT wrapper renamed to NIH_COPYRIGHT.  (Bug: #519278)

	* Serial added to libnih.m4 to stop aclocal overwriting a local
	  copy with an older installed copy.

	* NIH_WITH_LOCAL_LIBNIH macro added that can be used by external
	  sources to add a --with-local-libnih configure argument.

1.0.1  2010-02-04

	* Add missing __nih_* symbols to the linker version script,
	  otherwise software using TEST_ALLOC_FAIL cannot be compiled (like
	  Upstart).

	* The glibc __abort_msg symbol is now only linked as a weak
	  reference, if your C library does not have the symbol, libnih
	  will still work.

1.0.0  2009-11-28

	* libnih is no longer intended to be copied into an application
	  source tree and linked statically, but is now installed onto the
	  system and dynamically linked normally.  The nihify script has
	  been removed accordingly.

	* Future 1.0.x versions will contain bug fixes, but no API or ABI
	  changes.  Future 1.x.0 versions may introduce new things to the
	  API or ABI but will be backwards compatible with previous
	  versions.  Future x.0.0 versions will not be backwards compatible.

	* The NIH_INIT macro has been removed, to check for libnih or
	  libnih-dbus you should now use pkg-config, e.g.:

		PKG_CHECK_MODULES([NIH], [libnih >= 1.0.0])

	  any other checks should be added as necessary instead of
	  relying on that macro to do them for you.

	* An external pre-built nih-dbus-tool may be used instead of the
	  built copy by passing NIH_DBUS_TOOL to configure.  If you are
	  cross-compiling, this will be automatically searched for in the
	  PATH and a warning output if it doesn't exist and you fail to
	  specify it.  (Bug: #426740)


	* nih_alloc() has been fixed to work on platforms with alignment
	  greater than 4 bytes.  (Bug: #436758)

	* nih_alloc() no longer permits objects to have zero references,
	  passing NULL for the parent now creates a special reference from
	  a NULL parent.

	* nih_discard() removes this special reference before checking
	  whether remaining references free the object.

	* nih_ref() and nih_unref() may have NULL as the parent reference
	  and add or remove the special reference respectively.

	* nih_ref() does not remove the NULL reference, you must now use
	  nih_discard() or nih_local to construct floating objects.

	* Since nih_ref() may be used when parent is NULL, there's no reason
	  for an nih_unref_only() function so it has been dropped; the
	  following code is now perfectly safe:

		nih_ref (obj, new_parent);
		nih_unref (object, old_parent);

	* nih_alloc_parent() has changed again, now when passed NULL it
	  only returns TRUE if the object has the special NULL parent.

	* TEST_ALLOC_PARENT() has likewise changed, restoring the previous
	  behaviour that TEST_ALLOC_PARENT(ptr, NULL) tests whether it has
	  the NULL parent.

	* The TEST_ALLOC_ORPHAN() macro has been dropped, objects may no
	  longer have no parents.

	* A new TEST_ALLOC_NOT_PARENT() macro has been added that is the
	  exact inverse of TEST_ALLOC_PARENT()

	* These changes solve the problem where the object "obj" in the
	  following code would be freed, even though it was intended that
	  it be a top-level object:

		obj = nih_new (NULL, Obj);

		nih_ref (obj, tmp_obj);
		nih_unref (obj, tmp_obj);

	  This comes at a cost of breaking the previous behaviour where
	  a NULL-parented object could be considered floating and
	  ignored once referenced.  This kind of code was brittle anyway
	  and nih_local far better solves it, e.g. replace code such as:

		Obj *obj;

		obj = nih_new (NULL, Obj);
		func_that_will_ref (obj);

	  with:

		nih_local Obj *obj = NULL;

		obj = nih_new (NULL, Obj);
		func_that_will_ref (obj);

	* nih_log_message() will set the glibc __abort_msg variable to any
	  log message of NIH_LOG_FATAL priority or greater, this means that
	  should you call abort() core dump analysers can retrieve the
	  message; especially useful for nih_assert().  (Bug: #429411)


	* nih-dbus-tool generated code has been fixed so that when a
	  method call function is called on a disconnected connection
	  it returns a raised DBUS_ERROR_DISCONNECTED rather than causing
	  an assertion error.  (Bug: #477116)

0.3.2  2009-08-02

	* D-Bus 1.2.16 is now required.

	* Fixed compilation on ia64.

	* nih-dbus-tool(1) manpage will not be installed, since the binary
	  is not.  (Bug: #403103)

0.3.1  2009-07-09

	* The licence for libnih has been changed back to version 2 of the
	  GNU GPL.

	* D-Bus 1.2.15 is now required, this is the current GIT HEAD
	  pending a 1.2.16 release.

	* TEST_EXPECTED_STR and TEST_EXPECTED_FILE added.  These compare the
	  contents of a string and file respectively against the contents
	  of a given filename relative to the "expected" directory alongside
	  the test binary, e.g.:

		TEST_EXPECTED_STR (code, "foo.c");

	  in tests/test_foo will be TRUE if the contents of the C string
	  "code" match the contents of the file tests/expected/foo.c

	* NihFileFilter (the function type passed to nih_dir_walk and
	  nih_watch_new) now has an extra is_dir argument, this is set
	  without calling stat()

	* NihTimer now uses a monotonic clock, so is unaffected by changes
	  in the system clock; this means that you'll need to use
	  clock_gettime (CLOCK_MONOTONIC) when manually adjusting the due
	  time rather than time ().  (Bug: #389589)

	* NihError may now be directly embedded into other structures with
	  the NIH_ERROR_MEMBERS macro.

	* NihDBusError now directly embeds the members of NihError, there
	  is no longer an "error" member, instead you can directly access
	  "number" and "message" members.

	* NihDBusProxy has gained an auto_start member, TRUE by default.
	  If you do not want method calls to automatically start a service,
	  you may set this to FALSE after creating the proxy.  nih-dbus-tool
	  generated method calls will respect this flag.

	* nih_dbus_proxy_connect() no longer has both a parent and proxy
	  argument, it now only takes the proxy and is always a child of it.

	* NihDBusProxySignal no longer has connection, name or path members
	  and instead has a proxy member from which the values can be found.

	* nih_dbus_proxy_new() will now begin tracking any name given, even
	  if there is no lost_handler passed.  This (and the above changes)
	  allows signal handlers to compare the sender of a signal (which is
	  always a unique name) against the owner of the associated proxy.

	* Attempting to read from a D-Bus property that is write-only, or
	  attempting to write to a D-Bus property that is read-only will now
	  return the DBUS_ERROR_ACCESS_DENIED error rather than
	  DBUS_ERROR_UNKNOWN_METHOD.

	* An empty com.netsplit.Nih.Symbol annotation is no longer permitted
	  for D-Bus interfaces.  Instead use the new --default-interface
	  option to nih-dbus-tool.

	* nih-dbus-tool now properly supports structures, including arrays of
	  structures and arrays of dictionary entries.  The default naming
	  of the structure is derived from the method or signal name and
	  argument or the property name; the default naming of the members
	  is "item0".."itemN".  Structure definitions appear in the
	  generated header file.

	* nih-dbus-tool now generates prefix_interface_get_all() and
	  prefix_interface_get_all_sync() methods for each interface, these
	  get the values of all of the properties and store them in a
	  PrefixInterfaceProperties structure defined in the header file.

	* A side-effect of the above is that it's no longer possible to
	  name properties after C keywords.

0.3.0  2009-06-17

	* The licence for libnih has been changed to MIT/X11.

	* The --enable-compiler-warnings configure option has been
	  extended to add -Wextra, but turns off a few of the more extreme
	  warnings

	* TEST_FILE_MATCH() added to allow matching of a line in a file
	  against a wildcard string

	* NIH_MUST(), NIH_ZERO() and NIH_SHOULD() now expand to an
	  expression with the value of the expression inside.  This means
	  that the code like the following is now valid:

		ret = NIH_SHOULD (some_function_call ());
		if (ret < 0)
			...

	  This style is preferred to the previous way of doing it (set ret
	  inside the macro call) and the code has been updated.

	* nih_option_parser() fixed to not eat an argument containing a
	  lone dash.

	* nih_error_raise_again() renamed to nih_error_raise_error().

	* Errors are no longer removed from the context when you call
	  nih_error_get(), this means that to clear the error you must free
	  it and it's now a bug to call nih_error_raise_error() to raise
	  it again.

	* Unhandled errors now result in an assertion error, rather than a
	  log message being emitted.  This assertion will include the
	  filename, line number and function name where the error was
	  originally raised.  The assertion may be generated on exit from
	  the program.

	* nih_option_help() produces slightly different output if the
	  bug reporting address is a URL.

	* GNU C Library v2.4 (or backported inotify support) is required

	* D-Bus object and proxy interface structure definitions have been
	  moved to nih-dbus/dbus_interface.h, this file is still included
	  by nih-dbus/dbus_object.h and nih-dbus/dbus_proxy.h so there
	  may be no need to include it directly.

	* nih_dbus_proxy_new() has additional arguments, a lost handler
	  function which enables tracking of the owner of the well-known
	  name, and a data pointer.  NihDBusProxy has a new owner member
	  which contains this.

	* Signals may be connected using nih_dbus_proxy_connect(), this
	  requires both a handler function and an intermediate filter
	  function.  The NihDBusSignal structure gained a filter member
	  to specify the latter.

	* The D-Bus binding tool has moved into a separate nih-dbus-tool
	  subdirectory, and rewritten from Python to C.

	* The D-Bus binding tool now uses annotations rather than XML
	  namespaced attributes to adjust the output:
	  - set com.netsplit.Nih.Method.Async to "true" instead of using
	    nih:object="async"
	  - com.netsplit.Nih.Symbol may be used to override C symbol name
	    generation
          - org.freedesktop.DBus.Deprecated results in a deprecated
	    attribute on external API

	* Function names generated by the D-Bus binding tool now include
	  the last element of the interface name; my_method() would now
	  be named my_interface_method().  The interface name can be
	  ommitted by setting the com.netsplit.Nih.Symbol annotation to ""

	* Proxy method functions are now asynchronous by default, the
	  synchronous version has _sync() appended to its name.

	* Signal function names now always include "emit" in them.

	* Signal filter functions are generated by the binding tool for use
	  with nih_dbus_proxy_connect()

	* Get and Set access functions are now generated for properties,
	  and in object mode are expected to be provided.

	* Arrays of arrays are now fully supported; if the array is an
	  array of basic types, the function will have two arguments; a
	  NULL-terminated array of arrays, and a second NULL-terminated
	  array of those array lengths.  This is supported to infinite
	  depths.

	* D-Bus 1.2.4 is now required.

	* pkg-config 0.22 is now required, it probably was anyway but we
	  now explicitly check for it.

	* Dependency on Python for the D-Bus binding tool has been dropped
	  and replaced with a dependency on expat 2.0.0

	* The NIH_DBUS_ERROR and NIH_DBUS_INVALID_ARGS error enums have
	  been moved to nih-dbus/errors.h

0.2.0  2009-01-29

	* nih_alloc_set_allocator() is now a macro that casts the function
	  to the right typedef, so such casts are no longer needed

	* nih_alloc() now permits multiple parent references
	  - nih_ref(ptr, parent) creates a new parent reference
	  - nih_unref(ptr, parent) drops a reference and frees if the last
	  - nih_unref_only(ptr, parent) drops a reference without freeing
	  - nih_free() unconditionally frees as it always has
	  - nih_discard() only frees if there are no references

	* nih_local may be added to variable definitions to have the
	  pointer automatically discarded when it goes out of scope, unless
	  it is referenced in the meantime:

		{
			nih_local char *str = NULL;
			str = nih_strdup (NULL, "some string");
			pass_to_func (str);
		}

	* nih_alloc_reparent() has been dropped, it can be replaced with
	  an nih_unref_only()/nih_ref() pair - however many uses of this
	  are no longer necessary and it's worth taking some time to refactor
	  the code.

	* nih_alloc_parent() has changed; it now accepts both an object ptr
	  and a parent and returns TRUE if the object has that parent, if
	  parent is NULL is returns TRUE of the object has any parent.
	  (previously it was used to return _the_ parent).

	* TEST_ALLOC_PARENT() now behaves as nih_alloc_parent(), which means
	  testing for no parent with NULL has the exact opposite behaviour
	  use the new TEST_ALLOC_ORPHAN(ptr) macro instead.

	* nih_str_array_addp() now references the passed pointer, instead
	  of reparenting it.  Calling code should be modified to make sure
	  it either calls nih_discard() or uses nih_local to be safe in case
	  of error.

	* nih_strv_free() has been dropped since it did not match the
	  behaviour of the other functions

	* new NIH_LIST_ITER(iter, type, member) macro to handle the case of
	  an offset head in an iterated structure

	* nih_hash_pointer_new(), nih_hash_pointer_key(),
	  nih_hash_pointer_hash() and nih_hash_pointer_cmp() have been dropped
	  since they did strange things to pointers that probably aren't
	  legal C.

	* nih_config_parse() now reads the file into memory, instead of using
	  mmap().  The API is unchanged, however the errors may be different.

	* The D-Bus bindings have been moved into a separate sub-directory
	  and split out into multiple files.  You will need to update your
	  includes as follows:
	  - NihDBusError and nih_dbus_error_*() are in nih-dbus/dbus_error.h
	  - nih_dbus_connect(), nih_dbus_bus(), nih_dbus_setup() and
	    nih_dbus_server() are in nih-dbus/dbus_connection.h
	  - NihDBusMessage and nih_dbus_message_*() are in
	    nih-dbus/dbus_message.h
	  - NihDBusObject, NihDBusInterface and nih_dbus_object_new() are in
	    nih-dbus/dbus_object.h
	  - NihDBusProxy and nih_dbus_proxy_new() are in nih-dbus/dbus_proxy.h
	  - nih_dbus_path() is now in nih-dbus/dbus_util.h

	* The D-Bus test macros are now in nih-dbus/test_dbus.h

	* nih_dbus_message_new() now exists as a function in its own right

	* Asynchronous method callbacks must take a reference to the
	  NihDBusMessage object they are passed, otherwise it will be freed

	* Reply functions and nih_dbus_message_error() no longer free the
	  message passed in, this is consistent with the above change.

	* libtool 2.2.4 is now required

	* The MIN() and MAX() macros are no longer defined, instead use
	  nih_min() and nih_max() which do not re-evaluate their parameters
	  multiple times.

	* The nih_main_package_string() function has been dropped, instead
	  just access the package_string global set by nih_main_init_full()

0.1.0  2008-10-24
 
	* Initial public release.