Re: bsdgrep --null has no effect

From: Jan Beich <jbeich_at_tormail.net>
Date: Sun, 27 Nov 2011 19:07:30 +0800
Jan Beich <jbeich_at_tormail.net> writes:

> "O. Hartmann" <ohartman_at_zedat.fu-berlin.de> writes:
>
>> ===>  Patching for stellarium-0.11.1
>> sed:
>> /usr/ports/astro/stellarium/work/stellarium-0.11.1/src/core/external/fixx11h.h
>> /usr/ports/astro/stellarium/work/stellarium-0.11.1/src/CMakeLists.txt
>> /usr/ports/astro/stellarium/work/stellarium-0.11.1/plugins/TelescopeControl/src/TelescopeControl.hpp
>> /usr/ports/astro/stellarium/work/stellarium-0.11.1/plugins/Oculars/src/Oculars.hpp
>> /usr/ports/astro/stellarium/work/stellarium-0.11.1/plugins/CompassMarks/src/CompassMarks.hpp
>> /usr/ports/astro/stellarium/work/stellarium-0.11.1/plugins/TextUserInterface/src/TextUserInterface.hpp
>> /usr/ports/astro/stellarium/work/stellarium-0.11.1/plugins/Supernovae/src/Supernovae.hpp
>> /usr/ports/astro/stellarium/work/stellarium-0.11.1/plugins/SolarSystemEditor/src/SolarSystemEditor.hpp
>> /usr/ports/astro/stellarium/work/stellarium-0.11.1/plugins/Satellites/src/Satellites.hpp
>> /usr/ports/astro/stellarium/work/stellarium-0.11.1/plugins/HelloStelModule/src/HelloStelModule.hpp
>> /usr/ports/astro/stellarium/work/stellarium-0.11.1/plugins/TimeZoneConfiguration/src/TimeZoneConfiguration.hpp
>> /usr/ports/astro/stellarium/work/stellarium-0.11.1/plugins/AngleMeasure/src/AngleMeasure.hpp
>> : File name too long
>> *** Error code 1
>
> Do you use bsdgrep? ${GREP} -Rl --null ... | ${XARGS} -0 ... won't work.
>
>   $ gnugrep -l --null . /usr/include/md*.h | vis
>   /usr/include/md2.h\^_at_/usr/include/md4.h\^_at_/usr/include/md5.h\^_at_
>
>   $ bsdgrep -l --null . /usr/include/md*.h | vis
>   /usr/include/md2.h
>   /usr/include/md4.h
>   /usr/include/md5.h

Oops, here is a diff. Non -l/-L case still seems to be broken.

  $ echo t >a; echo t >b; echo t >c
  $ gnugrep --null . ? | vis
  a\^_at_t
  b\^_at_t
  c\^_at_t

  $ bsdgrep --null . ? | vis
  a\^_at_:t
  b\^_at_:t
  c\^_at_:t

Index: usr.bin/grep/util.c
===================================================================
--- usr.bin/grep/util.c	(revision 228003)
+++ usr.bin/grep/util.c	(working copy)
_at__at_ -246,9 +246,9 _at__at_ procfile(const char *fn)
 		printf("%u\n", c);
 	}
 	if (lflag && !qflag && c != 0)
-		printf("%s\n", fn);
+		printf("%s%c", fn, nullflag ? 0 : '\n');
 	if (Lflag && !qflag && c == 0)
-		printf("%s\n", fn);
+		printf("%s%c", fn, nullflag ? 0 : '\n');
 	if (c && !cflag && !lflag && !Lflag &&
 	    binbehave == BINFILE_BIN && f->binary && !qflag)
 		printf(getstr(8), fn);
Received on Sun Nov 27 2011 - 11:43:37 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:21 UTC