LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   [BUG] Current pkgtools installpkg bug (http://www.linuxquestions.org/questions/slackware-14/%5Bbug%5D-current-pkgtools-installpkg-bug-719166/)

jazzor 04-14-2009 10:07 PM

[BUG] Current pkgtools installpkg bug
 
The latest current update of pkgtools introduces a bug in installpkg script:

The installer will "hang" on packages that do not contain slack-desc.

This is very unfortunate for people who want to just make a quick self made package and use it.

The solution:

Lines 388 to about 400 in the script contains:

Code:

  if [ "$DESCRIPTION" = "" ]; then
    mkdir -p $TMP/scan$$
    ( cd $TMP/scan$$ ; $packagecompression -dc | $TAR xf - install ) < $package 2> /dev/null
    if grep "^$packagebase:" "$TMP/scan$$/install/slack-desc" 1> /dev/null 2> /dev/null ; then
      DESCRIPTION="$TMP/scan$$/install/slack-desc"
    elif grep "^$shortname:" "$TMP/scan$$/install/slack-desc" 1> /dev/null 2> /dev/null ; then
      DESCRIPTION="$TMP/scan$$/install/slack-desc"
    fi
  fi

but it should have a fallback to a blank description file so the script can continue, this is just an example:

Code:

  # If we still don't have a package description, look inside the package.
  # This requires a costly untar.
  if [ "$DESCRIPTION" = "" ]; then
    mkdir -p $TMP/scan$$
    ( cd $TMP/scan$$ ; $packagecompression -dc | $TAR xf - install ) < $package 2> /dev/null
    if grep "^$packagebase:" "$TMP/scan$$/install/slack-desc" 1> /dev/null 2> /dev/null ; then
      DESCRIPTION="$TMP/scan$$/install/slack-desc"
    elif grep "^$shortname:" "$TMP/scan$$/install/slack-desc" 1> /dev/null 2> /dev/null ; then
      DESCRIPTION="$TMP/scan$$/install/slack-desc"
    else
      DESCRIPTION=/etc/slackware-version
    fi
  fi


manwichmakesameal 04-14-2009 10:14 PM

Or you could just touch slack-desc and create a 0 byte file to fulfill the requirement.

rworkman 04-14-2009 10:51 PM

We've run across this one and a few others internally; new packages will arrive sooner or later. Thanks for testing - this is how we (hopefully) make sure that all these nits are gone before a release.

tuxdev 04-14-2009 10:56 PM

If the package doesn't contain a slack-desc or the slack-desc isn't formatted properly, it's not a valid package. Don't expect installpkg to not glitch up. An improperly formatted slack-desc may cause removepkg to not properly remove the package and leave files who-knows-where.

jazzor 04-15-2009 02:13 AM

Since when did you need to have a slack-desc to make a package? I understand that its useful if you are distributing to others, but for personal use, pkgtools has always worked regardless of whether a slack-desc is there or not, and there is nothing invalid about it.

GazL 04-15-2009 03:26 AM

Quote:

Originally Posted by tuxdev (Post 3509149)
If the package doesn't contain a slack-desc or the slack-desc isn't formatted properly, it's not a valid package. Don't expect installpkg to not glitch up.

Whether 'slack-desc' is required or not, allowing the program to hang demonstrates a lack of input validation. It's a bug whichever way you look at it. Programs shouldn't 'glitch up'. They should be coded to fail gracefully.

rworkman 04-15-2009 11:12 PM

Wed Apr 15 22:17:31 CDT 2009
a/pkgtools-12.34567890-noarch-2.tgz: Fixed bugs with package extension
stripping and package description handling that could cause error messages
or hangs during package installs or upgrades. Thanks to Piter Punk,
Alan Hicks, Eric Hameleers, and Robby Workman.
Handle "package not found" with upgradepkg gracefully. Thanks to Shark.

allend 04-16-2009 05:30 AM

My thanks and congratulations to Pat Volkerding and the Slackware crew!

/me pats self on back once again for choosing a distro where a minor bug reported in a key tool has a patch distributed in 24 hours.


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