Pacman

Welcome to the Pacman bug tracker. Please search the current bugs and feature requests before filing a new one! Use advanced search and select "Search in Comments".

* Please select the correct category and version.
* Write a descriptive summary, background info, and provide a reproducible test case whenever possible.
Tasklist

FS#30179 - pacman refuses to overwrite nonempty directory with file, yet commits transaction

Attached to Project: Pacman
Opened by Gaetan Bisson (vesath) - Thursday, 07 June 2012, 15:26 GMT
Last edited by Allan McRae (Allan) - Sunday, 24 February 2013, 03:13 GMT
Task Type Bug Report
Category Backend/Core
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity Low
Priority Normal
Reported Version 4.0.3
Due in Version 4.1.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Say your disk has a file called /var/run/bla, and some "filesystem" package contains a symlink called /var/run; pacman --force will refuse to install it, but will still update the database like it happened.

Live example:

# pacman -S filesystem --force
resolving dependencies...
looking for inter-conflicts...

Targets (1): filesystem-2012.6-2

Total Installed Size: 0.30 MiB
Net Upgrade Size: 0.23 MiB

Proceed with installation? [Y/n] y
(1/1) checking package integrity [#####################################] 100%
(1/1) loading package files [#####################################] 100%
(1/1) checking available disk space [#####################################] 100%
(1/1) upgrading filesystem [#####################################] 100%
warning: directory permissions differ on sys/
filesystem: 755 package: 555
error: extract: not overwriting dir with file var/run
error: problem occurred while upgrading filesystem
error: could not commit transaction
error: failed to commit transaction (transaction aborted)
Errors occurred, no packages were upgraded.

# pacman -Q filesystem
filesystem 2012.6-2

# ls -la /var | grep run
lrwxrwxrwx 1 root root 11 Jun 6 10:13 lock -> ../run/lock
drwxr-xr-x 4 root root 72 Jun 6 11:47 run

For context, see: https://mailman.archlinux.org/pipermail/arch-dev-public/2012-June/023067.html
This task depends upon

Closed by  Allan McRae (Allan)
Sunday, 24 February 2013, 03:13 GMT
Reason for closing:  Fixed
Additional comments about closing:  git commit 34749e17
Comment by Allan McRae (Allan) - Thursday, 07 June 2012, 23:06 GMT
I was convinced something was strange with this report but I can confirm...

BTW, --force is not needed to get this.
Comment by Allan McRae (Allan) - Friday, 08 June 2012, 01:35 GMT
I take my comment about not needing --force back. I got the something similar updating my chroot with mkarchroot (which does not use --force), but I can not replicate it.
Comment by Jesse Kaukonen (Gekko) - Sunday, 10 June 2012, 23:47 GMT
I got the same issue. Doing pacman -S filesystem gives an error about var/lock existing, but after pacman is done, that file is no longer around. When doing pacman -S filesystem --force, it gives the exact same error as mentioned above.
Comment by Dave Reisner (falconindy) - Sunday, 10 June 2012, 23:48 GMT
"Same issue" comments do not help. Please do not leave them.

We know the bug exists. We know what the problem is.
Comment by Zachariah Aslam (zak13362) - Tuesday, 19 June 2012, 19:45 GMT
deleting the /var/{run,lock} directories fixes the problem.
Comment by Allan McRae (Allan) - Saturday, 09 February 2013, 10:08 GMT
Simple example, foo-1-1 has directory /foo, unowned on filesystem file /foo/lock, foo-1-2 has file /foo.

> pacman -U foo-1-2-any.pkg.tar.xz
loading packages...
resolving dependencies...
looking for inter-conflicts...

Packages (1): foo-1-2

Total Installed Size: 0.00 MiB
Net Upgrade Size: 0.00 MiB

Proceed with installation? [Y/n]
(1/1) checking keys in keyring [######################] 100%
(1/1) checking package integrity [######################] 100%
(1/1) loading package files [######################] 100%
(1/1) checking for file conflicts [######################] 100%
error: failed to commit transaction (conflicting files)
foo: /foo exists in filesystem
Errors occurred, no packages were upgraded.


> pacman -U --force foo-1-2-any.pkg.tar.xz
loading packages...
resolving dependencies...
looking for inter-conflicts...

Packages (1): foo-1-2

Total Installed Size: 0.00 MiB
Net Upgrade Size: 0.00 MiB

Proceed with installation? [Y/n]
(1/1) checking keys in keyring [############################] 100%
(1/1) checking package integrity [############################] 100%
(1/1) loading package files [############################] 100%
(1/1) upgrading foo [############################] 100%
error: extract: not overwriting dir with file foo
error: problem occurred while upgrading foo
error: could not commit transaction
error: failed to commit transaction (transaction aborted)
Errors occurred, no packages were upgraded.


We will never delete files, even with --force, so if the conflict is a directory being replaced with a file, we should still abort and the user can manually delete the folder to get around the conflict. Or should we assume force means we have to delete the folder?
Comment by Allan McRae (Allan) - Tuesday, 12 February 2013, 12:08 GMT
Patch that causes directory-file conflicts to be detected even with --force:
https://mailman.archlinux.org/pipermail/pacman-dev/2013-February/016450.html

Loading...