bug-gnulib
[Top][All Lists]
Advanced

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

RE: Fwd: sed porting trouble


From: Schmitz, Joachim
Subject: RE: Fwd: sed porting trouble
Date: Fri, 1 Oct 2010 13:19:42 +0200

OK, here we go:

cc -DHAVE_CONFIG_H -I. -I.. -I../lib -I.. -I../lib -I/usr/local/include -g
-E btowc.c > i.c  shows (... denote empty lines):
#line 279 "/usr/local/Floss/sed-4.2.1/lib/../lib/stdint.h"
...
typedef int _verify_intmax_size[2 * (sizeof (gl_intmax_t) == sizeof
(gl_uintmax_t)) -
...
#line 62 "/usr/local/Floss/sed-4.2.1/lib/../lib/stdlib.h"
...
struct random_data
{

So apparently something is going wrong in stdint.h, it misses the "1];"
which is after a line break (i.e. after crah 80 in the terminal window).
That rings a bell, we have a "#pragma columns N", and /usr/include/stdint.h
(and other files in /usr/include too) for some stupid reason sets this to
80... Great, gives me the hint how to fix this!

diff -u ./gllib/stdint.in.h.orig ./gllib/stdint.in.h
--- ./gllib/stdint.in.h.orig    2010-03-30 05:01:15.000000000 -0500
+++ ./gllib/stdint.in.h 2010-09-30 12:56:01.000000000 -0500
@@ -278,7 +278,11 @@
 /* Verify that intmax_t and uintmax_t have the same size.  Too much code
    breaks if this is not the case.  If this check fails, the reason is
likely
    to be found in the autoconf macros.  */
+#ifdef __TANDEM /* keep line below 80 chars! */
+typedef int _verify_intmax_size[2*(sizeof(intmax_t) ==
sizeof(uintmax_t))-1];
+#else
 typedef int _verify_intmax_size[2 * (sizeof (intmax_t) == sizeof
(uintmax_t)) - 1];
+#endif

 /* 7.18.2. Limits of specified-width integer types */


Similar issue with stdlin.h, patch:

diff -u ./gllib/stdlib.in.h.orig ./gllib/stdlib.in.h
--- ./gllib/stdlib.in.h.orig    2010-10-01 06:10:08.000000000 -0500
+++ ./gllib/stdlib.in.h 2010-10-01 06:14:18.000000000 -0500
@@ -72,7 +72,10 @@
 };
 #endif

-#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK)
&& ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && !
defined __CYGWIN__)
+/* __TANDEM (can't #ifdef here): keep lines shorted than 800 chars! */
+#if (@GNULIB_MKSTEMP@ || @GNULIB_GETSUBOPT@ || defined GNULIB_POSIXCHECK)
&& \
+       ! defined __GLIBC__ && !((defined _WIN32 || defined __WIN32__) && \
+       ! defined __CYGWIN__)
 /* On MacOS X 10.3, only <unistd.h> declares mkstemp.  */
 /* On Cygwin 1.7.1, only <unistd.h> declares getsubopt.  */
 /* But avoid namespace pollution on glibc systems and native Windows.  */

(That does it, at least for now)

OK, now a first attempt at acltestdir. I had to 
- extended config.sub and config .guess
- applied the above patch to stdint.in.h
- casting away the constness of the 1st arg to acl() in various places
- using this patch:

diff -u ./gllib/acl-internal.h.orig ./gllib/acl-internal.h
--- ./gllib/acl-internal.h.orig 2010-08-10 19:25:14.000000000 -0500
+++ ./gllib/acl-internal.h      2010-09-30 12:31:01.000000000 -0500
@@ -26,6 +26,12 @@
 #if HAVE_SYS_ACL_H
 # include <sys/acl.h>
 #endif
+#ifdef __TANDEM
+typedef struct acl aclent_t;
+#define SETACL  ACL_SET
+#define GETACL  ACL_GET
+#define MODE_INSIDE_ACL   1  /* true? Or 0? Need to investigate... */
+#endif
 #if defined HAVE_ACL && ! defined GETACLCNT && defined ACL_CNT
 # define GETACLCNT ACL_CNT
 #endif

the result was:


cc  -g   -o test-set-mode-acl test-set-mode-acl.o ../gllib/libgnu.a

eld - TNS/E Native Mode Linker - T0608H01^AAK - 16FEB2009
Copyright 2009 Hewlett-Packard Company
This program may be distributed under the terms of the GNU
General Public License.

eld command line:
   /usr/bin/eld -o test-set-mode-acl -set systype oss -set highpin on -set
   highrequestor on -set inspect on /usr/lib/ccplmain.o test-set-mode-acl.o
   ../gllib/libgnu.a -L/usr/local/lib -lfloss -lutil -lrld -L
/G/system/sys03
   -lcre -lcrtl -lossk -lossf -lsec -li18n -licnv -losse -linet -lossh
-lossc
   -allow_duplicate_procs -unres_symbols error

