https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259197

Daniel Tameling <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #9 from Daniel Tameling <[email protected]> ---
(In reply to Craig Leres from comment #5)

I don't think it is a good idea to remove the -f flag from the wrapper script.
Quoting the xz man page: "When used with --decompress --stdout and xz cannot
recognize the type of the source file, copy the source file as is to standard
output.  This allows xzcat --force to be used like cat(1) for files that have
not been compressed with xz."

So currently you can search normal files simultaneously with xz archives with a
single command. E.g. if one uses xz to compress /var/log/messages one can use
  xzgrep harfbuzz /var/log/messages*
to search all files.

Without the flag one would get the warnings for the non-xz files, but they
wouldn't be passed to stdout.

The upstream xzgrep file also uses the -f flag, so changing it in base would
reduce the portability of scripts.

However, upstream has a way to deal with the situation: it invokes other
programs, depending on the file ending:
  case $i in
    *[-.][zZ] | *_z | *[-.]gz | *.t[ag]z) uncompress="gzip -cdf";;
    *[-.]bz2 | *[-.]tbz | *.tbz2) uncompress="bzip2 -cdf";;
    *[-.]lzo | *[-.]tzo) uncompress="lzop -cdf";;
    *[-.]zst | *[-.]tzst) uncompress="zstd -cdfq";; # zstd needs -q.
    *[-.]lz4) uncompress="lz4 -cdf";;
    *) uncompress="$xz -cdfqQ";; # -qQ to ignore warnings like unsupp. check.
  esac
Something similar could be implemented in our wrapper script if one really
wants to address the issue.

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

Reply via email to