pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/sysutils/coreutils Make build and run on Interix:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3bbf88c3b801
branches:  trunk
changeset: 490835:3bbf88c3b801
user:      tv <tv%pkgsrc.org@localhost>
date:      Mon Mar 21 14:44:08 2005 +0000

description:
Make build and run on Interix:

* Add check for sync(2) and setgroups(3), and don't use these if they
  don't exist on the host.

* Interix has a ... Special ... way of doing the "su" thing.

* Implement Interix-specific portion of mountlist.c.

diffstat:

 sysutils/coreutils/Makefile         |   9 ++++-
 sysutils/coreutils/PLIST            |   4 +-
 sysutils/coreutils/distinfo         |  16 ++++++-
 sysutils/coreutils/patches/patch-ab |  71 ++++++++++++++++++++++++++++++++++--
 sysutils/coreutils/patches/patch-ac |  11 +++--
 sysutils/coreutils/patches/patch-ad |  49 +++++++++++++++++++++++++
 sysutils/coreutils/patches/patch-ae |  15 +++++++
 sysutils/coreutils/patches/patch-af |  15 +++++++
 sysutils/coreutils/patches/patch-ag |  28 ++++++++++++++
 sysutils/coreutils/patches/patch-ah |  15 +++++++
 sysutils/coreutils/patches/patch-ai |  13 ++++++
 sysutils/coreutils/patches/patch-ba |  15 +++++++
 sysutils/coreutils/patches/patch-bb |  17 ++++++++
 sysutils/coreutils/patches/patch-ca |  28 ++++++++++++++
 sysutils/coreutils/patches/patch-cb |  24 ++++++++++++
 15 files changed, 315 insertions(+), 15 deletions(-)

diffs (truncated from 430 to 300 lines):

diff -r 573c3c104e9b -r 3bbf88c3b801 sysutils/coreutils/Makefile
--- a/sysutils/coreutils/Makefile       Mon Mar 21 14:34:34 2005 +0000
+++ b/sysutils/coreutils/Makefile       Mon Mar 21 14:44:08 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.23 2004/12/28 08:55:31 minskim Exp $
+# $NetBSD: Makefile,v 1.24 2005/03/21 14:44:08 tv Exp $
 
 DISTNAME=      coreutils-5.2.1
 PKGREVISION=   1
@@ -31,6 +31,13 @@
 
 .include "../../mk/bsd.prefs.mk"
 
+# Exclude programs from PLIST which aren't built on a platform.
+.if ${OPSYS} == "Interix"
+PLIST_SUBST+=          COREUTILS_HAVE_HOSTID="@comment "
+.else
+PLIST_SUBST+=          COREUTILS_HAVE_HOSTID=""
+.endif
+
 CONFIGURE_ARGS=                --program-prefix=${GNU_PROGRAM_PREFIX}
 # if GNU_PROGRAM_PREFIX == 'g'
 # devel/id-utils installs a 'gid' program, so conflict with it
