Bug 191821 - Tree path wrong when compressing a dir in a symlink, contains ../../../
Summary: Tree path wrong when compressing a dir in a symlink, contains ../../../
Status: RESOLVED FIXED
Alias: None
Product: ark
Classification: Applications
Component: general (show other bugs)
Version: 2.12
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Harald Hvaal
URL:
Keywords:
: 192281 204123 215298 220923 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-05-06 17:00 UTC by DrSlony
Modified: 2010-01-01 21:24 UTC (History)
12 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description DrSlony 2009-05-06 17:00:26 UTC
Version:           2.12 (using KDE 4.2.2)
Compiler:          gcc-4.3.2-r3 
OS:                Linux
Installed from:    Gentoo Packages

I create an archive that I save as /home/drslony/temp/foo.zip
I add this dir to it:
/music/music/Infected Mushroom

/music is a symlink, it points to /mnt/sda6/

The resulting zip archive has this tree:
../../../music/music/Infected Mushroom/2007 - Vicious Delicious/files here

This bug does not happen if instead of selecting the Infected Mushroom dir using the /music symlink, I do it by going to /mnt/sda6/music/ and selecting Infected Mushroom from there, so its related to symlinks.

Here is a screenshot:
http://imagebin.ca/img/ZD-r4FXu.png
Comment 1 Raphael Kubo da Costa 2009-05-07 06:22:21 UTC
I tried to reproduce it here but it worked well. Here's the procedure I followed:

cd /tmp
mkdir -p a/b
echo 'c' > a/b/c.txt
ln -s a z
mkdir -p x/y
# Call ark and create /tmp/x/y/bla.zip
# Click Add Folder and select /tmp/z

Is this what you've done?
Comment 2 Raphael Kubo da Costa 2009-05-17 21:33:40 UTC
*** Bug 192281 has been marked as a duplicate of this bug. ***
Comment 3 Raphael Kubo da Costa 2009-05-17 21:35:00 UTC
I can confirm this one on 4.2.2 after the comments in bug 192281. Later I'll check if this is still present with trunk, which uses clizipplugin.
Comment 4 Facundo Aguilera 2009-05-19 21:39:54 UTC
I'm having the same problem. When adding files from a symlink. 
Try:
$cd ~
$mkdir /tmp/pepe
$echo 'c'>/tmp/pepe/pepa.txt
$ln -s /tmp/pepe pepe_link
now create bla.zip somewhere, and add ~/pepe_link/pepa.txt
In addition, I have the same behavior with Squeeze.
Comment 5 Facundo Aguilera 2009-06-23 22:45:36 UTC
Trunk has the same problem?
Comment 6 Raphael Kubo da Costa 2009-06-23 23:40:59 UTC
Yes.
Comment 7 DrSlony 2009-08-18 19:52:59 UTC
Any progress? Fixed?
Comment 8 Raphael Kubo da Costa 2009-08-19 05:53:33 UTC
Not yet. Both Harald and I have been quite busy lately, so there hasn't been much time for either of us to give Ark much love.

Patches are welcome, though :)
Comment 9 Raphael Kubo da Costa 2009-08-19 06:21:34 UTC
*** Bug 204123 has been marked as a duplicate of this bug. ***
Comment 10 Facundo Aguilera 2009-08-24 21:13:39 UTC
I don't have this problem using 7z format in 4.3 (and 7z is better than zip, rar...).
Comment 11 Roberto Bianco 2009-08-26 16:28:27 UTC
I have same problem
Comment 12 DrSlony 2009-09-10 12:47:37 UTC
Ark-4.3.1, still not fixed.
Comment 13 Matty 2009-09-23 03:55:31 UTC
Same problem using 4.2.4 in Slackware
Ark 2.1.2

Interestingly, Dolphin has weird behavior when working with symlinks. 

If for example a user has a link on the desktop pointing to /data/docs/folder, Dolphin will display /home/username/Desktop/data/docs/folder.

