[augeas-devel] Compiling Augeas on AIX 6.1

James Conner j.conner at ucl.ac.uk
Wed Mar 2 13:56:51 UTC 2011


Hi Folks,

I'm involved in a puppet deployment project at the moment, and the fact 
that Augeas wasn't working on AIX was starting to make my life complicated.
Although I'm a newbie to Augeas, have little or no experience on AIX, 
and don't really know a lot about C coding, I decided not to let my 
ignorance stop me from having a go, and I am very pleased to say that I 
now have a working Augeas 0.8.0 setup on AIX6.1

I have to patch quite a few different things to get everything working 
correctly, so here are the patches I've created so far.
I'll apologise in advance as I'm sure my patches will be the wrong way 
of doing things, but hopefully someone who knows how to write code will 
be able to work out a better way.
It is also possible that my fix is in violation of the gnulib license - 
I just wanted to get things compiling for now.

Once all these patches are applied, Augeas will compile successfully, 
and 'make check' will pass most of the test.
There are still problems with four of the lenses - sudoers, nrpe, 
sysconfig and grub - I just deleted them from 
/usr/local/share/augeas/lenses and now augeas seems happy.
I haven't tested Augeas very thoroughly, but I can confirm that it has 
at least enough functionality to get/change/save settings in sshd_config


Fix no. 1:
There is no getopt_long in AIX's libc and including getopt.h causes 
compilation to fail.
I fixed this by downloading a copies of getopt_long.c and getopt_long.h 
with google, and including them instead.
I had to slightly tweak getopt_long.h to get rid of the dependency on 
gettext - I've included the full sources for getopt_long.c/h as 
attachments (which hopefully work on this mailing list)

diff -ru augeas-0.8.0-orig/examples/fadot.c 
augeas-0.8.0-aix6/examples/fadot.c
--- augeas-0.8.0-orig/examples/fadot.c  2010-08-28 01:51:06.000000000 +0100
+++ augeas-0.8.0-aix6/examples/fadot.c  2011-02-25 22:32:09.000000000 +0000
@@ -28,7 +28,6 @@
  #include <unistd.h>
  #include <ctype.h>
  #include <string.h>
-#include <getopt.h>
  #include <stdlib.h>

  #include "fa.h"



diff -ru augeas-0.8.0-orig/src/augparse.c augeas-0.8.0-aix6/src/augparse.c
--- augeas-0.8.0-orig/src/augparse.c    2010-10-14 23:26:08.000000000 +0100
+++ augeas-0.8.0-aix6/src/augparse.c    2011-03-02 16:30:21.000000000 +0000
@@ -22,7 +22,7 @@

  #include <config.h>
  #include <argz.h>
-#include <getopt.h>
+#include <getopt_long.c>

  #include "list.h"
  #include "syntax.h"


diff -ru augeas-0.8.0-orig/src/augtool.c augeas-0.8.0-aix6/src/augtool.c
--- augeas-0.8.0-orig/src/augtool.c     2011-02-23 02:03:37.000000000 +0000
+++ augeas-0.8.0-aix6/src/augtool.c     2011-03-02 16:30:13.000000000 +0000
@@ -28,7 +28,7 @@
  #include <readline/readline.h>
  #include <readline/history.h>
  #include <argz.h>
-#include <getopt.h>
+#include <getopt_long.c>
  #include <limits.h>
  #include <ctype.h>
  #include <locale.h>



Fix no. 2:
'make' check was failing on test-readlink - Apparently this is because 
AIX will return EINVAL instead of ENOTDIR

diff -ru augeas-0.8.0-orig/gnulib/tests/test-readlink.h 
augeas-0.8.0-aix6/gnulib/tests/test-readlink.h
--- augeas-0.8.0-orig/gnulib/tests/test-readlink.h      2011-01-08 
00:45:45.000000000 +0000
+++ augeas-0.8.0-aix6/gnulib/tests/test-readlink.h      2011-02-25 
23:15:00.000000000 +0000
@@ -51,7 +51,7 @@
    ASSERT (errno == EINVAL);
    errno = 0;
    ASSERT (func (BASE "file/", buf, sizeof buf) == -1);
-  ASSERT (errno == ENOTDIR);
+  ASSERT (errno == ENOTDIR || errno == EINVAL);

    /* Now test actual symlinks.  */
    if (symlink (BASE "dir", BASE "link"))
@@ -74,7 +74,7 @@
    ASSERT (symlink (BASE "file", BASE "link2") == 0);
    errno = 0;
    ASSERT (func (BASE "link2/", buf, sizeof buf) == -1);
-  ASSERT (errno == ENOTDIR);
+  ASSERT (errno == ENOTDIR || errno == EINVAL);
    ASSERT (unlink (BASE "file") == 0);
    ASSERT (unlink (BASE "link2") == 0);
    {


Fix no.3:
The test for fatest was failing to compile, complaining about spurious $ 
characters in the struct names
I just removed the $ symbols, which appears to have made things compile 
and work OK

diff -ru augeas-0.8.0-orig/tests/fatest.c augeas-0.8.0-aix6/tests/fatest.c
--- augeas-0.8.0-orig/tests/fatest.c    2011-02-24 01:07:26.000000000 +0000
+++ augeas-0.8.0-aix6/tests/fatest.c    2011-03-02 13:08:57.207708117 +0000
@@ -255,12 +255,12 @@
      struct fa *ss = make_good_fa(tc, "(X(.|\n))*YX");

      struct fa *a1f_mp = mark(fa_concat(a1f, mp));
-    struct fa *a1f_mp$a1t = mark(fa_intersect(a1f_mp, a1t));
-    struct fa *b1 = mark(fa_concat(a1f_mp$a1t, ms));
+    struct fa *a1f_mpa1t = mark(fa_intersect(a1f_mp, a1t));
+    struct fa *b1 = mark(fa_concat(a1f_mpa1t, ms));

      struct fa *sp_a2f = mark(fa_concat(sp, a2f));
-    struct fa *sp_a2f$a2t = mark(fa_intersect(sp_a2f, a2t));
-    struct fa *b2 = mark(fa_concat(ss, sp_a2f$a2t));
+    struct fa *sp_a2fa2t = mark(fa_intersect(sp_a2f, a2t));
+    struct fa *b2 = mark(fa_concat(ss, sp_a2fa2t));

      struct fa *amb = mark(fa_intersect(b1, b2));
      struct fa *exp = make_good_fa(tc, "XaYXXbYXXa");


Thanks to all who have been involved in Augeas.  You guys are making my 
life easier.

Cheers,

Jim


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: getopt_long.c
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20110302/5d5acd32/attachment.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: getopt_long.h
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20110302/5d5acd32/attachment.h>


More information about the augeas-devel mailing list