You are not logged in.

#1 2007-06-28 04:59:34

Smurth
Member
Registered: 2007-04-07
Posts: 3

pacman bugs with symlink ?

Hi,

Yesterday, I've upgrade my system and so, pacman.
On my system, /opt was a symlink to /usr/opt
After the system upgrade, /opt were replaced by a regular directory.
Of course, it's not so hard to work around, but it's a little annoying

Offline

#2 2007-06-28 12:47:06

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: pacman bugs with symlink ?

http://bugs.archlinux.org/task/7484

I hope we will find a solution tongue


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#3 2007-06-29 11:40:41

hybrid
Member
Registered: 2007-02-05
Posts: 261

Re: pacman bugs with symlink ?

I'm also affected by that bug (have /opt symlinked to /usr/opt) and some questions:
1) Is it safe, to just copy (preserving permissions and ownerships) that upgraded stuff from the /opt directory into the directory that the old symlink pointed to (in my case /usr/opt) and then after that to remove the /opt directory and then to reestablish a symlink?
Or will that have any "sideffects" like will that confuse pacman once I remove that package again? (I mean, it actually shouldn't have any "side effects" later on, but I don't know pacman that well yet, see next question)

2) I don't really understand pacman yet. big_smile I can handle and use it and whatnot, but I don't really understand what it needs it's dependencies, eg. libarchive. Especially when I read through the bugreport for this bug I don't really understand. I mean, the packages are pretty much nothing more than a simple tar file that contains all the files and the structure for the package. So shouldn't it be enough to untar it into your filesystem and have your packet manager remember which files were being extracted and where (I'm leaving meta informations such as that stuff that pacman -Qi shows out). So what is libarchive and all that stuff for?

thx in advance :>

Offline

#4 2007-06-29 11:49:55

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: pacman bugs with symlink ?

1) I didn't check, but I think that should work, without side effects.

2) libarchive is used only as an untar, so yes basically, the only thing it does is extracting files from the tar package to the filesystem.
It's only used to make this possible from C code.


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#5 2007-06-29 17:56:18

loserMcloser
Member
From: Canada
Registered: 2004-12-15
Posts: 130

Re: pacman bugs with symlink ?

hybrid wrote:

I'm also affected by that bug (have /opt symlinked to /usr/opt) and some questions:
1) Is it safe, to just copy (preserving permissions and ownerships) that upgraded stuff from the /opt directory into the directory that the old symlink pointed to (in my case /usr/opt) and then after that to remove the /opt directory and then to reestablish a symlink?
Or will that have any "sideffects" like will that confuse pacman once I remove that package again? (I mean, it actually shouldn't have any "side effects" later on, but I don't know pacman that well yet, see next question)

Depending on what order pacman does things (maybe someone more knowledgeable can clarify), this will only work if you upgrade each package which goes under /opt one at a time, doing your workaround between each package upgrade.

If you do several packages at once, pacman might replace your /opt symlink on the first package upgrade, then the old version of the second package will not be properly removed from where it was installed under /usr/opt because pacman no longer knows you put it there. The result is that you may end up with some stale files under /usr/opt from old packages that will never get removed unless you go searching for them.

Personally, I'm not upgrading any packages until this is fixed, because I have a read-only / partition and don't really remember all the crazy symlink stuff I did to set it up in the first place, and would prefer pacman didn't undo it all for me tongue

Last edited by loserMcloser (2007-06-29 17:58:39)

Offline

#6 2007-06-29 18:43:17

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: pacman bugs with symlink ?

loserMcloser wrote:

If you do several packages at once, pacman might replace your /opt symlink on the first package upgrade, then the old version of the second package will not be properly removed from where it was installed under /usr/opt because pacman no longer knows you put it there. The result is that you may end up with some stale files under /usr/opt from old packages that will never get removed unless you go searching for them.

Oh indeed, I didn't check, but that looks correct.. I didn't think about that.
That's not very pretty..


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#7 2007-06-29 19:24:00

hybrid
Member
Registered: 2007-02-05
Posts: 261

Re: pacman bugs with symlink ?

loserMcloser wrote:

If you do several packages at once, pacman might replace your /opt symlink on the first package upgrade, then the old version of the second package will not be properly removed from where it was installed under /usr/opt because pacman no longer knows you put it there. The result is that you may end up with some stale files under /usr/opt from old packages that will never get removed unless you go searching for them.

Personally, I'm not upgrading any packages until this is fixed, because I have a read-only / partition and don't really remember all the crazy symlink stuff I did to set it up in the first place, and would prefer pacman didn't undo it all for me tongue

Yep, that is what's happening.
Before I found out that the new pacman (or lilbarchive) messes with the symlink I upgraded a couple packages and I found exactly that out (after jre was upgraded, the following packages (thunderbird) was not removed from /usr/opt).
As I said earlier in some other thread, I am certainly not gonna update anything either until this bug gets fixed. Especially not since this is a general problem and not bound to /opt. So if for some reason in some package there is a folder when there is a symlink for that on my system (anywhere) it will get screwed up - with pretty much no chance for me to find out.

But I was asking because right now everything except for jre is in /usr/opt and jre and the new thunderbird are in /opt (which I moved to /opt-screwed and linked /opt to /usr/opt again big_smile). So I'm gonna fix my jre and thunderbidr now :>

Offline

#8 2007-06-29 19:25:08

retsaw
Member
From: London, UK
Registered: 2005-03-22
Posts: 132

Re: pacman bugs with symlink ?

As a workaround you can mount /usr/opt/ to /opt. e.g.

mount /usr/opt /opt -o rbind

Or as a line in your /etc/fstab

/usr/opt /opt none rbind 0 0

Doing this will avoid any other bugs that arise from incorrect handling of symlinks aswell.

Note you can use "bind" instead of "rbind", "bind" just mounts a directory elsewhere, but not any submounts that may be under that directory whereas "rbind" includes the submounts aswell.

Offline

#9 2007-06-29 21:13:43

loserMcloser
Member
From: Canada
Registered: 2004-12-15
Posts: 130

Re: pacman bugs with symlink ?

Hey thanks retsaw, I knew you could use --bind to mount a filesystem in several places, but didn't know you could use it to mount part of a filesystem somewhere. I think I'll change my /opt symlink to a --bind mount.

Though I still think pacman/libarchive not following directory symlinks is dangerous and should be fixed.

(ps Thanks to shining for all your work/analysis in the bug report thread !)

Offline

#10 2007-06-29 21:32:28

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: pacman bugs with symlink ?

loserMcloser wrote:

Though I still think pacman/libarchive not following directory symlinks is dangerous and should be fixed.

(ps Thanks to shining for all your work/analysis in the bug report thread !)

Well, I did what I could, since it's pretty important, and no one was really looking at it, but that's not enough yet. Also, I'm quite scared about proposing a wrong solution, that would fix this issue but cause other problems sad


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

Board footer

Powered by FluxBB