[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [augeas-devel] regression when path contains whitespace ?



On Thu, 2009-03-12 at 10:58 +0100, Marc Fournier wrote:
> I just noticed that since 0.4.0, whitespaces seem to cause trouble to
> augeas:
> 
> augtool> set "/files/etc/rsyncd.conf/.anon/pid file" /var/run/rsyncd.pid
> Failed
> augtool> get /augeas/pathx/error/pos
> /augeas/pathx/error/pos = /files/etc/rsyncd.conf/.anon/pid |=|file
> augtool> set "/files/etc/rsyncd.conf/.anon/pid-file" /var/run/rsyncd.pid
> augtool> save
> Saved 1 file(s)
> 
> I'm not sure what to do about that. Is it maybe that something needs to
> be done in a different way in rsyncd.aug ? test_rsyncd.aug still seems
> to work.

You are right, with the expanded path expression syntax, certain
characters can't be used in a path anymore. The full regexp for what can
appear in a 'Name', i.e. the bits between slashes in a path is 
        /([^][/=) \t\n]|\\.)+/

IOW, anything but the characters ']', '[', '/', '=', ')', and
whitespace. If you want to use one of those, you have to escape it with
a '\', i.e. this works:

        augtool> set "/files/etc/rsyncd.conf/.anon/pid\ file" /var/run/rsyncd.pid

(and if you do that from puppet/ruby, you might have to throw additional
'\' in there for _their_ quoting needs)

Excluding whitespace isn't strictly necessary, but just seemed cleaner
to do at the time.

> By the way, this error is silently ignored by puppet's type for augeas.
> Do you think it is a separate problem ?

Yeah, that is an error in the puppet type. aug_set returns -1 when the
path expression is invalid; the puppet type should notice that and flag
an error to the user. And as you've figured out, you can see all errors
by doing 'print /augeas//error' in augtool.

David




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]