Bug 1170839 - zu not working as intented
zu not working as intented
Status: IN_PROGRESS
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: libzypp
Current
All Other
: P5 - None : Normal (vote)
: ---
Assigned To: Yunhe Guo
E-mail List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-04-29 14:13 UTC by Miguel Rozsas
Modified: 2020-09-17 19:08 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Miguel Rozsas 2020-04-29 14:13:54 UTC
zu (part of "zp - shorter commands for zypper" package) has a bug that prevents it to work as intended.

The offended line in zu (/etc/profile.d/shorten-zypper.sh) is: 

if grep -Fq '^NAME="openSUSE Tumbleweed"' /etc/os-release 2> /dev/null; then...

The problem is the -F grep's flag (Fixed string) can not be uses with the "^" the meta char in the search string, as it will be taken as literal.
The correct line should be:

if \grep q '^NAME="openSUSE Tumbleweed"' /etc/os-release 2> /dev/null; then
    sudo zypper dist-upgrade --allow-vendor-change "$@"

The "\" at front of grep prevents a user alias to be used and removes the -F so enable match at start of line, as intended.

Also, I would like to suggest the use of --allow-vendor-change to avoid potencial conflicts when using multiple repositories.
Comment 1 Miguel Rozsas 2020-08-31 11:41:35 UTC
ouch, I meant: (fixed a typo in my own proposed solution, changed "grep q" to "grep -q"

The correct line should be:

if \grep -q '^NAME="openSUSE Tumbleweed"' /etc/os-release 2> /dev/null; then
    sudo zypper dist-upgrade --allow-vendor-change "$@"
Comment 2 Benjamin Zeller 2020-09-04 11:52:22 UTC
This is not part of the zypper package, reassigning to maintainer
Comment 3 Yunhe Guo 2020-09-16 08:46:51 UTC
Hi, you can branch the package, add your changes and submit it. The OBS project is https://build.opensuse.org/package/show/utilities/zp
Comment 4 Miguel Rozsas 2020-09-17 19:08:01 UTC
Done.
The branch URL is https://build.opensuse.org/package/show/home:marozsas:branches:utilities/zp

Created a new file zp-0.2.1.tar.gz with the fix and edited zp.changes accordly.