Current-Users archive

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

pax and malloc.conf



 Hi.

 While making release sets for evbarm, I found a strange behavior.

(on i386 -current)
> # ./build.sh -j3 -m evbarm
 (snip)
> --- do-modules ---
> #    create  modules.tgz
> cd /disk/sources/4NetBSD-current/src/distrib/sets &&  
> DESTDIR=/disk/sources/4NetBSD-current/src/obj/destdir.evbarm  MACHINE=evbarm  
> MACHINE_ARCH=arm  
> AWK=/disk/sources/4NetBSD-current/src/obj/tooldir.NetBSD-6.99.11-i386/bin/nbawk
>   
> CKSUM=/disk/sources/4NetBSD-current/src/obj/tooldir.NetBSD-6.99.11-i386/bin/nbcksum
>   
> DB=/disk/sources/4NetBSD-current/src/obj/tooldir.NetBSD-6.99.11-i386/bin/nbdb 
>  HOST_SH=/bin/sh  
> MAKE=/disk/sources/4NetBSD-current/src/obj/tooldir.NetBSD-6.99.11-i386/bin/nbmake
>   
> MKTEMP=/disk/sources/4NetBSD-current/src/obj/tooldir.NetBSD-6.99.11-i386/bin/nbmktemp
>   
> MTREE=/disk/sources/4NetBSD-current/src/obj/tooldir.NetBSD-6.99.11-i386/bin/nbmtree
>   
> PAX=/disk/sources/4NetBSD-current/src/obj/tooldir.NetBSD-6.99.11-i386/bin/nbpax
>   COMPRESS_PROGRAM=gzip  
> PKG_CREATE=/disk/sources/4NetBSD-current/src/obj/tooldir.NetBSD-6.99.11-i386/bin/nbpkg_create
>   
> SED=/disk/sources/4NetBSD-current/src/obj/tooldir.NetBSD-6.99.11-i386/bin/nbsed
>   TSORT=/disk/sources/4NetBSD-current/src/o
 bj/tool
dir.NetBSD-6.99.11-i386/bin/nbtsort\ -q  /bin/sh ./maketars -d 
/disk/sources/4NetBSD-current/src/obj/destdir.evbarm     -N 
/disk/sources/4NetBSD-current/src/etc -t 
/disk/sources/4NetBSD-current/src/obj/releasedir/evbarm/binary/sets modules  || 
{ rm -f 
/disk/sources/4NetBSD-current/src/obj/releasedir/evbarm/binary/sets/modules.tgz;
 false; }
> Creating modules.tgz
> pax: Unable to access XX/etc/mtree/set.modules (No such file or directory) 
> <=== !!!
> *** [do-modules] Error code 1
> nbmake: stopped in /disk/sources/4NetBSD-current/src/distrib/sets
> 1 error
> nbmake: stopped in /disk/sources/4NetBSD-current/src/distrib/sets
> *** [release] Error code 2
> nbmake: stopped in /disk/sources/4NetBSD-current/src/etc
> 1 error
> nbmake: stopped in /disk/sources/4NetBSD-current/src/etc
> *** [release] Error code 2
> 
> nbmake: stopped in /disk/sources/4NetBSD-current/src
> 1 error
> 
> nbmake: stopped in /disk/sources/4NetBSD-current/src
> 
> ERROR: Failed to make release
> *** BUILD ABORTED ***
> # exit

In "XX" non US ASCII char are printed on my terminal. I noticed that
this problem occures only on the system using "ln -s J /etc/malloc.conf".

 I made a patch to fix this problem. The patch is appended in this mail.
This change was taken from FreeBSD. The reason of this bug is:

        a) The first char of evbarm's etc/mtree/set.modules is newline.

> five# head obj/destdir.evbarm/etc/mtree/set.modules
>                                   <===== only newline
> ./etc/mtree/set.modules

        b) With this input, farray[0][0] is skipped because the for loop
           increments "i".

My questions are:

        0) Is "a)" bug?

        1) "b)" must be bug, but I don't know why It works correctly
           without /etc/malloc.conf. The first character of farray[0] is
           '\0'. I'm afraid I will hide another bug if I commit this patch.

At least this problem occurs on netbsd-4, too.

Index: ftree.c
===================================================================
RCS file: /cvsroot/src/bin/pax/ftree.c,v
retrieving revision 1.41
diff -u -r1.41 ftree.c
--- ftree.c     20 Mar 2012 18:42:28 -0000      1.41
+++ ftree.c     26 Sep 2012 18:15:18 -0000
@@ -327,6 +327,8 @@
 static int
 ftree_arg(void)
 {
+
+       char *pt;
        /*
         * close off the current file tree
         */
@@ -342,24 +344,14 @@
         */
        for(;;) {
                if (fthead == NULL) {
-                       int i, c = EOF;
                        /*
                         * the user didn't supply any args, get the file trees
                         * to process from stdin;
                         */
-                       for (i = 0; i < PAXPATHLEN + 2; i++) {
-                               c = getchar();
-                               if (c == EOF)
-                                       break;
-                               else if (c == sep) {
-                                       if (i != 0)
-                                               break;
-                               } else
-                                       farray[0][i] = c;
-                       }
-                       if (i == 0)
-                               return -1;
-                       farray[0][i] = '\0';
+                       if (fgets(farray[0], PAXPATHLEN+1, stdin) == NULL)
+                               return(-1);
+                       if ((pt = strchr(farray[0], '\n')) != NULL)
+                               *pt = '\0';
                } else {
                        /*
                         * the user supplied the file args as arguments to pax


-- 
-----------------------------------------------
                SAITOH Masanobu (msaitoh%execsw.org@localhost
                                 msaitoh%netbsd.org@localhost)


Home | Main Index | Thread Index | Old Index