KittyKatt / screenFetch

Fetches system/theme information in terminal for Linux desktop screenshots.
GNU General Public License v3.0
3.88k stars 454 forks source link

awk: cmd. line:7: warning: regexp escape sequence `\"' is not a known regexp operator #627

Closed arklee closed 4 years ago

arklee commented 5 years ago

I'm submitting a ... (check one with "x")

[x] bug report
[ ] new distro request

Bug report

=> search Github for a similar issue or PR before submitting
after an update,when I run screenfetch,it reports "awk: cmd. line:7: warning: regexp escape sequence `\"' is not a known regexp operator".I think it's a problem of awk,so when I switch from gawk to nawk, it disappeared.But for some reasons I still need to use gawk,I wonder if there is any solution.

=> download the latest revision from Github and check if the bug is still present
   -> https://github.com/KittyKatt/screenFetch/raw/master/screenfetch-dev
yes

=> Show us the output of: screenfetch -v
:: Finding distro...found as 'Gentoo testing'
:: Finding hostname and user...found as 'arkli@Gentoo'
:: Finding kernel version...found as 'x86_64 Linux 5.1.15-gentoo'
:: Finding current uptime...found as '21m'
:: Finding current package count...found as '974'
:: Finding current shell...found as 'zsh 5.7.1'
:: Finding current resolution(s)...found as '2560x1440'
awk: cmd. line:7: warning: regexp escape sequence `\"' is not a known regexp operator
:: Finding desktop environment...found as 'GNOME '
:: Finding window manager...found as 'GNOME Shell'
:: Finding window manager theme...found as 'Adapta-Nokto'
:: Finding GTK2 theme...found as 'Adapta-Nokto'
:: Finding GTK3 theme...found as 'Adapta-Nokto'
:: Finding icon theme...found as 'Papirus-Dark'
:: Finding user font...found as 'SFNS Display 12'
:: Finding current CPU...found as 'Intel Core i7-7700K @ 8x 4.5GHz [27.8°C]'
:: Finding current GPU...found as 'GeForce GTX 1070'
:: Finding current RAM usage...found as '1451MiB / 15984MiB'
         -/oyddmdhs+:.                arkli@Gentoo
     -odNMMMMMMMMNNmhy+-`             OS: Gentoo testing
   -yNMMMMMMMMMMMNNNmmdhy+-           Kernel: x86_64 Linux 5.1.15-gentoo
 `omMMMMMMMMMMMMNmdmmmmddhhy/`        Uptime: 21m
 omMMMMMMMMMMMNhhyyyohmdddhhhdo`      Packages: 974
.ydMMMMMMMMMMdhs++so/smdddhhhhdm+`    Shell: zsh 5.7.1
 oyhdmNMMMMMMMNdyooydmddddhhhhyhNd.   Resolution: 2560x1440
  :oyhhdNNMMMMMMMNNNmmdddhhhhhyymMh   DE: GNOME 
    .:+sydNMMMMMNNNmmmdddhhhhhhmMmy   WM: GNOME Shell
       /mMMMMMMNNNmmmdddhhhhhmMNhs:   WM Theme: Adapta-Nokto
    `oNMMMMMMMNNNmmmddddhhdmMNhs+`    GTK Theme: Adapta-Nokto [GTK2/3]
  `sNMMMMMMMMNNNmmmdddddmNMmhs/.      Icon Theme: Papirus-Dark
 /NMMMMMMMMNNNNmmmdddmNMNdso:`        Font: SFNS Display 12
+MMMMMMMNNNNNmmmmdmNMNdso/-           CPU: Intel Core i7-7700K @ 8x 4.5GHz [27.8°C]
yMMNNNNNNNmmmmmNNMmhs+/-`             GPU: GeForce GTX 1070
/hMMNNNNNNNNMNdhs++/-`                RAM: 1451MiB / 15984MiB
`/ohdmmddhys+++/:.`                  
  `-//////:--.                       
darealshinji commented 5 years ago

after an update,when I run screenfetch,it reports "awk: cmd. line:7: warning: regexp escape sequence `\"' is not a known regexp operator".I think it's a problem of awk,so when I switch from gawk to nawk, it disappeared.But for some reasons I still need to use gawk,I wonder if there is any solution.

I don't have such an issue:

$ awk --version
GNU Awk 4.1.4, API: 1.1 (GNU MPFR 4.0.1, GNU MP 6.1.2)

I don't know why it says line 7 because that's just a comment line. You can try to find out where exactly inside the script awk is creating this warning by running bash -x ./screenfetch-dev >log.txt 2>&1 and taking a look at the log file.

arklee commented 5 years ago

It's a problem of gawk,I downgrade gawk from 5.0.1 to 4.2.1 then this report of "awk : cmd..." disappeared.

BiagioFesta commented 5 years ago

The issue in the script seems to be located here: screenfetch-dev:1924.

In particular,

