[Libguestfs] [PATCH] daemon: tweak regexp for file type detection (RHBZ#1575640)

Richard W.M. Jones rjones at redhat.com
Mon May 7 20:05:13 UTC 2018


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




More information about the Libguestfs mailing list