Bug 287551

Summary: man:tar makes a tar archive instead.
Product: [Frameworks and Libraries] kio Reporter: dE <de.techno>
Component: manAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: adaptee, adawit, kollix
Priority: NOR    
Version: 4.6   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 4.9.1

Description dE 2011-11-25 15:32:55 UTC
Version:           unspecified (using KDE 4.6.5) 
OS:                Linux

Trying to view the tar man page (man:tar), does not open it's html form, instead gives the web browser a tar file to open.

Reproducible: Always


Actual Results:  
 

Expected Results:
Comment 1 Jekyll Wu 2012-01-01 19:08:59 UTC
I failed to reproduce the reported problem in KDE SC 4.6.5 and 4.8 RC1.
Comment 2 dE 2012-01-03 03:20:30 UTC
Try with Firefox.
Comment 3 Dawit Alemayehu 2012-01-05 07:49:27 UTC
(In reply to comment #2)
> Try with Firefox.

Huh ? What does Firefox have to do with KDE ? Did you mean change the default browser to Firefox and type man:tar in the KRun (ALT+F2) ?
Comment 4 dE 2012-01-05 18:34:20 UTC
Yes.

Actually it depends on the default MIME association. Set association of FF with HTML files.

I've similar issue with man:cat.

I think kio should append .html to the file name, since FF being more Windows prone checks the extension. Infact this's the same for Chromium.

This problem persists with kde 4.7
Comment 5 Dawit Alemayehu 2012-01-05 20:00:07 UTC
(In reply to comment #4)
> Yes.
> 
> Actually it depends on the default MIME association. Set association of FF with
> HTML files.
> 
> I've similar issue with man:cat.
> 
> I think kio should append .html to the file name, since FF being more Windows
> prone checks the extension. Infact this's the same for Chromium.
> 
> This problem persists with kde 4.7

Actually the bug here is not in kio_man, but rather in KRun that is responsible for making sure the proper application is launched to handle the given protocol. Neither Chromium nor Firefox support the KDE specific man: or info: protocols and hence should never be used to view those pages even if they are selected to handle the text/html by default. A solution would have to be found for that or this might be marked as a WONTFIX because the issue is not ours to fix.

My question to you however is why change the mime-type association when you can simply change the default web browser ? If you do that you won't run into this problem at all since man or info pages will not be opened with browsers that do not have support for those protocols.
Comment 6 dE 2012-01-06 16:14:23 UTC
The man: protocol simply converts man to a HTML file and places it in ~/.kde4/cache-OLD_BROKEN_LAP/krun/. 

As you said, krun then executes the associated HTML browser to open the page generated.

Since this generated file has an extension tar, FF/chromium do not recognize it as a HTML file so they just ask the user to save/open it.

If I add a html extension to the generated HTML file, it open fine.

Thus I think, kio should be modified to add html extension to the generated HTML file.
Comment 7 Martin Koller 2012-08-13 16:35:28 UTC
I's not the kio_man which produces the tmp file, it's the kioexec tool.
You can see the same problem when using "info:tar".
I created a patch here https://git.reviewboard.kde.org/r/106003/
Comment 8 Martin Koller 2012-08-13 16:47:06 UTC
Git commit 2faf28e34a13378a8a94b774e8f00c0cfca3b48d by Martin Koller.
Committed on 13/08/2012 at 18:39.
Pushed by mkoller into branch 'KDE/4.9'.

change tmp filename pattern to avoid misinterpretation

In the mentioned bugreport, kio_man is used with the url "man:tar"
firefox, which loads the tmp file kioexec created, seems to have a problem with the filename ending in
.tar as it thinks the file is a TAR file. The problem stems from the fact that kioexec creates the krun tmp filename by the
pattern <pid>.<jobnum>.<filename> and in this case filename == "tar"
A simple solution to not create a tmpfilename which can be misinterpreted is by changing "." -> "_" in the name pattern
so that the created filename does not have an "extension" part.
FIXED-IN: 4.9.1

M  +1    -1    kioexec/main.cpp

http://commits.kde.org/kde-runtime/2faf28e34a13378a8a94b774e8f00c0cfca3b48d
Comment 9 Martin Koller 2012-08-13 16:47:06 UTC
Git commit 9dc53f72fc5f29b379b4e3d649484ff9aff7e05e by Martin Koller.
Committed on 13/08/2012 at 18:39.
Pushed by mkoller into branch 'master'.

change tmp filename pattern to avoid misinterpretation

In the mentioned bugreport, kio_man is used with the url "man:tar"
firefox, which loads the tmp file kioexec created, seems to have a problem with the filename ending in
.tar as it thinks the file is a TAR file. The problem stems from the fact that kioexec creates the krun tmp filename by the
pattern <pid>.<jobnum>.<filename> and in this case filename == "tar"
A simple solution to not create a tmpfilename which can be misinterpreted is by changing "." -> "_" in the name pattern
so that the created filename does not have an "extension" part.
FIXED-IN: 4.9.1

M  +1    -1    kioexec/main.cpp

http://commits.kde.org/kde-runtime/9dc53f72fc5f29b379b4e3d649484ff9aff7e05e
Comment 10 dE 2013-03-10 10:01:08 UTC
There's a related bug in this. If you try to open a man page by it's exact location, e.g. -- 

man:/usr/share/man/man1/ls.1.bz2, then the problematic extension remains.
Comment 11 Martin Koller 2013-03-10 12:17:25 UTC
Does it mean you get no man page in that case ?
I can not reproduce a problem here.
Comment 12 dE 2013-03-18 15:23:47 UTC
With man:/usr/share/man/man1/ls.1.bz2

kio will provide a HTML file with bz2 extension, making FF mistake it as an archive.