Hi

I stumbled upon the same file size limitation of "look" today
(incidentally, doing a similar thing as Stephane).

I believe the bug in the file size check can be fixed by patching the
Makefile so that the correct define is used. SIZE_MAX was introduced in
C99 for this purpose:

--- a/usr.bin/look/Makefile     2017-12-29 10:02:09.000000000 +0100
+++ b/usr.bin/look/Makefile     2018-10-06 17:36:49.010093578 +0200
@@ -1,6 +1,6 @@
 PROG = look
 LIBS += -lbsd
-FLAGS = -include bsd/err.h -DSIZE_T_MAX=INT_MAX
+FLAGS = -include bsd/err.h -DSIZE_T_MAX=SIZE_MAX

 topdir=../..
 include $(topdir)/config.mk

After a quick look at the code I couldn't find any problems with that.
All relevant variables indeed seem to be using size_t, not int.

"look" from bsdmainutils 11.1.2 with this patch applied on Debian
Stretch seems to work as expected on a file roughly 22 GiB in size. It
will correctly find lines at the start as well as at the end of the file.

Best regards
Tomaž

Reply via email to