[File] Python misdetection with env

Steve Grubb sgrubb at redhat.com
Fri Jun 5 19:29:08 UTC 2020


On Thursday, June 4, 2020 9:52:51 AM EDT Christos Zoulas wrote:
> The last 2 commits on https://github.com/file/file
> <https://github.com/file/file>

Thanks for the pointer. I see there was one more patch in that area. I 
applied the fixes and rebuilt. To test that the detection of the first line is 
working rather than it deciding its python because of import statements, I 
reduced it down to this simplistic but valid python script.

#!   /usr/bin/env   python

print("Hello World")

There are 3 spaces between each part of the first line. It detects this as  
text/plain. I experimented with W, w, adding t, different ranges. Nothing 
except that regex seems to get it. My reading of the man page seems to 
indicate that W is supposed to compact whitespaces in the target down to 1. 
It seems like that ought to be what I'm looking for. But maybe I 
misunderstand how it works.

Best Regards,
-Steve


> > On Jun 3, 2020, at 10:37 PM, Steve Grubb <sgrubb at redhat.com> wrote:
> > 
> > On Wednesday, June 3, 2020 8:23:46 PM EDT Christos Zoulas wrote:
> >> That was a bug in the optional string comparison code. Fixed.
> > 
> > OK. Awesome. Is there a patch in github or elsewhere you can point to as
> > the fix? I'd like to get this in work.
> > 
> > Thanks,
> > -Steve
> > 
> >>> On Jun 3, 2020, at 6:43 PM, Steve Grubb <sgrubb at redhat.com> wrote:
> >>> 
> >>> 0       search/10       #!\ /usr/bin/env\ python        Python script
> >>> text executable






More information about the File mailing list