LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Bug in slackpkg -- fail to find installed package? (http://www.linuxquestions.org/questions/slackware-14/bug-in-slackpkg-fail-to-find-installed-package-734796/)

grissiom 06-22-2009 11:13 AM

Bug in slackpkg -- fail to find installed package?
 
slackpkg say I don't have qt3 package installed. But actually I have...

Code:

        root 2009-06-22 23:17 @darkstar
/ext4/slackware_rsync# slackpkg search qt3

The list below shows all packages with the selected pattern.

[ installed ] - kdebase-runtime-4.2.4-x86_64-1
[ installed ] - qt-r964497-x86_64-1
[uninstalled] - qt3-3.3.8b-x86_64-opt2


        root 2009-06-22 23:17 @darkstar
/ext4/slackware_rsync# ls /var/log/packages|grep qt3
qt3-3.3.8b-x86_64-opt2

        root 2009-06-23 0:10 @darkstar
/ext4/slackware_rsync#


willysr 06-22-2009 02:44 PM

You need to mention slackpkg version :)

grissiom 06-23-2009 11:41 AM

Oh, I always stay with current. So the version is slackpkg-2.71.2-noarch-2

mRgOBLIN 06-23-2009 03:37 PM

Thanks for the report. It was a bug and should be fixed in the next slackpkg release.

grissiom 07-15-2009 07:08 PM

Bug still exits in slackpkg - version 2.80.1

mRgOBLIN 07-15-2009 07:57 PM

Yes so it is.

Will run it past PiterPunk

niels.horn 07-15-2009 11:10 PM

The problem lies in the "opt2" extension of the slackpkg script.

In /usr/sbin/slackpkg at line 464 you'll find:
Code:

INSTPKG=$(ls -1 /var/log/packages | \
        grep -e "^${BASENAME}-[^-]\+-\(${ARCH}\|fw\|noarch\)-[[:digit:]]\+")

Most packages end with the "build-version" like -1, -2, -3 etc.

The qt3 package is optional and ends with -opt2 and therefore is not found as "installed" by Slackpkg.

The solution would be to change the line as follows:

Code:

INSTPKG=$(ls -1 /var/log/packages | \
        grep -e "^${BASENAME}-[^-]\+-\(${ARCH}\|fw\|noarch\)-[[:alpha:]]*[[:digit:]]\+")

This seems to work, as "slackpkg search qt3" returns:
Code:

[ installed ] - kdebase-runtime-4.2.4-x86_64-1
[ installed ] - qt-r994599-x86_64-1
[ installed ] - qt3-3.3.8b-x86_64-opt2

Note: I am not an expert, just a big fan of Slackpkg and have made some changes in the scripts before :)

mRgOBLIN 07-16-2009 01:23 AM

Thanks niels, yes we knew what the problem was but I think PP forgot to apply the fix :)

niels.horn 07-16-2009 05:26 AM

ok!

By the way, the same little bug also crept into the "info" function of Slackpkg.

"slackpkg info qt3" gives this result:
Code:

No packages found! Try:

        slackpkg search qt3

and choose one (and ONLY one package).

Changing the function like this (lines 484+):
Code:

        "info")
                PATTERN=`echo $INPUTLIST | sed -e 's/\+/\\\+/g' -e 's/\./\\\./g'`
                NAME=$(cutpkg $PATTERN)
                awk -F: "/PACKAGE NAME:.* ${NAME}-[^-]+-(${ARCH}|fw|noarch)-[[:alpha:]]*[[:digit:]]+/,/^$/ {
                                found=1
                                if (\$1 ~ /"$NAME"/) {
                                print \$PATTERN
                                } else {
                                print \$0
                                }
                        }
                        END {
                                if ( found != 1 ) {
                        print \"No packages found! Try:\n\n\tslackpkg search $PATTERN\n\nand choose one (and ONLY one package).\n\"
                                }
                        }" ${WORKDIR}/PACKAGES.TXT 2>/dev/null
        ;;

solved it as well!


All times are GMT -5. The time now is 07:32 PM.