Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Slackware This Forum is for the discussion of Slackware Linux.


  Search this Thread
Old 08-26-2015, 03:01 PM   #1
Registered: Oct 2004
Location: Israel
Distribution: Slackware64-current
Posts: 51

Rep: Reputation: 1
current slackpkg search hates xz

slackpkg-2.82.0-noarch-14 will return all packages if I search xz.
The reason is that slackpkg searches pkglist which looks something like this for each possible package:
repo name version arch name+version+arch+tag path extension
In most (all?) cases the extension is txz, so slackpkg search xz will return all those lines with txz at the end as a good search result.
The solution I used locally is adding sed in /usr/libexec/slackpkg/ lines 708-709:

PKGS=$(sed 's/txz$//g' ${TMPDIR}/pkglist | \
grep "^${i}.*${PATTERN}" | cut -f6 -d\ )

The added sed is something I wanted to avoid, but couldn't find a way to tell grep to work on a line up until 3 spaces before its end without using other commands anyway.
Old 08-27-2015, 05:17 AM   #2
Registered: May 2006
Location: France
Distribution: Slackware
Posts: 774

Rep: Reputation: 588Reputation: 588Reputation: 588Reputation: 588Reputation: 588Reputation: 588

AFAIK, there's no way to force grep to search in a given set of columns, so, sed in this case is not a bad idea.

Another way is to remove the last column with cut, which is a bit faster than sed :

PKGS=$(cut ${TMPDIR}/pkglist -f1-7 -d\ | grep "^${i}.*${PATTERN}" | cut -f6 -d\ )
Excluding the last column, (with sed or cut) have a side effect: users cannot search package based on their extension anymore. To workaround this :
if echo "${PATTERN}" | grep -q "^t[gx]z$" ; then
  PKGS=$(grep "^${i}.*${PATTERN}" ${TMPDIR}/pkglist | cut -f6 -d\ )
  PKGS=$(cut ${TMPDIR}/pkglist -f1-7 -d\ | \
    grep "^${i}.*${PATTERN}" | cut -f6 -d\ )        
note: slackpkg+ is impacted by this issue too.

Here is the patches to fix this issue in slackpkg and slackpkg+ :

Last edited by phenixia2003; 08-27-2015 at 08:31 AM.
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] slackpkg+ and -current ymf331 Slackware 2 08-26-2014 03:11 AM
[SOLVED] strange result in slackpkg search lvdd Slackware 2 09-03-2013 12:06 PM
[SOLVED] bug in slackpkg search? swatnio Slackware 9 05-27-2013 08:14 PM
[SOLVED] Slackpkg package search function ADX Slackware 3 07-15-2011 01:49 PM
Updating to -current with slackpkg macbeth8 Slackware 8 04-04-2008 08:14 PM > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:21 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration