NetBSD Problem Report #40766

From www@NetBSD.org  Fri Feb 27 10:05:35 2009
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 717FE63C10D
	for <gnats-bugs@gnats.netbsd.org>; Fri, 27 Feb 2009 10:05:35 +0000 (UTC)
Message-Id: <20090227100516.AEBE363B946@www.NetBSD.org>
Date: Fri, 27 Feb 2009 10:05:16 +0000 (UTC)
From: sbd@users.sf.net
Reply-To: sbd@netbsd.org
To: gnats-bugs@NetBSD.org
Subject: sysutls/mtree fails to build on Linux (with patch?)
X-Send-Pr-Version: www-1.0

>Number:         40766
>Category:       pkg
>Synopsis:       sysutils/mtree fails to build on Linux (with patch?)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    sbd
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Feb 27 10:10:00 +0000 2009
>Closed-Date:    Sun May 29 23:59:53 +0000 2016
>Last-Modified:  Sun May 29 23:59:53 +0000 2016
>Originator:     Steven Drake
>Release:        pkgsrc-2008Q4
>Organization:
>Environment:
Linux localhost 2.6.28.3 #1 PREEMPT Wed Feb 4 21:54:53 NZDT 2009 i686 pentium4 i386 GNU/Linux
GNU C Library stable release version 2.5, by Roland McGrath et al.

>Description:
mtree-20081105 fails to complie with gcc error's about undeclared variables in compare.c,create.c,stat_flags.c & verify.c
>How-To-Repeat:
[from inside work/mtree-20081105 after build failer]
make -i 
[output truncated]
gcc -DHAVE_CONFIG_H -DHAVE_NBCOMPAT_H=1 -I../libnbcompat -I. -I. -O2 -c compare.c
compare.c: In function 'compare':
compare.c:204: error: 'SF_IMMUTABLE' undeclared (first use in this function)
compare.c:204: error: (Each undeclared identifier is reported only once
compare.c:204: error: for each function it appears in.)
compare.c:204: error: 'SF_APPEND' undeclared (first use in this function)
compare.c:204: error: 'struct stat' has no member named 'st_flags'
compare.c:204: error: 'struct stat' has no member named 'st_flags'
compare.c:204: error: 'struct stat' has no member named 'st_flags'
compare.c:209: error: 'UF_NODUMP' undeclared (first use in this function)
compare.c:209: error: 'UF_IMMUTABLE' undeclared (first use in this function)
compare.c:209: error: 'UF_APPEND' undeclared (first use in this function)
compare.c:209: error: 'UF_OPAQUE' undeclared (first use in this function)
compare.c:209: error: 'UF_SETTABLE' undeclared (first use in this function)
compare.c:209: error: 'SF_ARCHIVED' undeclared (first use in this function)
compare.c:209: error: 'SF_SETTABLE' undeclared (first use in this function)
compare.c:209: error: 'struct stat' has no member named 'st_flags'
compare.c:209: error: 'struct stat' has no member named 'st_flags'
compare.c:209: error: 'struct stat' has no member named 'st_flags'
compare.c:364: error: 'struct stat' has no member named 'st_flags'
compare.c:366: error: 'struct stat' has no member named 'st_flags'
compare.c:371: error: 'struct stat' has no member named 'st_flags'
compare.c:375: error: 'struct stat' has no member named 'st_flags'
compare.c:375: error: 'struct stat' has no member named 'st_flags'
compare.c:377: error: 'struct stat' has no member named 'st_flags'
compare.c:377: error: 'struct stat' has no member named 'st_flags'
compare.c:379: error: 'struct stat' has no member named 'st_flags'
compare.c:379: error: 'struct stat' has no member named 'st_flags'
make: [compare.o] Error 1 (ignored)
gcc -DHAVE_CONFIG_H -DHAVE_NBCOMPAT_H=1 -I../libnbcompat -I. -I. -O2 -c create.c
create.c: In function 'statf':
create.c:247: warning: comparison between pointer and integer
create.c:254: warning: comparison between pointer and integer
create.c:261: warning: comparison between pointer and integer
create.c:268: warning: comparison between pointer and integer
create.c:273: warning: comparison between pointer and integer
create.c:278: warning: comparison between pointer and integer
create.c:287: error: 'struct stat' has no member named 'st_flags'
create.c:289: error: 'struct stat' has no member named 'st_flags'
create.c: In function 'statd':
create.c:326: error: 'UF_NODUMP' undeclared (first use in this function)
create.c:326: error: (Each undeclared identifier is reported only once
create.c:326: error: for each function it appears in.)
create.c:326: error: 'UF_IMMUTABLE' undeclared (first use in this function)
create.c:326: error: 'UF_APPEND' undeclared (first use in this function)
create.c:326: error: 'UF_OPAQUE' undeclared (first use in this function)
create.c:326: error: 'UF_SETTABLE' undeclared (first use in this function)
create.c:326: error: 'SF_ARCHIVED' undeclared (first use in this function)
create.c:326: error: 'SF_IMMUTABLE' undeclared (first use in this function)
create.c:326: error: 'SF_APPEND' undeclared (first use in this function)
create.c:326: error: 'SF_SETTABLE' undeclared (first use in this function)
create.c:363: error: 'struct stat' has no member named 'st_flags'
create.c:363: error: 'struct stat' has no member named 'st_flags'
create.c:365: error: 'struct stat' has no member named 'st_flags'
make: [create.o] Error 1 (ignored)
gcc -DHAVE_CONFIG_H -DHAVE_NBCOMPAT_H=1 -I../libnbcompat -I. -I. -O2 -c verify.c
verify.c: In function 'miss':
verify.c:308: error: 'SF_IMMUTABLE' undeclared (first use in this function)
verify.c:308: error: (Each undeclared identifier is reported only once
verify.c:308: error: for each function it appears in.)
verify.c:308: error: 'SF_APPEND' undeclared (first use in this function)
make: [verify.o] Error 1 (ignored)
gcc -DHAVE_CONFIG_H -DHAVE_NBCOMPAT_H=1 -I../libnbcompat -I. -I. -O2 -c stat_fla
gs.c
stat_flags.c: In function 'flags_to_string':
stat_flags.c:92: error: 'UF_APPEND' undeclared (first use in this function)
stat_flags.c:92: error: (Each undeclared identifier is reported only once
stat_flags.c:92: error: for each function it appears in.)
stat_flags.c:94: error: 'UF_IMMUTABLE' undeclared (first use in this function)
stat_flags.c:96: error: 'UF_NODUMP' undeclared (first use in this function)
stat_flags.c:98: error: 'UF_OPAQUE' undeclared (first use in this function)
stat_flags.c:100: error: 'SF_APPEND' undeclared (first use in this function)
stat_flags.c:102: error: 'SF_ARCHIVED' undeclared (first use in this function)
stat_flags.c:104: error: 'SF_IMMUTABLE' undeclared (first use in this function)stat_flags.c: In function 'string_to_flags':
stat_flags.c:163: error: 'SF_ARCHIVED' undeclared (first use in this function)
stat_flags.c:168: error: 'UF_NODUMP' undeclared (first use in this function)
stat_flags.c:178: error: 'UF_OPAQUE' undeclared (first use in this function)
stat_flags.c:181: error: 'SF_APPEND' undeclared (first use in this function)
stat_flags.c:183: error: 'SF_IMMUTABLE' undeclared (first use in this function)
stat_flags.c:188: error: 'UF_APPEND' undeclared (first use in this function)
stat_flags.c:190: error: 'UF_IMMUTABLE' undeclared (first use in this function)
make: [stat_flags.o] Error 1 (ignored)



