[RELz] tes3lint, a tool for finding possible problems in a p

Post » Fri May 13, 2011 1:19 pm

tes3lint (http://www.gamesas.com/bgsforums/index.php?showtopic=930873) is now in Beta.

tes3lint is a command-line tool for investigating potential problems in TES3 plugins. It is written in Perl and runs natively on Windows or Linux.

Highlights from the http://code.google.com/p/mlox/wiki/Tes3lint:

Features
* Find out if the plugin defines autocalc'ed spells.
* Find out if the plugin has an implicit dependency on Tribunal/Bloodmoon functions because it uses them but does not list the expansion as a Master.
* List Evil GMSTs.
* Find deprecated usage of Leveled List scripting functions on standard Bethesda Lists.
* Find duplicate (i.e.: "dirty/unclean") records that are unchanged from one of the masters.
* Shows duplicate and modified INFO dialogs.
* Find CELLs that trigger the FOGBUG.
* Find any CELLs where fog density in DATA is different from AMBI subrecords.
* Find problematic usage of GetSoundPlaying for detecting events.
* Find dirty junk cells that are apparently injected by some CS bug.
* Find scripts that are unaware of MenuMode.
* Show if plugin is missing Author/Description/Version from plugin header.
* Find duplicate/modified INFOs.
* Finds potentially buggy case where INFO dialogs have had their IDs changed.
* Find all records in the plugin that override records in its Masters.
* Find problematic scripts attached to Bethesda doors.

Here is a http://code.google.com/p/mlox/wiki/Tes3lintSample to get an idea of some of the things it will tell you about a plugin.

The wiki page explains how to http://code.google.com/p/mlox/wiki/Tes3lint#Get_tes3lint and http://code.google.com/p/mlox/wiki/Tes3lint#Installing_and_Running_tes3lint tes3lint.
User avatar
Rusty Billiot
 
Posts: 3431
Joined: Sat Sep 22, 2007 10:22 pm

Post » Fri May 13, 2011 1:32 pm

Congratulations on this release!

* Swiveller *
User avatar
Chris Duncan
 
Posts: 3471
Joined: Sun Jun 24, 2007 2:31 am

Post » Fri May 13, 2011 11:31 am

Congratulations indeed. :)
User avatar
Sammygirl500
 
Posts: 3511
Joined: Wed Jun 14, 2006 4:46 pm

Post » Fri May 13, 2011 12:58 pm

Is the new name the hint of a coming tes4lint? :D
User avatar
Claire Vaux
 
Posts: 3485
Joined: Sun Aug 06, 2006 6:56 am

Post » Fri May 13, 2011 3:18 pm

Is the new name the hint of a coming tes4lint? :D

Ha ha :) Not really. It's just that I wanted to emphasize that this tool was not also usable for TES4 plugins. I'm sure the issues with TES4 plugins are quite different.

Once I get the next 3 or 4 Morrowind tools I have in mind out the door, maybe I'll move on to Oblivion and see what I'd like to do there.
User avatar
Georgine Lee
 
Posts: 3353
Joined: Wed Oct 04, 2006 11:50 am

Post » Fri May 13, 2011 7:35 am

Have you considered flagging up invalid headers? Where the TES3.DATA doesn't match file size of the file defined in the corresponding TES3.MAST?
User avatar
Taylor Thompson
 
Posts: 3350
Joined: Fri Nov 16, 2007 5:19 am

Post » Fri May 13, 2011 8:31 pm

Have you considered flagging up invalid headers? Where the TES3.DATA doesn't match file size of the file defined in the corresponding TES3.MAST?

That would be pretty easily done. I've got a little library of over 2000 plugins installed, so I'll go do a test and see if that comes up with anything.

There are a couple good plugins to do tests on, that I thought I might mention:
MultiMark.esp contains a hexedited GMST that can choke a strict record parser.
morrowland.rar/From Hell To Heaven.esm is almost 70MB, so it's a good stress tester.

Edit: This was mildly interesting: I just tried a check for the number of records in the TES3.HEDR vs the actual count, and quite a few plugins differ. I conclude that particular field is pretty worthless :)
User avatar
Penny Flame
 
Posts: 3336
Joined: Sat Aug 12, 2006 1:53 am

Post » Fri May 13, 2011 9:52 am

