Richard W.M. Jones
2020-Jan-29 16:22 UTC
Re: [Libguestfs] [PATCH v2] mlcustomize: Trim whitespaces from commands read from file (RHBZ#1351000)
On Wed, Jan 29, 2020 at 03:07:12PM +0100, Martin Kletzander wrote:> From: Martin Kletzander <mkletzan@redhat.com> > > The first split does not care about the whole string, it is just trying to get > the command name in front, so triml is just right. > > Signed-off-by: Martin Kletzander <mkletzan@redhat.com> > --- > mlcustomize/customize_cmdline.ml | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/mlcustomize/customize_cmdline.ml b/mlcustomize/customize_cmdline.ml > index c062379879e2..abd21a4cbca5 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.triml lines in > let lines = List.filter ( > fun line -> > String.length line > 0 && line.[0] <> '#'Seems OK to me, so ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
Pino Toscano
2020-Feb-24 09:00 UTC
Re: [Libguestfs] [PATCH v2] mlcustomize: Trim whitespaces from commands read from file (RHBZ#1351000)
On Wednesday, 29 January 2020 17:22:51 CET Richard W.M. Jones wrote:> On Wed, Jan 29, 2020 at 03:07:12PM +0100, Martin Kletzander wrote: > > From: Martin Kletzander <mkletzan@redhat.com> > > > > The first split does not care about the whole string, it is just trying to get > > the command name in front, so triml is just right. > > > > Signed-off-by: Martin Kletzander <mkletzan@redhat.com> > > --- > > mlcustomize/customize_cmdline.ml | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/mlcustomize/customize_cmdline.ml b/mlcustomize/customize_cmdline.ml > > index c062379879e2..abd21a4cbca5 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.triml lines in > > let lines = List.filter ( > > fun line -> > > String.length line > 0 && line.[0] <> '#' > > Seems OK to me, so ACK.LGTM as well, so pushed: https://github.com/libguestfs/libguestfs-common/commit/12f3fb0f6ccdacb4c6fb81385550b62665fc1497 Thanks, -- Pino Toscano
Pino Toscano
2020-Feb-24 16:17 UTC
Re: [Libguestfs] [PATCH v2] mlcustomize: Trim whitespaces from commands read from file (RHBZ#1351000)
On Monday, 24 February 2020 10:00:31 CET Pino Toscano wrote:> On Wednesday, 29 January 2020 17:22:51 CET Richard W.M. Jones wrote: > > On Wed, Jan 29, 2020 at 03:07:12PM +0100, Martin Kletzander wrote: > > > From: Martin Kletzander <mkletzan@redhat.com> > > > > > > The first split does not care about the whole string, it is just trying to get > > > the command name in front, so triml is just right. > > > > > > Signed-off-by: Martin Kletzander <mkletzan@redhat.com> > > > --- > > > mlcustomize/customize_cmdline.ml | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/mlcustomize/customize_cmdline.ml b/mlcustomize/customize_cmdline.ml > > > index c062379879e2..abd21a4cbca5 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.triml lines in > > > let lines = List.filter ( > > > fun line -> > > > String.length line > 0 && line.[0] <> '#' > > > > Seems OK to me, so ACK. > > LGTM as well, so pushed: > https://github.com/libguestfs/libguestfs-common/commit/12f3fb0f6ccdacb4c6fb81385550b62665fc1497Just as a global FYI followup on this: "sadly" this file is a generated file by the generator in libguestfs, and thus it will be overwritten in libguestfs once the generator runs. The real place were to fix this was the generator, so I re-applied Martin's patch there: https://github.com/libguestfs/libguestfs/commit/c7d7b25524cf778c9cf26c9f0d01ccdd96071483 Sadly this is yet another problem caused by the split with the current submodle layout... -- Pino Toscano
Reasonably Related Threads
- [common PATCH] Trim whitespaces from commands read from file
- Re: [common PATCH] Trim whitespaces from commands read from file
- Re: [common PATCH] Trim whitespaces from commands read from file
- Re: [PATCH v2] mlcustomize: Trim whitespaces from commands read from file (RHBZ#1351000)
- [PATCH v2] mlcustomize: Trim whitespaces from commands read from file (RHBZ#1351000)