pkgsrc-Users archive

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

Re: KDE and the compose key



On Wednesday 12 September 2012 11:55:55 Jan Danielsson wrote:
> On 09/12/12 19:44, Sverre Froyen wrote:
> [---]
> 
> > Turns out the issue was "cap_mkdb /etc/login.conf" command. If the file
> > /etc/login.conf.db exists, cap_mkdb reads that file (ignoring
> > /etc/login.conf) and generates a new /etc/login.conf.db from the old
> > /etc/login.conf.db. Seems to me this is counter intuitive, if not a bug.
> > If I remove /etc/login.conf.db before running cap_mkdb, everything works
> > as expected.
> 
>    I'm sure I've seen this before.
> 
>    Ah, yes: http://gnats.netbsd.org/41660
> 
>    If I recall correctly, someone went through the ~same process as you
> before they filed that PR, and I can't recall anyone making any argument
> against the "it's a bug" claim.

Here's a patch that warns you if cap_mkdb will read the db file. It's 
obviously a hack but I have no idea about how and for what cap_mkdb is being 
used.

Regards,
Sverre
Index: usr.bin/cap_mkdb/cap_mkdb.c
===================================================================
RCS file: /cvsroot/src/usr.bin/cap_mkdb/cap_mkdb.c,v
retrieving revision 1.27
diff -u -p -r1.27 cap_mkdb.c
--- usr.bin/cap_mkdb/cap_mkdb.c 29 Aug 2011 13:56:17 -0000      1.27
+++ usr.bin/cap_mkdb/cap_mkdb.c 12 Sep 2012 22:22:40 -0000
@@ -84,7 +84,7 @@ static HASHINFO openinfo = {
 int
 main(int argc, char *argv[])
 {
-       int c, byteorder;
+       int c, byteorder, fd;
        char *p;
 
        capname = NULL;
@@ -118,6 +118,23 @@ main(int argc, char *argv[])
        openinfo.lorder = byteorder;
 
        /*
+        * XXX If argv refers to the text file and the db file exists,
+        * do_build (using cgetnext) will read the db file, not the
+        * text file. The resulting db file will therefore be a copy of
+        * the existing one. Interestingly, count_records reads the
+        * text file.
+        *
+        * The warning should prompt the user to rm the db file.
+        */
+       (void)snprintf(buf, sizeof(buf), "%s.db", *argv);
+       if ((fd = open(buf, O_RDONLY)) > 0) {
+               (void)fprintf(stderr,
+                   "%s: warning: %s exists (%s ignored) rm %s?\n",
+                   getprogname(), buf, *argv, buf);
+               (void)close(fd);
+       }
+
+       /*
         * Set nelem to twice the value returned by count_record().
         */
        openinfo.nelem = count_records(argv) << 1;


Home | Main Index | Thread Index | Old Index