Have you considered flagging up invalid headers? Where the TES3.DATA doesn't match file size of the file defined in the corresponding TES3.MAST?

I've checked in a new flag for this (MASTERS - lists masters out of sync with installed masters), available from svn:
http://mlox.googlecode.com/svn/trunk/util/tes3lint (Right click/Save)

It'll be in the next release.
User avatar
Dj Matty P
 
Posts: 3398
Joined: Sat Jun 09, 2007 12:31 am

Post » Fri May 13, 2011 6:20 am

Another idea: When loading a plugin with the Enchanted Editor sometimes I get this warning:
Warning: The number of records was mis-reported in the file header. This might have been caused by the file being edited in a hex editor or other low level editor. The problem has been corrected and will probably have no effect.
Seem to get this with mods edited by TESAME and those cleaned with TESPCD.
User avatar
Brandi Norton
 
Posts: 3334
Joined: Fri Feb 09, 2007 9:24 pm

Post » Fri May 13, 2011 3:40 pm

Another idea: When loading a plugin with the Enchanted Editor sometimes I get this warning:Seem to get this with mods edited by TESAME and those cleaned with TESPCD.

I have that check written in the code now, but I haven't enabled it yet. It ended up not seeming very interesting. It doesn't seem to affect either Morrowind or the CS, they just read all the records in the file anyway. But I could enable it, if you like.
User avatar
MISS KEEP UR
 
Posts: 3384
Joined: Sat Aug 26, 2006 6:26 am

Post » Fri May 13, 2011 6:36 pm

Well, maybe it's just me but I always fix those errors when I come across them :shrug:
User avatar
JUan Martinez
 
Posts: 3552
Joined: Tue Oct 16, 2007 7:12 am

Post » Fri May 13, 2011 8:50 pm

Okey dokey, next release will check the actual number of records vs. those recorded in the header.
User avatar
Kelly James
 
Posts: 3266
Joined: Wed Oct 04, 2006 7:33 pm

Post » Fri May 13, 2011 7:47 pm

Okey dokey, next release will check the actual number of records vs. those recorded in the header.

It is a really strange record that, as it isn't used by Morrowind at all. (That I can make out :shrug:)


(Not saying that it is a bad thing to check for or anything... )
User avatar
kennedy
 
Posts: 3299
Joined: Mon Oct 16, 2006 1:53 am

Post » Fri May 13, 2011 4:30 am

