Menu

#698 mimetype, filetype result empty for text files

open
5
2006-10-02
2005-10-18
Mikhail T.
No

modules/fumagic/filetypes.test
- tcltest 2.2.8
- fileutil::magic::filetype 1.0
- fileutil::magic::rt 1.0

==== fumagic.filetype-1.2 test file directory FAILED
==== Contents of test case:

set f [file join $dir fileTypeTest]
set res [catch {fileutil::magic::filetype $f} msg]
regsub {file[0-9]+} $msg {fileXXX} msg
list $res $msg

---- Result was:
0 {}
---- Result should have been (exact matching):
1 {error reading "fileXXX": illegal operation on a
directory}
==== fumagic.filetype-1.2 FAILED

modules/fumagic/mimetypes.test
- tcltest 2.2.8
- fileutil::magic::mimetype 1.0
- fileutil::magic::rt 1.0

==== fumagic.mimetype-1.2 test file directory FAILED
==== Contents of test case:

set f [file join $dir fileTypeTest]
set res [catch {fileutil::magic::mimetype $f} msg]
regsub {file[0-9]+} $msg {fileXXX} msg
list $res $msg

---- Result was:
0 {}
---- Result should have been (exact matching):
1 {error reading "fileXXX": illegal operation on a
directory}

In fact, trying to apply to a text file, such as
/var/log/messages or /COPYRIGHT returns nothing --
[rt::resultv] seems to be an empty list.

Using the procedure on some other things -- like
picture files -- seems to work, however.

Discussion

  • Andreas Kupries

    Andreas Kupries - 2005-10-18

    Logged In: YES
    user_id=75003

    The directory failures seem to be BSD specific. Solaris
    could have them too, as that allows to read a directory is
    if it were a file.

    Regarding /var/log/messages, what user were you ? IIRC this
    file is usually read-only root, i.e. unaccessible to anybody
    else. Right now I have now idea how fumagic will react if it
    doesn't have the permissions to read a file. You could try
    to make readable copies of messages and COPYRIGHT and try to
    get results for that.

    Have you also tried it on other text files, not only pictures ?

     
  • Andreas Kupries

    Andreas Kupries - 2005-10-18
    • labels: --> fileutil :: magic
     
  • Andreas Kupries

    Andreas Kupries - 2005-10-18
    • assigned_to: nobody --> andreas_kupries
     
  • Andreas Kupries

    Andreas Kupries - 2005-10-18
    • priority: 5 --> 6
     
  • Mikhail T.

    Mikhail T. - 2005-10-18

    Logged In: YES
    user_id=173641

    file(1), when applied to a directory responds with
    "directory" -- try `file /' on any system.

    /var/log/message is readable to all on my system and
    yes, I did try other text file (/COPYRIGHT, for example).

    file(1) works properly:

    % file /COPYRIGHT
    /COPYRIGHT: ASCII English text

     
  • Don Porter

    Don Porter - 2006-09-27

    Logged In: YES
    user_id=80530

    still fail in
    - tcllib::testutils 1.1
    - fileutil::magic::rt 1.0
    * fileutil::magic::filetype 1.0.1
    (tcllib-1.9-rc1)

    on Solaris 9

     
  • Andreas Kupries

    Andreas Kupries - 2006-09-27

    Logged In: YES
    user_id=75003

    Fixed the test failures. Committed to head.
    Nothing done yet regarding /var/log/messages, copyright, etc.

     
  • Andreas Kupries

    Andreas Kupries - 2006-10-02
    • priority: 6 --> 5
     
  • Andreas Kupries

    Andreas Kupries - 2006-10-02
    • summary: fumagic.filetype tests fail --> mimetype, filetype result empty for text files