[pacman-dev] dangerous symlink handling with --root option

Mister Dobalina reebydobalina at yahoo.ca
Tue Aug 21 11:20:33 EDT 2007


--- Xavier <shiningxc at gmail.com> wrote:
> So isn't it a bug in the package rather than in
> pacman?
> Shouldn't there be only relative symlinks?
> 

I don't know if any package maintainers have reasons
for prefering an absolute symlink over a relative one.
Either way, I think there is something wrong with the
following test case. Note that it actually only uses a
relative symlink, and does not involve the --root
option.

Make and install the package in the following
PKGBUILD. Just install it with "-U".

##################
pkgname=symlinktest
pkgver=0.1
pkgrel=1
arch=(i686 x86_64)

build()
{
  mkdir -p ${startdir}/pkg/tmp
  cd ${startdir}/pkg/tmp
  ln -s tmpfs/file symlink
}
##################

Then issue the following commands (as root):

# mkdir /tmp/tmpfs
# mount -t tmpfs -o size=1k tmpfs /tmp/tmpfs
# touch /tmp/tmpfs/file
# mount -o remount,ro /tmp/tmpfs
# pacman -R symlinktest

On my system, pacman (v 3.0.5-3) goes into that
infinite loop, after giving the following output:

error: cannot remove file '/tmp/symlink': Read-only
file system
error: failed to commit transaction (cannot remove all
files for package)
error: failed to release transaction (could not commit
transaction)

Why should /tmp/tmpfs being read-only affect removing
that symlink? Doing

# mount -o remount,rw /tmp/tmpfs
# pacman -R symlinktest

works as expected though, and /tmp/tmpfs/file remains
intact, so I guess there is not really any danger
here. So it seems pacman can't remove symlinks which
point to files which live on read-only filesystems,
which I guess is not such a serious issue, since most
people don't run with read-only root partitions.
Curious though.

I guess I'll stop wasting your time now :)

Jeremy



      Be smarter than spam. See how smart SpamGuard is at giving junk email the boot with the All-new Yahoo! Mail at http://mrd.mail.yahoo.com/try_beta?.intl=ca





More information about the pacman-dev mailing list