Richard W.M. Jones
2022-Mar-08 16:00 UTC
[Libguestfs] [libguestfs-common PATCH] mlcustomize/firstboot: take an optional priority in "add_firstboot_script"
This patch is fine, thanks ...> + it is taken as [default_prio], that is, 5000. If [prio] is smaller than 0 > + or greater than 9999, an Assert_failure is raised (the [prio] parameter > + is not expected to depend on external data).... but I'm confused by what you meant by "is not expected to depend on external data"? Anyway, ACK Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/
Richard W.M. Jones
2022-Mar-08 16:18 UTC
[Libguestfs] [libguestfs-common PATCH] mlcustomize/firstboot: take an optional priority in "add_firstboot_script"
On Tue, Mar 08, 2022 at 04:00:15PM +0000, Richard W.M. Jones wrote:> This patch is fine, thanks ... > > > + it is taken as [default_prio], that is, 5000. If [prio] is smaller than 0 > > + or greater than 9999, an Assert_failure is raised (the [prio] parameter > > + is not expected to depend on external data). > > ... but I'm confused by what you meant by "is not expected to depend > on external data"? > > Anyway, ACK... but see my comment on patch 11: https://listman.redhat.com/archives/libguestfs/2022-March/028400.html Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
Laszlo Ersek
2022-Mar-09 08:40 UTC
[Libguestfs] [libguestfs-common PATCH] mlcustomize/firstboot: take an optional priority in "add_firstboot_script"
On 03/08/22 17:00, Richard W.M. Jones wrote:> This patch is fine, thanks ... > >> + it is taken as [default_prio], that is, 5000. If [prio] is smaller than 0 >> + or greater than 9999, an Assert_failure is raised (the [prio] parameter >> + is not expected to depend on external data). > > ... but I'm confused by what you meant by "is not expected to depend > on external data"?In general, no assert() condition should depend on user-controlled data; assert() is for catching programming bugs. If user input can lead to the falsification of a condition (invariant etc), then that needs to be caught with a different tool -- throw a different exception, report an error, etc. So the idea here is that the priority should never depend on user input. (For example: in case the priority parameter were exposed by virt-customize's --firstboot* options in the future, then the assert() would no longer be OK. A different kind of exception would be necessary.)> > Anyway, ACKThanks! Laszlo