**** ERROR **** [1210]:
   ../gllib/libgnu.a(set-mode-acl.o): In function `qset_acl':
   set-mode-acl.o(.text._148712224+0x202): unresolved reference to facl.

No output file created.

1 error reported.
No warnings reported.
No informational messages reported.
16 informational messages suppressed.
Elapsed Time:  00:00:01
c89: /usr/bin/eld exited, returning 1.
*** Error code 1

OK, so we don't have facl(), but what now?
I guess it is supposed to do ACLs on open file descriptors rather than
filenames?

Bye, Jojo
-----Original Message-----
From: Schmitz, Joachim [mailto:address@hidden 
Sent: Wednesday, September 29, 2010 10:34 PM
To: 'Bruno Haible'
Cc: 'Paolo Bonzini'; 'bug-gnulib'
Subject: RE: Fwd: sed porting trouble

Hi Bruno

The official name is NonStop Kernel.

Version number, hmm. There are several. First there are several different
architectures, TNS (outdated), TNS/R (Risc, mips, almost outdated) and TNS/E
(EPIC, Itanium). There's also NEO or Neoview, which basically is the same as
EPIC. Both come in 2 flavours, the newer of either is a blades architecture
OS versions are Cnn.mm (TNS), Dnn.mm (TNS/R, Hnn.mm and Jnn.mm (TNS/E), Nnn
and Pnn (NEO)

config.guess know only TNS/R. I've already submitted patches (to Ben
Eliston, resp. address@hidden) to also recognize TNE(E and Neo.
Here they go again:

diff -u ./build-aux/config.guess.orig ./build-aux/config.guess
--- ./build-aux/config.guess.orig       2010-09-29 15:10:40.000000000 -0500
+++ ./build-aux/config.guess    2010-09-28 11:22:46.000000000 -0500
@@ -1262,6 +1262,12 @@
     *:QNX:*:4*)
        echo i386-pc-qnx
        exit ;;
+    NEO-?:NONSTOP_KERNEL:*:*)
+       echo neo-tandem-nsk${UNAME_RELEASE}
+       exit ;;
+    NSE-?:NONSTOP_KERNEL:*:*)
+       echo nse-tandem-nsk${UNAME_RELEASE}
+       exit ;;
     NSR-?:NONSTOP_KERNEL:*:*)
        echo nsr-tandem-nsk${UNAME_RELEASE}
        exit ;;
diff -u ./build-aux/config.sub.orig ./build-aux/config.sub
--- ./build-aux/config.sub.orig 2009-06-15 04:05:11.000000000 -0500
+++ ./build-aux/config.sub      2010-09-28 11:22:01.000000000 -0500
@@ -830,6 +830,12 @@
        np1)
                basic_machine=np1-gould
                ;;
+       neo-tandem)
+               basic_machine=neo-tandem
+               ;;
+       nse-tandem)
+               basic_machine=nse-tandem
+               ;;
        nsr-tandem)
                basic_machine=nsr-tandem
                ;;


__TANDEM is the predefined C compiler macro, __hpux is not (that an
different OS altogether)

Refencence for the ACL APIs should be here:
http://bizsupport1.austin.hp.com/bc/docs/support/SupportManual/c02128649/c02
128649.pdf
and here:
http://bizsupport1.austin.hp.com/bc/docs/support/SupportManual/c02492445/c02
492445.pdf

/usr/include/sys/acl.h is the header file

It contains a couple macros:

/* cmd values used by acl() */
#define ACL_GET         0x01    /* get ACL */
#define ACL_SET         0x02    /* set ACL */
#define ACL_CNT         0x03    /* get ACL Count */

/* cmd values used by acl_save_restore() */
#define ACL_GETALL      0x04    /* get ACL */
#define ACL_SETALL      0x05    /* set ACL */
#define ACL_CNTALL      0x06    /* get ACL Count */

A struct:
struct acl {
        int             a_type;                 /* entry type */
        uid_t           a_id;                   /* user or group ID */
        unsigned short  a_perm;                 /* entry permissions */
};

Some more macros:
/*
 * Values for acl entry type (a_type field)  */

#define USER_OBJ        0x01                    /* owner of the object */
#define USER            0x02                    /* additional users */
#define GROUP_OBJ       0x04                    /* group of the object */
#define GROUP           0x08                    /* additional groups */
#define CLASS_OBJ       0x10                    /* file group class entry */
#define OTHER_OBJ       0x20                    /* other entry */
#define ACL_DEFAULT     0x10000                 /* default entry */
#define DEF_USER_OBJ    (ACL_DEFAULT | USER_OBJ)/* default object owner */
#define DEF_USER        (ACL_DEFAULT | USER)    /* default additional users
*/
#define DEF_GROUP_OBJ   (ACL_DEFAULT | GROUP_OBJ)/* default owning group */
#define DEF_GROUP       (ACL_DEFAULT | GROUP)   /* default additional groups
*/
#define DEF_CLASS_OBJ   (ACL_DEFAULT | CLASS_OBJ)/* default class entry */
#define DEF_OTHER_OBJ   (ACL_DEFAULT | OTHER_OBJ)/* default other entry */

#define NACLBASE        4       /* number of "base" ACL entries */
                                /* (USER_OBJ, GROUP_OBJ,        */
                                /* CLASS_OBJ, & OTHER_OBJ)      */
#define NACLENTRIES    150      /* Total number of base + optional entries,
*/
                                /* arbitrarily selected to match HFS's # of
*/
                                /* optional entries (HFS only has 3 base
*/
                                /* entries; cf. NACLENTRIES in <sys/acl.h>)
*/
#define DONTCARE      0x40000   /* for pattern match */
#define IDDONTCARE    0x80000   /* for pattern match */

/* For source compatibility with HPUX, the following two NACLV aliases
   are provided: */
#define NACLVBASE    NACLBASE     /* For compatibility with HPUX */
#define NACLVENTRIES NACLENTRIES  /* For compatibility with HPUX */

and some prototypes :
/* Function prototypes */
int acl (char *, int, int, struct acl *); int aclsort (int, int, struct acl
*);

/* Following prototype provided for internal product use only */ int
acl_save_restore (char *, int, int, char *);

That should answer your question for defined symbols too.

Your sample program:
$ cat foo.c
extern int acl (char *); int foo (const char *s) { return acl (s); } $ c89
-c foo.c
  extern int acl (char *); int foo (const char *s) { return acl (s); }
                                                                 ^
"/home/jojo/foo.c", line 1: error(252): argument of type "const char *" is
          incompatible with parameter of type "char *"


1 error detected in the compilation of "foo.c".
c89: /usr/cmplr/ccombe exited, returning 2.
$

Our compiler treats this as an error rather than a warning.

Enough for today, I'll look into this again tomorrow...

Bye, Jojo

-----Original Message-----
From: Bruno Haible [mailto:address@hidden
Sent: Wednesday, September 29, 2010 9:47 PM
To: Schmitz, Joachim
Cc: Paolo Bonzini; bug-gnulib
Subject: Re: Fwd: sed porting trouble

Hi Joachim,

> > I'm trying to port sed-4.1.5 (and 4.2.1) to HP NonStop and I'm 
> > having a couple issues with it.

This is an OS on which gnulib was never tested so far. Therefore I have to
start with a few basic questions:

  - What is the official name of the OS? NonStop? NonStop OS? NonStop UX?
    Also the version number (for reference in gnulib documentation)?

  - What is the result of config.guess?
      $ sh build-aux/config.guess

  - What are the predefined C compiler macros? __TANDEM, what else?
    __hpux also?

Then, three questions about the ACL support. First, where is a reference of
the API? I need this info for updating
 
<http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=doc/acl-resources
.txt>

  - Which include files declares functions related to ACLs?

  - Which symbols are defined? Something like
      $ nm /usr/lib/libc.so | grep acl
    should provide the list.

> > Some are due to our picky compiler (or a potential bug in either 
> > your code or out implementation of acl())

Just a test case: When you try to compile this file with "cc -c foo.c"
======================== foo.c ======================== extern int acl (char
*); int foo (const char *s) { return acl (s); }
=======================================================
what is the result?

> > some due to differenences how
> > POSIX ACLs are implemented here:

gnulib contains a couple of unit tests for this code. sed-4.2.1 doesn't.
Therefore I'd like to ask you to repeat your effort with this tarball:
  http://www.haible.de/bruno/gnu/acltestdir.tar.gz

With your changes, does only the compilation pass, or does "make check"
also pass?

> > There is something strange going on in lib/stdlib.h, gives me a very 
> > strange error message:
> > 
> > address@hidden:/usr/local/Floss/sed-4.2.1 $ make make all-recursive 
> > Making all in lib make all-recursive source='btowc.c'
> > object='btowc.o' libtool=no DEPDIR=.deps depmode=none bin/sh 
> > ../build-aux/depcomp cc -DHAVE_CONFIG_H -I. -I.. -I../lib -I..
> > -I../lib -I/usr/local/include -g -c btowc.c struct random_data ^ 
> > "/usr/local/Floss/sed-4.2.1/lib/../lib/stdlib.h", line 64: error(123):
> > expected an expression
> > {
> > ^
> > "/usr/local/Floss/sed-4.2.1/lib/../lib/stdlib.h", line 65: error(111):
> > expected a "]"
> > {
> > ^
> > "/usr/local/Floss/sed-4.2.1/lib/../lib/stdlib.h", line 65: error(158):
> > expected a ";"
> > 3 errors detected in the compilation of "btowc.c".
> > c89: /usr/cmplr/ccombe exited, returning 2.
> > *** Error code 1
> > 
> > In lib/stdlib.h.in, somewhere before 'struct random' it goes 
> > horribly wrong, haven't yet been able to spot where, might be in
lib/stdint.h?

Try to only preprocess the file:
  $ cc -DHAVE_CONFIG_H -I. -I.. -I../lib -I.. -I../lib -I/usr/local/include
-g -E btowc.c > i.c and look at i.c. Here it should be easier to spot which
tokens before 'struct random_data' are confusing the compiler.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]