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

Re: [augeas-devel] [Augeas] #276: clear command is not intuitive



#276: clear command is not intuitive
--------------------------+----------------------
  Reporter:  jokajak      |      Owner:  lutter
      Type:  enhancement  |     Status:  reopened
  Priority:  minor        |  Milestone:  next
 Component:  Augeas       |    Version:  0.9.0
Resolution:               |   Keywords:
Blocked By:               |   Blocking:
--------------------------+----------------------
Changes (by domcleal):

 * status:  closed => reopened
 * resolution:  fixed =>


Comment:

 Replying to [comment:2 lutter]:
 > I like the change; it changes behavior subtly though: 'set foo ""' will
 now set foo to NULL, not the empty string; that behavior should be
 restored

 Ah thanks, I hadn't realised the two were different.  I'd copied the if
 statement from cmd_defnode, where the comment says:

 {{{
     /* Our simple minded line parser treats non-existant and empty values
      * the same. We choose to take the empty string to mean NULL */
 }}}

 From what I can tell, this isn't the case, so I think I can remove the if
 statement from here and defnode too.

 {{{
 Breakpoint 1, cmd_set (cmd=0x7fffffffd8f0) at augrun.c:590
 590         if (val != NULL && strlen(val) == 0)
 (gdb) p val
 $1 = 0x0
 (gdb) c
 Continuing.

 Breakpoint 1, cmd_set (cmd=0x7fffffffd8f0) at augrun.c:590
 590         if (val != NULL && strlen(val) == 0)
 (gdb) p val
 $2 = 0x27ffb29 ""
 (gdb) c
 Continuing.

 Breakpoint 1, cmd_set (cmd=0x7fffffffd8f0) at augrun.c:590
 590         if (val != NULL && strlen(val) == 0)
 (gdb) p val
 $3 = 0x2aaeae9 "foo"
 }}}

 Safe to remove these checks do you think?

 > Also, should 'setm' be treated similarly, i.e. so that 'setm etc/hosts/*
 alias' creates an alias node for each node, with value NULL ?

 Yes, I forgot to mention in the ticket that I'd changed both set and setm
 to have this behaviour.  The example you gave also works.

-- 
Ticket URL: <https://fedorahosted.org/augeas/ticket/276#comment:3>
Augeas <http://augeas.net/>
a configuration API



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