Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken magic_mode in internal viewer #2976

Closed
mc-butler opened this issue Mar 9, 2013 · 9 comments
Closed

Broken magic_mode in internal viewer #2976

mc-butler opened this issue Mar 9, 2013 · 9 comments
Assignees
Labels
area: mcview mcview, the built-in text editor prio: medium Has the potential to affect progress
Milestone

Comments

@mc-butler
Copy link

Important

This issue was migrated from Trac:

Origin https://midnight-commander.org/ticket/2976
Reporter szaszg (szaszg@….inter.net)
Mentions gotar@….pl
  • create a gzipped file (e.g. gzip -c config.h >config.h.gz)
  • create a gzipped file without the gz ext. (e.g. gzip -c config.h >config.h.txt)

Reproduce:
=====================

  • open gzipped files in mcview (F3) - we see the ungzipped content
  • switch back and fort with F8 - all O.K.
  • open gzipped file with gz extension (config.h.gz) in mcview raw mode (Shift-F3) - we see the raw content
  • switch back and fort with F8 - all O.K.
  • open gzipped file without gz extension (config.h.txt) in mcview raw mode (Shift-F3) - we see the raw content
  • press F8 (=> Parsed content) - the file name in the header is disappeared, but we see the raw content
  • press F8 (=> Raw content) - the file name in the header is appeared, we see ungzipped content
  • press F8 (=> Parsed content again) - nothing happend
  • switch one panel to "quick view" mode
  • highlite any of the gzipped file - we see the raw content, and there is no filename in the viewer header
  • switch to QW "panel" and press F8 (Raw mode) - there is no filename in header and we see ungzipped content
  • press F8 (=> Parsed content again) - nothing happend

Problem:
======================
magic mode broken in mcview

If we open a file with F3 from panels, then mc use "file extension" style open (e.g. archive.sh) and Format/Raw switching O.K.

If we open file in "Raw" mode, or use quick view, mc opens files without "file extension" helpers. Format/Raw switching broken.

In mcview.c: mcview_load we check magic_mode and detect "compressed" files (line 375).
If magic mode on and file is "compressed" we free the current vpath and generate a new vpath with "decompress magic", but nothing else.
So, the file name disappear and we see the raw content.
After user press F8, mcview reload the file. Now filename is the "new" magic filename. mcview_load open the file with the decompress "helper" (use sfs). We see the uncompressed (parsed) content.
After user press F8, nothing happend, because original file name lost...

Solution:
======================
I attach a patch, wich fix this problem.
The patch:

  • remove the old vpath destruction
  • open the file with "uncopress magic" if magic_mode on and file "compressed"

This patch fix Ticket#2090 (CmdViewFile Raw/Parse switching) but not fix Ticket#2968

Note

Original attachments:

@mc-butler
Copy link
Author

Changed by szaszg (szaszg@….inter.net) on Mar 9, 2013 at 3:27 UTC

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Mar 9, 2013 at 6:28 UTC (comment 1)

  • Votes set to andrew_b
  • Status changed from new to accepted
  • Milestone changed from Future Releases to 4.8.8
  • Owner set to andrew_b

Thanks for the patch! I think it will help us in #2968.

Branch: 2976_broken_magic_mode.
[229a5907ae4c922987a317cdd8f92c47bbfec277]

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Mar 9, 2013 at 7:34 UTC

@mc-butler
Copy link
Author

Changed by szaszg (szaszg@….inter.net) on Mar 10, 2013 at 23:13 UTC (comment 3)

Hmm... Sorry, but this patch not really fix Ticket#2090. Just magic mode sometimes work as open file with command. So the examples in Ticket#2090 work after this patch, but the problem still exists. The proble in Ticket#2968 is the same as in Ticket#2090. First mcviewer open the file with external helper (exec_extension_view()), but later just open with magic mode...

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Mar 11, 2013 at 10:57 UTC (comment 4)

  • Branch state changed from no branch to on review

@mc-butler
Copy link
Author

Changed by gotar (gotar@….pl) on Mar 15, 2013 at 15:14 UTC (comment 5)

  • Cc set to gotar@….pl

@mc-butler
Copy link
Author

Changed by angel_il (@ilia-maslakov) on Mar 20, 2013 at 9:57 UTC (comment 6)

  • Branch state changed from on review to approved
  • Votes changed from andrew_b to andrew_b angel_il

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Mar 20, 2013 at 13:05 UTC (comment 7)

  • Keywords magic_mode deleted
  • Resolution set to fixed
  • Status changed from accepted to testing
  • Votes changed from andrew_b angel_il to committed-master
  • Branch state changed from approved to merged

Merged to master: [b8208b0].

@mc-butler
Copy link
Author

Changed by andrew_b (@aborodin) on Mar 20, 2013 at 13:06 UTC (comment 8)

  • Status changed from testing to closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: mcview mcview, the built-in text editor prio: medium Has the potential to affect progress
Development

No branches or pull requests

2 participants