It seems that this could be related.
Comment 14 Janet 2009-09-26 13:59:13 UTC
Cannot confirm dolphin part of Comment #13. Symlinks are shown fine in dolphin of 4.3.1 so this cannot be related.
Comment 15 Matty 2009-09-26 19:17:19 UTC
Janet:
Have you tried with symlinks that point to a different partition? This is when the behavior happens for me in Dolphin and the weird packaging in Ark.
Comment 16 Janet 2009-09-27 04:14:45 UTC
@Matty: Yes, have tried that: /media/disk2part5/Multimedia/Samples linked to ~/Desktop/Samples shows as ~/Desktop/Samples in Dolphin.
Comment 17 Matty 2009-09-30 02:20:20 UTC
Ok, I know what is causing the link behavior in Dolphin. 

1. If you right click and select "link to new location(URL)" and enter the path, then everything is fine. When you open up Dolphin, you get the actual path.

2. When you drag a folder and select "link here", the link that is created contains the relative path. 

So if you have:
/path/to/folder1
/home/matty/folder1 (where folder1 is the link to /path/to/folder1)

If you use method 1, Dolphin displays /path/to/folder1
method 2, Dolphin displays /home/matty/folder1 

Another thing to note is that when you use method 2, you also get a folder icon with a little arrow at the bottom left, indicating that it is a link. 

Perhaps this inconsistency should be addressed?
Comment 18 Raphael Kubo da Costa 2009-09-30 03:03:14 UTC
Matty, I couldn't understand if the problem in Dolphin you've described relates to Ark.

In case it doesn't, please file a separate bug report for Dolphin.
Comment 19 Janet 2009-09-30 14:15:48 UTC
Matty, I'm sure this has nothing to do with ark. And you mix the creation of symlinks and URLs, that's something totally different and no inconsistency.
Comment 20 Matty 2009-10-01 03:58:38 UTC
@Janet:
Ok I don't care to split hairs here, but when in Dolphin and you right-click and choose to compress you get,

incorrect behavior (described by the OP) when using symlinks,
correct behavior when using URL

I think its reasonable to think that this might help with troubleshooting the problem. Do with this information as you wish.
Comment 21 Kris Moore 2009-10-12 18:28:45 UTC
I'm seeing this problem on PC-BSD as well, running Ark 2.1.3 and KDE 4.3.1. 

Its easily repeated, we have /home as a symlink to /usr/home, so when you navigate to a file under /home/ and add it, it ends up with a bunch of bogus "../../../" lines in the added file path. However, if you add the file from /usr/home directly, it works fine.
Comment 22 Luiz Angelo De Luca 2009-10-19 00:21:28 UTC
No big news but also present on Opensuse 11.1 x86_64 with 4.3.1
Comment 23 mikey 2009-11-17 15:14:10 UTC
Can confirm for Gentoo AMD_64 with 4.3.1 Ark
Comment 24 webhead 2009-12-04 01:14:53 UTC
I can confirm this bug as well with: 
Arch Linux x64.  
KDE 4.3.4
Ark 2.1.3

I've been experiencing this for some time and finally decided to figure out what was going on.  Good to know it isn't just me.
Comment 25 Raphael Kubo da Costa 2009-12-29 04:11:40 UTC
*** Bug 215298 has been marked as a duplicate of this bug. ***
Comment 26 Raphael Kubo da Costa 2009-12-29 05:57:21 UTC
SVN commit 1067179 by rkcosta:

Do not call QDir::relativeFilePath() from QDir::current().

QDir::setCurrent() is called if global work dir is set, which ends
up resolving symlinks automatically. Creating a QDir and calling
relativeFilePath() on this object solves the problem.

BUG: 191821

 M  +12 -7     kerfuffle/cliinterface.cpp  
 M  +14 -9     plugins/libarchive/libarchivehandler.cpp  
 M  +2 -0      plugins/libarchive/libarchivehandler.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1067179
Comment 27 Raphael Kubo da Costa 2009-12-29 06:08:13 UTC
SVN commit 1067183 by rkcosta:

Backport r1067179.

Do not call QDir::relativeFilePath() from QDir::current().

QDir::setCurrent() is called if global work dir is set, which ends
up resolving symlinks automatically. Creating a QDir and calling
relativeFilePath() on this object solves the problem.

CCBUG: 191821


 M  +12 -7     kerfuffle/cliinterface.cpp  
 M  +14 -9     plugins/libarchive/libarchivehandler.cpp  
 M  +2 -0      plugins/libarchive/libarchivehandler.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1067183
Comment 28 Raphael Kubo da Costa 2010-01-01 21:24:43 UTC
*** Bug 220923 has been marked as a duplicate of this bug. ***