FS#52992 - [pacman] Provide option for null terminated input

Attached to Project: Pacman
Opened by Earnestly (Earnest) - Friday, 17 February 2017, 12:35 GMT
Last edited by Allan McRae (Allan) - Wednesday, 12 April 2017, 03:04 GMT
Task Type Feature Request
Category General
Status Closed
Assigned To Andrew Gregory (andrewgregory)
Architecture All
Severity Low
Priority Normal
Reported Version 5.0.1
Due in Version 5.1.0
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

My usecase was using find and pacman -Qo - to build a list of unowned files, but as some contain spaces it results in errors such as:

error: failed to read file '/usr/share/fonts/TTF/Anonymous': No such file or directory
error: failed to find 'Pro' in PATH: No such file or directory
error: failed to find 'Minus' in PATH: No such file or directory
error: failed to find 'BI.ttf' in PATH: No such file or directory

Unless there's a better way to handle this, it would be nice if pacman had a flag such as -0 or -z to accept input strings with null termination.

(Currently my workaround is to use find's -exec with {} +)
This task depends upon

Closed by  Allan McRae (Allan)
Wednesday, 12 April 2017, 03:04 GMT
Reason for closing:  Fixed
Additional comments about closing:  git commit d9908fc1
Comment by Doug Newgard (Scimmia) - Friday, 17 February 2017, 14:39 GMT
Why not just change IFS, read into an array, then feed that to pacman quoted?
Comment by Andrew Gregory (andrewgregory) - Friday, 17 February 2017, 17:26 GMT
Before we add an option for null-terminated input, I'd like to just see us switch to newline-terminated input.
Comment by Earnestly (Earnest) - Friday, 17 February 2017, 21:39 GMT
Hm, newline termination could work. I did try attempt to work around this by assuming pacman -Qo - would support newline termination using -print0 and awk to rearrange RS=\0 to ORS=\n and various IFS= fiddling, all without much success (which now makes sense).
Comment by Earnestly (Earnest) - Thursday, 23 February 2017, 21:18 GMT
Applying the patch series from https://lists.archlinux.org/pipermail/pacman-dev/2017-February/021876.html locally fixes this use-case rather nicely.

Loading...