Pino Toscano
2018-May-07 15:20 UTC
[Libguestfs] [PATCH] daemon: tweak regexp for file type detection (RHBZ#1575640)
Newer versions of file slightly changed the output, removing the comma between the type, and the architecture string. Tweak the regular expression so: - the comma is optional, but if missing then only the architecture string will follow - the architecture string has no commas --- daemon/filearch.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daemon/filearch.ml b/daemon/filearch.ml index b2c30ae87..a892ba851 100644 --- a/daemon/filearch.ml +++ b/daemon/filearch.ml @@ -25,7 +25,7 @@ open Unix_utils open Utils let re_file_elf - PCRE.compile "ELF (\\d+)-bit (MSB|LSB).*(?:executable|shared object|relocatable), (.+?)," + PCRE.compile "ELF (\\d+)-bit (MSB|LSB).*(?:executable|shared object|relocatable)(?:,)? ([^,]+?)," let re_file_elf_ppc64 = PCRE.compile ".*64.*PowerPC" -- 2.14.3
Richard W.M. Jones
2018-May-07 20:05 UTC
Re: [Libguestfs] [PATCH] daemon: tweak regexp for file type detection (RHBZ#1575640)
On Mon, May 07, 2018 at 05:20:43PM +0200, Pino Toscano wrote:> Newer versions of file slightly changed the output, removing the comma > between the type, and the architecture string. > > Tweak the regular expression so: > - the comma is optional, but if missing then only the architecture > string will follow > - the architecture string has no commas > --- > daemon/filearch.ml | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/daemon/filearch.ml b/daemon/filearch.ml > index b2c30ae87..a892ba851 100644 > --- a/daemon/filearch.ml > +++ b/daemon/filearch.ml > @@ -25,7 +25,7 @@ open Unix_utils > open Utils > > let re_file_elf > - PCRE.compile "ELF (\\d+)-bit (MSB|LSB).*(?:executable|shared object|relocatable), (.+?)," > + PCRE.compile "ELF (\\d+)-bit (MSB|LSB).*(?:executable|shared object|relocatable)(?:,)? ([^,]+?)," > > let re_file_elf_ppc64 = PCRE.compile ".*64.*PowerPC"ACK, thanks. Rich. -- 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
Seemingly Similar Threads
- [PATCH v2 3/3] daemon: Restore PCRE regular expressions in OCaml code.
- [PATCH v5] inspector: recognize ppc64 and ppc64le archs (RHBZ#1211996)
- [PATCH 12/27] daemon: Reimplement ‘file_architecture’ API in OCaml.
- [PATCH v4 0/2] inspector: recognize ppc64 and ppc64le archs (RHBZ#1211996)
- [PATCH v4 1/2] inspector: recognize ppc64 and ppc64le archs (RHBZ#1211996)