Date: Fri, 10 Dec 2004 20:31:30 +0200 (EET) From: Diomidis Spinellis <dds@spiti.spinellis.gr> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/74926: look(1) will silently ignore input from non-disk based files. Message-ID: <200412101831.iBAIVUh2085679@spiti.spinellis.gr> Resent-Message-ID: <200412101840.iBAIeMuV009425@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 74926 >Category: bin >Synopsis: look(1) will silently ignore input from non-disk based files. >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Dec 10 18:40:21 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Diomidis Spinellis >Release: FreeBSD 4.10-STABLE i386 >Organization: AUEB >Environment: System: FreeBSD spiti.spinellis.gr 4.10-STABLE FreeBSD 4.10-STABLE #8: Fri Oct 8 18:28:03 EEST 2004 dds@spiti.spinellis.gr:/vol/obj/vol/src/sys/SPITI i386 >Description: Look(1) will not work on non disk based files. The program's design relies on having its input in memory (via mmap). No provisions are made for files that can not be mmaped. >How-To-Repeat: look hyppo </usr/share/dict/words >Fix: Performing a binary search on sequential input does not make sense. Therefore, either add code to perform a linear scan or map the look(1) invocation into an equivalent sed(1) command: # If -f y/:upper:/:lower:/ # Use the actual characters here # if -d s/[^:alnum:]//g # Always /^word/,${ /^word/!q p } Example: sed -ne 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/;/^hyppo/,${;/^hyppo/!q;p;}' </usr/share/dict/words (When file arguments are specified add /dev/null before the first argument to ensure that no further commands are given to sed.) >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200412101831.iBAIVUh2085679>