diff -r 573c3c104e9b -r 3bbf88c3b801 sysutils/coreutils/PLIST
--- a/sysutils/coreutils/PLIST  Mon Mar 21 14:34:34 2005 +0000
+++ b/sysutils/coreutils/PLIST  Mon Mar 21 14:44:08 2005 +0000
@@ -1,4 +1,4 @@
-@comment $NetBSD: PLIST,v 1.4 2004/12/06 16:00:57 adam Exp $
+@comment $NetBSD: PLIST,v 1.5 2005/03/21 14:44:08 tv Exp $
 bin/${GNU_PROGRAM_PREFIX}[
 bin/${GNU_PROGRAM_PREFIX}basename
 bin/${GNU_PROGRAM_PREFIX}cat
@@ -28,7 +28,7 @@
 bin/${GNU_PROGRAM_PREFIX}fold
 bin/${GNU_PROGRAM_PREFIX}groups
 bin/${GNU_PROGRAM_PREFIX}head
-bin/${GNU_PROGRAM_PREFIX}hostid
+${COREUTILS_HAVE_HOSTID}bin/${GNU_PROGRAM_PREFIX}hostid
 bin/${GNU_PROGRAM_PREFIX}hostname
 bin/${GNU_PROGRAM_PREFIX}id
 bin/${GNU_PROGRAM_PREFIX}install
diff -r 573c3c104e9b -r 3bbf88c3b801 sysutils/coreutils/distinfo
--- a/sysutils/coreutils/distinfo       Mon Mar 21 14:34:34 2005 +0000
+++ b/sysutils/coreutils/distinfo       Mon Mar 21 14:44:08 2005 +0000
@@ -1,8 +1,18 @@
-$NetBSD: distinfo,v 1.8 2005/02/24 13:40:51 agc Exp $
+$NetBSD: distinfo,v 1.9 2005/03/21 14:44:08 tv Exp $
 
 SHA1 (coreutils-5.2.1.tar.bz2) = 1028755ae0fa9be840576e4837004cf5a9981c45
 RMD160 (coreutils-5.2.1.tar.bz2) = a72bdb360371c026e77281ae0d543bdcce55a4e6
 Size (coreutils-5.2.1.tar.bz2) = 4270776 bytes
 SHA1 (patch-aa) = 36c3a4a810bdc9efd7b0c3a6dc4203e0cfcbfae5
-SHA1 (patch-ab) = a38174cf4c85cdddc23f3b59c7c04679c898c232
-SHA1 (patch-ac) = e5db45fbb7f4e424fa7ce5474d99f863b4b46bd2
+SHA1 (patch-ab) = 2fdd6dcccc20038afbb145d10b2988829702b285
+SHA1 (patch-ac) = 982848fe7c82a6601893eed5122de544484b4cf9
+SHA1 (patch-ad) = 3b61ead0225d17667d27a6a0e379d5aabc75b0df
+SHA1 (patch-ae) = 1dda20cdc03336694b2c8dd42de159168de1f28d
+SHA1 (patch-af) = cd7deba7a8ecdf17b39668a9d5a80323e1a02c06
+SHA1 (patch-ag) = 20deb326e88b2d0a275b4a16b84ea43a9e280d79
+SHA1 (patch-ah) = 3f56cd4e1c657551f4967928ebea19df23c0d850
+SHA1 (patch-ai) = e9964ba9e3fd6ec8f2728e53439a960a6dd0a32f
+SHA1 (patch-ba) = 3867a17e0ad8f7c87c91ec8e511972a6255062dd
+SHA1 (patch-bb) = ade6f8e0aa73478270f568dba25e79f825374c02
+SHA1 (patch-ca) = 414af007d0afe03a0e95f1f26f9e8fdff10702e4
+SHA1 (patch-cb) = de1896d77504b8fd82da8e2cdf6b8a82a31ba09f
diff -r 573c3c104e9b -r 3bbf88c3b801 sysutils/coreutils/patches/patch-ab
--- a/sysutils/coreutils/patches/patch-ab       Mon Mar 21 14:34:34 2005 +0000
+++ b/sysutils/coreutils/patches/patch-ab       Mon Mar 21 14:44:08 2005 +0000
@@ -1,8 +1,8 @@
-$NetBSD: patch-ab,v 1.5 2004/05/18 19:07:57 tron Exp $
+$NetBSD: patch-ab,v 1.6 2005/03/21 14:44:08 tv Exp $
 
---- lib/mountlist.c.orig       2004-01-26 09:58:12.000000000 +0100
-+++ lib/mountlist.c    2004-05-18 20:56:57.000000000 +0200
-@@ -173,6 +173,11 @@
+--- lib/mountlist.c.orig       Mon Jan 26 03:58:12 2004
++++ lib/mountlist.c
+@@ -173,6 +173,11 @@ xatoi (char *cp)
  
  #if MOUNTED_GETMNTINFO
  
@@ -14,3 +14,66 @@
  # if ! HAVE_F_FSTYPENAME_IN_STATFS
  static char *
  fstype_to_string (short t)
+@@ -296,6 +301,11 @@ fstype_to_string (int t)
+ }
+ #endif /* MOUNTED_VMOUNT */
+ 
++#ifdef __INTERIX
++# include <dirent.h>
++# include <sys/statvfs.h>
++#endif
++
+ /* Return a list of the currently mounted filesystems, or NULL on error.
+    Add each entry to the tail of the list so that they stay in order.
+    If NEED_FS_TYPE is nonzero, ensure that the filesystem type fields in
+@@ -804,6 +814,50 @@ read_filesystem_list (int need_fs_type)
+     free (entries);
+   }
+ #endif /* MOUNTED_VMOUNT. */
++
++#ifdef __INTERIX              /* Interix. */
++  {
++    DIR *devfs = opendir ("/dev/fs");
++    struct dirent *de;
++    struct statvfs svfs;
++    char fsname[] = "/dev/fs/#"; /* writable */
++
++    if (devfs == NULL)
++      return NULL;
++
++    while ((de = readdir (devfs)) != NULL)
++      {
++      if (strlen (de->d_name) != 1)
++        {
++          /* "Drive letters" should all be exactly one character long. */
++          continue;
++        }
++
++      fsname[8] = de->d_name[0];
++
++      if (statvfs (fsname, &svfs) != 0)
++        {
++          /* Could be an offline network fs or empty removable; don't fail. */
++          continue;
++        }
++
++      me = xmalloc (sizeof *me);
++
++      me->me_devname = xstrdup (svfs.f_mntfromname);
++      me->me_mountdir = xstrdup (svfs.f_mntonname);
++      me->me_type = xstrdup (svfs.f_fstypename);
++      me->me_dev = (dev_t)svfs.f_fsid;
++      me->me_dummy = (svfs.f_type == ST_FSTYPE_OFS ? 1 : 0);
++      me->me_remote = ((svfs.f_type == ST_FSTYPE_SAMBA
++                        || svfs.f_type == ST_FSTYPE_NFS) ? 1 : 0);
++      me->me_type_malloced = 1;
++
++      /* Add to the linked list. */
++      *mtail = me;
++      mtail = &me->me_next;
++      }
++  }
++#endif
+ 
+   *mtail = NULL;
+   return mount_list;
diff -r 573c3c104e9b -r 3bbf88c3b801 sysutils/coreutils/patches/patch-ac
--- a/sysutils/coreutils/patches/patch-ac       Mon Mar 21 14:34:34 2005 +0000
+++ b/sysutils/coreutils/patches/patch-ac       Mon Mar 21 14:44:08 2005 +0000
@@ -1,12 +1,13 @@
-$NetBSD: patch-ac,v 1.4 2004/05/18 19:07:58 tron Exp $
+$NetBSD: patch-ac,v 1.5 2005/03/21 14:44:08 tv Exp $
 
