Ticket #2090 (closed defect: fixed)

Opened 14 years ago

Last modified 11 years ago

CmdViewFile Raw/Parse switching

Reported by: gotar Owned by:
Priority: minor Milestone: 4.8.9
Component: mcview Version: master
Keywords: Cc:
Blocked By: #2976 Blocking:
Branch state: no branch Votes for changeset:

Description

Assume we have file.txt.gz. When viewed with CmdView (F3) the contents are ungzipped and we can switch back and forth with F8 (ViewToggleMagicMode). However if viewed with CmdViewFile (shift-F3) weird things happen:

  1. shift-F3: we see binary contents, Raw mode is on (always, in contrary to F3, which starts with last used mode),
  2. F8: Parse mode should be on, but it isn't - the only change is that status bar prints now file.txt.gz#ugz,
  3. F8: Parse mode should be turned off, instead it is apparently on! Contents are ungzipped now (via SFS, how does it know what to use?),
  4. F8 again: nothing else happens, we stuck with ungzipped text.

The worse happens with other files compressed with gz algorithm, like zip archives or ods documents: after second F8 we get only "gzip: stdin has more than one entry--rest ignored" and "Error Cannot open file.zip#ugz No such file or directory (2)" after that.

And BTW: current viewer doesn't display column count in UnWrap mode (i.e. horizontal shift), probably since #1585 fixing.

Change History

comment:1 Changed 13 years ago by keasy

  • Branch state set to no branch
  • Summary changed from CmdViewFile Raw/Parse switching and SFS interaction to CmdViewFile Raw/Parse switching

The problem is, there are two variables passed around when Raw/Parse? is involved -- "command" and "filename". Three objects are operated on, however: current input source, an external filter and an external command. Sometimes, those overlap in a bad way, like described in the ticket.

An easier example to follow is:

mcview filename.html
command="htmlparser"
filename="filename.html"
all clean and simple

mcview M-! cat filename.html
command="cat filename.html"
filename="" NULL?
where do you add parser now?

And when you also use VFS, it's only a matter of time till you're out of those 2 variables and an extra click on Raw/Parse? borks your current state to the point of no return.

Now, the filter command actually expects a real filename and not input redirected from mc. Put shortly, the traditional unix chain of input/output stream redirection does not exist in mcview, it's all based on hacks, and I strongly suspect DOS heritage and it's weird streams are to blame.

A very easy, and even more hacky way to fix this would be to actually re-construct the command string by prepending / appending additional filters with pipes.

A harder way would be to steam-line everything to be a little more like unix streams.

comment:2 Changed 12 years ago by andrew_b

  • Version changed from version not selected to master
  • Milestone changed from 4.7 to Future Releases

comment:3 Changed 11 years ago by andrew_b

  • Blocked By 2976 added

comment:4 Changed 11 years ago by andrew_b

  • Status changed from new to closed
  • Resolution set to fixed
  • Milestone changed from Future Releases to 4.8.9

Fixed in #2968.

Note: See TracTickets for help on using tickets.