Bug 32006

Summary: wrong/different icon (filetype) with symlinks
Product: [Applications] konqueror Reporter: micha
Component: generalAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description micha 2001-09-02 21:26:52 UTC
(*** This bug was imported into bugs.kde.org ***)

Package:           konqueror
Version:           KDE 2.2.0 
Severity:          normal
Installed from:    Compiled From Sources
Compiler:          gcc version 2.96 20000731 (Red Hat Linux 7.1 2.96-81)
OS:                Linux
OS/Compiler notes: Not Specified

it seems the icon which is displayed with a _regular_ file is retrieved in 2 steps:
1.) if the file has a known extension (.c .html and thelike) the appropriate icon is chosen
2.) if the file has no or no valid extension an icon will be displayed  according to the information you get out of the "file" -command.

with symlinks only method 2.) seems to be used.

Example 1: 
is a totally correct html file  "correct.html"
and the symlink is named "correct.jsp"
both the regular file and the symlink got the
same html-icon.

Example 2:
in fact a html-file but it has blank lines in front of the <html> tag. maybe because of some javascript functions it is recognized as a "c++" file by the file command.
this time the regular file "bad.html" has got the html-icon but the symlink "bad.jsp" shows up with a c++ -icon.

(of course this leads to different actions when clicking either the original or the symlink)

(Submitted via bugs.kde.org)
(Called from KBugReport dialog. Fields Application KDE Version OS Compiler manually changed)
Comment 1 Bodo Eggert 2002-08-12 00:38:36 UTC
Version:           KDE 3.0.2 
Installed from:    SuSE RPMs
Compiler:          Not Specified
OS:                Linux
OS/Compiler notes: Not Specified

If a symlink points to a file with a different extension the extension of the symlink is used to select the icon. This wouldn't be bad if it were used for the on-click-action too. Instead the extension/filetype of the target file will be used.

Example:

cat>malicious.sh<<EOF
#!/bin/sh
/usr/X11R6/bin/xeyes
EOF
chmod 777 malicious.sh
ln -s malicious.sh harmless.jpg

This problem was propably introduced while fixing bug 32006 therefore i'll report it here.

(Submitted via bugs.kde.org)
Comment 2 Dirk Mueller 2003-07-28 22:23:06 UTC
Subject: KDE_3_1_BRANCH: kdebase/konqueror

CVS commit by mueller: 

make sure we don't change the servicetype during execution
CCMAIL: 32006-done@bugs.kde.org


  M +1 -1      konq_mainwindow.cc   1.1083.2.32


--- kdebase/konqueror/konq_mainwindow.cc  #1.1083.2.31:1.1083.2.32
@@ -456,5 +456,5 @@ void KonqMainWindow::openURL( KonqView *
 
   // Fast mode for local files: do the stat ourselves instead of letting KRun do it.
-  if ( url.isLocalFile() )
+  if ( serviceType.isEmpty() && url.isLocalFile() )
   {
     QCString _path( QFile::encodeName(url.path()));