[Debian-pan-maintainers] Bug#1147941: ovito: Undocumented Sun RPC license; non-free
Bastian Germann
bage at debian.org
Tue Sep 15 16:56:41 BST 2026
Source: ovito
Version: 3.15.4~ds-1
Severity: serious
Tags: patch
Your package contains code that is licensed under Sun RPC which is not
documented in the copyright file. Most of the included code's upstream
was relicensed in glibc and Free BSD under BSD-3-Clause.
You can make the package build without the code in question by using the
attached patch (which has two replacement implementations for xdr_seek
and xdr_tell) and adding libtirpc-dev to the Build-Depends.
It would obviously be better to repack the source to get rid of the
code in the source package as well.
-------------- next part --------------
diff --git a/src/3rdparty/xdrfile/CMakeLists.txt b/src/3rdparty/xdrfile/CMakeLists.txt
index 23ebea5..f268a1d 100644
--- a/src/3rdparty/xdrfile/CMakeLists.txt
+++ b/src/3rdparty/xdrfile/CMakeLists.txt
@@ -45,6 +45,16 @@ TARGET_INCLUDE_DIRECTORIES(xdrfile INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/..")
# Add standard compile and link options to the CMake target.
OVITO_ADD_STANDARD_COMPILE_OPTIONS(xdrfile)
+TARGET_COMPILE_DEFINITIONS(xdrfile PRIVATE HAVE_RPC_XDR_H)
+FIND_PATH(TIRPC_INCLUDE_DIR rpc/xdr.h)
+IF(TIRPC_INCLUDE_DIR)
+ TARGET_INCLUDE_DIRECTORIES(xdrfile PRIVATE "${TIRPC_INCLUDE_DIR}")
+ENDIF()
+FIND_LIBRARY(TIRPC_LIBRARY tirpc)
+IF(TIRPC_LIBRARY)
+ TARGET_LINK_LIBRARIES(xdrfile PRIVATE "${TIRPC_LIBRARY}")
+ENDIF()
+
IF(CMAKE_C_COMPILER_ID STREQUAL "IntelLLVM")
# Silence Intel DPC++ compiler warning: "variable XXX set but not used"
TARGET_COMPILE_OPTIONS(xdrfile PRIVATE "-Wno-unused-but-set-variable")
diff --git a/src/3rdparty/xdrfile/xdrfile.c b/src/3rdparty/xdrfile/xdrfile.c
index 7ade89d..088e0ea 100644
--- a/src/3rdparty/xdrfile/xdrfile.c
+++ b/src/3rdparty/xdrfile/xdrfile.c
@@ -2030,607 +2030,15 @@ F77_FUNC(xddcd,XDRDCD)(int *fid, double *data, int *ncoord,
-/*************************************************************
- * The rest of this file contains our own implementation *
- * of the XDR calls in case you are compiling without them. *
- * You do NOT want to change things here since it would make *
- * things incompatible with the standard RPC/XDR routines. *
- *************************************************************/
-#ifndef HAVE_RPC_XDR_H
-
-/*
- * What follows is a modified version of the Sun XDR code. For reference
- * we include their copyright and license:
- *
- * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
- * unrestricted use provided that this legend is included on all tape
- * media and as a part of the software program in whole or part. Users
- * may copy or modify Sun RPC without charge, but are not authorized
- * to license or distribute it to anyone else except as part of a product or
- * program developed by the user.
- *
- * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
- * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun RPC is provided with no support and without any obligation on the
- * part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California 94043
- */
-
-/* INT_MAX is defined in limits.h according to ANSI C */
-#if (INT_MAX > 2147483647)
-# error Error: Cannot use builtin XDR support when size of int
-# error is larger than 4 bytes. Use your system XDR libraries
-# error instead, or modify the source code in xdrfile.c
-#endif /* Check for 4 byte int type */
-
-
-
-
-
-typedef int (*xdrproc_t) (XDR *, void *,...);
-
-#define xdr_getlong(xdrs, longp) \
- (*(xdrs)->x_ops->x_getlong)(xdrs, longp)
-#define xdr_putlong(xdrs, longp) \
- (*(xdrs)->x_ops->x_putlong)(xdrs, longp)
-#define xdr_getbytes(xdrs, addr, len) \
- (*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
-#define xdr_putbytes(xdrs, addr, len) \
- (*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
-
-#define BYTES_PER_XDR_UNIT 4
-static char xdr_zero[BYTES_PER_XDR_UNIT] = {0, 0, 0, 0};
-
-static int32_t
-xdr_swapbytes(int32_t x)
-{
- int32_t y,i;
- char *px=(char *)&x;
- char *py=(char *)&y;
-
- for(i=0;i<4;i++)
- py[i]=px[3-i];
-
- return y;
-}
-
-static int32_t
-xdr_htonl(int32_t x)
-{
- int s=0x1234;
- if( *((char *)&s)==(char)0x34) {
- /* smallendian,swap bytes */
- return xdr_swapbytes(x);
- } else {
- /* bigendian, do nothing */
- return x;
- }
-}
-
-static int32_t
-xdr_ntohl(int x)
-{
- int s=0x1234;
- if( *((char *)&s)==(char)0x34) {
- /* smallendian, swap bytes */
- return xdr_swapbytes(x);
- } else {
- /* bigendian, do nothing */
- return x;
- }
-}
-
-static int
-xdr_int (XDR *xdrs, int *ip)
-{
- int32_t i32;
-
- switch (xdrs->x_op)
- {
- case XDR_ENCODE:
- i32 = (int32_t) *ip;
- return xdr_putlong (xdrs, &i32);
-
- case XDR_DECODE:
- if (!xdr_getlong (xdrs, &i32))
- {
- return 0;
- }
- *ip = (int) i32;
- case XDR_FREE:
- return 1;
- }
- return 0;
-}
-
-static int
-xdr_u_int (XDR *xdrs, unsigned int *up)
-{
- uint32_t ui32;
-
- switch (xdrs->x_op)
- {
- case XDR_ENCODE:
- ui32 = (uint32_t) * up;
- return xdr_putlong (xdrs, (int32_t *)&ui32);
-
- case XDR_DECODE:
- if (!xdr_getlong (xdrs, (int32_t *)&ui32))
- {
- return 0;
- }
- *up = (uint32_t) ui32;
- case XDR_FREE:
- return 1;
- }
- return 0;
-}
-
-static int
-xdr_short (XDR *xdrs, short *sp)
-{
- int32_t i32;
-
- switch (xdrs->x_op)
- {
- case XDR_ENCODE:
- i32 = (int32_t) *sp;
- return xdr_putlong (xdrs, &i32);
-
- case XDR_DECODE:
- if (!xdr_getlong (xdrs, &i32))
- {
- return 0;
- }
- *sp = (short) i32;
- return 1;
-
- case XDR_FREE:
- return 1;
- }
- return 0;
-}
-
-static int
-xdr_u_short (XDR *xdrs, unsigned short *sp)
+int64_t
+xdr_tell(XDRFILE *xd)
{
- uint32_t ui32;
-
- switch (xdrs->x_op)
- {
- case XDR_ENCODE:
- ui32 = (uint32_t) *sp;
- return xdr_putlong (xdrs, (int32_t *)&ui32);
-
- case XDR_DECODE:
- if (!xdr_getlong (xdrs, (int32_t *)&ui32))
- {
- return 0;
- }
- *sp = (unsigned short) ui32;
- return 1;
-
- case XDR_FREE:
- return 1;
- }
- return 0;
+ return ftell(xd->fp);
}
-static int
-xdr_char (XDR *xdrs, char *cp)
-{
- int i;
-
- i = (*cp);
- if (!xdr_int (xdrs, &i))
- {
- return 0;
- }
- *cp = i;
- return 1;
-}
-
-static int
-xdr_u_char (XDR *xdrs, unsigned char *cp)
-{
- unsigned int u;
-
- u = (*cp);
- if (!xdr_u_int (xdrs, &u))
- {
- return 0;
- }
- *cp = u;
- return 1;
-}
-
-/*
- * XDR opaque data
- * Allows the specification of a fixed size sequence of opaque bytes.
- * cp points to the opaque object and cnt gives the byte length.
- */
-static int
-xdr_opaque (XDR *xdrs, char *cp, unsigned int cnt)
-{
- unsigned int rndup;
- static char crud[BYTES_PER_XDR_UNIT];
-
- /*
- * if no data we are done
- */
- if (cnt == 0)
- return 1;
-
- /*
- * round byte count to full xdr units
- */
- rndup = cnt % BYTES_PER_XDR_UNIT;
- if (rndup > 0)
- rndup = BYTES_PER_XDR_UNIT - rndup;
-
- switch (xdrs->x_op)
- {
- case XDR_DECODE:
- if (!xdr_getbytes (xdrs, cp, cnt))
- {
- return 0;
- }
- if (rndup == 0)
- return 1;
- return xdr_getbytes (xdrs, (char *)crud, rndup);
-
- case XDR_ENCODE:
- if (!xdr_putbytes (xdrs, cp, cnt))
- {
- return 0;
- }
- if (rndup == 0)
- return 1;
- return xdr_putbytes (xdrs, xdr_zero, rndup);
-
- case XDR_FREE:
- return 1;
- }
-#undef BYTES_PER_XDR_UNIT
- return 0;
-}
-
-
-/*
- * XDR null terminated ASCII strings
- */
-static int
-xdr_string (XDR *xdrs, char **cpp, unsigned int maxsize)
-{
- char *sp = *cpp; /* sp is the actual string pointer */
- unsigned int size;
- unsigned int nodesize;
-
- /*
- * first deal with the length since xdr strings are counted-strings
- */
- switch (xdrs->x_op)
- {
- case XDR_FREE:
- if (sp == NULL)
- {
- return 1; /* already free */
- }
- /* fall through... */
- case XDR_ENCODE:
- if (sp == NULL)
- return 0;
- size = strlen (sp);
- break;
- case XDR_DECODE:
- break;
- }
- if (!xdr_u_int (xdrs, &size))
- {
- return 0;
- }
- if (size > maxsize)
- {
- return 0;
- }
- nodesize = size + 1;
-
- /*
- * now deal with the actual bytes
- */
- switch (xdrs->x_op)
- {
- case XDR_DECODE:
- if (nodesize == 0)
- {
- return 1;
- }
- if (sp == NULL)
- *cpp = sp = (char *) malloc (nodesize);
- if (sp == NULL)
- {
- (void) fputs ("xdr_string: out of memory\n", stderr);
- return 0;
- }
- sp[size] = 0;
- /* fall into ... */
-
- case XDR_ENCODE:
- return xdr_opaque (xdrs, sp, size);
-
- case XDR_FREE:
- free (sp);
- *cpp = NULL;
- return 1;
- }
- return 0;
-}
-
-
-
-/* Floating-point stuff */
-
-static int
-xdr_float(XDR *xdrs, float *fp)
-{
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- if (sizeof(float) == sizeof(int32_t))
- return (xdr_putlong(xdrs, (int32_t *)fp));
- else if (sizeof(float) == sizeof(int)) {
- int32_t tmp = *(int *)fp;
- return (xdr_putlong(xdrs, &tmp));
- }
- break;
-
- case XDR_DECODE:
- if (sizeof(float) == sizeof(int32_t))
- return (xdr_getlong(xdrs, (int32_t *)fp));
- else if (sizeof(float) == sizeof(int)) {
- int32_t tmp;
- if (xdr_getlong(xdrs, &tmp)) {
- *(int *)fp = tmp;
- return (1);
- }
- }
- break;
-
- case XDR_FREE:
- return (1);
- }
- return (0);
-}
-
-
-static int
-xdr_double(XDR *xdrs, double *dp)
-{
- /* Gromacs detects floating-point stuff at compile time, which is faster */
-#ifdef GROMACS
-# ifndef FLOAT_FORMAT_IEEE754
-# error non-IEEE floating point system, or you defined GROMACS yourself...
-# endif
- int LSW;
-# ifdef IEEE754_BIG_ENDIAN_WORD_ORDER
- int LSW=1;
-# else
- int LSW=0;
-# endif /* Big endian word order */
-#else
- /* Outside Gromacs we rely on dynamic detection of FP order. */
- int LSW; /* Least significant fp word */
-
- double x=0.987654321; /* Just a number */
- unsigned char ix = *((char *)&x);
-
- /* Possible representations in IEEE double precision:
- * (S=small endian, B=big endian)
- *
- * Byte order, Word order, Hex
- * S S b8 56 0e 3c dd 9a ef 3f
- * B S 3c 0e 56 b8 3f ef 9a dd
- * S B dd 9a ef 3f b8 56 0e 3c
- * B B 3f ef 9a dd 3c 0e 56 b8
- */
- if(ix==0xdd || ix==0x3f)
- LSW=1; /* Big endian word order */
- else if(ix==0xb8 || ix==0x3c)
- LSW=0; /* Small endian word order */
- else { /* Catch strange errors */
- fprintf(stderr,"Cannot detect floating-point word order.\n"
- "Do you have a non-IEEE system?\n"
- "Use system XDR libraries or fix xdr_double().\n");
- abort();
- }
-#endif /* end of dynamic detection of fp word order */
-
- switch (xdrs->x_op) {
-
- case XDR_ENCODE:
- if (2*sizeof(int32_t) == sizeof(double)) {
- int32_t *lp = (int32_t *)dp;
- return (xdr_putlong(xdrs, lp+!LSW) &&
- xdr_putlong(xdrs, lp+LSW));
- } else if (2*sizeof(int) == sizeof(double)) {
- int *ip = (int *)dp;
- int32_t tmp[2];
- tmp[0] = ip[!LSW];
- tmp[1] = ip[LSW];
- return (xdr_putlong(xdrs, tmp) &&
- xdr_putlong(xdrs, tmp+1));
- }
- break;
-
- case XDR_DECODE:
- if (2*sizeof(int32_t) == sizeof(double)) {
- int32_t *lp = (int32_t *)dp;
- return (xdr_getlong(xdrs, lp+!LSW) &&
- xdr_getlong(xdrs, lp+LSW));
- } else if (2*sizeof(int) == sizeof(double)) {
- int *ip = (int *)dp;
- int32_t tmp[2];
- if (xdr_getlong(xdrs, tmp+!LSW) &&
- xdr_getlong(xdrs, tmp+LSW)) {
- ip[0] = tmp[0];
- ip[1] = tmp[1];
- return (1);
- }
- }
- break;
-
- case XDR_FREE:
- return (1);
- }
- return (0);
-}
-
-
-static int xdrstdio_getlong (XDR *, int32_t *);
-static int xdrstdio_putlong (XDR *, int32_t *);
-static int xdrstdio_getbytes (XDR *, char *, unsigned int);
-static int xdrstdio_putbytes (XDR *, char *, unsigned int);
-static int64_t xdrstdio_getpos (XDR *);
-static int xdrstdio_setpos (XDR *, int64_t, int);
-static void xdrstdio_destroy (XDR *);
-
-/*
- * Ops vector for stdio type XDR
- */
-static const struct xdr_ops xdrstdio_ops =
- {
- xdrstdio_getlong, /* deserialize a long int */
- xdrstdio_putlong, /* serialize a long int */
- xdrstdio_getbytes, /* deserialize counted bytes */
- xdrstdio_putbytes, /* serialize counted bytes */
- xdrstdio_getpos, /* get offset in the stream */
- xdrstdio_setpos, /* set offset in the stream */
- xdrstdio_destroy, /* destroy stream */
- };
-
-/*
- * Initialize a stdio xdr stream.
- * Sets the xdr stream handle xdrs for use on the stream file.
- * Operation flag is set to op.
- */
-static void
-xdrstdio_create (XDR *xdrs, FILE *file, enum xdr_op op)
-{
- xdrs->x_op = op;
-
- xdrs->x_ops = (struct xdr_ops *) &xdrstdio_ops;
- xdrs->x_private = (char *) file;
-}
-
-/*
- * Destroy a stdio xdr stream.
- * Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create.
- */
-static void
-xdrstdio_destroy (XDR *xdrs)
-{
- (void) fflush ((FILE *) xdrs->x_private);
- /* xx should we close the file ?? */
-}
-
-static int
-xdrstdio_getlong (XDR *xdrs, int32_t *lp)
-{
- int32_t mycopy;
-
- if (fread ((char *) & mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
- return 0;
- *lp = (int32_t) xdr_ntohl (mycopy);
- return 1;
-}
-
-static int
-xdrstdio_putlong (XDR *xdrs, int32_t *lp)
-{
- int32_t mycopy = xdr_htonl (*lp);
- lp = &mycopy;
- if (fwrite ((char *) lp, 4, 1, (FILE *) xdrs->x_private) != 1)
- return 0;
- return 1;
-}
-
-static int
-xdrstdio_getbytes (XDR *xdrs, char *addr, unsigned int len)
-{
- if ((len != 0) && (fread (addr, (int) len, 1,
- (FILE *) xdrs->x_private) != 1))
- return 0;
- return 1;
-}
-
-static int
-xdrstdio_putbytes (XDR *xdrs, char *addr, unsigned int len)
-{
- if ((len != 0) && (fwrite (addr, (int) len, 1,
- (FILE *) xdrs->x_private) != 1))
- return 0;
- return 1;
-}
-
-
-static int64_t
-xdrstdio_getpos (XDR *xdrs)
-{
- #ifdef _WIN32
- return _ftelli64((FILE *) xdrs->x_private);
- #else /* __unix__ */
- return ftello((FILE *) xdrs->x_private);
- #endif
-}
-
-static int
-xdrstdio_setpos (XDR *xdrs, int64_t pos, int whence)
-{
- /* A reason for failure can be filesystem limits on allocation units,
- * before the actual off_t overflow (ext3, with a 4K clustersize,
- * has a 16TB limit).*/
- /* We return errno relying on the fact that it is never set to 0 on
- * success, which means that if an error occurrs it'll never be the same
- * as exdrOK, and xdr_seek won't be confused.*/
- #ifdef _WIN32
- return _fseeki64((FILE *) xdrs->x_private, pos, whence) < 0 ? errno : exdrOK;
- #else /* __unix__ */
- return fseeko((FILE *) xdrs->x_private, pos, whence) < 0 ? errno : exdrOK;
- #endif
-
-
-}
-
-
-int64_t xdr_tell(XDRFILE *xd)
-/* Reads position in file */
-{
- return (int64_t)xdrstdio_getpos(xd->xdr);
-}
-
-int xdr_seek(XDRFILE *xd, int64_t pos, int whence)
-/* Seeks to position in file */
+int
+xdr_seek(XDRFILE *xd, int64_t pos, int whence)
{
- int result;
- if ((result = xdrstdio_setpos(xd->xdr, (int64_t) pos, whence)) != 0)
- return result;
-
- return exdrOK;
+ return fseek(xd->fp, pos, whence);
}
-
-#endif /* HAVE_RPC_XDR_H not defined */
More information about the Debian-pan-maintainers
mailing list