[Libguestfs] [PATCH version 2] guestfish: Use xstrtol to parse integers (RHBZ#557655).

Richard W.M. Jones rjones at redhat.com
Mon Jan 25 12:14:50 UTC 2010


On Mon, Jan 25, 2010 at 01:05:32PM +0100, Jim Meyering wrote:
> Richard W.M. Jones wrote:
> > + chmod 0777 /public  # OK
> > + chmod 777 /public   # WRONG! This is mode 777 decimal = 01411 octal.
> 
> This strikes me as surprising enough that it would deserve
> to emit a warning when there is no leading 0.
> Doing anything else seems like just asking for trouble.

There's a limit to what we can do here.  We would have to mark this
parameter in a special way in the generator (not 'Int' but
'Int_that_usually_needs_octal_in_guestfish').

While I now think it was a bad idea to use plain types like 'Int' and
'String' in the generator (you live and learn, but this is why we
replaced many uses of 'String' with 'Pathname', 'Device' etc),
changing this is quite involved for little gain.  And what happens if
people do want to use decimal modes, eg. if they are generating
guestfish scripts.  It is also now documented.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora




More information about the Libguestfs mailing list