Skip to content

ads-github-merge-all-upstreams: unset GREP_OPTIONS to prevent warning from GNU grep 2.11+ #29

@salewski

Description

@salewski

The ads-github-merge-all-upstreams program should unset the 'GREP_OPTIONS'
environment variable prior to any grep invocation in order to avoid the
following warning message emitted by versions of GNU grep newer than version
2.11 when the variable is set:

    grep: warning: GREP_OPTIONS is deprecated; please use an alias or script

Pros

  1. When GNU grep 2.11 or newer is being used, then the above warning
    message will not be emitted on stderr if the user has the
    'GREP_OPTIONS' variable set. This is a "pro" because it avoids giving
    the impression to the user that the ads-github-merge-all-upstreams
    program is faulty in its use of grep. This behavior could also be seen
    as a "con"; see below.

  2. When GNU grep older than version 2.11 is being used, the behavior of
    grep becomes more predictable as this change avoids implicitly adding
    a bunch of arbitrary options to the grep invocation that we have no
    control over.

Cons

  1. When GNU grep 2.11 or newer is being used, then the above warning
    message will not be emitted on stderr if the user has the
    'GREP_OPTIONS' variable set. This could be seen as a "con" because it
    "papers over" the issue. The user may not be aware that setting
    GREP_OPTIONS could be problematic, and this behavior contributes to
    keeping that information suppressed.

Background

Prior to GNU grep 2.11 (~2014-11), the 'GREP_OPTIONS' environment variable
could be used (without warning) to add options to each grep invocation. The
author of this bug report used it for years without problems, but only because
his use of it was simple and the options used innocuous. The feature itself,
however, is dangerous so was deprecated.

See also:

Metadata

Metadata

Assignees

No one assigned

    Labels

    resolution:fixedRead as "fixed OR done OR implemented OR answered"status:resolvedtype:featureAdds a new capability or behavioral property

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions