[augeas-devel] Weird print result with Perl bindings on amd64

Dominique Dumont dominique.dumont at hp.com
Tue Jan 13 13:16:32 UTC 2009


David Lutterkort <lutter at redhat.com> writes:

> Isn't the output for the perl example what a previous incarnation of the
> sshd lens produced ? 
>
> Are you absolutely sure you don't have AUGEAS_LENS_LIB set on your amd64
> box or an old lens in the default lens dir ? Might be worth stracing the
> perl command to see where it gets the sshd.aug lens from and
> double-checking that that's the version from 0.3.5.

Some more news on this topic

I've reproduced this problem on Rhel5 x86_64, with perl 5.8. So it's
not Debian specific or perl 5.10 specific.

So to summarize, this problems occurs only when calling aug_init from
Perl on 64 bits architecture.

To minimize the interference between Perl and Augeas, I've trimmed
down the Perl/Augeas glue down to this generated C function to no avail:

    XS(XS_Config__Augeas_init)
    {
        dXSARGS;
        if (items != 0)
    	Perl_croak(aTHX_ "Usage: Config::Augeas::init()");
        {
          augeas* aug ;
          aug = aug_init(NULL ,NULL ,NULL) ;
          aug_print(aug, stdout, NULL);
        }
        XSRETURN_EMPTY;
    }
   
To help tests, I've also trimmed sshd_config down to:

  Match User bush Group pres.* Host white.house.*
  Banner /etc/welcome.txt

In fact, and this is the only good news I have, I've found a
workaround by slightly changing sshd.aug lens.

I've changed:

   let key_re = /[A-Za-z0-9]+/ - /MACs|Match|AcceptEnv|Subsystem|(Allow|Deny)(Groups|Users)/

to

   let key_re = /[A-Za-z0-9]+r/ - /MACs|Match|AcceptEnv|Subsystem|(Allow|Deny)(Groups|Users)/


This forces key_re *not* to match "Match" (unintended pun). Then I get
correct behavior:

$ ./Build && AUGEAS_ROOT=wr_root perl -I blib/arch/ -Iblib/lib -MConfig::Augeas -e '$a=Config::Augeas::init();'
/augeas
/augeas/root = "wr_root/"
/augeas/save = "overwrite"
/augeas/files
/augeas/files/etc
/augeas/files/etc/ssh
/augeas/files/etc/ssh/sshd_config
/augeas/files/etc/ssh/sshd_config/path = "/files/etc/ssh/sshd_config"
/augeas/files/etc/ssh/sshd_config/lens
/augeas/files/etc/ssh/sshd_config/lens/info = "/usr/share/augeas/lenses/sshd.aug:54.12-56.36"
/augeas/files/etc/ssh/sshd_config/lens/id = "0x6953b60"
/files
/files/etc
/files/etc/ssh
/files/etc/ssh/sshd_config
/files/etc/ssh/sshd_config/Match
/files/etc/ssh/sshd_config/Match/Condition[1]
/files/etc/ssh/sshd_config/Match/Condition[1]/User = "bush"
/files/etc/ssh/sshd_config/Match/Condition[2]
/files/etc/ssh/sshd_config/Match/Condition[2]/Group = "pres.*"
/files/etc/ssh/sshd_config/Match/Condition[3]
/files/etc/ssh/sshd_config/Match/Condition[3]/Host = "white.house.*"
/files/etc/ssh/sshd_config/Match/Settings
/files/etc/ssh/sshd_config/Match/Settings/Banner = "/etc/welcome.txt"


So the problem is around reg exp handling. I've absolutely no clue as
to why this problem shows only when calling Augeas from Perl and not
when calling directly Augeas in a pure C program.

All the best

-- 
Dominique Dumont 
"Delivering successful solutions requires giving people what they
need, not what they want." Kurt Bittner

irc:
  domidumont at irc.freenode.net
  ddumont at irc.debian.org




More information about the augeas-devel mailing list