Update of bug #46791 (group findutils):
Status: Obsolete => None
Assigned to: jay => berny
Open/Closed: Closed => Open
_______________________________________________________
Follow-up Comment #5:
I see that adding such predicates is almost trivial, as the implementation
has
just to evaluate the already known value of 'struct stat' member 'rdev', and
we
already deal with major/minor numbers in -ls,-fls (although not in -printf).
I also don't see that this would add much risks or bloat, so it may fit quite
well into find(1).
As such, I'm hereby re-opening this one for discussion.
As for the user interface, I'd rather avoid messy parsing of the "x:y"
syntax,
and instead use the gear we already have for other numerical comparisons
(-inum, -gid, -uid, -size, -links) which additionally allows the comparison
with +N (COMP_GT), -N (COMP_LT) and exactly N (COMP_EQ).
# Search the device with number '1:3'.
$ find /dev -major 1 -minor 3 -exec ls -logd '{}' +
crw-rw-rw- 1 1, 3 Jan 5 23:14 /dev/null
# Search all devices with major number <2.
$ find /dev -major -2 -exec ls -logd '{}' +
crw-rw-rw- 1 1, 7 Jan 5 23:14 /dev/full
crw-r--r-- 1 1, 11 Jan 5 23:14 /dev/kmsg
crw-r----- 1 1, 1 Jan 5 23:14 /dev/mem
crw-rw-rw- 1 1, 3 Jan 5 23:14 /dev/null
crw-r----- 1 1, 4 Jan 5 23:14 /dev/port
crw-rw-rw- 1 1, 8 Jan 5 23:14 /dev/random
crw-rw-rw- 1 1, 9 Jan 5 23:14 /dev/urandom
crw-rw-rw- 1 1, 5 Jan 5 23:14 /dev/zero
# Search for all devices with minor number >300.
$ find /dev -type c -minor +300 -exec ls -logd '{}' +
crw-rw-r-- 1 189, 384 Jan 5 23:14 /dev/bus/usb/004/001
crw-rw-r-- 1 189, 385 Jan 5 23:14 /dev/bus/usb/004/002
crw-rw-r-- 1 189, 386 Jan 5 23:14 /dev/bus/usb/004/003
I prototyped that as new predicate names '-major N -minor N',
but I'm not strictly opposed to use more descriptive yet longer names
like '-devmajor N -devminor N' or even '-rdev_major N -rdev_minor N'
to emphasize that this test is limited to char+block devices.
I'm not sure one would rather like to see a combined '-rdev' test, as
e.g. one wouldn't really search with '-rdev 259' for '/dev/null', would one?
Missing at this point: doc (man+texi), tests.
FWIW: the suggested '-major N -minor N' even works for '0:0' devices
found in '/run/systemd/inaccessible/' on my system.
Opinions, objections, ...?
(file #56745)
_______________________________________________________
Additional Item Attachment:
File name: 0001-FIXME-find-add-major-and-minor-predicate-to-search-f.patch
Size: 10KiB
<https://file.savannah.gnu.org/file/0001-FIXME-find-add-major-and-minor-predicate-to-search-f.patch?file_id=56745>
AGPL NOTICE
These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-60bab5f4bb97079a4f50fd30c5633b2562628477.tar.gz
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?46791>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