---- src/stat.c.orig    2004-02-05 14:46:12.000000000 +0100
-+++ src/stat.c 2004-05-18 21:02:54.000000000 +0200
-@@ -86,6 +86,11 @@
+--- src/stat.c.orig    Thu Feb  5 08:46:12 2004
++++ src/stat.c
+@@ -86,6 +86,12 @@
  # endif
  #endif
  
-+#if defined(__NetBSD__) && (__NetBSD_Version__ > 200030000)
++#if (defined(__NetBSD__) && (__NetBSD_Version__ > 200030000)) || defined(__INTERIX)
++#include <sys/statvfs.h>
 +#define       statfs                                  statvfs
 +#define       STATXFS_FILE_SYSTEM_TYPE_MEMBER_NAME    f_fstypename
 +#endif
diff -r 573c3c104e9b -r 3bbf88c3b801 sysutils/coreutils/patches/patch-ad
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/coreutils/patches/patch-ad       Mon Mar 21 14:44:08 2005 +0000
@@ -0,0 +1,49 @@
+$NetBSD: patch-ad,v 1.1 2005/03/21 14:44:08 tv Exp $
+
+--- src/su.c.orig      Wed Jan 21 17:27:02 2004
++++ src/su.c
+@@ -141,6 +141,12 @@
+ /* The user to become if none is specified.  */
+ #define DEFAULT_USER "root"
+ 
++#ifdef __INTERIX
++# include <interix/security.h>
++# undef DEFAULT_USER
++# define DEFAULT_USER (strdup(getpwuid(197108)->pw_name))
++#endif
++
+ char *crypt ();
+ char *getpass ();
+ char *getusershell ();
+@@ -291,9 +297,13 @@ correct_password (const struct passwd *p
+       error (0, 0, _("getpass: cannot open /dev/tty"));
+       return 0;
+     }
++#ifdef __INTERIX
++  return setuser (pw->pw_name, unencrypted, SU_CHECK) == 0;
++#else
+   encrypted = crypt (unencrypted, correct);
+   memset (unencrypted, 0, strlen (unencrypted));
+   return strcmp (encrypted, correct) == 0;
++#endif
+ }
+ 
+ /* Update `environ' for the new shell based on PW, with SHELL being
+@@ -343,6 +353,9 @@ modify_environment (const struct passwd 
+ static void
+ change_identity (const struct passwd *pw)
+ {
++#ifdef __INTERIX
++  setuser (pw->pw_name, NULL, SU_COMPLETE);
++#else
+ #ifdef HAVE_INITGROUPS
+   errno = 0;
+   if (initgroups (pw->pw_name, pw->pw_gid) == -1)
+@@ -353,6 +366,7 @@ change_identity (const struct passwd *pw
+     error (EXIT_FAIL, errno, _("cannot set group id"));
+   if (setuid (pw->pw_uid))
+     error (EXIT_FAIL, errno, _("cannot set user id"));
++#endif
+ }
+ 
+ /* Run SHELL, or DEFAULT_SHELL if SHELL is empty.
diff -r 573c3c104e9b -r 3bbf88c3b801 sysutils/coreutils/patches/patch-ae
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/coreutils/patches/patch-ae       Mon Mar 21 14:44:08 2005 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-ae,v 1.1 2005/03/21 14:44:08 tv Exp $
+
+--- src/setuidgid.c.orig       Wed Jan 21 17:27:02 2004
++++ src/setuidgid.c
+@@ -106,8 +106,10 @@ main (int argc, char **argv)
+     error (SETUIDGID_FAILURE, errno,
+          _("unknown user-ID: %s"), quote (user_id));
+ 
++#if HAVE_SETGROUPS
+   if (setgroups (1, &pwd->pw_gid))
+     error (SETUIDGID_FAILURE, errno, _("cannot set supplemental group"));
++#endif
+ 
+   if (setgid (pwd->pw_gid))
+     error (SETUIDGID_FAILURE, errno,
diff -r 573c3c104e9b -r 3bbf88c3b801 sysutils/coreutils/patches/patch-af
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/coreutils/patches/patch-af       Mon Mar 21 14:44:08 2005 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-af,v 1.1 2005/03/21 14:44:08 tv Exp $
+
+--- src/system.h.orig  Thu Feb  5 04:23:23 2004
++++ src/system.h
+@@ -92,6 +92,10 @@ you must include <sys/types.h> before in
+ #endif
+ #undef HAVE_MAJOR
+ 
++#if !defined(makedev) && defined(mkdev)
++# define makedev(a, b) (mkdev((a), (b)))
++#endif
++
+ #if HAVE_UTIME_H
+ # include <utime.h>
+ #endif
diff -r 573c3c104e9b -r 3bbf88c3b801 sysutils/coreutils/patches/patch-ag
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/coreutils/patches/patch-ag       Mon Mar 21 14:44:08 2005 +0000
@@ -0,0 +1,28 @@
+$NetBSD: patch-ag,v 1.1 2005/03/21 14:44:08 tv Exp $
+
+--- src/shred.c.orig   Wed Jan 21 17:27:02 2004
++++ src/shred.c
+@@ -1398,7 +1398,11 @@ wipename (char *oldname, char const *qol
+               {
+                 if (dir_fd < 0
+                     || (fdatasync (dir_fd) < 0 && fsync (dir_fd) < 0))
++#if HAVE_SYNC
+                   sync ();    /* Force directory out */
++#else
++                  ; /* No sync(2) call */
++#endif
+                 if (flags->verbose)
+                   {
+                     /*
+@@ -1431,7 +1435,11 @@ wipename (char *oldname, char const *qol
+   free (newname);
+   err = unlink (oldname);
+   if (dir_fd < 0 || (fdatasync (dir_fd) < 0 && fsync (dir_fd) < 0))
++#if HAVE_SYNC
+     sync ();
++#else
++    ; /* No sync(2) call */
++#endif
+   close (dir_fd);
+   if (!err && flags->verbose)
+     error (0, 0, _("%s: removed"), qoldname);
diff -r 573c3c104e9b -r 3bbf88c3b801 sysutils/coreutils/patches/patch-ah
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/coreutils/patches/patch-ah       Mon Mar 21 14:44:08 2005 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-ah,v 1.1 2005/03/21 14:44:08 tv Exp $
+



Home | Main Index | Thread Index | Old Index