This is the mail archive of the cygwin-apps@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

Attachment: choose.cc.patch
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]