[pacman-dev] [PATCH 0/2] [WIP] Fix du filesize computation

Eli Schwartz eschwartz at archlinux.org
Fri Mar 8 05:22:48 UTC 2019

On 3/7/19 10:18 PM, Santiago Torres-Arias wrote:
> On Thu, Mar 07, 2019 at 10:07:12PM -0500, Eli Schwartz wrote:
>> On 3/7/19 9:36 PM, Santiago Torres wrote:
>>> This patchset is a WIP that tries to address FS#61717[1].
>>> This is my first patch for pacman, so I may be missing a couple of the
>>> heuristics of proper pacman develoment. Namely, I'm worried about the
>>> use of xargs (I went down this road because I wanted to have the minimal
>>> set of changes). I'm not sure what're the heuristics for what I can
>>> assume (e.g., can findutils be assumed to exist?).
>> We explicitly use find -exec elsewhere, so that should be fine.
>> xargs --null is a GNU-ism and does not work on supported targets:
>> busybox xargs, and BSD xargs. Both support -0, but it is anyways a
>> better idea to simply stick with POSIX-defined find -exec ... {} +
> Oh ok, Ill move to a find-exec construct then.
>> (I think you can generally assume that long options will not work by
>> default, actually. Neither busybox nor BSD utilities typically seem to
>> implement them.)
> TIL, thanks!
>>> As a followup of this, I removed the configure.ac stuff related to
>>> DUPATH and DUFLAGS. I'm not sure if we'd want to add XARGSPATH or so. I
>>> opted to not do that just yet.
>> We do not need this; the only reason du is configurable rather than
>> relying on the PATH, is because people had wrapper programs that
>> pretended to be du, but were broken: https://bugs.archlinux.org/task/19932
> Aha, noted!
>> No one tries to colorize the output of find -exec or of xargs, I hope...
> Lol I hope so too. Let me follow up with a v2 using find -exec cat {}
> \;...

find . -type f -exec cat {} +

Please use the + format, not \; as the former will be able to accept
many filenames at once until it reaches the maximum length of a command
line (and cat supports this mode), while \; will fork a new cat command
for each file.

This is functionally comparable to xargs, which defaults to being like
find -exec {} +, but when using xargs -L 1, acts like find -exec {} \;

Eli Schwartz
Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1601 bytes
Desc: OpenPGP digital signature
URL: <https://lists.archlinux.org/pipermail/pacman-dev/attachments/20190308/90c4acca/attachment-0001.sig>

More information about the pacman-dev mailing list