Project

General

Profile

Actions

Bug #4114

open

grep doesn't support -a option

Added by Alexander Pyhalov over 8 years ago. Updated 10 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
cmd - userland programs
Start date:
2013-09-05
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

illumos grep doesn't support -a option, which causes GNU grep to process a binary file as if it were text


Related issues

Related to illumos gate - Feature #3546: add support for grep -o optionClosedRobert Mustacchi

Actions
Actions #1

Updated by Dan McDonald 10 months ago

Version 0.7 of dehydrated assumes the -a option for grep is available, which makes it break on illumos.

illumos grep implicitly has -a (treat all files like text, printing the hits) semantics. Both GNU grep and BSD grep will, in the face of binary files, do something like this:

macos-x(~)[0]% grep --version
grep (BSD grep) 2.5.1-FreeBSD
macos-x(~)[0]% grep ip `which ifconfig`
Binary file /sbin/ifconfig matches
macos-x(~)[0]% 

So to implement this fix, we must both:

1.) Implement binary-file detection and print a "Binary file" line by default.
2.) Implement the -a option to revert to classic illumos behavior.

Actions #2

Updated by Dan McDonald 10 months ago

Actions

Also available in: Atom PDF