You are not logged in.

#1 2019-10-23 18:39:08

minimalm
Member
From: Juneau, AK
Registered: 2011-09-08
Posts: 23
Website

[SOLVED] Weird issue with grep

I'm trying to do something simple like find out which mesa version I am running (since I'm troubleshooting weird screen tearing issues after this last kernel upgrade.... but that's another topic).  I would assume it should pick out the line and output it like it does on every other unix system I manage.  It starts looking through files.  Here is what I'm seeing:

$ pacman -Q |grep mesa
Binary file .PhpStorm2018.3/system/index/stubs/Stubs.storage.values matches
Binary file .linkassistant/jxbrowser-chromium-64.0.3282.24.6.22.2/libbrowsercore64.so matches
Desktop/upgrade-problem.txt:26:mesa
Desktop/upgrade-problem.txt:26:mesa
Desktop/upgrade-problem.txt:26:mesa
Desktop/upgrade-problem.txt:27:mesa
Desktop/upgrade-problem.txt:28:mesa
Desktop/upgrade-problem.txt:28:mesa
Desktop/upgrade-problem.txt:41:mesa
Desktop/upgrade-problem.txt:50:mesa
Desktop/upgrade-problem.txt:51:mesa
Desktop/upgrade-problem.txt:55:mesa
Desktop/upgrade-problem.txt:56:mesa
Desktop/upgrade-problem.txt:57:mesa
Desktop/upgrade-problem.txt:70:mesa
Desktop/upgrade-problem.txt:81:mesa
Desktop/upgrade-problem.txt:82:mesa
Desktop/upgrade-problem.txt:83:mesa
Desktop/upgrade-problem.txt:86:mesa
Desktop/upgrade-problem.txt:89:mesa
^C

$

But, this is what I expect to see, is this a bug?

$ pacman -Q |grep mesa
lib32-libva-mesa-driver 19.2.1-2
lib32-mesa 19.2.1-2
lib32-mesa-vdpau 19.2.1-2
libva-mesa-driver 19.2.1-2
mesa 19.2.1-2
mesa-demos 8.4.0-2
mesa-vdpau 19.2.1-2

Last edited by minimalm (2019-10-23 20:48:54)

Offline

#2 2019-10-23 19:13:57

loqs
Member
Registered: 2014-03-06
Posts: 19,098

Re: [SOLVED] Weird issue with grep

What is the output of

type -a pacman grep

Offline

#3 2019-10-23 19:18:37

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,526
Website

Re: [SOLVED] Weird issue with grep

Pipes pipe stdout, stderr still goes to the tty unless you specify otherwise:

pacman -Q 2>&1 | grep mesa

Is that output from pacman?  or is it just from grep?  Also, there's no reason to pipe to grep in the first place:

pacman -Qs mesa

But I think that's beside the point as something is odd about either the pacman or grep output.  Still the first step is to figure out which one is producing the output and whether it is to stdout or stderr.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2019-10-23 19:40:16

minimalm
Member
From: Juneau, AK
Registered: 2011-09-08
Posts: 23
Website

Re: [SOLVED] Weird issue with grep

@loqs

$ type -a pacman grep
pacman is /usr/bin/pacman
grep is aliased to `grep -norw --color=auto'
grep is /usr/bin/grep

@Trilby
Output from pacman -Q is normal, listing all the applications I have in my system.  it's the grep filter that is messing up, but now that I see what is output in type, from above (and the fact it works under root), I think it might have something to do with my .bashrc or similar.


If I su to root it works normally:

# pacman -Q|grep mesa
lib32-libva-mesa-driver 19.2.1-2
lib32-mesa 19.2.1-2
lib32-mesa-vdpau 19.2.1-2
libva-mesa-driver 19.2.1-2
mesa 19.2.1-2
mesa-demos 8.4.0-2
mesa-vdpau 19.2.1-2
$ pacman -Q
a52dec 0.7.4-10
aalib 1.4rc5-13
ack 3.1.3-1
acl 2.2.53-1
acroread-fonts-systemwide 1:DC_2015.020.20039-1
adobe-source-code-pro-fonts 2.030ro+1.050it-5
adwaita-icon-theme 3.34.0-1
alsa-lib 1.1.9-2
...
$ pacman -Q 2>&1 | grep mesa
Binary file .PhpStorm2018.3/system/index/stubs/Stubs.storage.values matches
Binary file .linkassistant/jxbrowser-chromium-64.0.3282.24.6.22.2/libbrowsercore64.so matches
Desktop/upgrade-problem.txt:26:mesa
^C
$ pacman -Qs mesa
local/glu 9.0.1-1
    Mesa OpenGL Utility library
local/lib32-glu 9.0.1-1
    Mesa OpenGL utility library (32 bits)
local/lib32-libva-mesa-driver 19.2.1-2
    VA-API implementation for gallium (32-bit)
local/lib32-mesa 19.2.1-2
    An open-source implementation of the OpenGL specification (32-bit)
local/lib32-mesa-vdpau 19.2.1-2
    Mesa VDPAU drivers (32-bit)
local/lib32-vulkan-radeon 19.2.1-2
    Radeon's Vulkan mesa driver (32-bit)
local/libva-mesa-driver 19.2.1-2
    VA-API implementation for gallium
local/mesa 19.2.1-2
    An open-source implementation of the OpenGL specification
local/mesa-demos 8.4.0-2
    Mesa demos and tools incl. glxinfo + glxgears
local/mesa-vdpau 19.2.1-2
    Mesa VDPAU drivers

I like that Qs command thanks for showing me that.

EDIT:  I removed the alias in my bashrc and it's working now....  interesting, thank you.

Last edited by minimalm (2019-10-23 19:42:02)

Offline

#5 2019-10-23 20:07:08

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,406

Re: [SOLVED] Weird issue with grep

man grep wrote:

-r, --recursive
              Read all files under each directory, recursively, following symbolic links only if they are on the command line.  Note that if no file operand is  given,  grep  searches  the
              working directory
.  This is equivalent to the -d recurse option.

Please mark as [SOLVED] by editing the title in your first post.

Offline

Board footer

Powered by FluxBB