>Fix:
It seams between mtree-20070710 (know to compile on this system) and mtree-20081105 some cpp if's where changed from HAVE_FILE_FLAGS to HAVE_STRUCT_STAT_ST_FLAGS (HAVE_STRUCT_STAT_ST_FLAGS is defined in extern.h). 
A fix would be to change them back.
The patches below fix this problem.

$NetBSD$

--- compare.c.orig      2009-02-27 19:10:38.000000000 +1300
+++ compare.c
@@ -198,7 +198,7 @@ typeerr:            LABEL;
        }
        if (mtree_Wflag)
                goto afterpermwhack;
-#if HAVE_STRUCT_STAT_ST_FLAGS
+#if HAVE_FILE_FLAGS
        if (iflag && !uflag) {
                if (s->flags & F_FLAGS)
                    SETFLAGS(p->fts_statp->st_flags, SP_FLGS);
@@ -354,7 +354,7 @@ typeerr:            LABEL;
                        tab = "\t";
                }
        }
-#if HAVE_STRUCT_STAT_ST_FLAGS
+#if HAVE_FILE_FLAGS
        /*
         * XXX
         * since lchflags(2) will reset file times, the utimes() above
$NetBSD$

--- create.c.orig       2009-02-27 19:10:38.000000000 +1300
+++ create.c
@@ -283,7 +283,7 @@ statf(FTSENT *p)
        if (keys & F_SLINK &&
            (p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE))
                output(&indent, "link=%s", vispath(rlink(p->fts_accpath)));
-#if HAVE_STRUCT_STAT_ST_FLAGS
+#if HAVE_FILE_FLAGS
        if (keys & F_FLAGS && p->fts_statp->st_flags != flags)
                output(&indent, "flags=%s",
                    flags_to_string(p->fts_statp->st_flags, "none"));
@@ -300,7 +300,7 @@ statf(FTSENT *p)
 #define        MTREE_MAXGID    5000
 #define        MTREE_MAXUID    5000
 #define        MTREE_MAXMODE   (MBITS + 1)
-#if HAVE_STRUCT_STAT_ST_FLAGS
+#if HAVE_FILE_FLAGS
 #define        MTREE_MAXFLAGS  (FLAGS2INDEX(CH_MASK) + 1)   /* 1808 */
 #else
 #define MTREE_MAXFLAGS 1
