[Bug 255990] when there's in environment set GREP_OPTIONS '--color=always' it breaks freebsd-update

From: <bugzilla-noreply_at_freebsd.org>
Date: Wed, 19 May 2021 07:54:50 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=255990

            Bug ID: 255990
           Summary: when there's in environment set GREP_OPTIONS
                    '--color=always' it breaks freebsd-update
           Product: Base System
           Version: Unspecified
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: oleg@pcbtech.ru

Hi all,
if i have in my shell profile set environment GREP_OPTIONS '--color=always' I
always get freebsd-update error:

$ freebsd-update fetch install
src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching metadata signature for 13.0-RELEASE from update1.freebsd.org... done.
Fetching metadata index... done.

The update metadata index is correctly signed, but
failed an integrity check.
Cowardly refusing to proceed any further.

After some researching i found out that the problem is in
/usr/sbin/freebsd-update at line #1293 :
  1288  # Sanity check all the lines of tINDEX.new.  Even if more metadata
lines
  1289  # are added by future versions of the server, this won't cause
problems,
  1290  # since the only lines which appear in tINDEX.new are the ones which we
  1291  # specifically grepped out of ${TINDEXHASH}.
  1292  fetch_metadata_index_sanity () {
  1293          if grep -qvE '^[0-9A-Z.-]+\|[0-9a-f]{64}$' tINDEX.new; then
  1294                  fetch_metadata_bogus " index"
  1295                  return 1
  1296          fi
  1297  }

when grep-ing tINDEX.new, there're unexpected ESC-color sequences and,
obviously, it fails

-- 
You are receiving this mail because:
You are the assignee for the bug.