Ticket #1427 (closed defect: wontfix)

Opened 10 years ago

Last modified 3 years ago

mcedit/mcview so slow open file if file contain long line in header

Reported by: angel_il Owned by:
Priority: major Milestone:
Component: mc-core Version:
Keywords: Cc:
Blocked By: Blocking:
Branch state: no branch Votes for changeset:

Description

mcedit/mcview so slow open file if file contain long line in header

it's not mc trouble but 'file' utility.
for solve this problem need truncate target file before start 'file' utility.

Change History

comment:1 Changed 10 years ago by iNode

I think 'file' problems should be solved in file/libmagic project but not in mc.

Did you check it with the latest file/libmagic?
Can you attach file to reproduce this behaviour?

$ touch test_libmagic.txt
$ for i in `seq 1 100000`;do echo -en SOMETEXT >> test_libmagic.txt; done;
$ du -sh test_libmagic.txt 
788K	test_libmagic.txt
% time file ./test_libmagic.txt
./test_libmagic.txt: ASCII text, with very long lines, with no line terminators
file ./test_libmagic.txt  0,02s user 0,01s system 102% cpu 0,031 total
$ file -v
file-4.26
magic file from /etc/magic:/usr/share/file/magic

comment:2 Changed 10 years ago by angel_il

$ for i in `seq 1 100000`;do echo -en SOMETEXT >> test_libmagic.txt; done;
$ time file ./test_libmagic.txt
./test_libmagic.txt: ASCII text, with very long lines, with no line terminators

real    0m0.140s
user    0m0.050s
sys     0m0.090s

$ rm test_libmagic.txt
$ for i in `seq 1 100000`;do echo -en " "  >> test_libmagic.txt; done;
$ time file ./test_libmagic.txt
./test_libmagic.txt: ASCII text, with very long lines, with no line terminators

real    0m14.550s
user    0m14.440s
sys     0m0.110s

comment:3 Changed 10 years ago by iNode

Yes it is. But it seems to be fixed in 5.x version.

$ time file ./test_libmagic.txt 
./test_libmagic.txt: ASCII text, with very long lines, with no line terminators
file ./test_libmagic.txt  20,56s user 0,04s system 96% cpu 21,257 total

$ time ~/opt/file5/bin/file test_libmagic.txt 
test_libmagic.txt: ASCII text, with very long lines, with no line terminators
~/opt/file5/bin/file test_libmagic.txt  0,08s user 0,00s system 91% cpu 0,092 total

I think we need no workaround here cause it can break something in work
of file and branch 5.x works good for us.

comment:4 Changed 10 years ago by angel_il

  • Milestone changed from 4.7.0-pre2 to future releases

comment:5 Changed 3 years ago by zaytsev

  • Status changed from new to closed
  • Version master deleted
  • Resolution set to wontfix
  • Branch state set to no branch
  • Milestone Future Releases deleted

Tested with the following file version:

$ file -v
file-5.22
magic file from /etc/magic:/usr/share/misc/magic

Both are fast. I think it's a wontfix for mc.

Note: See TracTickets for help on using tickets.