Ticket #2090 (closed defect: fixed)
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:
- shift-F3: we see binary contents, Raw mode is on (always, in contrary to F3, which starts with last used mode),
- F8: Parse mode should be on, but it isn't - the only change is that status bar prints now file.txt.gz#ugz,
- 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?),
- 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
Note: See
TracTickets for help on using
tickets.
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:
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.