gsub(/\"/,"",de)

gawk 5.0.1 does not recognize the expression \" as regex operator.

darealshinji commented 5 years ago

Hopefully fixed now.

mureithimaina commented 5 years ago

not yet in arch linux

mb1986 commented 5 years ago

not yet in arch linux

In Arch you can use screenfetch-git package.

SingularBunny commented 5 years ago

In Arch you can use screenfetch-git package.

Doesn't help.

GreenHatHG commented 5 years ago

In Arch you can use screenfetch-git package.

Doesn't help.

I installed screenfetch-git to solve the problem.

yay -S screenfetch-git

20190929095809.png The new version does not show CPU temperature

KittyKatt commented 5 years ago

@SingularBunny A little more than "Doesn't help." would help us. Is the gawk error fixed, but another error is present?

@GreenHatHG That's interesting, no idea why that's happening. Might have to open a new issue about that.

cfraizer commented 5 years ago

I think the real problem is on line 1603:

gpu=$(system_profiler SPDisplaysDataType | awk -F': ' '/^\ *Chipset Model:/ {print $2}' | awk '{ printf "%s / ", $0 }' | sed -e 's/\/ $//g')

I removed the backslash \ before *Chipset Model and the warning disappeared on my machine.

I can submit a pull request if that's useful.

cfraizer commented 5 years ago

@SingularBunny or @arklee, can one of you try the new version on your system and confirm that the problem is resolved?

My change worked for me and seems likely (to me) to fix the problem generally, but I'm not able to check other platforms or versions of Bash or {Gawk,Awk}.

All you have to do is this:

$ cd /tmp
$ git clone https://github.com/KittyKatt/screenFetch
$ cd screenFetch
$ ./screenfetch-dev
pgilad commented 5 years ago

@cfraizer Just tried the above recipe, can confirm the above awk bug is fixed 💯 Thank you very much 🏆 image

cartwright commented 5 years ago

I had to remove a different slash. In the DE Detection block at line 980, the first IF statement, the gsub function. Deleting the backslash fixed the problem for me. log.txt of pre-fix and current, working script on my machine attached.

log.txt

screenfetch.txt

bu4ak commented 4 years ago

Same issue. Fedora 31

dcermak commented 4 years ago

This issue does not occur on openSUSE Tumbleweed with gawk 5.0.1 and screenfetch 3.9.1.

X3MBoy commented 4 years ago

Same issue. Fedora 31

Confirmed is still in Fedora 31 gawk and screenfetch versions are:

$ sudo dnf info gawk
Last metadata expiration check: 0:00:24 ago on Mon 02 Dec 2019 09:18:52 AM -03.
Installed Packages
Name         : gawk
Version      : 5.0.1
Release      : 5.fc31
Architecture : x86_64
Size         : 2.9 M
Source       : gawk-5.0.1-5.fc31.src.rpm
Repository   : @System
From repo    : anaconda
Summary      : The GNU version of the AWK text processing utility
URL          : https://www.gnu.org/software/gawk/
License      : GPLv3+ and GPLv2+ and LGPLv2+ and BSD
Description  : The gawk package contains the GNU version of AWK text processing utility. AWK is
             : a programming language designed for text processing and typically used as a data
             : extraction and reporting tool.
             : 
             : The gawk utility can be used to do quick and easy text pattern matching,
             : extracting or reformatting. It is considered to be a standard Linux tool for
             : text processing.

$ sudo dnf info screenfetch 
Last metadata expiration check: 0:00:51 ago on Mon 02 Dec 2019 09:18:52 AM -03.
Installed Packages
Name         : screenfetch
Version      : 3.8.0
Release      : 6.fc31
Architecture : noarch
Size         : 271 k
Source       : screenfetch-3.8.0-6.fc31.src.rpm
Repository   : @System
From repo    : fedora
Summary      : A "Bash Screenshot Information Tool"
URL          : https://github.com/KittyKatt/screenFetch
License      : GPLv3+
Description  : This handy Bash script can be used to generate one of
             : those nifty terminal theme information + ASCII distribution
             : logos you see in everyone's screen-shots nowadays. It will
             : auto-detect your distribution and display an ASCII version
             : of that distribution's logo and some valuable information
             : to the right. There are options to specify no ASCII art,
             : colors, taking a screen-shot upon displaying info, and even
             : customizing the screen-shot command! This script is very easy
             : to add to and can easily be extended.
dodona2 commented 4 years ago

I confirmed it still is in Fedora 31

X3MBoy commented 4 years ago

Are you using git or a package? Package is maintained upstream.

I'm using it from repository. It looks like it is on the fedora main repository.

X3MBoy commented 4 years ago

Well, I fix it by deleting the extra character in line 1591 on the script that is packaged in Fedora. I saw the line in the screenfetch-dev file and I just edited the script. I think this could be better managed, but it's a solution:

Change: gsub(/\"/,"",de)

By: gsub(/"/,"",de)

X3MBoy commented 4 years ago

I thing this could be closed as it is fixed in 3.9.1. Also, for Fedora I sent a PR to get the latest version

bu4ak commented 4 years ago

Still occurs. Fedora 32

X3MBoy commented 4 years ago

Still occurs. Fedora 32

It's because they are shipping and outdated version. The newest version fix the problem

dralley commented 4 years ago

I've filed a bugzilla for this in the Fedora tracker

https://bugzilla.redhat.com/show_bug.cgi?id=1818538

barracuda156 commented 10 months ago

@X3MBoy I think it is still broken:

gawk: cmd. line:22: warning: regexp escape sequence `\#' is not a known regexp operator