Pacman

Historical bug tracker for the Pacman package manager.

The pacman bug tracker has moved to gitlab:
https://gitlab.archlinux.org/pacman/pacman/-/issues

This tracker remains open for interaction with historical bugs during the transition period. Any new bugs reports will be closed without further action.
Tasklist

FS#48515 - [pacman] PKGBUILD option=('!emptydirs') does not remove empty directories

Attached to Project: Pacman
Opened by Brian BIdulock (bidulock) - Wednesday, 09 March 2016, 05:08 GMT
Last edited by Allan McRae (Allan) - Tuesday, 29 March 2016, 04:22 GMT
Task Type Bug Report
Category General
Status Closed
Assigned To Allan McRae (Allan)
Architecture All
Severity Medium
Priority Normal
Reported Version 5.0.1
Due in Version 5.0.2
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

option=('!emptydirs') does not remove all empty directories in all cases since findutils was updated.

Additional info:
* pacman 5.0.1-2 with findutils 4.6.0-1

Steps to reproduce:
- build a perl package that remove *.pod an *.packlist with option=('!emptydirs')
- run namcap and find one empty directory remains

The problem is in /usr/share/makepkg/tidy/emptydirs.sh
The following line is at fault:

find . -depth -type d -exec rmdir '{}' + 2>/dev/null

find(1) manual page says under -exec command {} +:

"... If find encounters an error, this can sometimes cause an immediate exit, so some pending commands may not be run at all."

Changing '+' to ';' works. A better command is:

find . -type d -empty -delete
This task depends upon

Closed by  Allan McRae (Allan)
Tuesday, 29 March 2016, 04:22 GMT
Reason for closing:  Fixed
Additional comments about closing:  git commit baf1ff64
Comment by Allan McRae (Allan) - Sunday, 20 March 2016, 12:05 GMT
  • Field changed: Percent Complete (0% → 100%)
Comment by Allan McRae (Allan) - Sunday, 20 March 2016, 12:23 GMT
  • Field changed: Percent Complete (100% → 0%)
And rejected... busybox find does not have -empty (which is not POSIX).

I guess changing "+" to ";" is the solution, but I am quite interested in what error find is encountering ot cause the failure. Any output printed?
Comment by Brian BIdulock (bidulock) - Monday, 21 March 2016, 00:30 GMT
You need to remove '> /dev/null' to see them or execute the command. I get regular failure message for an attempt to remove a directory that is not empty. '+' to ';' works and is, I suppose, POSIX compliant. The issue is that '+' feeds groups of directories at rmdir and stop if rmdir return a non-zero exit status, which it does when any of the directories are not empty. ';' feeds individual directories at rmdir and will not stop just because one invocation exitted with a non-zero status.
Comment by Allan McRae (Allan) - Monday, 21 March 2016, 01:47 GMT
Ah - I see! I was going to add --ignore-fail-on-non-empty, but that is not available in BSD rmdir (although it is in busybox...). Changing '+' to ';' it is...

Loading...