[Libguestfs] [common PATCH] Trim whitespaces from commands read from file

Richard W.M. Jones rjones at redhat.com
Fri Jan 24 09:40:57 UTC 2020


On Thu, Jan 23, 2020 at 11:18:30PM +0100, Martin Kletzander wrote:
> On Thu, Jan 23, 2020 at 10:32:17PM +0100, Martin Kletzander wrote:
> >On Thu, Jan 23, 2020 at 03:16:47PM +0000, Richard W.M. Jones wrote:
> >>On Thu, Jan 23, 2020 at 02:04:53PM +0100, Martin Kletzander wrote:
> >>>On Thu, Jan 23, 2020 at 12:16:50PM +0100, Martin Kletzander wrote:
> >>>>Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
> >>>
> >>>I forgot to mention this is trying to fix the following BZ:
> >>>
> >>>https://bugzilla.redhat.com/show_bug.cgi?id=1351000
> >>
> >>>>---
> >>>>mlcustomize/customize_cmdline.ml | 1 +
> >>>>1 file changed, 1 insertion(+)
> >>>>
> >>>>diff --git a/mlcustomize/customize_cmdline.ml b/mlcustomize/customize_cmdline.ml
> >>>>index c062379879e2..67e85af2ad93 100644
> >>>>--- a/mlcustomize/customize_cmdline.ml
> >>>>+++ b/mlcustomize/customize_cmdline.ml
> >>>>@@ -481,6 +481,7 @@ let rec argspec () =
> >>>>    ] in
> >>>>    let lines = read_whole_file filename in
> >>>>    let lines = String.lines_split lines in
> >>>>+    let lines = List.map String.trim lines in
> >>
> >>I wonder if String.triml is safer?  However I cannot
> >>think of a way that it's likely to be useful to have
> >>trailing whitespace be meaningful.
> >>
> >
> >I actually thought about that and it might be dangerous to just trim from left.
> >Space in the end might change semantics of a command (although I did not go
> >through the commands), consider something like "cp a b " which would end up
> >being split into ["cp"; "a"; "b"; ""].  In this particular case it would
> >probably fail, but you know what I mean, right?
> >
> >>Please put this in the subject line of the commit
> >>message: “(RHBZ#1351000)”.  This will ensure that it
> >>is picked up by the release notes by the
> >>bugs-in-changelog script.
> >>
> >
> 
> I changed the subject to:
> 
> mlcustomize: Trim whitespaces from commands read from file (RHBZ#1351000)
> 
> and then realized I do not have commit access.  Could anyone fix-up the subject
> and push it?  Thanks

Oh I see, of course this is a patch to libguestfs-common.  In that
case bugs-in-changelog wouldn't see it at all, which also means
bugs-in-changelog is kind of broken in this case.

Perhaps Pino can push this because I don't have push access
until I get home.

Rich.

> >OK, probably the same thing needs to be added in the commit that updates the
> >submodule in libguestfs repo, right?
> >
> 
> Should I send a patch so that we don't forget or is it going to be picked up
> anyway?
> 
> >>ACK
> >>
> >>Rich.
> >>
> >>>>    let lines = List.filter (
> >>>>      fun line ->
> >>>>        String.length line > 0 && line.[0] <> '#'
> >>>>--
> >>>>2.25.0
> >>>>
> >>>>_______________________________________________
> >>>>Libguestfs mailing list
> >>>>Libguestfs at redhat.com
> >>>>https://www.redhat.com/mailman/listinfo/libguestfs
> >>
> >>
> >>
> >>--
> >>Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
> >>Read my programming and virtualization blog: http://rwmj.wordpress.com
> >>virt-top is 'top' for virtual machines.  Tiny program with many
> >>powerful monitoring features, net stats, disk stats, logging, etc.
> >>http://people.redhat.com/~rjones/virt-top
> 
> 
> 
> >_______________________________________________
> >Libguestfs mailing list
> >Libguestfs at redhat.com
> >https://www.redhat.com/mailman/listinfo/libguestfs
> 



-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html




More information about the Libguestfs mailing list