I look forward to the release date (I'm not knowledgeable enough about all this to provide any beta-testing feedback :( ). Keep up the great work, john.moonsugar! This utility will be a blessing. :tops:
User avatar
Tyrone Haywood
 
Posts: 3472
Joined: Sun Apr 29, 2007 7:10 am

Post » Fri May 13, 2011 5:44 am

The version of tes3lint in svn now has NUMRECS flag enabled:
http://mlox.googlecode.com/svn/trunk/util/tes3lint

example:
tes3lint -f numrecs "Zyndaar's Bows.esp"Zyndaar's Bows.esp: NUMRECS	[NUMRECS]: number of records in TES3.HEDR (20) != Actual count (8)

User avatar
Michelle Serenity Boss
 
Posts: 3341
Joined: Tue Oct 17, 2006 10:49 am

Post » Fri May 13, 2011 12:31 pm

John, have you seen abot's / LizTail's recent posts in the MGE thread? They talk about how to determine the end of a script (since the method MGE used previously didn't work on some mods). Might be worthwile to check whether tes3lint uses one of the two suggested working methods (record length check / check for "END" command) or the one the doesn't work on all mods (null-termination).
User avatar
Catharine Krupinski
 
Posts: 3377
Joined: Sun Aug 12, 2007 3:39 pm

Post » Fri May 13, 2011 5:37 am

John, have you seen abot's / LizTail's recent posts in the MGE thread? They talk about how to determine the end of a script (since the method MGE used previously didn't work on some mods). Might be worthwile to check whether tes3lint uses one of the two suggested working methods (record length check / check for "END" command) or the one the doesn't work on all mods (null-termination).

Alas no, I don't follow MGE, as I haven't gotten it working on Linux yet :)

I'll go see if I can find what you're talking about. I'm not sure I understand what the issue is to begin with.
User avatar
luke trodden
 
Posts: 3445
Joined: Sun Jun 24, 2007 12:48 am

Post » Fri May 13, 2011 7:23 am

I'll go see if I can find what you're talking about. I'm not sure I understand what the issue is to begin with.

One version of MGE assumes that SCPT.SCTX was null termianted. It isn't in all cases.
User avatar
sarah
 
Posts: 3430
Joined: Wed Jul 05, 2006 1:53 pm

Post » Fri May 13, 2011 3:15 pm

Sorry, I should've been more clear. I was thinking this:

tes3lint parses scripts in the esp. Scripts are terminated, and after termination other code may follow (for example if the script has been edited), which never gets executed. There are two potential problems with this:

1. If a utility that parses the scripts misses the end of a script, it then it treats the following records as part of the script code. (This is what the MGE beta apparently did.)

2. If the utility continues to read script code after the "END" command, then it may report problems of this code which are effectively false hits (because the respective code will never get executed).

Or just check posts #187 and #188 in the current MGE thread. :)
User avatar
Nina Mccormick
 
Posts: 3507
Joined: Mon Sep 18, 2006 5:38 pm

Post » Fri May 13, 2011 6:16 pm

One version of MGE assumes that SCPT.SCTX was null termianted. It isn't in all cases.

Ah, I just read that. Thanks.

tes3lint doesn't care if the scripts are null-terminated or not.

However, abot's comment on script text termination at the first "END" is interesting, I didn't know that people did that, although I think abot mentioned it before, it didn't register in my brain.

I can probably do an okay job of recognizing END, but I'll have to see. I'm using regexps, not a real parser.

Edit: maybe it's time to reverse-engineer the compiled script! :) Has anyone done that yet?
User avatar
Peetay
 
Posts: 3303
Joined: Sun Jul 22, 2007 10:33 am

Post » Fri May 13, 2011 1:50 pm

I scanned 2311 plugins, comprising 55220 scripts, and found 26 instances of non-comment code after the "End" statement.


D'oh, I did make a mistake. It was 36 plugins/65 scripts had non-comment code after the end. I think :)
User avatar
Jonathan Egan
 
Posts: 3432
Joined: Fri Jun 22, 2007 3:27 pm

Post » Fri May 13, 2011 7:40 am

Wow, fast work :)
Not that I think appending comments/previous versions of code after the end is a good practice, still it is something existing and working in some mods, like using Basic like = operator instead of C like ==, or <> instead of != ... MWEdit complains, TESCS happily compiles.
As the number of mods writing something after the first final end seems to be really low, all in all I don't think it is something critical to detect for MGE, but it is indeed good for this specialized tool :thumbsup:
User avatar
michael danso
 
Posts: 3492
Joined: Wed Jun 13, 2007 9:21 am

Post » Fri May 13, 2011 1:51 pm

Wow, fast work :)
Not that I think appending comments/previous versions of code after the end is a good practice,

It's possible some of them were mistakes too. It would be easy to overlook a little "end" in the middle of your script if you put it in and forgot, or were using someone else's script as a template. I'll take a closer look and see if I find any that are suspicious. Maybe I should flag these.
User avatar
Jacob Phillips
 
Posts: 3430
Joined: Tue Aug 14, 2007 9:46 am

Post » Fri May 13, 2011 4:45 am

Yes, maybe different persons working on scripts and keeping previous version when in doubt.
I just tried tes3lint-0.51 with one I stumbled upon when fixing some scripts (LGNPC_PaxRedoran_v1_12.esp, jo_BolvynCorpseScript script), it does not seem to be detected at the moment,
I am using this line
C:\Perl\bin\perl.exe tes3lint -r "G:\_games\_rpg\Morrowind\Data Files\LGNPC_PaxRedoran_v1_12.esp" > tes3lint.log
am I missing some parameter or is this feature not included in current uploaded version already?
User avatar
Charlie Sarson
 
Posts: 3445
Joined: Thu May 17, 2007 12:38 pm

Post » Fri May 13, 2011 11:08 am

I missing some parameter or is this feature not included in current uploaded version already?

Are you saying it does scan past the End? Or that it does not flag that there is code past the End?
The former is implemented in 0.51 so it should not scan past the End, the latter I was just musing about, haven't actually done anything yet.
User avatar
Kim Kay
 
Posts: 3427
Joined: Fri Oct 13, 2006 10:45 am

Next

Return to III - Morrowind