Tk Library Source Code

View Ticket
Login
Ticket UUID: 795585
Title: regular expression bug in fileutil::fileType
Type: Bug Version: None
Submitter: glennjnn Created on: 2003-08-26 20:00:35
Subsystem: fileutil Assigned To: andreas_kupries
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-09-04 07:11:38
Resolution: Fixed Closed By: andreas_kupries
    Closed on: 2003-09-04 00:11:38
Description:
The test to determine if a file is an interpreted
script file has an error:

The line
    if { [ regexp {^\#\!(\S+)} $test -> terp ] } {
does not accomodate the fact that whitespace is valid
after the #!

A file that begins
    #! /bin/sh
has its type reported as simply "text" instead of the
proper "text script /bin/sh"

The appropriate regex should be {^#!\s*(\S+)}
User Comments: andreas_kupries added on 2003-09-04 07:11:26:
Logged In: YES 
user_id=75003

Fixed in head. Also added code to recognize metakit 
database, also when attached to a file of a different format.