[PATCH suggestion] Can't open null for reading when installing from local directory

Pavel Tsekov ptsekov@syntrex.com
Wed Jul 3 05:39:00 GMT 2002


The following code is wrong - choose.cc, default_trust ():

default_trust (HWND h, trusts trust)
{
  chooser->deftrust = trust;
  packagedb db;
  for (size_t n = 1; n <= db.packages.number (); n++)
    {
      packagemeta & pkg = *db.packages[n];
      if (pkg.installed
          || pkg.Categories.getbykey (db.categories.registerbykey ("Base"))
          || pkg.Categories.getbykey (db.categories.registerbykey ("Misc")))
        {
          pkg.desired = pkg.trustp (trust);
          if (pkg.desired)
            {
              // The check below is not sufficient - one have to
              // check if the desired package has a binary package
              // i.e. if pkg.desired->bin.Base() for example returns
              // not NULL value.
              pkg.desired->binpicked = pkg.desired == pkg.installed ? 0 : 1;
              pkg.desired->srcpicked = 0;
            }
        }
      else
        pkg.desired = 0;
    }

This results in the nasty message being showed later in install.cc:

static int
install_one (packagemeta & pkg)
{
  int errors = 0;

  // binpicked is 1 here although we don't have a binary package -
  // install one source will display a message.
  if (pkg.desired->binpicked && pkg.installed != pkg.desired)
    {
      errors +=
        install_one_source (pkg, pkg.desired->bin, "cygfile://","/",
                            package_binary);
      if (!errors)
        pkg.installed = pkg.desired;
    }

The attached patch worked fine for me - I was doing a fresh default install
from a local dir. No error message appeared at all, without the patch
I got some of them.

A similiar or better patch may have to be applied to some other source
files - for example package_meta.cc, packagemeta::set_action () with
two arguments.

This patch is against 2.249.2.4 - I haven't verified if the problem is
still in the latest snapshot.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: choose.cc.patch
Type: application/octet-stream
Size: 492 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-apps/attachments/20020703/2e622da5/attachment.obj>


More information about the Cygwin-apps mailing list