[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

libdb2 or Hurd issue?



Okay, I went digging through the source, and it seems that libdb2, like
rpm, assumes some things about O_RDONLY/O_WRONLY/O_RDWR which are not
true on the Hurd.

So far, this means that two out of three packages that I've hacked on
the Hurd have had this problem; by no means scientific proof, but not
ignorable in any case.

So... should I fix the Hurd, or potentially lots of packages?  The patch
for libdb2 is attatched below to illustrate the problem.  The comments
from this libdb2 source file are:

        /*
         * XXX
         * Convert POSIX 1003.1 open(2) flags to DB flags.  Not an exact
         * science as most POSIX implementations don't have a flag value
         * for O_RDONLY, it's simply the lack of a write flag.
         */

(Would this be a Hurd thing or a mach thing?  I'm still unclear about
how
some of the stuff is delegated...)

-Jay 'Eraserhead' Felice

*** BEGIN PATCH ***
The test if for whether a file's access mode is read only fails on the
Hurd.
The Hurd has a read bit (0x1) and a write bit (0x2); O_RDWR is 0x3.  The
original read-only test determines that O_RDWR is read only.

--- os_oflags.c.orig    Fri Dec 29 01:14:09 2000
+++ os_oflags.c Fri Dec 29 01:15:55 2000
@@ -41,8 +41,13 @@
        dbflags = 0;
        if (oflags & O_CREAT)
                dbflags |= DB_CREATE;
+#ifdef O_ACCMODE
+       if ((oflags & O_ACCMODE) == O_RDONLY)
+               dbflags |= DB_RDONLY;
+#else  
        if (!(oflags & (O_RDWR | O_WRONLY)) || oflags & O_RDONLY)
                dbflags |= DB_RDONLY;
+#endif 
        if (oflags & O_TRUNC)
                dbflags |= DB_TRUNCATE;
        return (dbflags);
*** END PATCH ***



Reply to: