bin/74926: look(1) will silently ignore input from non-disk based files.

Diomidis Spinellis dds at spiti.spinellis.gr
Fri Dec 10 10:40:22 PST 2004


>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 at 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:


More information about the freebsd-bugs mailing list