Ticket #5 (closed defect: fixed)

Opened 7 years ago

Last modified 7 years ago

rpm fails with "cannot open Packages database"


Reported by: atkac Assigned to: pmatilai Priority: major Milestone:
Component: rpm Version: RPM Development Keywords: Cc:


Description

rpm -i <package> fails with "cannot open Packages database" error on GNU/Hurd system. After quick debugging problem is in rpmdb.c:openDatabase function. It has this code there:

if (mode & O_WRONLY)

return 1;

Main problem is that GNU/Hurd has this O_RDWR definition:

#define O_RDWR (O_RDONLY|O_WRONLY)

so rpm fails even if O_RDWR is set. POSIX says:

"In historical implementations the value of O_RDONLY is zero. Because of that, it is not possible to detect the presence of O_RDONLY and another option. Future implementations should encode O_RDONLY and O_WRONLY as bit flags so that:

O_RDONLY | O_WRONLY == O_RDWR "

I'm not sure what will be the proper patch because Linux has O_RDONLY == 0. It seems that "#ifdef linux" will help or that condition will be eliminated.

Change History

11/03/08 17:51:19 changed by atkac

Better fix is suggested on http://lists.gnu.org/archive/html/bug-hurd/2008-11/msg00021.html

11/03/08 19:00:17 changed by pmatilai

  • status changed from new to assigned.

Ok, that's a nice one, will do - there are a few other places in rpm that need a similar change.

11/04/08 08:01:50 changed by pmatilai

  • status changed from assigned to closed.
  • resolution set to fixed.

Should be fixed now in rpm.org HEAD, all access mode tests are now done using O_ACCMODE masks (unless of course I missed some spot :)