View Issue Details

IDProjectCategoryView StatusLast Update
0000387fileGeneralpublic2022-10-24 19:50
Reporterrrt Assigned Tochristos  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version5.43 
Fixed in Version5.44 
Summary0000387: !:strength sometimes causes magic to disappear
DescriptionI was investigating a problem with Lua magic patterns. With the default Lua magic in CVS, I get these results:

```
$ MAGIC=./magic/magic src/file --list|grep "Lua script text executable"
Strength = 51@11: Lua script text executable [text/x-lua]
Strength = 49@15: Lua script text executable [text/x-lua]
Strength = 48@13: Lua script text executable [text/x-lua]
Strength = 45@9: Lua script text executable [text/x-lua]
```

This is correct: there are four patterns in the lua magic file.

If I then add identical !:strength annotations to each entry, specifically "!:strength * 2", then one of the entries disappears (the one that should now have strength 96):

```
$ MAGIC=./magic/magic src/file --list|grep "Lua script text executable"
Strength = 102@12: Lua script text executable [text/x-lua]
Strength = 98@18: Lua script text executable [text/x-lua]
Strength = 90@9: Lua script text executable [text/x-lua]
```

If I change the multiplier on the missing entry from 2 to 3, it returns:

```
$ MAGIC=./magic/magic src/file --list|grep "Lua script text executable"
Strength = 144@15: Lua script text executable [text/x-lua]
Strength = 102@12: Lua script text executable [text/x-lua]
Strength = 98@18: Lua script text executable [text/x-lua]
Strength = 90@9: Lua script text executable [text/x-lua]
```
TagsNo tags attached.

Activities

christos

2022-10-09 17:23

manager   ~0003825

Can you please upload the two different minimal magic files you are using to reproduce this?

rrt

2022-10-20 19:19

reporter   ~0003843

I tried to make a minimal magic file, and in the process I obtained a similar strange result. When I compile just the CVS Lua magic file and then list its contents, I only get two text patterns, although the file contains four patterns. However, when I built the default "everything" magic file, it gives the expected four results.

Here is the unexpected result:

```
$ ./src/file -C -m ./magic/Magdir/lua
$ MAGIC=./lua.mgc src/file --list
Set 0:
Binary patterns:
Strength = 70@19: Lua bytecode, []
Text patterns:
Strength = 51@11: Lua script text executable [text/x-lua]
Strength = 48@13: Lua script text executable [text/x-lua]
Set 1:
Binary patterns:
Text patterns:
```

Note that there are only two text pattern results in Set 0. (I am not sure what Set 1 is?)

If I run against the complete magic file, I get more patterns that can only come from the `lua` file:

```
$ MAGIC=./magic/magic.mgc src/file --list|grep text/x-lua
Strength = 51@11: Lua script text executable [text/x-lua]
Strength = 49@15: Lua script text executable [text/x-lua]
Strength = 48@105: LuaTex script text executable [text/x-luatex]
Strength = 48@13: Lua script text executable [text/x-lua]
Strength = 45@9: Lua script text executable [text/x-lua]
```

In this set of results, only the LuaTex [sic] result is not from the `lua` file.

I have attached the `lua.mgc` file produced by my system.
lua.mgc (6,016 bytes)

christos

2022-10-23 13:23

manager   ~0003844

Yes, the listing was skipping entries. I fixed it now. (apprentice.c 1.338).

rrt

2022-10-24 10:03

reporter   ~0003847

Many thanks for the prompt fix!

Issue History

Date Modified Username Field Change
2022-10-01 19:52 rrt New Issue
2022-10-09 17:22 christos Assigned To => christos
2022-10-09 17:22 christos Status new => assigned
2022-10-09 17:23 christos Status assigned => feedback
2022-10-09 17:23 christos Note Added: 0003825
2022-10-20 19:19 rrt Note Added: 0003843
2022-10-20 19:19 rrt File Added: lua.mgc
2022-10-20 19:19 rrt Status feedback => assigned
2022-10-23 13:23 christos Status assigned => feedback
2022-10-23 13:23 christos Note Added: 0003844
2022-10-24 10:03 rrt Note Added: 0003847
2022-10-24 10:03 rrt Status feedback => assigned
2022-10-24 19:50 christos Status assigned => resolved
2022-10-24 19:50 christos Resolution open => fixed
2022-10-24 19:50 christos Fixed in Version => 5.44