@@ -359,7 +359,7 @@ statd(FTS *t, FTSENT *parent, uid_t *pui
                        maxuid = u[suid];
                }

-#if HAVE_STRUCT_STAT_ST_FLAGS
+#if HAVE_FILE_FLAGS
                sflags = FLAGS2INDEX(p->fts_statp->st_flags);
                if (sflags < MTREE_MAXFLAGS && ++f[sflags] > maxflags) {
                        saveflags = p->fts_statp->st_flags;
$NetBSD$

--- stat_flags.c.orig   2009-02-27 19:10:38.000000000 +1300
+++ stat_flags.c
@@ -88,7 +88,7 @@ flags_to_string(u_long flags, const char

        string[0] = '\0';
        prefix = NULL;
-#if HAVE_STRUCT_STAT_ST_FLAGS
+#if HAVE_FILE_FLAGS
        if (flags & UF_APPEND)
                SAPPEND("uappnd");
        if (flags & UF_IMMUTABLE)
@@ -147,7 +147,7 @@ string_to_flags(char **stringp, u_long *
        if (clrp)
                *clrp = 0;

-#if HAVE_STRUCT_STAT_ST_FLAGS
+#if HAVE_FILE_FLAGS
        string = *stringp;
        while ((p = strsep(&string, "\t ,")) != NULL) {
                clear = 0;
$NetBSD$

--- verify.c.orig       2009-02-27 19:10:38.000000000 +1300
+++ verify.c
@@ -300,7 +300,7 @@ miss(NODE *p, char *tail)
                                printf("%s: permissions not set: %s\n",
                                    path, strerror(errno));
                }
-#if HAVE_STRUCT_STAT_ST_FLAGS
+#if HAVE_FILE_FLAGS
                if ((p->flags & F_FLAGS) && p->st_flags) {
                        if (iflag)
                                flags = p->st_flags;

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: pkg-manager->sbd
Responsible-Changed-By: sbd@NetBSD.org
Responsible-Changed-When: Wed, 24 Mar 2010 20:41:04 +0000
Responsible-Changed-Why:
Over to maintainer.


From: Jukka Salmi <j+nbsd@2011.salmi.ch>
To: gnats-bugs@NetBSD.org
Cc: sbd@users.sf.net
Subject: Re: pkg/40766 (sysutls/mtree fails to build on Linux (with patch?))
Date: Wed, 23 Feb 2011 21:34:13 +0100

 --ikeVEW9yuYc//A+q
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline

 Hello

 Today I noticed the same problem while trying to build mtree on a Linux
 x86_64 system (CentOS 5.5).  While your patch seems to work it's
 probably easier to just not define HAVE_STRUCT_STAT_ST_FLAGS on Linux at
 all -- those file flags don't exist there.

 While the attached patch fixes the build on Linux and doesn't break it
 on NetBSD I'm not sure how to fix this correctly...


 Cheers, Jukka

 -- 
 This email fills a much-needed gap in your mailbox.

 --ikeVEW9yuYc//A+q
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename=diff

 Index: pkgtools/mtree/files/extern.h
 ===================================================================
 RCS file: /cvsroot/pkgsrc/pkgtools/mtree/files/extern.h,v
 retrieving revision 1.4
 diff -u -p -r1.4 extern.h
 --- pkgtools/mtree/files/extern.h	21 Mar 2010 16:30:17 -0000	1.4
 +++ pkgtools/mtree/files/extern.h	23 Feb 2011 20:09:48 -0000
 @@ -38,8 +38,6 @@

  #if HAVE_NBTOOL_CONFIG_H
  #include "nbtool_config.h"
 -#else 
 -#define HAVE_STRUCT_STAT_ST_FLAGS 1
  #endif

  #include <nbcompat.h>
 Index: pkgtools/mtree/files/stat_flags.c
 ===================================================================
 RCS file: /cvsroot/pkgsrc/pkgtools/mtree/files/stat_flags.c,v
 retrieving revision 1.4
 diff -u -p -r1.4 stat_flags.c
 --- pkgtools/mtree/files/stat_flags.c	6 Nov 2008 02:14:52 -0000	1.4
 +++ pkgtools/mtree/files/stat_flags.c	23 Feb 2011 20:09:48 -0000
 @@ -34,8 +34,6 @@
  #endif
  #if HAVE_NBTOOL_CONFIG_H
  #include "nbtool_config.h"
 -#else
 -#define HAVE_STRUCT_STAT_ST_FLAGS 1
  #endif

  #include <nbcompat.h>

 --ikeVEW9yuYc//A+q--

State-Changed-From-To: open->feedback
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Mon, 29 Dec 2014 08:21:52 +0000
State-Changed-Why:
Does this problem still happen?
(given the amount of linux bulk building that's been done in the intervening
years, I'm going to assume not in the absence of feedback)


State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 29 May 2016 23:59:53 +0000
State-Changed-Why:
Feedback timeout.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.