On Mon, Sep 17, 2012 at 10:23:04AM +0200, Jim Meyering wrote:
prohibit_magic_number_exit po-docs/ja.po:59861:"might be called indirectly from L<exit(3)>, which can cause unexpected " po-docs/libguestfs-docs.pot:50902:"might be called indirectly from L<exit(3)>, which can cause unexpected " po-docs/uk.po:57345:"might be called indirectly from L<exit(3)>, which can cause unexpected " src/guestfs.pod:2028:callback might be called indirectly from L<exit(3)>, which can cause tests/mount-local/test-parallel-mount-local.c:104: exit (77); tests/mount-local/test-parallel-mount-local.c:110: exit (77); tests/regressions/rhbz790721.c:79: exit (77); maint.mk: use EXIT_* values rather than magic number make: *** [sc_prohibit_magic_number_exit] Error 1
I think exit (77) is acceptable. To automake, this means that the test has been skipped, and there is no constant for it. However writing a regexp that matches all numbers except "77" is quite hard.
But we already have a secondary filtering mechanism, so the patch to exempt "77" is pretty easy. If you confirm that this works for you, I'll push it to gnulib:
diff --git a/top/maint.mk b/top/maint.mk index 4627bc5..1722eb7 100644 --- a/top/maint.mk +++ b/top/maint.mk @@ -354,7 +354,7 @@ sc_prohibit_strncpy: # perl -pi -e 's/(^|[^.])\b(exit ?)\(0\)/$1$2(EXIT_SUCCESS)/' sc_prohibit_magic_number_exit: @prohibit='(^|[^.])\<(usage|exit|error) ?\(-?[0-9]+[,)]' \ - exclude='error ?\((0,|[^,]*)' \ + exclude='exit \(77\)|error ?\(((0|77),|[^,]*)' \ halt='use EXIT_* values rather than magic number' \ $(_sc_search_regexp)
Tested and confirmed that it works. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/