From c3e4c8460e0708727e078ab114341d171503d3c1 Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Oct 27 2005 15:05:08 +0000 Subject: - 5.92. - No longer need afs, dircolors, utmp, gcc4, brokentest, dateseconds, chown, rmaccess, copy, stale-utmp, no-sign-extend, fchown patches. - Updated acl, dateman, pam, langinfo, i18n, getgrouplist, selinux patches. - Dropped printf-ll, allow_old_options, jday, zh_CN patches. - NOTE: i18n patch not ported for sort(1) yet. --- diff --git a/.cvsignore b/.cvsignore index 464a8cb..5ecb618 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1,2 @@ coreutils-5.2.1.tar.bz2 +coreutils-5.92.tar.bz2 diff --git a/coreutils-4.5.3-langinfo.patch b/coreutils-4.5.3-langinfo.patch index 5eca0eb..49a88aa 100644 --- a/coreutils-4.5.3-langinfo.patch +++ b/coreutils-4.5.3-langinfo.patch @@ -1,18 +1,18 @@ ---- coreutils-4.5.3/src/date.c.langinfo 2002-11-28 18:02:47.000000000 +0000 -+++ coreutils-4.5.3/src/date.c 2002-11-28 18:04:04.000000000 +0000 -@@ -509,14 +509,7 @@ - else +--- coreutils-5.92/src/date.c.langinfo 2005-09-16 09:06:57.000000000 +0100 ++++ coreutils-5.92/src/date.c 2005-10-24 18:09:16.000000000 +0100 +@@ -451,14 +451,7 @@ + format = DATE_FMT_LANGINFO (); + if (! *format) { - char *date_fmt = DATE_FMT_LANGINFO (); - /* Do not wrap the following literal format string with _(...). - For example, suppose LC_ALL is unset, LC_TIME="POSIX", -- and LANG="ko_KR". In that case, POSIX says that LC_TIME +- and LANG="ko_KR". In that case, POSIX says that LC_TIME - determines the format and contents of date and time strings - written by date, which means "date" must generate output - using the POSIX locale; but adding _() would cause "date" - to use a Korean translation of the format. */ -- format = *date_fmt ? date_fmt : "%a %b %e %H:%M:%S %Z %Y"; -+ format = *date_fmt ? date_fmt : dcgettext(NULL, N_("%a %b %e %H:%M:%S %Z %Y"), LC_TIME); +- format = "%a %b %e %H:%M:%S %Z %Y"; ++ format = dcgettext(NULL, N_("%a %b %e %H:%M:%S %Z %Y"), LC_TIME); } } - else if (*format == '\0') + diff --git a/coreutils-5.2.1-runuser.patch b/coreutils-5.2.1-runuser.patch index 52014ff..3356638 100644 --- a/coreutils-5.2.1-runuser.patch +++ b/coreutils-5.2.1-runuser.patch @@ -1,5 +1,122 @@ ---- /dev/null 2004-09-30 04:21:43.103661032 -0400 -+++ coreutils-5.2.1/man/runuser.1 2004-10-05 09:56:25.919169327 -0400 +--- coreutils-5.92/src/su.c.runuser 2005-10-27 09:13:53.000000000 +0100 ++++ coreutils-5.92/src/su.c 2005-10-27 09:17:11.000000000 +0100 +@@ -134,7 +134,9 @@ + /* The official name of this program (e.g., no `g' prefix). */ + #define PROGRAM_NAME "su" + ++#ifndef AUTHORS + #define AUTHORS "David MacKenzie" ++#endif + + #if HAVE_PATHS_H + # include +@@ -172,6 +174,10 @@ + #ifndef USE_PAM + char *crypt (); + #endif ++#ifndef CHECKPASSWD ++#define CHECKPASSWD 1 ++#endif ++ + char *getpass (); + char *getusershell (); + void endusershell (); +@@ -730,7 +736,7 @@ + : DEFAULT_SHELL); + endpwent (); + +- if (!correct_password (pw)) ++ if (CHECKPASSWD && !correct_password (pw)) + { + #ifdef SYSLOG_FAILURE + log_su (pw, false); +--- coreutils-5.92/src/Makefile.am.runuser 2005-10-27 09:13:53.000000000 +0100 ++++ coreutils-5.92/src/Makefile.am 2005-10-27 09:13:53.000000000 +0100 +@@ -17,7 +17,7 @@ + ## along with this program; if not, write to the Free Software Foundation, + ## Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +-EXTRA_PROGRAMS = chroot df hostid nice pinky stty su uname uptime users who ++EXTRA_PROGRAMS = chroot df hostid nice pinky stty su runuser uname uptime users who + + bin_SCRIPTS = groups + bin_PROGRAMS = [ chgrp chown chmod cp dd dircolors du \ +@@ -91,6 +91,7 @@ + uptime_LDADD = $(LDADD) $(GETLOADAVG_LIBS) + + su_LDADD = $(LDADD) $(LIB_CRYPT) @LIB_PAM@ ++runuser_LDADD = $(LDADD) $(LIB_CRYPT) + + $(PROGRAMS): ../lib/libcoreutils.a + +@@ -106,7 +107,7 @@ + chmod +x $@-t + mv $@-t $@ + +-all-local: su$(EXEEXT) ++all-local: su$(EXEEXT) runuser + + installed_su = $(DESTDIR)$(bindir)/`echo su|sed '$(transform)'` + +--- /dev/null 2005-10-10 09:36:06.437701000 +0100 ++++ coreutils-5.92/src/runuser.c 2005-10-27 09:17:34.000000000 +0100 +@@ -0,0 +1,54 @@ ++#define CHECKPASSWD 0 ++#define pam_start my_pam_start ++#define pam_end my_pam_end ++#define pam_setcred my_pam_setcred ++#define pam_open_session my_pam_open_session ++#define pam_close_session my_pam_close_session ++#define pam_strerror my_pam_strerror ++#define pam_getenvlist my_pam_getenvlist ++#define AUTHORS "David MacKenzie, Dan Walsh" ++#include "su.c" ++int pam_start(const char *service_name, const char *user, ++ const struct pam_conv *pam_conversation, ++ pam_handle_t **pamh) { ++ return PAM_SUCCESS; ++} ++int pam_end(pam_handle_t *pamh, int pam_status) { ++ return PAM_SUCCESS; ++} ++int pam_setcred(pam_handle_t *pamh, int flags){ ++ return PAM_SUCCESS; ++} ++int pam_open_session(pam_handle_t *pamh, int flags){ ++ return PAM_SUCCESS; ++} ++int pam_close_session(pam_handle_t *pamh, int flags){ ++ return PAM_SUCCESS; ++} ++const char *pam_strerror(pam_handle_t *pamh, int err){ ++ return ""; ++} ++char **pam_getenvlist(pam_handle_t *pamh){ ++ return NULL; ++} ++ ++int misc_conv(int num_msg, const struct pam_message **msgm, ++ struct pam_response **response, void *appdata_ptr) { ++ return PAM_SUCCESS; ++} ++ ++int pam_authenticate(pam_handle_t *pamh, int flags) { ++ return PAM_SUCCESS; ++} ++ ++int pam_acct_mgmt(pam_handle_t *pamh, int flags) { ++ return PAM_SUCCESS; ++} ++ ++int pam_chauthtok (pam_handle_t *pamh, int flags) { ++ return PAM_SUCCESS; ++} ++ ++int pam_set_item(pam_handle_t *pamh, int item_type, const void *item) { ++ return PAM_SUCCESS; ++} +--- /dev/null 2005-10-10 09:36:06.437701000 +0100 ++++ coreutils-5.92/man/runuser.1 2005-10-27 09:13:53.000000000 +0100 @@ -0,0 +1,59 @@ +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33. +.TH RUNUSER "1" "September 2004" "runuser (coreutils) 5.2.1" "User Commands" @@ -60,8 +177,8 @@ +.B info coreutils su +.PP +should give you access to the complete manual. ---- coreutils-5.2.1/man/Makefile.am.runuser 2004-01-23 10:54:23.000000000 -0500 -+++ coreutils-5.2.1/man/Makefile.am 2004-10-05 09:56:25.921169102 -0400 +--- coreutils-5.92/man/Makefile.am.runuser 2005-10-13 15:12:26.000000000 +0100 ++++ coreutils-5.92/man/Makefile.am 2005-10-27 09:13:53.000000000 +0100 @@ -7,7 +7,7 @@ link.1 ln.1 logname.1 \ ls.1 md5sum.1 mkdir.1 mkfifo.1 mknod.1 mv.1 nice.1 nl.1 nohup.1 od.1 \ @@ -79,15 +196,25 @@ seq.1: $(common_dep) $(srcdir)/seq.x ../src/seq.c sha1sum.1: $(common_dep) $(srcdir)/sha1sum.x ../src/md5sum.c shred.1: $(common_dep) $(srcdir)/shred.x ../src/shred.c ---- /dev/null 2004-09-30 04:21:43.103661032 -0400 -+++ coreutils-5.2.1/man/runuser.x 2004-10-05 09:56:25.922168989 -0400 +--- /dev/null 2005-10-10 09:36:06.437701000 +0100 ++++ coreutils-5.92/man/runuser.x 2005-10-27 09:13:53.000000000 +0100 @@ -0,0 +1,4 @@ +[NAME] +runuser \- run a shell with substitute user and group IDs +[DESCRIPTION] +.\" Add any additional description here ---- coreutils-5.2.1/README.runuser 2004-01-18 02:59:41.000000000 -0500 -+++ coreutils-5.2.1/README 2004-10-05 09:56:25.925168651 -0400 +--- coreutils-5.92/tests/help-version.runuser 2005-01-05 22:08:48.000000000 +0000 ++++ coreutils-5.92/tests/help-version 2005-10-27 09:13:53.000000000 +0100 +@@ -136,6 +136,7 @@ + seq_args=10 + sleep_args=0 + su_args=--version ++runuser_args=--version + test_args=foo + + # This is necessary in the unusual event that there is +--- coreutils-5.92/README.runuser 2005-09-28 19:34:03.000000000 +0100 ++++ coreutils-5.92/README 2005-10-27 09:13:53.000000000 +0100 @@ -11,7 +11,7 @@ df dir dircolors dirname du echo env expand expr factor false fmt fold ginstall groups head hostid hostname id join kill link ln logname ls @@ -97,127 +224,13 @@ split stat stty su sum sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes ---- coreutils-5.2.1/tests/help-version.runuser 2004-02-17 11:04:23.000000000 -0500 -+++ coreutils-5.2.1/tests/help-version 2004-10-05 09:56:25.924168764 -0400 -@@ -130,6 +130,7 @@ - seq_args=10 - sleep_args=0 - su_args=--version -+runuser_args=--version - test_args=foo - - # This is necessary in the unusual event that there is ---- coreutils-5.2.1/src/su.c.runuser 2004-10-05 09:56:25.680196251 -0400 -+++ coreutils-5.2.1/src/su.c 2004-10-05 09:56:25.915169778 -0400 -@@ -171,6 +171,10 @@ - #ifndef USE_PAM - char *crypt (); - #endif -+#ifndef CHECKPASSWD -+#define CHECKPASSWD 1 -+#endif -+ - char *getpass (); - char *getusershell (); - void endusershell (); -@@ -740,7 +744,7 @@ - pw->pw_dir = xstrdup (pw->pw_dir); - pw->pw_shell = xstrdup (pw->pw_shell); - -- if (!correct_password (pw)) -+ if (CHECKPASSWD && !correct_password (pw)) - { - #ifdef SYSLOG_FAILURE - log_su (pw, 0); ---- coreutils-5.2.1/src/Makefile.am.runuser 2004-10-05 09:56:25.677196589 -0400 -+++ coreutils-5.2.1/src/Makefile.am 2004-10-05 09:56:25.916169665 -0400 -@@ -1,6 +1,6 @@ - ## Process this file with automake to produce Makefile.in -*-Makefile-*- - --EXTRA_PROGRAMS = chroot df hostid nice pinky stty su uname uptime users who -+EXTRA_PROGRAMS = chroot df hostid nice pinky stty su runuser uname uptime users who - - bin_SCRIPTS = groups - bin_PROGRAMS = [ chgrp chown chmod cp dd dircolors du \ -@@ -67,6 +67,7 @@ - uptime_LDADD = $(LDADD) $(GETLOADAVG_LIBS) - - su_LDADD = $(LDADD) $(LIB_CRYPT) @LIB_PAM@ -+runuser_LDADD = $(LDADD) $(LIB_CRYPT) - - $(PROGRAMS): ../lib/libfetish.a - -@@ -84,7 +85,7 @@ - chmod +x $@-t - mv $@-t $@ - --all-local: su$(EXEEXT) -+all-local: su$(EXEEXT) runuser - - installed_su = $(DESTDIR)$(bindir)/`echo su|sed '$(transform)'` - -@@ -100,7 +101,7 @@ - chmod $(setuid_root_mode) $(installed_su) - - install-root: su$(EXEEXT) -- @$(INSTALL_SU) -+ @$(INSTALL_SU) - - install-exec-local: su$(EXEEXT) - @TMPFILE=$(DESTDIR)$(bindir)/.su-$$$$; \ ---- /dev/null 2004-09-30 04:21:43.103661032 -0400 -+++ coreutils-5.2.1/src/runuser.c 2004-10-05 10:04:28.835490381 -0400 -@@ -0,0 +1,53 @@ -+#define CHECKPASSWD 0 -+#define pam_start my_pam_start -+#define pam_end my_pam_end -+#define pam_setcred my_pam_setcred -+#define pam_open_session my_pam_open_session -+#define pam_close_session my_pam_close_session -+#define pam_strerror my_pam_strerror -+#define pam_getenvlist my_pam_getenvlist -+#include "su.c" -+int pam_start(const char *service_name, const char *user, -+ const struct pam_conv *pam_conversation, -+ pam_handle_t **pamh) { -+ return PAM_SUCCESS; -+} -+int pam_end(pam_handle_t *pamh, int pam_status) { -+ return PAM_SUCCESS; -+} -+int pam_setcred(pam_handle_t *pamh, int flags){ -+ return PAM_SUCCESS; -+} -+int pam_open_session(pam_handle_t *pamh, int flags){ -+ return PAM_SUCCESS; -+} -+int pam_close_session(pam_handle_t *pamh, int flags){ -+ return PAM_SUCCESS; -+} -+const char *pam_strerror(pam_handle_t *pamh, int err){ -+ return ""; -+} -+char **pam_getenvlist(pam_handle_t *pamh){ -+ return NULL; -+} -+ -+int misc_conv(int num_msg, const struct pam_message **msgm, -+ struct pam_response **response, void *appdata_ptr) { -+ return PAM_SUCCESS; -+} -+ -+int pam_authenticate(pam_handle_t *pamh, int flags) { -+ return PAM_SUCCESS; -+} -+ -+int pam_acct_mgmt(pam_handle_t *pamh, int flags) { -+ return PAM_SUCCESS; -+} -+ -+int pam_chauthtok (pam_handle_t *pamh, int flags) { -+ return PAM_SUCCESS; -+} -+ -+int pam_set_item(pam_handle_t *pamh, int item_type, const void *item) { -+ return PAM_SUCCESS; -+} +--- coreutils-5.92/AUTHORS.runuser 2004-11-03 23:10:50.000000000 +0000 ++++ coreutils-5.92/AUTHORS 2005-10-27 09:13:53.000000000 +0100 +@@ -59,6 +59,7 @@ + readlink: Dmitry V. Levin + rm: Paul Rubin, David MacKenzie, Richard Stallman, Jim Meyering + rmdir: David MacKenzie ++runuser: David MacKenzie, Dan Walsh + seq: Ulrich Drepper + sha1sum: Ulrich Drepper, Scott Miller + shred: Colin Plumb diff --git a/coreutils-getgrouplist.patch b/coreutils-getgrouplist.patch index 35ad04a..0e2851d 100644 --- a/coreutils-getgrouplist.patch +++ b/coreutils-getgrouplist.patch @@ -1,16 +1,16 @@ ---- coreutils-5.2.1/m4/jm-macros.m4.getgrouplist 2003-12-20 17:57:18.000000000 +0000 -+++ coreutils-5.2.1/m4/jm-macros.m4 2004-10-05 12:43:14.975401711 +0100 -@@ -83,6 +83,7 @@ - endpwent \ - fdatasync \ +--- coreutils-5.92/m4/jm-macros.m4.getgrouplist 2005-09-25 06:57:46.000000000 +0100 ++++ coreutils-5.92/m4/jm-macros.m4 2005-10-25 14:28:45.000000000 +0100 +@@ -105,6 +105,7 @@ + fchmod \ + fchown \ ftruncate \ + getgrouplist \ - gethrtime \ hasmntopt \ isascii \ ---- coreutils-5.2.1/lib/getugroups.c.getgrouplist 2003-09-10 07:23:09.000000000 +0100 -+++ coreutils-5.2.1/lib/getugroups.c 2004-10-05 12:43:14.980400761 +0100 -@@ -21,6 +21,9 @@ + iswspace \ +--- coreutils-5.92/lib/getugroups.c.getgrouplist 2005-09-22 07:47:18.000000000 +0100 ++++ coreutils-5.92/lib/getugroups.c 2005-10-25 14:28:02.000000000 +0100 +@@ -23,6 +23,9 @@ # include #endif @@ -20,15 +20,15 @@ #include #include /* grp.h on alpha OSF1 V2.0 uses "FILE *". */ #include -@@ -95,3 +98,4 @@ +@@ -105,3 +108,4 @@ return count; } +#endif /* have getgrouplist */ ---- coreutils-5.2.1/src/id.c.getgrouplist 2004-10-05 12:26:40.222539037 +0100 -+++ coreutils-5.2.1/src/id.c 2004-10-05 12:43:14.986399620 +0100 -@@ -316,14 +316,36 @@ - if (username == 0) +--- coreutils-5.92/src/id.c.getgrouplist 2005-08-11 22:02:57.000000000 +0100 ++++ coreutils-5.92/src/id.c 2005-10-25 14:30:41.000000000 +0100 +@@ -253,7 +253,14 @@ + if (!username) max_n_groups = getgroups (0, NULL); else - max_n_groups = getugroups (0, NULL, username, gid); @@ -41,28 +41,29 @@ +#endif + } - /* Add 1 just in case max_n_groups is zero. */ - g = xmalloc (max_n_groups * sizeof (GETGROUPS_T) + 1); - if (username == 0) - ng = getgroups (max_n_groups, g); - else -- ng = getugroups (max_n_groups, g, username, gid); -+ { -+#ifdef HAVE_GETGROUPLIST -+ int e; -+ ng = max_n_groups; -+ while ((e = getgrouplist (username, gid, g, &ng)) == -1 -+ && ng > max_n_groups) + if (max_n_groups < 0) + ng = -1; +@@ -263,7 +270,22 @@ + if (!username) + ng = getgroups (max_n_groups, g); + else +- ng = getugroups (max_n_groups, g, username, gid); + { -+ max_n_groups = ng; -+ g = xrealloc (g, max_n_groups * sizeof (GETGROUPS_T)); -+ } -+ if (e == -1) -+ ng = -1; ++#ifdef HAVE_GETGROUPLIST ++ int e; ++ ng = max_n_groups; ++ while ((e = getgrouplist (username, gid, g, &ng)) == -1 ++ && ng > max_n_groups) ++ { ++ max_n_groups = ng; ++ g = xrealloc (g, max_n_groups * sizeof (GETGROUPS_T)); ++ } ++ if (e == -1) ++ ng = -1; +#else -+ ng = getugroups (max_n_groups, g, username, gid); ++ ng = getugroups (max_n_groups, g, username, gid); +#endif -+ } ++ } + } if (ng < 0) - { diff --git a/coreutils-i18n.patch b/coreutils-i18n.patch index 99d1d47..d128144 100644 --- a/coreutils-i18n.patch +++ b/coreutils-i18n.patch @@ -1,5 +1,5 @@ ---- coreutils-5.1.3/lib/linebuffer.h.i18n 2003-06-18 07:58:01.000000000 +0100 -+++ coreutils-5.1.3/lib/linebuffer.h 2004-02-16 15:36:40.000000000 +0000 +--- coreutils-5.92/lib/linebuffer.h.i18n 2005-05-14 08:58:06.000000000 +0100 ++++ coreutils-5.92/lib/linebuffer.h 2005-10-26 22:17:04.000000000 +0100 @@ -22,6 +22,11 @@ # include @@ -22,8 +22,8 @@ }; /* Initialize linebuffer LINEBUFFER for use. */ ---- coreutils-5.1.3/src/cut.c.i18n 2004-01-21 22:27:02.000000000 +0000 -+++ coreutils-5.1.3/src/cut.c 2004-02-16 15:45:41.000000000 +0000 +--- coreutils-5.92/src/cut.c.i18n 2005-08-12 09:28:48.000000000 +0100 ++++ coreutils-5.92/src/cut.c 2005-10-26 22:17:04.000000000 +0100 @@ -29,6 +29,11 @@ #include #include @@ -56,7 +56,7 @@ #define PROGRAM_NAME "cut" @@ -67,6 +84,52 @@ - } \ + } \ while (0) +/* Refill the buffer BUF to get a multibyte character. */ @@ -159,7 +159,7 @@ /* If true do not output lines containing no delimeter characters. Otherwise, all such lines are printed. This option is valid only with field mode. */ -@@ -128,6 +202,9 @@ +@@ -132,6 +206,9 @@ /* The delimeter character for field mode. */ static unsigned char delim; @@ -169,16 +169,16 @@ /* True if the --output-delimiter=STRING option was specified. */ static bool output_delimiter_specified; -@@ -199,7 +276,7 @@ - -f, --fields=LIST output only these fields; also print any line\n\ +@@ -205,7 +282,7 @@ + -f, --fields=LIST select only these fields; also print any line\n\ that contains no delimiter character, unless\n\ the -s option is specified\n\ - -n (ignored)\n\ + -n with -b: don't split multibyte characters\n\ "), stdout); fputs (_("\ - -s, --only-delimited do not print lines not containing delimiters\n\ -@@ -327,7 +404,7 @@ + --complement complement the set of selected bytes, characters\n\ +@@ -360,7 +437,7 @@ in_digits = false; /* Starting a range. */ if (dash_found) @@ -187,7 +187,7 @@ dash_found = true; fieldstr++; -@@ -352,14 +429,16 @@ +@@ -385,14 +462,16 @@ if (value == 0) { /* `n-'. From `initial' to end of line. */ @@ -206,7 +206,7 @@ /* Is there already a range going to end of line? */ if (eol_range_start != 0) -@@ -434,6 +513,9 @@ +@@ -465,6 +544,9 @@ if (operating_mode == byte_mode) error (0, 0, _("byte offset %s is too large"), quote (bad_num)); @@ -216,7 +216,7 @@ else error (0, 0, _("field number %s is too large"), quote (bad_num)); -@@ -445,7 +527,7 @@ +@@ -475,7 +557,7 @@ fieldstr++; } else @@ -225,16 +225,7 @@ } max_range_endpoint = 0; -@@ -515,7 +597,7 @@ - print_delimiter = false; - while (1) - { -- register int c; /* Each character from the file. */ -+ int c; /* Each character from the file. */ - - c = getc (stream); - -@@ -549,6 +631,63 @@ +@@ -568,6 +650,63 @@ } } @@ -298,7 +289,7 @@ /* Read from stream STREAM, printing to standard output any selected fields. */ static void -@@ -669,13 +808,192 @@ +@@ -689,13 +828,192 @@ } } @@ -494,8 +485,8 @@ } /* Process file FILE to standard output. -@@ -724,6 +1042,8 @@ - int optc, exit_status = 0; +@@ -745,6 +1063,8 @@ + bool ok; bool delim_specified = false; char *spec_list_string IF_LINT(= NULL); + char mbdelim[MB_LEN_MAX + 1]; @@ -503,15 +494,15 @@ initialize_main (&argc, &argv); program_name = argv[0]; -@@ -749,7 +1069,6 @@ - break; - +@@ -767,7 +1087,6 @@ + switch (optc) + { case 'b': - case 'c': /* Build the byte list. */ if (operating_mode != undefined_mode) FATAL_ERROR (_("only one type of list may be specified")); -@@ -757,6 +1076,14 @@ +@@ -775,6 +1094,14 @@ spec_list_string = optarg; break; @@ -526,7 +517,7 @@ case 'f': /* Build the field list. */ if (operating_mode != undefined_mode) -@@ -768,10 +1095,35 @@ +@@ -786,10 +1113,35 @@ case 'd': /* New delimiter. */ /* Interpret -d '' to mean `use the NUL byte as the delimiter.' */ @@ -566,7 +557,7 @@ break; case OUTPUT_DELIMITER_OPTION: -@@ -784,6 +1136,7 @@ +@@ -802,6 +1154,7 @@ break; case 'n': @@ -574,7 +565,7 @@ break; case 's': -@@ -802,7 +1155,7 @@ +@@ -824,7 +1177,7 @@ if (operating_mode == undefined_mode) FATAL_ERROR (_("you must specify a list of bytes, characters, or fields")); @@ -583,7 +574,7 @@ FATAL_ERROR (_("an input delimiter may be specified only\ when operating on fields")); -@@ -829,15 +1182,34 @@ +@@ -851,15 +1204,34 @@ } if (!delim_specified) @@ -624,10 +615,10 @@ } if (optind == argc) ---- coreutils-5.1.3/src/pr.c.i18n 2004-01-21 22:27:02.000000000 +0000 -+++ coreutils-5.1.3/src/pr.c 2004-02-16 15:36:40.000000000 +0000 -@@ -314,12 +314,50 @@ - #include +--- coreutils-5.92/src/pr.c.i18n 2005-09-16 08:51:01.000000000 +0100 ++++ coreutils-5.92/src/pr.c 2005-10-26 22:17:04.000000000 +0100 +@@ -313,6 +313,32 @@ + #include #include + @@ -658,8 +649,9 @@ + #include "system.h" #include "error.h" - #include "mbswidth.h" - #include "posixver.h" + #include "hard-locale.h" +@@ -324,6 +350,18 @@ + #include "strftime.h" #include "xstrtol.h" +/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ @@ -677,29 +669,29 @@ /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "pr" -@@ -412,7 +450,20 @@ +@@ -416,7 +454,20 @@ #define NULLCOL (COLUMN *)0 --static int char_to_clump (int c); +-static int char_to_clump (char c); +/* Funtion pointers to switch functions for single byte locale or for + multibyte locale. If multibyte functions do not exist in your sysytem, + these pointers always point the function for single byte locale. */ -+static void (*print_char) (int c); -+static int (*char_to_clump) (int c); ++static void (*print_char) (char c); ++static int (*char_to_clump) (char c); + +/* Functions for single byte locale. */ -+static void print_char_single (int c); -+static int char_to_clump_single (int c); ++static void print_char_single (char c); ++static int char_to_clump_single (char c); + +/* Functions for multibyte locale. */ -+static void print_char_multi (int c); -+static int char_to_clump_multi (int c); ++static void print_char_multi (char c); ++static int char_to_clump_multi (char c); + - static int read_line (COLUMN *p); - static int print_page (void); - static int print_stored (COLUMN *p); -@@ -422,6 +473,7 @@ + static bool read_line (COLUMN *p); + static bool print_page (void); + static bool print_stored (COLUMN *p); +@@ -426,6 +477,7 @@ static void pad_across_to (int position); static void add_line_number (COLUMN *p); static void getoptarg (char *arg, char switch_char, char *character, @@ -707,15 +699,15 @@ int *number); void usage (int status); static void print_files (int number_of_files, char **av); -@@ -436,7 +488,6 @@ +@@ -440,7 +492,6 @@ static void pad_down (int lines); static void read_rest_of_line (COLUMN *p); static void skip_read (COLUMN *p, int column_number); --static void print_char (int c); +-static void print_char (char c); static void cleanup (void); - static void first_last_page (char *pages); static void print_sep_string (void); -@@ -452,7 +503,7 @@ + static void separator_string (const char *optarg_S); +@@ -455,7 +506,7 @@ we store the leftmost columns contiguously in buff. To print a line from buff, get the index of the first character from line_vector[i], and print up to line_vector[i + 1]. */ @@ -724,8 +716,8 @@ /* Index of the position in buff where the next character will be stored. */ -@@ -556,7 +607,7 @@ - static int untabify_input = FALSE; +@@ -559,7 +610,7 @@ + static bool untabify_input = false; /* (-e) The input tab character. */ -static char input_tab_char = '\t'; @@ -733,8 +725,8 @@ /* (-e) Tabstops are at chars_per_tab, 2*chars_per_tab, 3*chars_per_tab, ... where the leftmost column is 1. */ -@@ -566,7 +617,10 @@ - static int tabify_output = FALSE; +@@ -569,7 +620,10 @@ + static bool tabify_output = false; /* (-i) The output tab character. */ -static char output_tab_char = '\t'; @@ -745,8 +737,8 @@ /* (-i) The width of the output tab. */ static int chars_per_output_tab = 8; -@@ -640,7 +694,13 @@ - static int numbered_lines = FALSE; +@@ -643,7 +697,13 @@ + static bool numbered_lines = false; /* (-n) Character which follows each line number. */ -static char number_separator = '\t'; @@ -760,7 +752,7 @@ /* (-n) line counting starts with 1st line of input file (not with 1st line of 1st page printed). */ -@@ -693,6 +753,7 @@ +@@ -696,6 +756,7 @@ -a|COLUMN|-m is a `space' and with the -J option a `tab'. */ static char *col_sep_string = ""; static int col_sep_length = 0; @@ -768,7 +760,7 @@ static char *column_separator = " "; static char *line_separator = "\t"; -@@ -842,6 +903,13 @@ +@@ -852,6 +913,13 @@ col_sep_length = (int) strlen (optarg_S); col_sep_string = xmalloc (col_sep_length + 1); strcpy (col_sep_string, optarg_S); @@ -782,7 +774,7 @@ } int -@@ -866,6 +934,21 @@ +@@ -877,6 +945,21 @@ atexit (close_stdout); @@ -804,7 +796,7 @@ n_files = 0; file_names = (argc > 1 ? xmalloc ((argc - 1) * sizeof (char *)) -@@ -943,8 +1026,12 @@ +@@ -949,8 +1032,12 @@ break; case 'e': if (optarg) @@ -817,9 +809,9 @@ + &dummy_width, &chars_per_input_tab); + } /* Could check tab width > 0. */ - untabify_input = TRUE; + untabify_input = true; break; -@@ -957,8 +1044,12 @@ +@@ -963,8 +1050,12 @@ break; case 'i': if (optarg) @@ -832,11 +824,11 @@ + &dummy_width, &chars_per_output_tab); + } /* Could check tab width > 0. */ - tabify_output = TRUE; + tabify_output = true; break; -@@ -985,8 +1076,8 @@ +@@ -991,8 +1082,8 @@ case 'n': - numbered_lines = TRUE; + numbered_lines = true; if (optarg) - getoptarg (optarg, 'n', &number_separator, - &chars_per_number); @@ -844,17 +836,17 @@ + &number_separator_width, &chars_per_number); break; case 'N': - skip_count = FALSE; -@@ -1025,7 +1116,7 @@ - old_s = FALSE; + skip_count = false; +@@ -1031,7 +1122,7 @@ + old_s = false; /* Reset an additional input of -s, -S dominates -s */ col_sep_string = ""; - col_sep_length = 0; + col_sep_length = col_sep_width = 0; - use_col_separator = TRUE; + use_col_separator = true; if (optarg) separator_string (optarg); -@@ -1173,10 +1264,45 @@ +@@ -1188,10 +1279,45 @@ a number. */ static void @@ -902,16 +894,16 @@ if (*arg) { long int tmp_long; -@@ -1241,7 +1367,7 @@ +@@ -1256,7 +1382,7 @@ else col_sep_string = column_separator; - col_sep_length = 1; + col_sep_length = col_sep_width = 1; - use_col_separator = TRUE; + use_col_separator = true; } /* It's rather pointless to define a TAB separator with column -@@ -1273,11 +1399,11 @@ +@@ -1288,11 +1414,11 @@ TAB_WIDTH (chars_per_input_tab, chars_per_number); */ /* Estimate chars_per_text without any margin and keep it constant. */ @@ -925,7 +917,7 @@ /* The number is part of the column width unless we are printing files in parallel. */ -@@ -1292,7 +1418,7 @@ +@@ -1307,7 +1433,7 @@ } chars_per_column = (chars_per_line - chars_used_by_number - @@ -934,7 +926,7 @@ if (chars_per_column < 1) error (EXIT_FAILURE, 0, _("page width too narrow")); -@@ -1421,7 +1547,7 @@ +@@ -1432,7 +1558,7 @@ /* Enlarge p->start_position of first column to use the same form of padding_not_printed with all columns. */ @@ -943,7 +935,7 @@ /* This loop takes care of all but the rightmost column. */ -@@ -1455,7 +1581,7 @@ +@@ -1466,7 +1592,7 @@ } else { @@ -952,7 +944,7 @@ h_next = h + chars_per_column; } } -@@ -1739,9 +1865,9 @@ +@@ -1756,9 +1882,9 @@ align_column (COLUMN *p) { padding_not_printed = p->start_position; @@ -964,11 +956,11 @@ padding_not_printed = ANYWHERE; } -@@ -2015,13 +2141,13 @@ +@@ -2029,13 +2155,13 @@ /* May be too generous. */ - buff = x2nrealloc (buff, &buff_allocated, sizeof *buff); + buff = X2REALLOC (buff, &buff_allocated); } -- buff[buff_current++] = (char) c; +- buff[buff_current++] = c; + buff[buff_current++] = (unsigned char) c; } @@ -980,7 +972,7 @@ char *s; int left_cut; -@@ -2044,22 +2170,24 @@ +@@ -2058,22 +2184,24 @@ /* Tabification is assumed for multiple columns, also for n-separators, but `default n-separator = TAB' hasn't been given priority over equal column_width also specified by POSIX. */ @@ -989,27 +981,27 @@ { i = number_width - chars_per_number; while (i-- > 0) - (p->char_func) ((int) ' '); + (p->char_func) (' '); } else -- (p->char_func) ((int) number_separator); +- (p->char_func) (number_separator); + for (j = 0; j < number_separator_length; j++) -+ (p->char_func) ((int) number_separator[j]); ++ (p->char_func) (number_separator[j]); } else /* To comply with POSIX, we avoid any expansion of default TAB separator with a single column output. No column_width requirement has to be considered. */ { -- (p->char_func) ((int) number_separator); +- (p->char_func) (number_separator); - if (number_separator == '\t') -+ for (j = 0; j < number_separator_length; j++) -+ (p->char_func) ((int) number_separator[j]); ++ for (j = 0; j < number_separator_length; j++) ++ (p->char_func) (number_separator[j]); + if (number_separator[0] == '\t') output_position = POS_AFTER_TAB (chars_per_output_tab, output_position); } -@@ -2219,7 +2347,7 @@ +@@ -2234,7 +2362,7 @@ while (goal - h_old > 1 && (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal) { @@ -1018,7 +1010,7 @@ h_old = h_new; } while (++h_old <= goal) -@@ -2239,6 +2367,7 @@ +@@ -2254,6 +2382,7 @@ { char *s; int l = col_sep_length; @@ -1026,7 +1018,7 @@ s = col_sep_string; -@@ -2252,6 +2381,7 @@ +@@ -2267,6 +2396,7 @@ { for (; separators_not_printed > 0; --separators_not_printed) { @@ -1034,7 +1026,7 @@ while (l-- > 0) { /* 3 types of sep_strings: spaces only, spaces and chars, -@@ -2265,12 +2395,15 @@ +@@ -2280,12 +2410,15 @@ } else { @@ -1051,24 +1043,22 @@ /* sep_string ends with some spaces */ if (spaces_not_printed > 0) print_white_space (); -@@ -2297,8 +2430,9 @@ - a nonspace is encountered, call print_white_space() to print the +@@ -2313,7 +2446,7 @@ required number of tabs and spaces. */ -+ static void --print_char (int c) -+print_char_single (int c) +-print_char (char c) ++print_char_single (char c) { if (tabify_output) { -@@ -2322,6 +2456,74 @@ +@@ -2337,6 +2470,74 @@ putchar (c); } +#ifdef HAVE_MBRTOWC +static void -+print_char_multi (int c) ++print_char_multi (char c) +{ + static size_t mbc_pos = 0; + static unsigned char mbc[MB_LEN_MAX] = {'\0'}; @@ -1137,8 +1127,8 @@ /* Skip to page PAGE before printing. PAGE may be larger than total number of pages. */ -@@ -2496,9 +2698,9 @@ - align_empty_cols = FALSE; +@@ -2517,9 +2718,9 @@ + align_empty_cols = false; } - if (padding_not_printed - col_sep_length > 0) @@ -1149,7 +1139,7 @@ padding_not_printed = ANYWHERE; } -@@ -2599,9 +2801,9 @@ +@@ -2620,9 +2821,9 @@ } } @@ -1161,7 +1151,7 @@ padding_not_printed = ANYWHERE; } -@@ -2614,8 +2816,8 @@ +@@ -2635,8 +2836,8 @@ if (spaces_not_printed == 0) { output_position = p->start_position + end_vector[line]; @@ -1171,19 +1161,17 @@ + output_position -= col_sep_width; } - return TRUE; -@@ -2633,8 +2835,9 @@ - characters in clump_buff. (e.g, the width of '\b' is -1, while the + return true; +@@ -2655,7 +2856,7 @@ number of characters is 1.) */ -+ static int --char_to_clump (int c) -+char_to_clump_single (int c) +-char_to_clump (char c) ++char_to_clump_single (char c) { - register int *s = clump_buff; - register int i; -@@ -2643,10 +2846,10 @@ + unsigned char uc = c; + char *s = clump_buff; +@@ -2665,10 +2866,10 @@ int chars; int chars_per_c = 8; @@ -1196,16 +1184,16 @@ { width = TAB_WIDTH (chars_per_c, input_position); -@@ -2717,6 +2920,154 @@ +@@ -2739,6 +2940,154 @@ return chars; } +#ifdef HAVE_MBRTOWC +static int -+char_to_clump_multi (int c) ++char_to_clump_multi (char c) +{ + static size_t mbc_pos = 0; -+ static unsigned char mbc[MB_LEN_MAX] = {'\0'}; ++ static char mbc[MB_LEN_MAX] = {'\0'}; + static mbstate_t state = {'\0'}; + mbstate_t state_bak; + wchar_t wc; @@ -1219,7 +1207,7 @@ + int chars_per_c = 8; + + state_bak = state; -+ mbc[mbc_pos++] = (unsigned char)c; ++ mbc[mbc_pos++] = c; + mblength = mbrtowc (&wc, mbc, mbc_pos, &state); + + width = 0; @@ -1351,1032 +1339,8 @@ /* We've just printed some files and need to clean up things before looking for more options and printing the next batch of files. ---- coreutils-5.2.1/src/sort.c 2004-12-15 14:10:01.347312694 +0000 -+++ coreutils-5.2.1/src/sort.c 2005-02-09 07:34:40.000000000 -0500 -@@ -23,10 +23,31 @@ - - #include - -+#include - #include - #include - #include - #include -+ -+/* Solaris 2.5 has a bug: must be included before . */ -+/* Get mbstate_t, mbrtowc(), wcwidth(). */ -+#if HAVE_WCHAR_H -+# include -+#endif -+ -+/* Get isw* functions. */ -+#if HAVE_WCTYPE_H -+# include -+#endif -+ -+/* Get nl_langinfo(). */ -+#if HAVE_LANGINFO_CODESET -+# include -+#endif -+ -+/* Include this after wctype.h so that we `#undef' ISPRINT -+ (from Solaris's euc.h, from widec.h, from wctype.h) before -+ redefining and using it. */ - #include "system.h" - #include "error.h" - #include "hard-locale.h" -@@ -46,6 +67,17 @@ - # define getrlimit(Resource, Rlp) (-1) - #endif - -+/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC -+ installation; work around this configuration error. */ -+#if !defined MB_LEN_MAX || MB_LEN_MAX == 1 -+# define MB_LEN_MAX 16 -+#endif -+ -+/* Some systems, like BeOS, have multibyte encodings but lack mbstate_t. */ -+#if HAVE_MBRTOWC && defined mbstate_t -+# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0) -+#endif -+ - /* The official name of this program (e.g., no `g' prefix). */ - #define PROGRAM_NAME "sort" - -@@ -91,6 +123,7 @@ - - static char decimal_point; - static int th_sep; /* if CHAR_MAX + 1, then there is no thousands separator */ -+static int force_general_numcompare = 0; - - /* Nonzero if the corresponding locales are hard. */ - static bool hard_LC_COLLATE; -@@ -109,6 +142,28 @@ - - #define NONZERO(x) (x != 0) - -+/* get a multibyte character's byte length. */ -+#define GET_BYTELEN_OF_CHAR(LIM, PTR, MBLENGTH, STATE) \ -+ do \ -+ { \ -+ wchar_t wc; \ -+ mbstate_t state_bak; \ -+ \ -+ state_bak = STATE; \ -+ mblength = mbrtowc (&wc, PTR, LIM - PTR, &STATE); \ -+ \ -+ switch (MBLENGTH) \ -+ { \ -+ case (size_t)-1: \ -+ case (size_t)-2: \ -+ STATE = state_bak; \ -+ /* Fall through. */ \ -+ case 0: \ -+ MBLENGTH = 1; \ -+ } \ -+ } \ -+ while (0) -+ - /* The kind of blanks for '-b' to skip in various options. */ - enum blanktype { bl_start, bl_end, bl_both }; - -@@ -245,13 +300,11 @@ - they were read if all keys compare equal. */ - static bool stable; - --/* If TAB has this value, blanks separate fields. */ --enum { TAB_DEFAULT = CHAR_MAX + 1 }; -- --/* Tab character separating fields. If TAB_DEFAULT, then fields are -+/* Tab character separating fields. If tab_length is 0, then fields are - separated by the empty string between a non-blank character and a blank - character. */ --static int tab = TAB_DEFAULT; -+static char tab[MB_LEN_MAX + 1]; -+static size_t tab_length = 0; - - /* Flag to remove consecutive duplicate lines from the output. - Only the last of a sequence of equal lines will be output. */ -@@ -384,6 +437,46 @@ - }; - static struct tempnode *volatile temphead; - -+/* Fucntion pointers. */ -+static void -+(*inittables) (void); -+ -+static char * -+(* begfield) (const struct line *line, const struct keyfield *key); -+ -+static char * -+(* limfield) (const struct line *line, const struct keyfield *key); -+ -+static int -+(*getmonth) (const char *s, size_t len); -+ -+static int -+(* keycompare) (const struct line *a, const struct line *b); -+ -+/* Test for white space multibyte character. -+ Set LENGTH the byte length of investigated multibyte character. */ -+#if HAVE_MBRTOWC -+static int -+ismbblank (const char *str, size_t len, size_t *length) -+{ -+ size_t mblength; -+ wchar_t wc; -+ mbstate_t state; -+ -+ memset (&state, '\0', sizeof(mbstate_t)); -+ mblength = mbrtowc (&wc, str, len, &state); -+ -+ if (mblength == (size_t)-1 || mblength == (size_t)-2) -+ { -+ *length = 1; -+ return 0; -+ } -+ -+ *length = (mblength < 1) ? 1 : mblength; -+ return iswblank (wc); -+} -+#endif -+ - /* Clean up any remaining temporary files. */ - - static void -@@ -521,7 +614,7 @@ - } - } - --#if HAVE_NL_LANGINFO -+#if HAVE_LANGINFO_CODESET - - static int - struct_month_cmp (const void *m1, const void *m2) -@@ -536,7 +629,7 @@ - /* Initialize the character class tables. */ - - static void --inittables (void) -+inittables_uni (void) - { - int i; - -@@ -574,6 +667,64 @@ - #endif - } - -+#if HAVE_MBRTOWC -+static void -+inittables_mb (void) -+{ -+ int i, j, k, l; -+ char *name, *s; -+ size_t s_len, mblength; -+ char mbc[MB_LEN_MAX]; -+ wchar_t wc, pwc; -+ mbstate_t state_mb, state_wc; -+ -+ for (i = 0; i < MONTHS_PER_YEAR; i++) -+ { -+ s = (char *) nl_langinfo (ABMON_1 + i); -+ s_len = strlen (s); -+ monthtab[i].name = name = (char *) xmalloc (s_len + 1); -+ monthtab[i].val = i + 1; -+ -+ memset (&state_mb, '\0', sizeof (mbstate_t)); -+ memset (&state_wc, '\0', sizeof (mbstate_t)); -+ -+ for (j = 0; j < s_len;) -+ { -+ if (!ismbblank (s + j, s_len - j, &mblength)) -+ break; -+ j += mblength; -+ } -+ -+ for (k = 0; j < s_len;) -+ { -+ mblength = mbrtowc (&wc, (s + j), (s_len - j), &state_mb); -+ assert (mblength != (size_t)-1 && mblength != (size_t)-2); -+ if (mblength == 0) -+ break; -+ -+ pwc = towupper (wc); -+ if (pwc == wc) -+ { -+ memcpy (mbc, s + j, mblength); -+ j += mblength; -+ } -+ else -+ { -+ j += mblength; -+ mblength = wcrtomb (mbc, pwc, &state_wc); -+ assert (mblength != (size_t)0 && mblength != (size_t)-1); -+ } -+ -+ for (l = 0; l < mblength; l++) -+ name[k++] = mbc[l]; -+ } -+ name[k] = '\0'; -+ } -+ qsort ((void *) monthtab, MONTHS_PER_YEAR, -+ sizeof (struct month), struct_month_cmp); -+} -+#endif -+ - /* Specify the amount of main memory to use when sorting. */ - static void - specify_sort_size (char const *s) -@@ -784,7 +935,7 @@ - by KEY in LINE. */ - - static char * --begfield (const struct line *line, const struct keyfield *key) -+begfield_uni (const struct line *line, const struct keyfield *key) - { - register char *ptr = line->text, *lim = ptr + line->length - 1; - register size_t sword = key->sword; -@@ -794,10 +945,10 @@ - /* The leading field separator itself is included in a field when -t - is absent. */ - -- if (tab != TAB_DEFAULT) -+ if (tab_length) - while (ptr < lim && sword--) - { -- while (ptr < lim && *ptr != tab) -+ while (ptr < lim && *ptr != tab[0]) - ++ptr; - if (ptr < lim) - ++ptr; -@@ -825,11 +976,70 @@ - return ptr; - } - -+#if HAVE_MBRTOWC -+static char * -+begfield_mb (const struct line *line, const struct keyfield *key) -+{ -+ int i; -+ char *ptr = line->text, *lim = ptr + line->length - 1; -+ size_t sword = key->sword; -+ size_t schar = key->schar; -+ size_t mblength; -+ mbstate_t state; -+ -+ memset (&state, '\0', sizeof(mbstate_t)); -+ -+ if (tab_length) -+ while (ptr < lim && sword--) -+ { -+ while (ptr < lim && memcmp (ptr, tab, tab_length) != 0) -+ { -+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); -+ ptr += mblength; -+ } -+ if (ptr < lim) -+ { -+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); -+ ptr += mblength; -+ } -+ } -+ else -+ while (ptr < lim && sword--) -+ { -+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength)) -+ ptr += mblength; -+ if (ptr < lim) -+ { -+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); -+ ptr += mblength; -+ } -+ while (ptr < lim && !ismbblank (ptr, lim - ptr, &mblength)) -+ ptr += mblength; -+ } -+ -+ if (key->skipsblanks) -+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength)) -+ ptr += mblength; -+ -+ for (i = 0; i < schar; i++) -+ { -+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); -+ -+ if (ptr + mblength > lim) -+ break; -+ else -+ ptr += mblength; -+ } -+ -+ return ptr; -+} -+#endif -+ - /* Return the limit of (a pointer to the first character after) the field - in LINE specified by KEY. */ - - static char * --limfield (const struct line *line, const struct keyfield *key) -+limfield_uni (const struct line *line, const struct keyfield *key) - { - register char *ptr = line->text, *lim = ptr + line->length - 1; - register size_t eword = key->eword, echar = key->echar; -@@ -842,10 +1052,10 @@ - `beginning' is the first character following the delimiting TAB. - Otherwise, leave PTR pointing at the first `blank' character after - the preceding field. */ -- if (tab != TAB_DEFAULT) -+ if (tab_length) - while (ptr < lim && eword--) - { -- while (ptr < lim && *ptr != tab) -+ while (ptr < lim && *ptr != tab[0]) - ++ptr; - if (ptr < lim && (eword | echar)) - ++ptr; -@@ -891,10 +1101,10 @@ - */ - - /* Make LIM point to the end of (one byte past) the current field. */ -- if (tab != TAB_DEFAULT) -+ if (tab_length) - { - char *newlim; -- newlim = memchr (ptr, tab, lim - ptr); -+ newlim = memchr (ptr, tab[0], lim - ptr); - if (newlim) - lim = newlim; - } -@@ -926,15 +1136,137 @@ - return ptr; - } - -+#if HAVE_MBRTOWC -+static char * -+limfield_mb (const struct line *line, const struct keyfield *key) -+{ -+ char *ptr = line->text, *lim = ptr + line->length - 1; -+ size_t eword = key->eword, echar = key->echar; -+ int i; -+ size_t mblength; -+ mbstate_t state; -+ -+ memset (&state, '\0', sizeof(mbstate_t)); -+ -+ if (tab_length) -+ while (ptr < lim && eword--) -+ { -+ while (ptr < lim && memcmp (ptr, tab, tab_length) != 0) -+ { -+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); -+ ptr += mblength; -+ } -+ if (ptr < lim && (eword | echar)) -+ { -+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); -+ ptr += mblength; -+ } -+ } -+ else -+ while (ptr < lim && eword--) -+ { -+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength)) -+ ptr += mblength; -+ if (ptr < lim) -+ { -+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); -+ ptr += mblength; -+ } -+ while (ptr < lim && !ismbblank (ptr, lim - ptr, &mblength)) -+ ptr += mblength; -+ } -+ -+ -+# ifdef POSIX_UNSPECIFIED -+ /* Make LIM point to the end of (one byte past) the current field. */ -+ if (tab_length) -+ { -+ char *newlim, *p; -+ -+ newlim = NULL; -+ for (p = ptr; p < lim;) -+ { -+ if (memcmp (p, tab, tab_length) == 0) -+ { -+ newlim = p; -+ break; -+ } -+ -+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); -+ p += mblength; -+ } -+ } -+ else -+ { -+ char *newlim; -+ newlim = ptr; -+ -+ while (newlim < lim && ismbblank (newlim, lim - newlim, &mblength)) -+ newlim += mblength; -+ if (ptr < lim) -+ { -+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); -+ ptr += mblength; -+ } -+ while (newlim < lim && !ismbblank (newlim, lim - newlim, &mblength)) -+ newlim += mblength; -+ lim = newlim; -+ } -+# endif -+ -+ /* If we're skipping leading blanks, don't start counting characters -+ * until after skipping past any leading blanks. */ -+ if (key->skipsblanks) -+ while (ptr < lim && ismbblank (ptr, lim - ptr, &mblength)) -+ ptr += mblength; -+ -+ memset (&state, '\0', sizeof(mbstate_t)); -+ -+ /* Advance PTR by ECHAR (if possible), but no further than LIM. */ -+ for (i = 0; i < echar; i++) -+ { -+ GET_BYTELEN_OF_CHAR (lim, ptr, mblength, state); -+ -+ if (ptr + mblength > lim) -+ break; -+ else -+ ptr += mblength; -+ } -+ -+ return ptr; -+} -+#endif -+ - /* Return the number of trailing blanks in FIELD, with LEN bytes. */ - - static size_t - trailing_blanks (char const *field, size_t len) - { -- size_t i; -- for (i = len; 0 < i && blanks[UCHAR (field[i - 1])]; i--) -- continue; -- return len - i; -+#if HAVE_MBRTOWC -+ if (MB_CUR_MAX > 1) -+ { -+ size_t blanks = 0; -+ -+ while (len) { -+ size_t mblength; -+ if (ismbblank (field, len, &mblength)) -+ blanks++; -+ else -+ blanks = 0; -+ -+ field += mblength, len -= mblength; -+ } -+ -+ return blanks; -+ } -+ else -+#endif -+ { -+ size_t i; -+ for (i = len; 0 < i && blanks[UCHAR (field[i - 1])]; i--) -+ continue; -+ return len - i; -+ } - } - - /* Fill BUF reading from FP, moving buf->left bytes from the end -@@ -1019,8 +1351,22 @@ - else - { - if (key->skipsblanks) -- while (blanks[UCHAR (*line_start)]) -- line_start++; -+#if HAVE_MBRTOWC -+ { -+ if (MB_CUR_MAX > 1) -+ { -+ size_t mblength; -+ -+ while (ismbblank (line_start, ptr - line_start, &mblength)) -+ line_start += mblength; -+ } -+ else -+#endif -+ { -+ while (blanks[UCHAR (*line_start)]) -+ line_start++; -+ } -+ } - line->keybeg = line_start; - } - if (key->skipeblanks) -@@ -1128,13 +1474,32 @@ - register int tmpa, tmpb, tmp; - register size_t log_a, log_b; - -- tmpa = *a; -- tmpb = *b; -+#if HAVE_MBRTOWC -+ if (MB_CUR_MAX > 1) -+ { -+ size_t mblength; -+ size_t alen = strnlen (a, MB_LEN_MAX); -+ size_t blen = strnlen (b, MB_LEN_MAX); -+ -+ while (ismbblank (a, alen, &mblength)) -+ a += mblength, alen -= mblength; -+ while (ismbblank (b, blen, &mblength)) -+ b += mblength, blen -= mblength; - -- while (blanks[UCHAR (tmpa)]) -- tmpa = *++a; -- while (blanks[UCHAR (tmpb)]) -- tmpb = *++b; -+ tmpa = *a; -+ tmpb = *b; -+ } -+ else -+#endif -+ { -+ tmpa = *a; -+ tmpb = *b; -+ -+ while (blanks[UCHAR (tmpa)]) -+ tmpa = *++a; -+ while (blanks[UCHAR (tmpb)]) -+ tmpb = *++b; -+ } - - if (tmpa == NEGATION_SIGN) - { -@@ -1268,15 +1633,60 @@ - /* FIXME: maybe add option to try expensive FP conversion - only if A and B can't be compared more cheaply/accurately. */ - -- char *ea; -- char *eb; -- double a = strtod (sa, &ea); -- double b = strtod (sb, &eb); -+ char *bufa, *ea; -+ char *bufb, *eb; -+ double a; -+ double b; -+ -+ char *p; -+ struct lconv *lconvp = localeconv (); -+ size_t thousands_sep_len = strlen (lconvp->thousands_sep); -+ -+ bufa = (char *) xmalloc (strlen (sa) + 1); -+ bufb = (char *) xmalloc (strlen (sb) + 1); -+ strcpy (bufa, sa); -+ strcpy (bufb, sb); -+ -+ if (force_general_numcompare) -+ { -+ while (1) -+ { -+ a = strtod (bufa, &ea); -+ if (memcmp (ea, lconvp->thousands_sep, thousands_sep_len) == 0) -+ { -+ for (p = ea; *(p + thousands_sep_len) != '\0'; p++) -+ *p = *(p + thousands_sep_len); -+ *p = '\0'; -+ continue; -+ } -+ break; -+ } -+ -+ while (1) -+ { -+ b = strtod (bufb, &eb); -+ if (memcmp (eb, lconvp->thousands_sep, thousands_sep_len) == 0) -+ { -+ for (p = eb; *(p + thousands_sep_len) != '\0'; p++) -+ *p = *(p + thousands_sep_len); -+ *p = '\0'; -+ continue; -+ } -+ break; -+ } -+ } -+ else -+ { -+ a = strtod (bufa, &ea); -+ b = strtod (bufb, &eb); -+ } - - /* Put conversion errors at the start of the collating sequence. */ -- if (sa == ea) -- return sb == eb ? 0 : -1; -- if (sb == eb) -+ free (bufa); -+ free (bufb); -+ if (bufa == ea) -+ return bufb == eb ? 0 : -1; -+ if (bufb == eb) - return 1; - - /* Sort numbers in the usual way, where -0 == +0. Put NaNs after -@@ -1294,7 +1704,7 @@ - Return 0 if the name in S is not recognized. */ - - static int --getmonth (const char *s, size_t len) -+getmonth_uni (const char *s, size_t len) - { - char *month; - register size_t i; -@@ -1332,11 +1742,79 @@ - return result; - } - -+#if HAVE_MBRTOWC -+static int -+getmonth_mb (const char *s, size_t len) -+{ -+ char *month; -+ register size_t i; -+ register int lo = 0, hi = MONTHS_PER_YEAR, result; -+ char *tmp; -+ size_t wclength, mblength; -+ const char **pp; -+ const wchar_t **wpp; -+ wchar_t *month_wcs; -+ mbstate_t state; -+ -+ while (len > 0 && ismbblank (s, len, &mblength)) -+ { -+ s += mblength; -+ len -= mblength; -+ } -+ -+ if (len == 0) -+ return 0; -+ -+ month = (char *) alloca (len + 1); -+ -+ tmp = (char *) alloca (len + 1); -+ memcpy (tmp, s, len); -+ tmp[len] = '\0'; -+ pp = (const char **)&tmp; -+ month_wcs = (wchar_t *) alloca ((len + 1) * sizeof (wchar_t)); -+ memset (&state, '\0', sizeof(mbstate_t)); -+ -+ wclength = mbsrtowcs (month_wcs, pp, len + 1, &state); -+ assert (wclength != (size_t)-1 && *pp == NULL); -+ -+ for (i = 0; i < wclength; i++) -+ { -+ month_wcs[i] = towupper(month_wcs[i]); -+ if (iswblank (month_wcs[i])) -+ { -+ month_wcs[i] = L'\0'; -+ break; -+ } -+ } -+ -+ wpp = (const wchar_t **)&month_wcs; -+ -+ mblength = wcsrtombs (month, wpp, len + 1, &state); -+ assert (mblength != (-1) && *wpp == NULL); -+ -+ do -+ { -+ int ix = (lo + hi) / 2; -+ -+ if (strncmp (month, monthtab[ix].name, strlen (monthtab[ix].name)) < 0) -+ hi = ix; -+ else -+ lo = ix; -+ } -+ while (hi - lo > 1); -+ -+ result = (!strncmp (month, monthtab[lo].name, strlen (monthtab[lo].name)) -+ ? monthtab[lo].val : 0); -+ -+ return result; -+} -+#endif -+ - /* Compare two lines A and B trying every key in sequence until there - are no more keys or a difference is found. */ - - static int --keycompare (const struct line *a, const struct line *b) -+keycompare_uni (const struct line *a, const struct line *b) - { - struct keyfield const *key = keylist; - -@@ -1507,6 +1985,187 @@ - return key->reverse ? -diff : diff; - } - -+#if HAVE_MBRTOWC -+static int -+keycompare_mb (const struct line *a, const struct line *b) -+{ -+ struct keyfield *key = keylist; -+ -+ /* For the first iteration only, the key positions have been -+ precomputed for us. */ -+ char *texta = a->keybeg; -+ char *textb = b->keybeg; -+ char *lima = a->keylim; -+ char *limb = b->keylim; -+ -+ size_t mblength_a, mblength_b; -+ wchar_t wc_a, wc_b; -+ mbstate_t state_a, state_b; -+ -+ int diff; -+ -+ memset (&state_a, '\0', sizeof(mbstate_t)); -+ memset (&state_b, '\0', sizeof(mbstate_t)); -+ -+ for (;;) -+ { -+ unsigned char *translate = (unsigned char *) key->translate; -+ bool const *ignore = key->ignore; -+ -+ /* Find the lengths. */ -+ size_t lena = lima <= texta ? 0 : lima - texta; -+ size_t lenb = limb <= textb ? 0 : limb - textb; -+ -+ if (key->skipeblanks) -+ { -+ char *a_end = texta + lena; -+ char *b_end = textb + lenb; -+ a_end -= trailing_blanks (texta, lena); -+ b_end -= trailing_blanks (textb, lenb); -+ lena = a_end - texta; -+ lenb = b_end - textb; -+ } -+ -+ /* Actually compare the fields. */ -+ if (key->numeric | key->general_numeric) -+ { -+ char savea = *lima, saveb = *limb; -+ -+ *lima = *limb = '\0'; -+ if (force_general_numcompare) -+ diff = general_numcompare (texta, textb); -+ else -+ diff = ((key->numeric ? numcompare : general_numcompare) -+ (texta, textb)); -+ *lima = savea, *limb = saveb; -+ } -+ else if (key->month) -+ diff = getmonth (texta, lena) - getmonth (textb, lenb); -+ else -+ { -+ if (ignore || translate) -+ { -+ char *copy_a = (char *) alloca (lena + 1 + lenb + 1); -+ char *copy_b = copy_a + lena + 1; -+ size_t new_len_a, new_len_b; -+ size_t i, j; -+ -+ /* Ignore and/or translate chars before comparing. */ -+# define IGNORE_CHARS(NEW_LEN, LEN, TEXT, COPY, WC, MBLENGTH, STATE) \ -+ do \ -+ { \ -+ wchar_t uwc; \ -+ char mbc[MB_LEN_MAX]; \ -+ mbstate_t state_wc; \ -+ \ -+ for (NEW_LEN = i = 0; i < LEN;) \ -+ { \ -+ mbstate_t state_bak; \ -+ \ -+ state_bak = STATE; \ -+ MBLENGTH = mbrtowc (&WC, TEXT + i, LEN - i, &STATE); \ -+ \ -+ if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1 \ -+ || MBLENGTH == 0) \ -+ { \ -+ if (MBLENGTH == (size_t)-2 || MBLENGTH == (size_t)-1) \ -+ STATE = state_bak; \ -+ if (!ignore) \ -+ COPY[NEW_LEN++] = TEXT[i++]; \ -+ continue; \ -+ } \ -+ \ -+ if (ignore) \ -+ { \ -+ if ((ignore == nonprinting && !iswprint (WC)) \ -+ || (ignore == nondictionary \ -+ && !iswalnum (WC) && !iswblank (WC))) \ -+ { \ -+ i += MBLENGTH; \ -+ continue; \ -+ } \ -+ } \ -+ \ -+ if (translate) \ -+ { \ -+ \ -+ uwc = towupper(WC); \ -+ if (WC == uwc) \ -+ { \ -+ memcpy (mbc, TEXT + i, MBLENGTH); \ -+ i += MBLENGTH; \ -+ } \ -+ else \ -+ { \ -+ i += MBLENGTH; \ -+ WC = uwc; \ -+ memset (&state_wc, '\0', sizeof (mbstate_t)); \ -+ \ -+ MBLENGTH = wcrtomb (mbc, WC, &state_wc); \ -+ assert (MBLENGTH != (size_t)-1 && MBLENGTH != 0); \ -+ } \ -+ \ -+ for (j = 0; j < MBLENGTH; j++) \ -+ COPY[NEW_LEN++] = mbc[j]; \ -+ } \ -+ else \ -+ for (j = 0; j < MBLENGTH; j++) \ -+ COPY[NEW_LEN++] = TEXT[i++]; \ -+ } \ -+ COPY[NEW_LEN] = '\0'; \ -+ } \ -+ while (0) -+ IGNORE_CHARS (new_len_a, lena, texta, copy_a, -+ wc_a, mblength_a, state_a); -+ IGNORE_CHARS (new_len_b, lenb, textb, copy_b, -+ wc_b, mblength_b, state_b); -+ diff = xmemcoll (copy_a, new_len_a, copy_b, new_len_b); -+ } -+ else if (lena == 0) -+ diff = - NONZERO (lenb); -+ else if (lenb == 0) -+ goto greater; -+ else -+ diff = xmemcoll (texta, lena, textb, lenb); -+ } -+ -+ if (diff) -+ goto not_equal; -+ -+ key = key->next; -+ if (! key) -+ break; -+ -+ /* Find the beginning and limit of the next field. */ -+ if (key->eword != -1) -+ lima = limfield (a, key), limb = limfield (b, key); -+ else -+ lima = a->text + a->length - 1, limb = b->text + b->length - 1; -+ -+ if (key->sword != -1) -+ texta = begfield (a, key), textb = begfield (b, key); -+ else -+ { -+ texta = a->text, textb = b->text; -+ if (key->skipsblanks) -+ { -+ while (texta < lima && ismbblank (texta, lima - texta, &mblength_a)) -+ texta += mblength_a; -+ while (textb < limb && ismbblank (textb, limb - textb, &mblength_b)) -+ textb += mblength_b; -+ } -+ } -+ } -+ -+ return 0; -+ -+greater: -+ diff = 1; -+not_equal: -+ return key->reverse ? -diff : diff; -+} -+#endif -+ - /* Compare two lines A and B, returning negative, zero, or positive - depending on whether A compares less than, equal to, or greater than B. */ - -@@ -2252,20 +2911,44 @@ - { - struct lconv const *lconvp = localeconv (); - -- /* If the locale doesn't define a decimal point, or if the decimal -- point is multibyte, use the C decimal point. We don't support -- multibyte decimal points yet. */ - decimal_point = *lconvp->decimal_point; - if (! decimal_point || lconvp->decimal_point[1]) -- decimal_point = C_DECIMAL_POINT; -+ { -+ decimal_point = C_DECIMAL_POINT; -+ if (lconvp->decimal_point[0] && lconvp->decimal_point[1]) -+ force_general_numcompare = 1; -+ } - - /* We don't support multibyte thousands separators yet. */ - th_sep = *lconvp->thousands_sep; - if (! th_sep || lconvp->thousands_sep[1]) -- th_sep = CHAR_MAX + 1; -+ { -+ th_sep = CHAR_MAX + 1; -+ if (lconvp->thousands_sep[0] && lconvp->thousands_sep[1]) -+ force_general_numcompare = 1; -+ } - } - #endif - -+#if HAVE_MBRTOWC -+ if (MB_CUR_MAX > 1) -+ { -+ inittables = inittables_mb; -+ begfield = begfield_mb; -+ limfield = limfield_mb; -+ getmonth = getmonth_mb; -+ keycompare = keycompare_mb; -+ } -+ else -+#endif -+ { -+ inittables = inittables_uni; -+ begfield = begfield_uni; -+ limfield = limfield_uni; -+ keycompare = keycompare_uni; -+ getmonth = getmonth_uni; -+ } -+ - have_read_stdin = false; - inittables (); - -@@ -2462,13 +3145,47 @@ - - case 't': - { -- int newtab = optarg[0]; -- if (! newtab) -+ char newtab[MB_LEN_MAX + 1]; -+ size_t newtab_length = 1; -+ strncpy (newtab, optarg, MB_LEN_MAX); -+ if (! newtab[0]) - error (SORT_FAILURE, 0, _("empty tab")); -+#if HAVE_MBRTOWC -+ if (MB_CUR_MAX > 1) -+ { -+ wchar_t wc; -+ mbstate_t state; -+ size_t i; -+ -+ memset (&state, '\0', sizeof (mbstate_t)); -+ newtab_length = mbrtowc (&wc, newtab, strnlen (newtab, MB_LEN_MAX), &state); -+ switch (newtab_length) -+ { -+ case (size_t) -1: -+ case (size_t) -2: -+ case 0: -+ newtab_length = 1; -+ } -+ -+ if (optarg[newtab_length]) -+ { -+ if (strcmp (optarg, "\\0") == 0) -+ newtab[0] = '\0'; -+ /* Provoke with `sort -txx'. Complain about -+ "multi-character tab" instead of "multibyte tab", so -+ that the diagnostic's wording does not need to be -+ changed once multibyte characters are supported. */ -+ error (SORT_FAILURE, 0, _("multi-character tab `%s'"), -+ optarg); -+ } -+ } -+ else -+#endif -+ - if (optarg[1]) - { - if (strcmp (optarg, "\\0") == 0) -- newtab = '\0'; -+ newtab[0] = '\0'; - else - { - /* Provoke with `sort -txx'. Complain about -@@ -2479,9 +3196,12 @@ - optarg); - } - } -- if (tab != TAB_DEFAULT && tab != newtab) -+ if (tab_length -+ && (tab_length != newtab_length -+ || memcmp (tab, newtab, tab_length) != 0)) - error (SORT_FAILURE, 0, _("incompatible tabs")); -- tab = newtab; -+ memcpy (tab, newtab, newtab_length); -+ tab_length = newtab_length; - } - break; - ---- coreutils-5.1.3/src/uniq.c.i18n 2004-01-21 22:27:02.000000000 +0000 -+++ coreutils-5.1.3/src/uniq.c 2004-02-16 15:36:40.000000000 +0000 +--- coreutils-5.92/src/uniq.c.i18n 2005-07-05 08:38:37.000000000 +0100 ++++ coreutils-5.92/src/uniq.c 2005-10-26 22:17:04.000000000 +0100 @@ -23,6 +23,16 @@ #include #include @@ -2394,8 +1358,8 @@ #include "system.h" #include "argmatch.h" #include "linebuffer.h" -@@ -31,7 +41,19 @@ - #include "posixver.h" +@@ -32,7 +42,19 @@ + #include "quote.h" #include "xmemcoll.h" #include "xstrtol.h" -#include "memcasecmp.h" @@ -2415,7 +1379,7 @@ /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "uniq" -@@ -108,6 +130,10 @@ +@@ -109,6 +131,10 @@ /* Select whether/how to delimit groups of duplicate lines. */ static enum delimit_method delimit_groups; @@ -2426,16 +1390,16 @@ static struct option const longopts[] = { {"count", no_argument, NULL, 'c'}, -@@ -188,7 +214,7 @@ +@@ -189,7 +215,7 @@ return a pointer to the beginning of the line's field to be compared. */ static char * -find_field (const struct linebuffer *line) +find_field_uni (struct linebuffer *line) { - register size_t count; - register char *lp = line->buffer; -@@ -209,6 +235,83 @@ + size_t count; + char *lp = line->buffer; +@@ -210,6 +236,83 @@ return lp + i; } @@ -2516,11 +1480,11 @@ +} +#endif + - /* Return zero if two strings OLD and NEW match, nonzero if not. + /* Return false if two strings OLD and NEW match, true if not. OLD and NEW point not to the beginnings of the lines but rather to the beginnings of the fields to compare. -@@ -217,6 +320,8 @@ - static int +@@ -218,6 +321,8 @@ + static bool different (char *old, char *new, size_t oldlen, size_t newlen) { + char *copy_old, *copy_new; @@ -2528,7 +1492,7 @@ if (check_chars < oldlen) oldlen = check_chars; if (check_chars < newlen) -@@ -224,15 +329,93 @@ +@@ -225,14 +330,92 @@ if (ignore_case) { @@ -2545,8 +1509,8 @@ + copy_new[i] = toupper (new[i]); + } } -- else if (HAVE_SETLOCALE && hard_LC_COLLATE) -- return xmemcoll (old, oldlen, new, newlen); +- else if (hard_LC_COLLATE) +- return xmemcoll (old, oldlen, new, newlen) != 0; else - return oldlen != newlen || memcmp (old, new, oldlen); + { @@ -2555,8 +1519,8 @@ + } + + return xmemcoll (copy_old, oldlen, copy_new, newlen); - } - ++} ++ +#if HAVE_MBRTOWC +static int +different_multi (const char *old, const char *new, size_t oldlen, size_t newlen, mbstate_t oldstate, mbstate_t newstate) @@ -2621,13 +1585,12 @@ + } + + return xmemcoll (copy[0], len[0], copy[1], len[1]); -+} + } +#endif -+ - /* Output the line in linebuffer LINE to stream STREAM + + /* Output the line in linebuffer LINE to standard output provided that the switches say it should be output. - MATCH is true if the line matches the previous line. -@@ -296,15 +479,43 @@ +@@ -286,15 +469,43 @@ { char *prevfield IF_LINT (= NULL); size_t prevlen IF_LINT (= 0); @@ -2637,7 +1600,7 @@ + memset (&prevstate, '\0', sizeof (mbstate_t)); +#endif - while (!feof (istream)) + while (!feof (stdin)) { char *thisfield; size_t thislen; @@ -2645,7 +1608,7 @@ + mbstate_t thisstate; +#endif + - if (readlinebuffer (thisline, istream) == 0) + if (readlinebuffer (thisline, stdin) == 0) break; thisfield = find_field (thisline); thislen = thisline->length - 1 - (thisfield - thisline->buffer); @@ -2658,7 +1621,7 @@ + (thisfield, prevfield, thislen, prevlen, thisstate, prevstate)) + { + fwrite (thisline->buffer, sizeof (char), -+ thisline->length, ostream); ++ thisline->length, stdout); + + SWAP_LINES (prevline, thisline); + prevfield = thisfield; @@ -2671,15 +1634,15 @@ if (prevline->length == 0 || different (thisfield, prevfield, thislen, prevlen)) { -@@ -323,17 +534,26 @@ +@@ -313,17 +524,26 @@ size_t prevlen; - int match_count = 0; - int first_delimiter = 1; + uintmax_t match_count = 0; + bool first_delimiter = true; +#if HAVE_MBRTOWC + mbstate_t prevstate; +#endif - if (readlinebuffer (prevline, istream) == 0) + if (readlinebuffer (prevline, stdin) == 0) goto closefiles; prevfield = find_field (prevline); prevlen = prevline->length - 1 - (prevfield - prevline->buffer); @@ -2687,7 +1650,7 @@ + prevstate = prevline->state; +#endif - while (!feof (istream)) + while (!feof (stdin)) { bool match; char *thisfield; @@ -2695,10 +1658,10 @@ +#if HAVE_MBRTOWC + mbstate_t thisstate; +#endif - if (readlinebuffer (thisline, istream) == 0) + if (readlinebuffer (thisline, stdin) == 0) { - if (ferror (istream)) -@@ -342,6 +562,15 @@ + if (ferror (stdin)) +@@ -332,6 +552,15 @@ } thisfield = find_field (thisline); thislen = thisline->length - 1 - (thisfield - thisline->buffer); @@ -2712,9 +1675,9 @@ + else +#endif match = !different (thisfield, prevfield, thislen, prevlen); + match_count += match; - if (match) -@@ -369,6 +598,9 @@ +@@ -364,6 +593,9 @@ SWAP_LINES (prevline, thisline); prevfield = thisfield; prevlen = thislen; @@ -2724,7 +1687,7 @@ if (!match) match_count = 0; } -@@ -411,6 +643,19 @@ +@@ -408,6 +640,19 @@ atexit (close_stdout); @@ -2744,9 +1707,9 @@ skip_chars = 0; skip_fields = 0; check_chars = SIZE_MAX; ---- coreutils-5.1.3/src/expand.c.i18n 2004-01-21 22:27:02.000000000 +0000 -+++ coreutils-5.1.3/src/expand.c 2004-02-16 15:36:40.000000000 +0000 -@@ -38,12 +38,29 @@ +--- coreutils-5.92/src/expand.c.i18n 2005-08-12 09:28:48.000000000 +0100 ++++ coreutils-5.92/src/expand.c 2005-10-26 22:17:04.000000000 +0100 +@@ -38,11 +38,28 @@ #include #include #include @@ -2758,7 +1721,6 @@ + #include "system.h" #include "error.h" - #include "posixver.h" #include "quote.h" #include "xstrndup.h" @@ -2776,25 +1738,15 @@ /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "expand" -@@ -332,6 +349,7 @@ - ++column; +@@ -182,6 +199,7 @@ + stops = num_start + len - 1; } } + else { - if (convert) -@@ -343,7 +361,8 @@ - } - else - { -- ++column; -+ if (!ISCNTRL (c)) -+ ++column; - if (convert_entire_line == 0) - convert = 0; - } -@@ -353,6 +372,146 @@ + error (0, 0, _("tab size contains invalid character(s): %s"), +@@ -364,6 +382,142 @@ } } @@ -2821,9 +1773,6 @@ + if (fp == NULL) + return; + -+ /* Binary I/O will preserve the original EOL style (DOS/Unix) of files. */ -+ SET_BINARY2 (fileno (fp), STDOUT_FILENO); -+ + memset (&o_state, '\0', sizeof(mbstate_t)); + memset (&i_state, '\0', sizeof(mbstate_t)); + @@ -2847,7 +1796,6 @@ + else + { + memset (&i_state, '\0', sizeof(mbstate_t)); -+ SET_BINARY2 (fileno (fp), STDOUT_FILENO); + continue; + } + } @@ -2941,7 +1889,7 @@ int main (int argc, char **argv) { -@@ -424,7 +583,12 @@ +@@ -428,7 +582,12 @@ file_list = (optind < argc ? &argv[optind] : stdin_argv); @@ -2953,11 +1901,11 @@ +#endif + expand (); - if (have_read_stdin && fclose (stdin) == EOF) + if (have_read_stdin && fclose (stdin) != 0) error (EXIT_FAILURE, errno, "-"); ---- coreutils-5.1.3/src/fold.c 2004-02-16 15:36:40.000000000 +0000 -+++ coreutils-5.2.1/src/fold.c 2004-10-18 22:28:41.114883456 +0100 -@@ -23,31 +23,74 @@ +--- coreutils-5.92/src/fold.c.i18n 2005-08-12 09:28:48.000000000 +0100 ++++ coreutils-5.92/src/fold.c 2005-10-26 22:17:04.000000000 +0100 +@@ -23,11 +23,33 @@ #include #include @@ -2973,7 +1921,7 @@ + #include "system.h" #include "error.h" - #include "posixver.h" + #include "quote.h" #include "xstrtol.h" +/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC @@ -2988,8 +1936,10 @@ +# define mbrtowc(pwc, s, n, ps) (mbrtowc) (pwc, s, n, 0) +#endif + + #define TAB_WIDTH 8 + /* The official name of this program (e.g., no `g' prefix). */ - #define PROGRAM_NAME "fold" +@@ -35,23 +57,44 @@ #define AUTHORS "David MacKenzie" @@ -3028,6 +1978,9 @@ /* If nonzero, at least one of the files we read was standard input. */ static bool have_read_stdin; +-static char const shortopts[] = "bsw:0::1::2::3::4::5::6::7::8::9::"; ++static char const shortopts[] = "bcsw:0::1::2::3::4::5::6::7::8::9::"; + static struct option const longopts[] = { {"bytes", no_argument, NULL, 'b'}, @@ -3035,7 +1988,7 @@ {"spaces", no_argument, NULL, 's'}, {"width", required_argument, NULL, 'w'}, {GETOPT_HELP_OPTION_DECL}, -@@ -77,6 +120,7 @@ +@@ -81,6 +124,7 @@ "), stdout); fputs (_("\ -b, --bytes count bytes rather than columns\n\ @@ -3043,7 +1996,7 @@ -s, --spaces break at spaces\n\ -w, --width=WIDTH use WIDTH columns instead of 80\n\ "), stdout); -@@ -94,7 +138,7 @@ +@@ -98,7 +142,7 @@ static size_t adjust_column (size_t column, char c) { @@ -3052,21 +2005,21 @@ { if (c == '\b') { -@@ -113,34 +157,14 @@ +@@ -117,35 +161,14 @@ return column; } -/* Fold file FILENAME, or standard input if FILENAME is "-", - to stdout, with maximum line length WIDTH. -- Return 0 if successful, 1 if an error occurs. */ +- Return true if successful. */ - --static int --fold_file (char *filename, int width) +-static bool +-fold_file (char *filename, size_t width) +static void -+fold_text (FILE *istream, int width, int *saved_errno) ++fold_text (FILE *istream, size_t width, int *saved_errno) { - FILE *istream; - register int c; + int c; size_t column = 0; /* Screen column where next char will go. */ size_t offset_out = 0; /* Index in `line_out' for next char. */ static char *line_out = NULL; @@ -3084,12 +2037,13 @@ - if (istream == NULL) - { - error (0, errno, "%s", filename); -- return 1; +- return false; - } - +- while ((c = getc (istream)) != EOF) { -@@ -168,6 +192,15 @@ + if (offset_out + 1 >= allocated_out) +@@ -172,6 +195,15 @@ bool found_blank = false; size_t logical_end = offset_out; @@ -3105,7 +2059,7 @@ /* Look for the last blank. */ while (logical_end) { -@@ -214,11 +247,225 @@ +@@ -218,11 +250,225 @@ line_out[offset_out++] = c; } @@ -3332,7 +2286,7 @@ if (ferror (istream)) { error (0, saved_errno, "%s", filename); -@@ -251,7 +498,8 @@ +@@ -255,7 +501,8 @@ atexit (close_stdout); @@ -3340,20 +2294,11 @@ + operating_mode = column_mode; + break_spaces = have_read_stdin = false; - /* Turn any numeric options into -w options. */ - for (i = 1; i < argc; i++) -@@ -278,7 +526,7 @@ - } - } - -- while ((optc = getopt_long (argc, argv, "bsw:", longopts, NULL)) != -1) -+ while ((optc = getopt_long (argc, argv, "bcsw:", longopts, NULL)) != -1) + while ((optc = getopt_long (argc, argv, shortopts, longopts, NULL)) != -1) { +@@ -264,7 +511,15 @@ switch (optc) { -@@ -286,7 +534,15 @@ - break; - case 'b': /* Count bytes rather than columns. */ - count_bytes = true; + if (operating_mode != column_mode) @@ -3368,9 +2313,9 @@ break; case 's': /* Break at word boundaries. */ ---- coreutils-5.1.3/src/join.c.i18n 2004-01-21 22:27:02.000000000 +0000 -+++ coreutils-5.1.3/src/join.c 2004-02-16 15:36:40.000000000 +0000 -@@ -24,16 +24,30 @@ +--- coreutils-5.92/src/join.c.i18n 2005-08-12 09:28:48.000000000 +0100 ++++ coreutils-5.92/src/join.c 2005-10-26 22:17:04.000000000 +0100 +@@ -23,16 +23,30 @@ #include #include @@ -3389,8 +2334,8 @@ #include "hard-locale.h" #include "linebuffer.h" -#include "memcasecmp.h" - #include "posixver.h" #include "quote.h" + #include "stdio--.h" #include "xmemcoll.h" #include "xstrtol.h" @@ -3402,19 +2347,24 @@ /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "join" -@@ -110,7 +124,10 @@ - /* Tab character separating fields; if this is NUL fields are separated - by any nonempty string of white space, otherwise by exactly one - tab character. */ --static char tab; +@@ -104,10 +118,12 @@ + /* Last element in `outlist', where a new element can be added. */ + static struct outlist *outlist_end = &outlist_head; + +-/* Tab character separating fields. If negative, fields are separated +- by any nonempty string of blanks, otherwise by exactly one +- tab character whose value (when cast to unsigned char) equals TAB. */ +-static int tab = -1; ++/* Tab character separating fields. If NULL, fields are separated ++ by any nonempty string of blanks. */ +static char *tab = NULL; + +/* The number of bytes used for tab. */ +static size_t tablen = 0; - /* When using getopt_long_only, no long option can start with - a character that is a short option. */ -@@ -222,6 +239,8 @@ + static struct option const longopts[] = + { +@@ -197,6 +213,8 @@ /* Fill in the `fields' structure in LINE. */ @@ -3423,19 +2373,21 @@ static void xfields (struct line *line) { -@@ -231,9 +250,9 @@ +@@ -206,10 +224,11 @@ if (ptr == lim) return; -- if (tab) +- if (0 <= tab) + if (tab != NULL) { -- unsigned char t = tab; + unsigned char t = tab[0]; char *sep; - for (; (sep = memchr (ptr, t, lim - ptr)) != NULL; ptr = sep + 1) +- for (; (sep = memchr (ptr, tab, lim - ptr)) != NULL; ptr = sep + 1) ++ for (; (sep = memchr (ptr, t, lim - ptr)) != NULL; ptr = sep + 1) extract_field (line, ptr, sep - ptr); -@@ -262,6 +281,148 @@ + } + else +@@ -236,6 +255,148 @@ extract_field (line, ptr, lim - ptr); } @@ -3584,7 +2536,7 @@ /* Read a line from FP into LINE and split it into fields. Return true if successful. */ -@@ -282,6 +443,11 @@ +@@ -256,6 +417,11 @@ line->nfields_allocated = 0; line->nfields = 0; line->fields = NULL; @@ -3596,7 +2548,7 @@ xfields (line); return true; } -@@ -336,56 +502,114 @@ +@@ -310,56 +476,114 @@ keycmp (struct line const *line1, struct line const *line2) { /* Start of field to compare in each file. */ @@ -3716,7 +2668,7 @@ } else { -- if (HAVE_SETLOCALE && hard_LC_COLLATE) +- if (hard_LC_COLLATE) - return xmemcoll (beg1, len1, beg2, len2); - diff = memcmp (beg1, beg2, MIN (len1, len2)); + copy[0] = (unsigned char *) beg[0]; @@ -3734,7 +2686,7 @@ } /* Print field N of LINE if it exists and is nonempty, otherwise -@@ -410,11 +634,18 @@ +@@ -384,11 +608,18 @@ /* Print the join of LINE1 and LINE2. */ @@ -3750,11 +2702,11 @@ prjoin (struct line const *line1, struct line const *line2) { const struct outlist *outlist; -- char output_separator = tab ? tab : ' '; +- char output_separator = tab < 0 ? ' ' : tab; outlist = outlist_head.next; if (outlist) -@@ -430,12 +661,12 @@ +@@ -404,12 +635,12 @@ if (o->file == 0) { if (line1 == &uni_blank) @@ -3769,7 +2721,7 @@ line = line1; field = join_field_1; } -@@ -449,7 +680,7 @@ +@@ -423,7 +654,7 @@ o = o->next; if (o == NULL) break; @@ -3778,7 +2730,7 @@ } putchar ('\n'); } -@@ -467,23 +698,23 @@ +@@ -441,23 +672,23 @@ prfield (join_field_1, line1); for (i = 0; i < join_field_1 && i < line1->nfields; ++i) { @@ -3806,43 +2758,61 @@ prfield (i, line2); } putchar ('\n'); -@@ -678,7 +909,7 @@ - valid = true; - } - else -- { -+ { - /* `0' must be all alone -- no `.FIELD'. */ - error (0, 0, _("invalid field specifier: `%s'"), s); - } -@@ -817,7 +1048,23 @@ - break; +@@ -869,20 +1100,41 @@ case 't': -- tab = *optarg; -+ tab = xstrdup(optarg); + { +- unsigned char newtab = optarg[0]; +- if (! newtab) ++ char *newtab; ++ size_t newtablen; ++ if (! optarg[0]) + error (EXIT_FAILURE, 0, _("empty tab")); +- if (optarg[1]) ++ newtab = xstrdup (optarg); +#if HAVE_MBRTOWC -+ if (MB_CUR_MAX > 1) -+ { -+ mbstate_t state; ++ if (MB_CUR_MAX > 1) ++ { ++ mbstate_t state; + -+ memset(&state, 0, sizeof(mbstate_t)); -+ tablen = mbrtowc(NULL, optarg, strnlen(optarg, MB_LEN_MAX), &state); -+ if (tablen == (size_t) 0 -+ || tablen == (size_t)-1 || tablen == (size_t)-2) -+ tablen = 1; -+ } -+ else -+ { ++ memset (&state, 0, sizeof (mbstate_t)); ++ newtablen = mbrtowc (NULL, newtab, ++ strnlen (newtab, MB_LEN_MAX), ++ &state); ++ if (newtablen == (size_t) 0 ++ || newtablen == (size_t) -1 ++ || newtablen == (size_t) -2) ++ newtablen = 1; ++ } ++ else +#endif -+ tablen = 1; -+ } ++ newtablen = 1; ++ ++ if (newtablen == 1 && newtab[1]) ++ { ++ if (STREQ (newtab, "\\0")) ++ newtab[0] = '\0'; ++ } ++ if (tab != NULL && strcmp (tab, newtab)) + { +- if (STREQ (optarg, "\\0")) +- newtab = '\0'; +- else +- error (EXIT_FAILURE, 0, _("multi-character tab %s"), +- quote (optarg)); ++ free (newtab); ++ error (EXIT_FAILURE, 0, _("incompatible tabs")); + } +- if (0 <= tab && tab != newtab) +- error (EXIT_FAILURE, 0, _("incompatible tabs")); + tab = newtab; ++ tablen = newtablen; + } break; - case 1: /* Non-option argument. */ ---- coreutils-5.1.3/src/unexpand.c.i18n 2004-01-21 22:27:02.000000000 +0000 -+++ coreutils-5.1.3/src/unexpand.c 2004-02-16 15:36:40.000000000 +0000 -@@ -40,10 +40,27 @@ +--- coreutils-5.92/src/unexpand.c.i18n 2005-08-12 09:28:48.000000000 +0100 ++++ coreutils-5.92/src/unexpand.c 2005-10-26 22:18:37.000000000 +0100 +@@ -39,11 +39,28 @@ #include #include #include @@ -3854,7 +2824,8 @@ + #include "system.h" #include "error.h" - #include "posixver.h" + #include "quote.h" + #include "xstrndup.h" +/* MB_LEN_MAX is incorrectly defined to be 1 in at least one GCC + installation; work around this configuration error. */ @@ -3870,20 +2841,12 @@ /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "unexpand" -@@ -348,7 +365,8 @@ - } - else - { -- ++column; -+ if (!ISCNTRL (c)) -+ ++column; - if (convert_entire_line == 0) - convert = 0; - } -@@ -366,6 +384,210 @@ - } - } +@@ -110,6 +127,208 @@ + {NULL, 0, NULL, 0} + }; ++static FILE *next_file (FILE *fp); ++ +#if HAVE_MBRTOWC +static void +unexpand_multibyte (void) @@ -3911,9 +2874,6 @@ + if (fp == NULL) + return; + -+ /* Binary I/O will preserve the original EOL style (DOS/Unix) of files. */ -+ SET_BINARY2 (fileno (fp), STDOUT_FILENO); -+ + memset (&o_state, '\0', sizeof(mbstate_t)); + memset (&i_state, '\0', sizeof(mbstate_t)); + @@ -3944,7 +2904,7 @@ + wc = L'\0'; + } + -+ if (wc == L' ' && convert && column < TAB_STOP_SENTINEL) ++ if (wc == L' ' && convert && column < INT_MAX) + { + ++pending; + ++column; @@ -4029,7 +2989,6 @@ + else + { + memset (&i_state, '\0', sizeof(mbstate_t)); -+ SET_BINARY2 (fileno (fp), STDOUT_FILENO); + continue; + } + } @@ -4091,7 +3050,7 @@ void usage (int status) { -@@ -488,7 +710,12 @@ +@@ -532,7 +751,12 @@ file_list = (optind < argc ? &argv[optind] : stdin_argv); @@ -4103,10 +3062,10 @@ +#endif + unexpand (); - if (have_read_stdin && fclose (stdin) == EOF) + if (have_read_stdin && fclose (stdin) != 0) error (EXIT_FAILURE, errno, "-"); ---- coreutils-5.2.1/tests/sort/sort-mb-tests.jj 2005-02-09 07:34:40.000000000 -0500 -+++ coreutils-5.2.1/tests/sort/sort-mb-tests 2005-02-09 07:34:40.000000000 -0500 +--- /dev/null 2005-10-10 09:36:06.437701000 +0100 ++++ coreutils-5.92/tests/sort/sort-mb-tests 2005-10-26 22:17:04.000000000 +0100 @@ -0,0 +1,58 @@ +#! /bin/sh +case $# in @@ -4166,37 +3125,37 @@ +fi +test $errors = 0 || errors=1 +exit $errors ---- coreutils-5.2.1/tests/sort/mb1.I.jj 2005-02-09 07:34:40.000000000 -0500 -+++ coreutils-5.2.1/tests/sort/mb1.I 2005-02-09 07:34:40.000000000 -0500 +--- /dev/null 2005-10-10 09:36:06.437701000 +0100 ++++ coreutils-5.92/tests/sort/mb1.I 2005-10-26 22:17:04.000000000 +0100 @@ -0,0 +1,4 @@ +Apple@10 +Banana@5 +Citrus@20 +Cherry@30 ---- coreutils-5.2.1/tests/sort/mb2.I.jj 2005-02-09 07:34:40.000000000 -0500 -+++ coreutils-5.2.1/tests/sort/mb2.I 2005-02-09 07:34:40.000000000 -0500 +--- /dev/null 2005-10-10 09:36:06.437701000 +0100 ++++ coreutils-5.92/tests/sort/mb2.I 2005-10-26 22:17:04.000000000 +0100 @@ -0,0 +1,4 @@ +Apple@AA10@@20 +Banana@AA5@@30 +Citrus@AA20@@5 +Cherry@AA30@@10 ---- coreutils-5.2.1/tests/sort/mb1.X.jj 2005-02-09 07:34:40.000000000 -0500 -+++ coreutils-5.2.1/tests/sort/mb1.X 2005-02-09 07:34:40.000000000 -0500 +--- /dev/null 2005-10-10 09:36:06.437701000 +0100 ++++ coreutils-5.92/tests/sort/mb1.X 2005-10-26 22:17:04.000000000 +0100 @@ -0,0 +1,4 @@ +Banana@5 +Apple@10 +Citrus@20 +Cherry@30 ---- coreutils-5.2.1/tests/sort/mb2.X.jj 2005-02-09 07:34:40.000000000 -0500 -+++ coreutils-5.2.1/tests/sort/mb2.X 2005-02-09 07:34:40.000000000 -0500 +--- /dev/null 2005-10-10 09:36:06.437701000 +0100 ++++ coreutils-5.92/tests/sort/mb2.X 2005-10-26 22:17:04.000000000 +0100 @@ -0,0 +1,4 @@ +Citrus@AA20@@5 +Cherry@AA30@@10 +Apple@AA10@@20 +Banana@AA5@@30 ---- coreutils-5.2.1/tests/sort/Makefile.am.jj 2004-02-11 06:54:14.000000000 -0500 -+++ coreutils-5.2.1/tests/sort/Makefile.am 2005-02-09 07:36:20.000000000 -0500 -@@ -43,12 +43,14 @@ o-no-file1.E create-empty.O create-empty +--- coreutils-5.92/tests/sort/Makefile.am.i18n 2005-06-23 17:32:54.000000000 +0100 ++++ coreutils-5.92/tests/sort/Makefile.am 2005-10-26 22:17:04.000000000 +0100 +@@ -43,14 +43,16 @@ nul-nls.E use-nl.O use-nl.E o2.O o2.E nul-tab.O nul-tab.E ##test-files-end @@ -4205,30 +3164,35 @@ +run_gen += mb1.O mb2.O + +EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen) mb1.I mb1.X mb2.I mb2.X -+noinst_SCRIPTS = $x-tests $x-mb-tests ++noinst_SCRIPTS = $x-tests # $x-mb-tests + TESTS_ENVIRONMENT = \ + PATH="`pwd`/../../src$(PATH_SEPARATOR)$$PATH" editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,$(srcdir),g' -TESTS = $x-tests -+TESTS = $x-tests $x-mb-tests ++TESTS = $x-tests # $x-mb-tests mk_script = $(srcdir)/../mk-script - $(srcdir)/$x-tests: $(mk_script) Test.pm ---- coreutils-5.2.1/tests/sort/Makefile.in.jj 2004-03-11 03:58:06.000000000 -0500 -+++ coreutils-5.2.1/tests/sort/Makefile.in 2005-02-09 07:36:50.000000000 -0500 -@@ -301,10 +301,13 @@ n10b.E n11a.O n11a.E n11b.O n11b.E 01a.O + $(srcdir)/$x-tests: $(mk_script) Test.pm Makefile.am +--- coreutils-5.92/tests/sort/Makefile.in.i18n 2005-10-22 19:13:23.000000000 +0100 ++++ coreutils-5.92/tests/sort/Makefile.in 2005-10-26 22:17:04.000000000 +0100 +@@ -338,13 +338,15 @@ o-no-file1.E create-empty.O create-empty.E neg-nls.O neg-nls.E nul-nls.O \ nul-nls.E use-nl.O use-nl.E o2.O o2.E nul-tab.O nul-tab.E +-EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen) +-noinst_SCRIPTS = $x-tests +run_gen += mb1.O mb2.O + +EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen) mb1.I mb1.X mb2.I mb2.X - EXTRA_DIST = Test.pm $x-tests $(explicit) $(maint_gen) --noinst_SCRIPTS = $x-tests -+noinst_SCRIPTS = $x-tests $x-mb-tests ++noinst_SCRIPTS = $x-tests # $x-mb-tests + TESTS_ENVIRONMENT = \ + PATH="`pwd`/../../src$(PATH_SEPARATOR)$$PATH" + editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,$(srcdir),g' -TESTS = $x-tests -+TESTS = $x-tests $x-mb-tests ++TESTS = $x-tests # $x-mb-tests mk_script = $(srcdir)/../mk-script MAINTAINERCLEANFILES = $x-tests $(maint_gen) CLEANFILES = $(run_gen) diff --git a/coreutils-pam.patch b/coreutils-pam.patch index a2ba825..c342555 100644 --- a/coreutils-pam.patch +++ b/coreutils-pam.patch @@ -1,16 +1,16 @@ ---- coreutils-5.2.1/src/Makefile.am.pam 2005-04-15 17:03:44.000000000 +0100 -+++ coreutils-5.2.1/src/Makefile.am 2005-04-15 17:03:44.000000000 +0100 -@@ -66,7 +66,7 @@ +--- coreutils-5.92/src/Makefile.am.pam 2005-10-24 17:58:21.000000000 +0100 ++++ coreutils-5.92/src/Makefile.am 2005-10-24 17:58:21.000000000 +0100 +@@ -93,7 +93,7 @@ uptime_LDADD = $(LDADD) $(GETLOADAVG_LIBS) -su_LDADD = $(LDADD) $(LIB_CRYPT) +su_LDADD = $(LDADD) $(LIB_CRYPT) @LIB_PAM@ - $(PROGRAMS): ../lib/libfetish.a + $(PROGRAMS): ../lib/libcoreutils.a ---- coreutils-5.2.1/src/su.c.pam 2005-04-15 17:03:44.000000000 +0100 -+++ coreutils-5.2.1/src/su.c 2005-04-15 17:04:52.000000000 +0100 +--- coreutils-5.92/src/su.c.pam 2005-10-24 17:58:21.000000000 +0100 ++++ coreutils-5.92/src/su.c 2005-10-24 18:06:22.000000000 +0100 @@ -38,6 +38,16 @@ restricts who can su to UID 0 accounts. RMS considers that to be fascist. @@ -54,21 +54,22 @@ char *getpass (); char *getusershell (); void endusershell (); -@@ -158,8 +179,12 @@ +@@ -158,8 +179,13 @@ extern char **environ; --static void run_shell (const char *, const char *, char **) -+static void run_shell (const char *, const char *, char **, const struct passwd *) +-static void run_shell (char const *, char const *, char **, size_t) ++static void run_shell (char const *, char const *, char **, size_t, ++ const struct passwd *) +#ifdef USE_PAM -+ ; ++ ; +#else ATTRIBUTE_NORETURN; +#endif /* The name this program was run with. */ char *program_name; -@@ -271,7 +296,22 @@ +@@ -248,7 +274,22 @@ } #endif @@ -88,11 +89,11 @@ + /* Ask the user for a password. + If PAM is in use, let PAM ask for the password if necessary. - Return 1 if the user gives the correct password for entry PW, - 0 if not. Return 1 without asking for a password if run by UID 0 + Return true if the user gives the correct password for entry PW, + false if not. Return true without asking for a password if run by UID 0 or if PW has an empty password. */ -@@ -279,6 +319,44 @@ - static int +@@ -256,6 +297,44 @@ + static bool correct_password (const struct passwd *pw) { +#ifdef USE_PAM @@ -136,41 +137,34 @@ char *unencrypted, *encrypted, *correct; #if HAVE_GETSPNAM && HAVE_STRUCT_SPWD_SP_PWDP /* Shadow passwd stuff for SVR3 and maybe other systems. */ -@@ -303,6 +381,7 @@ +@@ -280,6 +359,7 @@ encrypted = crypt (unencrypted, correct); memset (unencrypted, 0, strlen (unencrypted)); - return strcmp (encrypted, correct) == 0; + return STREQ (encrypted, correct); +#endif /* !USE_PAM */ } /* Update `environ' for the new shell based on PW, with SHELL being -@@ -312,16 +391,24 @@ - modify_environment (const struct passwd *pw, const char *shell) - { - char *term; -+ char *display; -+ char *xauthority; - - if (simulate_login) - { -- /* Leave TERM unchanged. Set HOME, SHELL, USER, LOGNAME, PATH. -+ /* Leave TERM, DISPLAY, XAUTHORITY unchanged. Set HOME, SHELL, USER, LOGNAME, PATH. +@@ -293,12 +373,18 @@ + /* Leave TERM unchanged. Set HOME, SHELL, USER, LOGNAME, PATH. Unset all other environment variables. */ - term = getenv ("TERM"); -+ display = getenv ("DISPLAY"); -+ xauthority = getenv ("XAUTHORITY"); - environ = xmalloc (2 * sizeof (char *)); - environ[0] = 0; + char const *term = getenv ("TERM"); ++ char const *display = getenv ("DISPLAY"); ++ char const *xauthority = getenv ("XAUTHORITY"); + if (term) + term = xstrdup (term); + environ = xmalloc ((6 + !!term) * sizeof (char *)); + environ[0] = NULL; if (term) - xputenv (concat ("TERM", "=", term)); + xsetenv ("TERM", term); + if (display) -+ xputenv (concat ("DISPLAY", "=", display)); ++ xsetenv ("DISPLAY", display); + if (xauthority) -+ xputenv (concat ("XAUTHORITY", "=", xauthority)); - xputenv (concat ("HOME", "=", pw->pw_dir)); - xputenv (concat ("SHELL", "=", shell)); - xputenv (concat ("USER", "=", pw->pw_name)); -@@ -354,8 +441,13 @@ ++ xsetenv ("XAUTHORITY", xauthority); + xsetenv ("HOME", pw->pw_dir); + xsetenv ("SHELL", shell); + xsetenv ("USER", pw->pw_name); +@@ -331,8 +417,13 @@ { #ifdef HAVE_INITGROUPS errno = 0; @@ -185,7 +179,7 @@ endgrent (); #endif if (setgid (pw->pw_gid)) -@@ -364,16 +456,69 @@ +@@ -341,6 +432,31 @@ error (EXIT_FAIL, errno, _("cannot set user id")); } @@ -205,7 +199,8 @@ + env = pam_getenvlist(pamh); + if(env) { + while(*env) { -+ xputenv(*env); ++ if (putenv (*env)) ++ xalloc_die (); + env++; + } + } @@ -215,15 +210,17 @@ + /* Run SHELL, or DEFAULT_SHELL if SHELL is empty. If COMMAND is nonzero, pass it to the shell with the -c option. - If ADDITIONAL_ARGS is nonzero, pass it to the shell as more - arguments. */ + Pass ADDITIONAL_ARGS to the shell as more arguments; there +@@ -348,17 +464,49 @@ static void --run_shell (const char *shell, const char *command, char **additional_args) -+run_shell (const char *shell, const char *command, char **additional_args, const struct passwd *pw) + run_shell (char const *shell, char const *command, char **additional_args, +- size_t n_additional_args) ++ size_t n_additional_args, const struct passwd *pw) { - const char **args; - int argno = 1; + size_t n_args = 1 + fast_startup + 2 * !!command + n_additional_args + 1; + char const **args = xnmalloc (n_args, sizeof *args); + size_t argno = 1; +#ifdef USE_PAM + int child; + sigset_t ourset; @@ -254,9 +251,8 @@ + pam_end(pamh, 0); +#endif - if (additional_args) - args = xmalloc (sizeof (char *) -@@ -385,6 +530,9 @@ + if (simulate_login) + { char *arg0; char *shell_basename; @@ -266,7 +262,7 @@ shell_basename = base_name (shell); arg0 = xmalloc (strlen (shell_basename) + 2); arg0[0] = '-'; -@@ -411,6 +559,66 @@ +@@ -383,6 +531,66 @@ error (0, errno, "%s", shell); exit (exit_status); } @@ -332,24 +328,23 @@ +#endif /* USE_PAM */ } - /* Return 1 if SHELL is a restricted shell (one not returned by -@@ -586,9 +794,10 @@ - } + /* Return true if SHELL is a restricted shell (one not returned by +@@ -550,9 +758,11 @@ + shell = xstrdup (shell ? shell : pw->pw_shell); modify_environment (pw, shell); -+ +#ifndef USE_PAM change_identity (pw); -- if (simulate_login && chdir (pw->pw_dir)) -- error (0, errno, _("warning: cannot change directory to %s"), pw->pw_dir); +#endif + if (simulate_login && chdir (pw->pw_dir) != 0) + error (0, errno, _("warning: cannot change directory to %s"), pw->pw_dir); -- run_shell (shell, command, additional_args); -+ run_shell (shell, command, additional_args, pw); +- run_shell (shell, command, argv + optind, MAX (0, argc - optind)); ++ run_shell (shell, command, argv + optind, MAX (0, argc - optind), pw); } ---- coreutils-5.2.1/doc/coreutils.texi.pam 2005-04-15 17:03:44.000000000 +0100 -+++ coreutils-5.2.1/doc/coreutils.texi 2005-04-15 17:03:44.000000000 +0100 -@@ -11850,8 +11850,11 @@ +--- coreutils-5.92/doc/coreutils.texi.pam 2005-10-16 08:26:21.000000000 +0100 ++++ coreutils-5.92/doc/coreutils.texi 2005-10-24 17:58:21.000000000 +0100 +@@ -12746,8 +12746,11 @@ @findex syslog @command{su} can optionally be compiled to use @code{syslog} to report failed, and optionally successful, @command{su} attempts. (If the system @@ -363,7 +358,7 @@ The program accepts the following options. Also see @ref{Common options}. -@@ -11932,33 +11935,6 @@ +@@ -12828,33 +12831,6 @@ the exit status of the subshell otherwise @end display @@ -397,11 +392,11 @@ @node Process control @chapter Process control ---- coreutils-5.2.1/configure.ac.pam 2005-04-15 17:03:44.000000000 +0100 -+++ coreutils-5.2.1/configure.ac 2005-04-15 17:03:44.000000000 +0100 -@@ -7,6 +7,13 @@ - - AM_INIT_AUTOMAKE([1.8 gnits dist-bzip2]) +--- coreutils-5.92/configure.ac.pam 2005-10-24 17:58:21.000000000 +0100 ++++ coreutils-5.92/configure.ac 2005-10-24 17:58:21.000000000 +0100 +@@ -28,6 +28,13 @@ + AB_INIT() + AM_INIT_AUTOMAKE([1.8.3 gnits dist-bzip2]) +dnl Give the chance to enable PAM +AC_ARG_ENABLE(pam, dnl @@ -412,10 +407,10 @@ + gl_DEFAULT_POSIX2_VERSION gl_USE_SYSTEM_EXTENSIONS - jm_PERL ---- coreutils-5.2.1/config.hin.pam 2005-04-15 17:03:44.000000000 +0100 -+++ coreutils-5.2.1/config.hin 2005-04-15 17:03:44.000000000 +0100 -@@ -1365,6 +1365,9 @@ + gl_PERL +--- coreutils-5.92/config.hin.pam 2005-10-24 17:58:21.000000000 +0100 ++++ coreutils-5.92/config.hin 2005-10-24 17:58:21.000000000 +0100 +@@ -1526,6 +1526,9 @@ /* Define if you want access control list support. */ #undef USE_ACL diff --git a/coreutils-selinux.patch b/coreutils-selinux.patch index b156391..702c281 100644 --- a/coreutils-selinux.patch +++ b/coreutils-selinux.patch @@ -1,22 +1,5 @@ -unchanged: ---- coreutils-5.2.1/README.selinux 2004-12-29 12:24:03.260876459 -0500 -+++ coreutils-5.2.1/README 2004-12-29 12:24:03.417858780 -0500 -@@ -7,11 +7,11 @@ - - The programs that can be built with this package are: - -- [ basename cat chgrp chmod chown chroot cksum comm cp csplit cut date dd -+ [ basename cat chcon chgrp chmod chown chroot cksum comm cp csplit cut date dd - df dir dircolors dirname du echo env expand expr factor false fmt fold - ginstall groups head hostid hostname id join kill link ln logname ls - md5sum mkdir mkfifo mknod mv nice nl nohup od paste pathchk pinky pr -- printenv printf ptx pwd readlink rm rmdir runuser seq sha1sum shred sleep sort -+ printenv printf ptx pwd readlink rm rmdir runcon runuser seq sha1sum shred sleep sort - split stat stty su sum sync tac tail tee test touch tr true tsort tty - uname unexpand uniq unlink uptime users vdir wc who whoami yes - ---- coreutils-5.2.1/src/stat.c.selinux 2004-02-05 08:46:12.000000000 -0500 -+++ coreutils-5.2.1/src/stat.c 2004-12-29 12:24:03.419858555 -0500 +--- coreutils-5.92/src/stat.c.selinux 2005-10-14 14:55:40.000000000 +0100 ++++ coreutils-5.92/src/stat.c 2005-10-26 17:51:02.000000000 +0100 @@ -42,6 +42,13 @@ # endif #endif @@ -31,25 +14,25 @@ unchanged: #include "system.h" #include "error.h" -@@ -95,6 +102,7 @@ - {"dereference", no_argument, 0, 'L'}, - {"format", required_argument, 0, 'c'}, - {"filesystem", no_argument, 0, 'f'}, +@@ -101,6 +108,7 @@ + #define AUTHORS "Michael Meskes" + + static struct option const long_options[] = { + {"context", no_argument, 0, 'Z'}, - {"terse", no_argument, 0, 't'}, - {GETOPT_HELP_OPTION_DECL}, - {GETOPT_VERSION_OPTION_DECL}, -@@ -345,7 +353,7 @@ + {"dereference", no_argument, NULL, 'L'}, + {"file-system", no_argument, NULL, 'f'}, + {"filesystem", no_argument, NULL, 'f'}, /* obsolete and undocumented alias */ +@@ -311,7 +319,7 @@ /* print statfs info */ static void - print_statfs (char *pformat, char m, char const *filename, + print_statfs (char *pformat, size_t buf_len, char m, char const *filename, - void const *data) -+ void const *data,SECURITY_ID_T scontext) ++ void const *data, SECURITY_ID_T scontext) { STRUCT_STATVFS const *statfsbuf = data; -@@ -407,7 +415,10 @@ - strcat (pformat, PRIdMAX); +@@ -383,7 +391,10 @@ + xstrcat (pformat, buf_len, PRIdMAX); printf (pformat, (intmax_t) (statfsbuf->f_ffree)); break; - @@ -58,54 +41,55 @@ unchanged: + printf(scontext); + break; default: - strcat (pformat, "c"); + xstrcat (pformat, buf_len, "c"); printf (pformat, m); -@@ -417,7 +428,7 @@ - +@@ -394,7 +405,7 @@ /* print stat info */ static void --print_stat (char *pformat, char m, char const *filename, void const *data) -+print_stat (char *pformat, char m, char const *filename, void const *data, SECURITY_ID_T scontext) + print_stat (char *pformat, size_t buf_len, char m, +- char const *filename, void const *data) ++ char const *filename, void const *data, SECURITY_ID_T scontext) { struct stat *statbuf = (struct stat *) data; struct passwd *pw_ent; -@@ -553,6 +564,10 @@ - strcat (pformat, "d"); - printf (pformat, (int) statbuf->st_ctime); +@@ -528,6 +539,10 @@ + xstrcat (pformat, buf_len, TYPE_SIGNED (time_t) ? "ld" : "lu"); + printf (pformat, (unsigned long int) statbuf->st_ctime); break; + case 'C': + strcat (pformat, "s"); + printf(pformat,scontext); + break; default: - strcat (pformat, "c"); + xstrcat (pformat, buf_len, "c"); printf (pformat, m); -@@ -562,8 +577,8 @@ +@@ -537,8 +552,9 @@ static void print_it (char const *masterformat, char const *filename, -- void (*print_func) (char *, char, char const *, void const *), +- void (*print_func) (char *, size_t, char, char const *, void const *), - void const *data) -+ void (*print_func) (char *, char, char const *, void const *,SECURITY_ID_T ), -+ void const *data, SECURITY_ID_T scontext) ++ void (*print_func) (char *, size_t, char, char const *, void const *, ++ SECURITY_ID_T ), ++ void const *data, SECURITY_ID_T scontext) { char *b; -@@ -598,7 +613,7 @@ +@@ -576,7 +592,7 @@ putchar ('%'); break; default: -- print_func (dest, *p, filename, data); -+ print_func (dest, *p, filename, data,scontext); +- print_func (dest, n_alloc, *p, filename, data); ++ print_func (dest, n_alloc, *p, filename, data, scontext); break; } } -@@ -615,9 +630,17 @@ +@@ -592,9 +608,17 @@ - /* stat the filesystem and print what we find */ - static void --do_statfs (char const *filename, int terse, char const *format) -+do_statfs (char const *filename, int terse, int secure, char const *format) + /* Stat the file system and print what we find. */ + static bool +-do_statfs (char const *filename, bool terse, char const *format) ++do_statfs (char const *filename, bool terse, bool secure, char const *format) { STRUCT_STATVFS statfsbuf; + SECURITY_ID_T scontext = NULL; @@ -116,175 +100,170 @@ unchanged: + return; + } +#endif - int i = statfs (filename, &statfsbuf); - if (i == -1) -@@ -629,23 +652,40 @@ + if (STATFS (filename, &statfsbuf) != 0) + { +@@ -605,25 +629,46 @@ if (format == NULL) { - format = (terse -- ? "%n %i %l %t %b %f %a %s %c %d" +- ? "%n %i %l %t %s %S %b %f %a %c %d\n" - : " File: \"%n\"\n" - " ID: %-8i Namelen: %-7l Type: %T\n" -- "Blocks: Total: %-10b Free: %-10f Available: %-10a Size: %s\n" -- "Inodes: Total: %-10c Free: %-10d"); -- } -- -- print_it (format, filename, print_statfs, &statfsbuf); -+ if (terse) { -+ if(secure) -+ format = "%n %i %l %t %b %f %a %s %c %d %C"; -+ else -+ format = "%n %i %l %t %b %f %a %s %c %d"; -+ } -+ else +- "Block size: %-10s Fundamental block size: %S\n" +- "Blocks: Total: %-10b Free: %-10f Available: %a\n" +- "Inodes: Total: %-10c Free: %d\n"); ++ if (terse) + { -+ if(secure) ++ if (secure) ++ format = "%n %i %l %t %s %S %b %f %a %c %d %C\n"; ++ else ++ format = "%n %i %l %t %s %S %b %f %a %c %d\n"; ++ } ++ else ++ { ++ if (secure) + format = " File: \"%n\"\n" + " ID: %-8i Namelen: %-7l Type: %T\n" -+ "Blocks: Total: %-10b Free: %-10f Available: %-10a Size: %s\n" -+ "Inodes: Total: %-10c Free: %-10d\n" ++ "Block size: %-10s Fundamental block size: %S\n" ++ "Blocks: Total: %-10b Free: %-10f Available: %a\n" ++ "Inodes: Total: %-10c Free: %d\n" + " S_Context: %C\n"; -+ else -+ format= " File: \"%n\"\n" ++ else ++ format = " File: \"%n\"\n" + " ID: %-8i Namelen: %-7l Type: %T\n" -+ "Blocks: Total: %-10b Free: %-10f Available: %-10a Size: %s\n" -+ "Inodes: Total: %-10c Free: %-10d"; -+ } -+ } -+ print_it (format, filename, print_statfs, &statfsbuf,scontext); ++ "Block size: %-10s Fundamental block size: %S\n" ++ "Blocks: Total: %-10b Free: %-10f Available: %a\n" ++ "Inodes: Total: %-10c Free: %d\n"; ++ } + } + +- print_it (format, filename, print_statfs, &statfsbuf); ++ print_it (format, filename, print_statfs, &statfsbuf, scontext); +#ifdef WITH_SELINUX + if (scontext != NULL) + freecon(scontext); +#endif + return true; } -- + /* stat the file and print what we find */ - static void --do_stat (char const *filename, int follow_links, int terse, -+ do_stat (char const *filename, int follow_links, int terse,int secure, + static bool +-do_stat (char const *filename, bool follow_links, bool terse, ++do_stat (char const *filename, bool follow_links, bool terse, bool secure, char const *format) { struct stat statbuf; + SECURITY_ID_T scontext = NULL; - int i = ((follow_links == 1) - ? stat (filename, &statbuf) - : lstat (filename, &statbuf)); -@@ -656,11 +696,28 @@ - return; + + if ((follow_links ? stat : lstat) (filename, &statbuf) != 0) + { +@@ -631,11 +676,29 @@ + return false; } +#ifdef WITH_SELINUX + if(secure) { -+ if (link) ++ int i; ++ if (!follow_links) + i=lgetfilecon(filename, &scontext); + else + i=getfilecon(filename, &scontext); + if (i == -1) + { + perror (filename); -+ return; ++ return false; + } + } +#endif + if (format == NULL) { - if (terse != 0) + if (terse) { -- format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o"; +- format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n"; + if (secure) -+ format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o %C"; ++ format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o %C\n"; + else -+ format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o"; ++ format = "%n %s %b %f %u %g %D %i %h %t %T %X %Y %Z %o\n"; } else { -@@ -668,7 +725,17 @@ - i = statbuf.st_mode & S_IFMT; - if (i == S_IFCHR || i == S_IFBLK) - { -- format = -+ if (secure) -+ format = -+ " File: %N\n" -+ " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" -+ "Device: %Dh/%dd\tInode: %-10i Links: %-5h" -+ " Device type: %t,%T\n" -+ "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" -+ " S_Context: %C\n" -+ "Access: %x\n" "Modify: %y\n" "Change: %z\n"; -+ else -+ format = - " File: %N\n" - " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" - "Device: %Dh/%dd\tInode: %-10i Links: %-5h" -@@ -678,6 +745,15 @@ +@@ -653,16 +716,30 @@ } else { -+ if (secure) -+ format = -+ " File: %N\n" -+ " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" -+ "Device: %Dh/%dd\tInode: %-10i Links: %-5h\n" -+ "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" -+ "S_Context: %C\n" -+ "Access: %x\n" "Modify: %y\n" "Change: %z\n"; -+ else - format = - " File: %N\n" - " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" -@@ -687,7 +763,11 @@ +- format = +- " File: %N\n" +- " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" +- "Device: %Dh/%dd\tInode: %-10i Links: %h\n" +- "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" +- "Access: %x\n" "Modify: %y\n" "Change: %z\n"; ++ if (secure) ++ format = ++ " File: %N\n" ++ " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" ++ "Device: %Dh/%dd\tInode: %-10i Links: %-5h" ++ " Device type: %t,%T\n" ++ "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" ++ " S_Context: %C\n" ++ "Access: %x\n" "Modify: %y\n" "Change: %z\n"; ++ else ++ format = ++ " File: %N\n" ++ " Size: %-10s\tBlocks: %-10b IO Block: %-6o %F\n" ++ "Device: %Dh/%dd\tInode: %-10i Links: %h\n" ++ "Access: (%04a/%10.10A) Uid: (%5u/%8U) Gid: (%5g/%8G)\n" ++ "Access: %x\n" "Modify: %y\n" "Change: %z\n"; } } } - print_it (format, filename, print_stat, &statbuf); -+ print_it (format, filename, print_stat, &statbuf,scontext); ++ print_it (format, filename, print_stat, &statbuf, scontext); +#ifdef WITH_SELINUX + if (scontext) + freecon(scontext); +#endif + return true; } - void -@@ -705,6 +785,7 @@ - -f, --filesystem display filesystem status instead of file status\n\ +@@ -681,6 +758,7 @@ + -f, --file-system display file system status instead of file status\n\ -c --format=FORMAT use the specified FORMAT instead of the default\n\ -L, --dereference follow links\n\ + -Z, --context print the security context \n\ -t, --terse print the information in terse form\n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); -@@ -756,6 +837,7 @@ +@@ -732,6 +810,7 @@ %c Total file nodes in file system\n\ %d Free file nodes in file system\n\ %f Free blocks in file system\n\ + %C - Security context in SELinux\n\ "), stdout); fputs (_("\ - %i File System id in hex\n\ -@@ -778,6 +860,7 @@ - int follow_links = 0; - int fs = 0; - int terse = 0; -+ int secure = 0; + %i File System ID in hex\n\ +@@ -756,6 +835,7 @@ + bool follow_links = false; + bool fs = false; + bool terse = false; ++ bool secure = false; char *format = NULL; + bool ok = true; - initialize_main (&argc, &argv); -@@ -788,7 +871,7 @@ +@@ -767,7 +847,7 @@ atexit (close_stdout); -- while ((c = getopt_long (argc, argv, "c:fLlt", long_options, NULL)) != -1) -+ while ((c = getopt_long (argc, argv, "c:fLltZ", long_options, NULL)) != -1) +- while ((c = getopt_long (argc, argv, "c:fLt", long_options, NULL)) != -1) ++ while ((c = getopt_long (argc, argv, "c:fLtZ", long_options, NULL)) != -1) { switch (c) { -@@ -810,6 +893,14 @@ +@@ -786,6 +866,14 @@ case 't': - terse = 1; + terse = true; break; + case 'Z': + if((is_selinux_enabled()>0)) @@ -297,20 +276,19 @@ unchanged: case_GETOPT_HELP_CHAR; -@@ -829,9 +920,9 @@ +@@ -804,8 +892,8 @@ + for (i = optind; i < argc; i++) - { - if (fs == 0) -- do_stat (argv[i], follow_links, terse, format); -+ do_stat (argv[i], follow_links, terse, secure, format); - else -- do_statfs (argv[i], terse, format); -+ do_statfs (argv[i], terse, secure, format); - } + ok &= (fs +- ? do_statfs (argv[i], terse, format) +- : do_stat (argv[i], follow_links, terse, format)); ++ ? do_statfs (argv[i], terse, secure, format) ++ : do_stat (argv[i], follow_links, terse, secure, format)); - exit (G_fail ? EXIT_FAILURE : EXIT_SUCCESS); ---- coreutils-5.2.1/src/runcon.c 2004-12-29 12:24:03.421858330 -0500 -+++ coreutils-5.2.1/src/runcon.c 2005-05-16 14:19:19.000000000 -0400 + exit (ok ? EXIT_SUCCESS : EXIT_FAILURE); + } +--- /dev/null 2005-10-10 09:36:06.437701000 +0100 ++++ coreutils-5.92/src/runcon.c 2005-10-26 17:42:29.000000000 +0100 @@ -0,0 +1,253 @@ +/* + * runcon [ context | @@ -565,9 +543,9 @@ unchanged: + } + return 1; /* can't reach this statement.... */ +} ---- coreutils-5.2.1/src/mkdir.c.selinux 2004-01-21 17:27:02.000000000 -0500 -+++ coreutils-5.2.1/src/mkdir.c 2004-12-29 12:24:03.422858217 -0500 -@@ -34,6 +34,10 @@ +--- coreutils-5.92/src/mkdir.c.selinux 2005-06-15 00:55:47.000000000 +0100 ++++ coreutils-5.92/src/mkdir.c 2005-10-26 17:42:29.000000000 +0100 +@@ -34,11 +34,18 @@ #define AUTHORS "David MacKenzie" @@ -578,8 +556,6 @@ unchanged: /* The name this program was run with. */ char *program_name; -@@ -42,6 +46,9 @@ - static struct option const longopts[] = { +#ifdef WITH_SELINUX @@ -588,7 +564,7 @@ unchanged: {"mode", required_argument, NULL, 'm'}, {"parents", no_argument, NULL, 'p'}, {"verbose", no_argument, NULL, 'v'}, -@@ -63,6 +70,11 @@ +@@ -60,6 +67,11 @@ Create the DIRECTORY(ies), if they do not already exist.\n\ \n\ "), stdout); @@ -600,9 +576,9 @@ unchanged: fputs (_("\ Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); -@@ -98,7 +110,11 @@ +@@ -95,7 +107,11 @@ - create_parents = 0; + atexit (close_stdout); +#ifdef WITH_SELINUX + while ((optc = getopt_long (argc, argv, "pm:vZ:", longopts, NULL)) != -1) @@ -612,7 +588,7 @@ unchanged: { switch (optc) { -@@ -113,6 +129,20 @@ +@@ -108,6 +124,20 @@ case 'v': /* --verbose */ verbose_fmt_string = _("created directory %s"); break; @@ -633,8 +609,8 @@ unchanged: case_GETOPT_HELP_CHAR; case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); default: ---- coreutils-5.2.1/src/mv.c.selinux 2004-12-29 12:24:02.845923189 -0500 -+++ coreutils-5.2.1/src/mv.c 2004-12-29 12:24:03.424857992 -0500 +--- coreutils-5.92/src/mv.c.selinux 2005-10-26 17:42:28.000000000 +0100 ++++ coreutils-5.92/src/mv.c 2005-10-26 17:42:29.000000000 +0100 @@ -34,6 +34,11 @@ #include "quote.h" #include "remove.h" @@ -647,17 +623,17 @@ unchanged: /* The official name of this program (e.g., no `g' prefix). */ #define PROGRAM_NAME "mv" -@@ -124,6 +129,9 @@ - x->preserve_links = 1; - x->preserve_mode = 1; - x->preserve_timestamps = 1; +@@ -127,6 +132,9 @@ + x->preserve_links = true; + x->preserve_mode = true; + x->preserve_timestamps = true; +#ifdef WITH_SELINUX + x->preserve_security_context = 1; +#endif - x->require_preserve = 0; /* FIXME: maybe make this an option */ - x->recursive = 1; + x->require_preserve = false; /* FIXME: maybe make this an option */ + x->recursive = true; x->sparse_mode = SPARSE_AUTO; /* FIXME: maybe make this an option */ -@@ -376,6 +384,10 @@ +@@ -365,6 +373,10 @@ cp_option_init (&x); @@ -668,9 +644,9 @@ unchanged: /* FIXME: consider not calling getenv for SIMPLE_BACKUP_SUFFIX unless we'll actually use backup_suffix_string. */ backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); ---- coreutils-5.2.1/src/ls.c.selinux 2004-12-29 12:24:02.848922851 -0500 -+++ coreutils-5.2.1/src/ls.c 2004-12-29 12:24:03.429857429 -0500 -@@ -121,6 +121,18 @@ +--- coreutils-5.92/src/ls.c.selinux 2005-10-26 17:42:28.000000000 +0100 ++++ coreutils-5.92/src/ls.c 2005-10-26 17:42:29.000000000 +0100 +@@ -135,6 +135,18 @@ #define AUTHORS "Richard Stallman", "David MacKenzie" @@ -689,7 +665,7 @@ unchanged: #define obstack_chunk_alloc malloc #define obstack_chunk_free free -@@ -165,7 +177,8 @@ +@@ -170,7 +182,8 @@ symbolic_link DT_INIT (DT_LNK), sock DT_INIT (DT_SOCK), arg_directory DT_INIT (2 * (DT_UNKNOWN | DT_FIFO | DT_CHR | DT_DIR | DT_BLK @@ -699,15 +675,15 @@ unchanged: }; struct fileinfo -@@ -174,6 +187,7 @@ +@@ -179,6 +192,7 @@ char *name; struct stat stat; + int stat_failed; - /* For symbolic link, name of the file linked to, otherwise zero. */ + /* For symbolic link, name of the file linked to, otherwise zero. */ char *linkname; -@@ -192,6 +206,10 @@ +@@ -197,6 +211,10 @@ /* For long listings, true if the file has an access control list. */ bool have_acl; #endif @@ -718,17 +694,17 @@ unchanged: }; #if HAVE_ACL || USE_ACL -@@ -227,7 +245,8 @@ - static int file_interesting (const struct dirent *next); - static uintmax_t gobble_file (const char *name, enum filetype type, - int explicit_arg, const char *dirname); +@@ -232,7 +250,8 @@ + static bool file_ignored (char const *name); + static uintmax_t gobble_file (char const *name, enum filetype type, + bool command_line_arg, char const *dirname); -static void print_color_indicator (const char *name, mode_t mode, int linkok); +static void print_color_indicator (const char *name, mode_t mode, int linkok, + int stat_failed); static void put_indicator (const struct bin_str *ind); - static int put_indicator_direct (const struct bin_str *ind); static void add_ignore_pattern (const char *pattern); -@@ -247,7 +266,7 @@ + static void attach (char *dest, const char *dirname, const char *name); +@@ -253,7 +272,7 @@ static void print_long_format (const struct fileinfo *f); static void print_many_per_line (void); static void print_name_with_quoting (const char *p, mode_t mode, @@ -737,7 +713,7 @@ unchanged: struct obstack *stack); static void prep_non_filename_text (void); static void print_type_indicator (mode_t mode); -@@ -256,6 +275,9 @@ +@@ -263,6 +282,9 @@ static void sort_files (void); static void parse_ls_color (void); void usage (int status); @@ -745,9 +721,9 @@ unchanged: +static void print_scontext_format (const struct fileinfo *f); +#endif - /* The name the program was run with, stripped of any leading path. */ + /* The name this program was run with. */ char *program_name; -@@ -354,7 +376,11 @@ +@@ -371,7 +393,11 @@ one_per_line, /* -1 */ many_per_line, /* -C */ horizontal, /* -x */ @@ -760,7 +736,7 @@ unchanged: }; static enum format format; -@@ -679,6 +705,11 @@ +@@ -740,6 +766,11 @@ SHOW_CONTROL_CHARS_OPTION, SI_OPTION, SORT_OPTION, @@ -772,43 +748,40 @@ unchanged: TIME_OPTION, TIME_STYLE_OPTION }; -@@ -722,6 +753,11 @@ - {"time-style", required_argument, 0, TIME_STYLE_OPTION}, - {"color", optional_argument, 0, COLOR_OPTION}, - {"block-size", required_argument, 0, BLOCK_SIZE_OPTION}, +@@ -784,6 +815,11 @@ + {"time-style", required_argument, NULL, TIME_STYLE_OPTION}, + {"color", optional_argument, NULL, COLOR_OPTION}, + {"block-size", required_argument, NULL, BLOCK_SIZE_OPTION}, +#ifdef WITH_SELINUX + {"context", no_argument, 0, CONTEXT_OPTION}, + {"lcontext", no_argument, 0, LCONTEXT_OPTION}, + {"scontext", no_argument, 0, SCONTEXT_OPTION}, +#endif - {"author", no_argument, 0, AUTHOR_OPTION}, + {"author", no_argument, NULL, AUTHOR_OPTION}, {GETOPT_HELP_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL}, -@@ -731,13 +767,21 @@ +@@ -793,12 +829,19 @@ static char const *const format_args[] = { "verbose", "long", "commas", "horizontal", "across", -- "vertical", "single-column", 0 -+ "vertical", "single-column", +- "vertical", "single-column", NULL ++ "vertical", "single-column", +#ifdef WITH_SELINUX + "context", +#endif -+ 0 ++ NULL }; - static enum format const format_types[] = { long_format, long_format, with_commas, horizontal, horizontal, -- many_per_line, one_per_line -+ many_per_line, one_per_line, + many_per_line, one_per_line +#ifdef WITH_SELINUX -+ security_format, ++ , security_format +#endif -+ invalid_format }; + ARGMATCH_VERIFY (format_args, format_types); - static char const *const sort_args[] = -@@ -1101,6 +1145,9 @@ +@@ -1222,6 +1265,9 @@ format_needs_stat = sort_type == sort_time || sort_type == sort_size || format == long_format @@ -817,27 +790,27 @@ unchanged: +#endif || dereference == DEREF_ALWAYS || print_block_size || print_inode; - format_needs_type = (format_needs_stat == 0 -@@ -1125,7 +1172,7 @@ - - for (; i < argc; i++) - { -- gobble_file (argv[i], unknown, 1, ""); -+ gobble_file (argv[i], command_line, 1, ""); + format_needs_type = (!format_needs_stat +@@ -1251,7 +1297,7 @@ } + else + do +- gobble_file (argv[i++], unknown, true, ""); ++ gobble_file (argv[i++], command_line, true, ""); + while (i < argc); - if (dir_defaulted) -@@ -1273,6 +1320,9 @@ - all_files = 0; - really_all_files = 0; - ignore_patterns = 0; + if (files_index) +@@ -1414,6 +1460,9 @@ + ignore_mode = IGNORE_DEFAULT; + ignore_patterns = NULL; + hide_patterns = NULL; +#ifdef WITH_SELINUX + print_scontext = 0; +#endif /* FIXME: put this in a function. */ { -@@ -1350,7 +1400,7 @@ +@@ -1489,7 +1538,7 @@ } while ((c = getopt_long (argc, argv, @@ -846,7 +819,7 @@ unchanged: long_options, NULL)) != -1) { switch (c) -@@ -1470,6 +1520,13 @@ +@@ -1608,6 +1657,13 @@ format = horizontal; break; @@ -858,9 +831,9 @@ unchanged: + break; +#endif case 'A': - really_all_files = 0; - all_files = 1; -@@ -1637,6 +1694,25 @@ + if (ignore_mode == IGNORE_DEFAULT) + ignore_mode = IGNORE_DOT_AND_DOTDOT; +@@ -1784,6 +1840,25 @@ case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); @@ -884,12 +857,12 @@ unchanged: +#endif + default: - usage (EXIT_FAILURE); + usage (LS_FAILURE); } -@@ -2300,6 +2376,12 @@ +@@ -2468,6 +2543,12 @@ + { free (files[i].name); - if (files[i].linkname) - free (files[i].linkname); + free (files[i].linkname); +#ifdef WITH_SELINUX + if (files[i].scontext) { + freecon (files[i].scontext); @@ -899,15 +872,15 @@ unchanged: } files_index = 0; -@@ -2336,11 +2418,14 @@ - f->linkname = 0; +@@ -2506,11 +2587,14 @@ + f->linkname = NULL; f->linkmode = 0; - f->linkok = 0; + f->linkok = false; +#ifdef WITH_SELINUX + f->scontext = NULL; +#endif - if (explicit_arg + if (command_line_arg || format_needs_stat || (format_needs_type - && (type == unknown @@ -915,38 +888,38 @@ unchanged: /* FIXME: remove this disjunct. I don't think we care about symlinks here, but for now -@@ -2373,6 +2458,11 @@ +@@ -2547,6 +2631,11 @@ { case DEREF_ALWAYS: - err = stat (path, &f->stat); + err = stat (absolute_name, &f->stat); +#ifdef WITH_SELINUX + if (err>=0) + if (format == security_format || print_scontext) -+ getfilecon(path, &f->scontext); ++ getfilecon(absolute_name, &f->scontext); +#endif break; case DEREF_COMMAND_LINE_ARGUMENTS: -@@ -2381,6 +2471,11 @@ +@@ -2555,6 +2644,11 @@ { - int need_lstat; - err = stat (path, &f->stat); + bool need_lstat; + err = stat (absolute_name, &f->stat); +#ifdef WITH_SELINUX + if (err>=0) + if (format == security_format || print_scontext) -+ getfilecon(path, &f->scontext); ++ getfilecon(absolute_name, &f->scontext); +#endif if (dereference == DEREF_COMMAND_LINE_ARGUMENTS) break; -@@ -2399,18 +2494,42 @@ +@@ -2573,17 +2667,41 @@ default: /* DEREF_NEVER */ - err = lstat (path, &f->stat); + err = lstat (absolute_name, &f->stat); +#ifdef WITH_SELINUX + if (err>=0) + if (format == security_format || print_scontext) -+ lgetfilecon(path, &f->scontext); ++ lgetfilecon(absolute_name, &f->scontext); +#endif break; } @@ -955,22 +928,20 @@ unchanged: + f->stat_failed = (err < 0); + if (f->stat_failed) { -- error (0, errno, "%s", quotearg_colon (path)); -- exit_status = 1; +- file_failure (command_line_arg, "%s", absolute_name); + /* We treat stat failures for files the user named special. + There is no guarantee that these files really exist so + we do not print any information. */ + if (type == command_line) + { -+ error (0, errno, "%s", quotearg_colon (path)); -+ exit_status = 1; ++ file_failure (1, "%s", absolute_name); + return 0; + } + + f->filetype = type; + memset (&f->stat, '\0', sizeof (f->stat)); + -+ f->name = xstrdup (name); ++ f->name = xstrdup (absolute_name); + files_index++; + return 0; @@ -982,11 +953,11 @@ unchanged: +#ifdef WITH_SELINUX + || format == security_format +#endif -+ ) ++ ) { - int n = file_has_acl (path, &f->stat); + int n = file_has_acl (absolute_name, &f->stat); f->have_acl = (0 < n); -@@ -2893,6 +3012,16 @@ +@@ -3072,6 +3190,16 @@ DIRED_PUTCHAR ('\n'); } break; @@ -1003,31 +974,31 @@ unchanged: } } -@@ -2974,9 +3103,9 @@ +@@ -3179,17 +3307,19 @@ WIDTH. */ static void -format_user (uid_t u, int width) +format_user (uid_t u, int width, int stat_failed) { -- char const *name = (numeric_ids ? NULL : getuser (u)); -+ char const *name = stat_failed ? "?" : (numeric_ids ? NULL : getuser (u)); - if (name) - printf ("%-*s ", width, name); - else -@@ -2988,9 +3117,9 @@ +- format_user_or_group (numeric_ids ? NULL : getuser (u), u, width); ++ format_user_or_group (stat_failed ? "?" : ++ (numeric_ids ? NULL : getuser (u)), u, width); + } + /* Likewise, for groups. */ static void -format_group (gid_t g, int width) +format_group (gid_t g, int width, int stat_failed) { -- char const *name = (numeric_ids ? NULL : getgroup (g)); -+ char const *name = stat_failed ? "?" : (numeric_ids ? NULL : getgroup (g)); - if (name) - printf ("%-*s ", width, name); - else -@@ -3095,7 +3224,7 @@ +- format_user_or_group (numeric_ids ? NULL : getgroup (g), g, width); ++ format_user_or_group (stat_failed ? "?" : ++ (numeric_ids ? NULL : getgroup (g)), g, width); + } + + /* Return the number of columns that format_user_or_group will print. */ +@@ -3279,7 +3409,7 @@ { char hbuf[INT_BUFSIZE_BOUND (uintmax_t)]; sprintf (p, "%*s ", inode_number_width, @@ -1036,27 +1007,27 @@ unchanged: p += inode_number_width + 1; } -@@ -3103,8 +3232,10 @@ +@@ -3287,8 +3417,10 @@ { char hbuf[LONGEST_HUMAN_READABLE + 1]; - sprintf (p, "%*s ", block_size_width, -- human_readable (ST_NBLOCKS (f->stat), hbuf, human_output_opts, -- ST_NBLOCKSIZE, output_block_size)); -+ f->stat_failed -+ ? "?" -+ : human_readable (ST_NBLOCKS (f->stat), hbuf, human_output_opts, -+ ST_NBLOCKSIZE, output_block_size)); - p += block_size_width + 1; - } - -@@ -3113,10 +3244,18 @@ + char const *blocks = +- human_readable (ST_NBLOCKS (f->stat), hbuf, human_output_opts, +- ST_NBLOCKSIZE, output_block_size); ++ f->stat_failed ++ ? "?" ++ : human_readable (ST_NBLOCKS (f->stat), hbuf, human_output_opts, ++ ST_NBLOCKSIZE, output_block_size); + int pad; + for (pad = block_size_width - mbswidth (blocks, 0); 0 < pad; pad--) + *p++ = ' '; +@@ -3302,10 +3434,18 @@ { char hbuf[INT_BUFSIZE_BOUND (uintmax_t)]; sprintf (p, "%s %*s ", modebuf, nlink_width, - umaxtostr (f->stat.st_nlink, hbuf)); + f->stat_failed ? "?" : umaxtostr (f->stat.st_nlink, hbuf)); } - p += sizeof modebuf + nlink_width + 1; + p += sizeof modebuf - 2 + any_has_acl + 1 + nlink_width + 1; +#ifdef WITH_SELINUX + @@ -1069,7 +1040,7 @@ unchanged: DIRED_INDENT (); if (print_owner | print_group | print_author) -@@ -3124,18 +3263,19 @@ +@@ -3313,18 +3453,19 @@ DIRED_FPUTS (buf, stdout, p - buf); if (print_owner) @@ -1093,26 +1064,29 @@ unchanged: { char majorbuf[INT_BUFSIZE_BOUND (uintmax_t)]; char minorbuf[INT_BUFSIZE_BOUND (uintmax_t)]; -@@ -3153,13 +3293,15 @@ +@@ -3342,8 +3483,10 @@ + { char hbuf[LONGEST_HUMAN_READABLE + 1]; - uintmax_t size = unsigned_file_size (f->stat.st_size); - sprintf (p, "%*s ", file_size_width, -- human_readable (size, hbuf, human_output_opts, -- 1, file_output_block_size)); -+ f->stat_failed -+ ? "?" -+ : human_readable (size, hbuf, human_output_opts, -+ 1, file_output_block_size)); - } - - p += file_size_width + 1; - -- if ((when_local = localtime (&when))) -+ if (!f->stat_failed && (when_local = localtime (&when))) + char const *size = +- human_readable (unsigned_file_size (f->stat.st_size), +- hbuf, human_output_opts, 1, file_output_block_size); ++ f->stat_failed ++ ? "?" ++ : human_readable (unsigned_file_size (f->stat.st_size), ++ hbuf, human_output_opts, 1, file_output_block_size); + int pad; + for (pad = file_size_width - mbswidth (size, 0); 0 < pad; pad--) + *p++ = ' '; +@@ -3356,7 +3499,7 @@ + s = 0; + *p = '\1'; + +- if (when_local) ++ if (!f->stat_failed && when_local) { time_t six_months_ago; - int recent; -@@ -3214,15 +3356,17 @@ + bool recent; +@@ -3403,15 +3546,17 @@ print it as a huge integer number of seconds. */ char hbuf[INT_BUFSIZE_BOUND (intmax_t)]; sprintf (p, "%*s ", long_time_expected_width (), @@ -1134,7 +1108,7 @@ unchanged: if (f->filetype == symbolic_link) { -@@ -3230,7 +3374,7 @@ +@@ -3419,7 +3564,7 @@ { DIRED_FPUTS_LITERAL (" -> ", stdout); print_name_with_quoting (f->linkname, f->linkmode, f->linkok - 1, @@ -1143,7 +1117,7 @@ unchanged: if (indicator_style != none) print_type_indicator (f->linkmode); } -@@ -3412,10 +3556,10 @@ +@@ -3601,10 +3746,10 @@ static void print_name_with_quoting (const char *p, mode_t mode, int linkok, @@ -1156,7 +1130,7 @@ unchanged: if (stack) PUSH_CURRENT_DIRED_POS (stack); -@@ -3460,7 +3604,8 @@ +@@ -3652,7 +3797,8 @@ human_readable (ST_NBLOCKS (f->stat), buf, human_output_opts, ST_NBLOCKSIZE, output_block_size)); @@ -1166,7 +1140,7 @@ unchanged: if (indicator_style != none) print_type_indicator (f->stat.st_mode); -@@ -3499,7 +3644,8 @@ +@@ -3693,7 +3839,8 @@ } static void @@ -1176,16 +1150,16 @@ unchanged: { int type = C_FILE; struct color_ext_type *ext; /* Color extension */ -@@ -3536,6 +3682,8 @@ +@@ -3732,6 +3879,8 @@ type = C_CHR; else if (S_ISDOOR (mode)) type = C_DOOR; + else if (stat_failed) + type = C_ORPHAN; - if ((type == C_FILE) && ((mode & S_ISUID) != 0)) - type = C_UID; -@@ -4037,6 +4185,16 @@ + if (type == C_FILE) + { +@@ -4221,6 +4370,16 @@ -X sort alphabetically by entry extension\n\ -1 list one file per line\n\ "), stdout); @@ -1202,7 +1176,7 @@ unchanged: fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); fputs (_("\n\ -@@ -4055,3 +4213,83 @@ +@@ -4244,3 +4403,83 @@ } exit (status); } @@ -1286,8 +1260,8 @@ unchanged: + } +} +#endif ---- /dev/null 2004-12-29 02:13:24.827638832 -0500 -+++ coreutils-5.2.1/src/chcon.c 2004-12-29 12:24:03.430857317 -0500 +--- /dev/null 2005-10-10 09:36:06.437701000 +0100 ++++ coreutils-5.92/src/chcon.c 2005-10-26 17:42:29.000000000 +0100 @@ -0,0 +1,421 @@ +/* chcontext -- change security context of a pathname */ + @@ -1710,9 +1684,9 @@ unchanged: + freecon(ref_context); + exit (errors); +} ---- coreutils-5.2.1/src/id.c.selinux 2004-12-29 12:24:03.287873419 -0500 -+++ coreutils-5.2.1/src/id.c 2004-12-29 12:24:03.432857091 -0500 -@@ -45,6 +45,20 @@ +--- coreutils-5.92/src/id.c.selinux 2005-10-26 17:42:29.000000000 +0100 ++++ coreutils-5.92/src/id.c 2005-10-26 17:42:29.000000000 +0100 +@@ -37,6 +37,20 @@ int getugroups (); @@ -1733,9 +1707,9 @@ unchanged: static void print_user (uid_t uid); static void print_group (gid_t gid); static void print_group_list (const char *username); -@@ -63,8 +77,14 @@ - /* Nonzero if errors have been encountered. */ - static int problems = 0; +@@ -55,8 +69,14 @@ + /* True unless errors have been encountered. */ + static bool ok = true; +/* The SELinux context */ +/* Set `context' to a known invalid value so print_full_info() will * @@ -1748,7 +1722,7 @@ unchanged: {"group", no_argument, NULL, 'g'}, {"groups", no_argument, NULL, 'G'}, {"name", no_argument, NULL, 'n'}, -@@ -88,6 +108,7 @@ +@@ -80,6 +100,7 @@ Print information for USERNAME, or the current user.\n\ \n\ -a ignore, for compatibility with other versions\n\ @@ -1756,15 +1730,15 @@ unchanged: -g, --group print only the effective group ID\n\ -G, --groups print all group IDs\n\ -n, --name print a name instead of a number, for -ugG\n\ -@@ -109,6 +130,7 @@ +@@ -101,6 +122,7 @@ main (int argc, char **argv) { int optc; + int selinux_enabled=(is_selinux_enabled()>0); - /* If nonzero, output the list of all group IDs. -G */ - int just_group_list = 0; -@@ -127,7 +149,7 @@ + /* If true, output the list of all group IDs. -G */ + bool just_group_list = false; +@@ -119,13 +141,24 @@ atexit (close_stdout); @@ -1773,7 +1747,6 @@ unchanged: { switch (optc) { -@@ -136,6 +158,17 @@ case 'a': /* Ignore -a, for compatibility with SVR4. */ break; @@ -1789,9 +1762,9 @@ unchanged: + break; +#endif case 'g': - just_group = 1; + just_group = true; break; -@@ -158,8 +191,28 @@ +@@ -148,8 +181,28 @@ } } @@ -1820,9 +1793,9 @@ unchanged: + if (just_user + just_group + just_group_list + just_context > 1) + error (EXIT_FAILURE, 0, _("cannot print \"only\" of more than one choice")); - if (just_user + just_group + just_group_list == 0 && (use_real || use_name)) + if (just_user + just_group + just_group_list == 0 && (use_real | use_name)) error (EXIT_FAILURE, 0, -@@ -190,6 +243,10 @@ +@@ -183,6 +236,10 @@ print_group (use_real ? rgid : egid); else if (just_group_list) print_group_list (argv[optind]); @@ -1833,7 +1806,7 @@ unchanged: else print_full_info (argv[optind]); putchar ('\n'); -@@ -419,4 +476,9 @@ +@@ -407,4 +464,9 @@ free (groups); } #endif /* HAVE_GETGROUPS */ @@ -1843,9 +1816,9 @@ unchanged: + } +#endif } ---- coreutils-5.2.1/src/install.c.selinux 2004-12-29 12:24:02.850922625 -0500 -+++ coreutils-5.2.1/src/install.c 2004-12-29 12:24:47.138935019 -0500 -@@ -47,6 +47,43 @@ +--- coreutils-5.92/src/install.c.selinux 2005-10-26 17:42:28.000000000 +0100 ++++ coreutils-5.92/src/install.c 2005-10-26 17:42:29.000000000 +0100 +@@ -48,6 +48,43 @@ # include #endif @@ -1886,10 +1859,10 @@ unchanged: +} +#endif + - struct passwd *getpwnam (); - struct group *getgrnam (); - -@@ -123,11 +160,17 @@ + #if ! HAVE_ENDGRENT + # define endgrent() ((void) 0) + #endif +@@ -109,12 +146,18 @@ static struct option const long_options[] = { {"backup", optional_argument, NULL, 'b'}, @@ -1899,6 +1872,7 @@ unchanged: {"directory", no_argument, NULL, 'd'}, {"group", required_argument, NULL, 'g'}, {"mode", required_argument, NULL, 'm'}, + {"no-target-directory", no_argument, NULL, 'T'}, {"owner", required_argument, NULL, 'o'}, {"preserve-timestamps", no_argument, NULL, 'p'}, +#ifdef WITH_SELINUX @@ -1906,19 +1880,19 @@ unchanged: +#endif {"strip", no_argument, NULL, 's'}, {"suffix", required_argument, NULL, 'S'}, - {"version-control", required_argument, NULL, 'V'}, /* Deprecated. FIXME. */ -@@ -244,6 +287,9 @@ + {"target-directory", required_argument, NULL, 't'}, +@@ -154,6 +197,9 @@ + x->stdin_tty = false; - x->update = 0; - x->verbose = 0; + x->update = false; +#ifdef WITH_SELINUX + x->preserve_security_context = 0; +#endif + x->verbose = false; x->dest_info = NULL; x->src_info = NULL; - } -@@ -261,6 +307,11 @@ - struct cp_options x; +@@ -195,6 +241,11 @@ + bool no_target_directory = false; int n_files; char **file; +#ifdef WITH_SELINUX @@ -1929,21 +1903,21 @@ unchanged: initialize_main (&argc, &argv); program_name = argv[0]; -@@ -282,7 +333,11 @@ +@@ -216,7 +267,11 @@ we'll actually use backup_suffix_string. */ backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); +#ifdef WITH_SELINUX -+ while ((optc = getopt_long (argc, argv, "bcsDdg:m:o:pPvV:S:Z:", long_options, ++ while ((optc = getopt_long (argc, argv, "bcsDdg:m:o:pPt:TvS:Z:", long_options, +#else - while ((optc = getopt_long (argc, argv, "bcsDdg:m:o:pvV:S:", long_options, + while ((optc = getopt_long (argc, argv, "bcsDdg:m:o:pt:TvS:", long_options, +#endif NULL)) != -1) { switch (optc) -@@ -335,6 +390,41 @@ - make_backups = 1; - backup_suffix_string = optarg; +@@ -278,6 +333,41 @@ + case 'T': + no_target_directory = true; break; +#ifdef WITH_SELINUX + case 'P': @@ -1983,19 +1957,19 @@ unchanged: case_GETOPT_HELP_CHAR; case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); default: -@@ -564,6 +654,10 @@ - err = 1; +@@ -524,6 +614,10 @@ + ok = false; } +#ifdef WITH_SELINUX + if (use_default_selinux_context) -+ setdefaultfilecon(path); ++ setdefaultfilecon(name); +#endif - return err; + return ok; } -@@ -716,6 +810,11 @@ - -S, --suffix=SUFFIX override the usual backup suffix\n\ +@@ -668,6 +762,11 @@ + -T, --no-target-directory treat DEST as a normal file\n\ -v, --verbose print the name of each directory as it is created\n\ "), stdout); + fputs (_("\ @@ -2006,21 +1980,21 @@ unchanged: fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); fputs (_("\ ---- coreutils-5.2.1/src/copy.h.selinux 2004-12-29 12:24:02.853922288 -0500 -+++ coreutils-5.2.1/src/copy.h 2004-12-29 12:24:03.435856754 -0500 -@@ -105,6 +105,9 @@ - int preserve_ownership; - int preserve_mode; - int preserve_timestamps; +--- coreutils-5.92/src/copy.h.selinux 2005-10-26 17:42:28.000000000 +0100 ++++ coreutils-5.92/src/copy.h 2005-10-26 17:42:29.000000000 +0100 +@@ -127,6 +127,9 @@ + bool preserve_ownership; + bool preserve_mode; + bool preserve_timestamps; +#ifdef WITH_SELINUX -+ int preserve_security_context; ++ bool preserve_security_context; +#endif /* Enabled for mv, and for cp by the --preserve=links option. - If nonzero, attempt to preserve in the destination files any ---- coreutils-5.2.1/src/Makefile.am.selinux 2004-12-29 12:24:03.264876008 -0500 -+++ coreutils-5.2.1/src/Makefile.am 2004-12-29 12:24:03.436856641 -0500 -@@ -3,13 +3,13 @@ + If true, attempt to preserve in the destination files any +--- coreutils-5.92/src/Makefile.am.selinux 2005-10-26 17:42:29.000000000 +0100 ++++ coreutils-5.92/src/Makefile.am 2005-10-26 17:42:29.000000000 +0100 +@@ -20,13 +20,13 @@ EXTRA_PROGRAMS = chroot df hostid nice pinky stty su runuser uname uptime users who bin_SCRIPTS = groups @@ -2036,23 +2010,31 @@ unchanged: test true tty whoami yes \ $(OPTIONAL_BIN_PROGS) $(DF_PROG) -@@ -32,13 +32,20 @@ - # replacement functions defined in libfetish.a. - LDADD = ../lib/libfetish.a $(LIBINTL) ../lib/libfetish.a - +@@ -50,9 +50,9 @@ + LDADD = ../lib/libcoreutils.a $(LIBINTL) ../lib/libcoreutils.a + + # for eaccess in lib/euidaccess.c. +-cp_LDADD = $(LDADD) $(LIB_EACCESS) @LIBACL@ +-ginstall_LDADD = $(LDADD) $(LIB_EACCESS) @LIBACL@ +-mv_LDADD = $(LDADD) $(LIB_EACCESS) @LIBACL@ ++cp_LDADD = $(LDADD) $(LIB_EACCESS) @LIBACL@ @LIB_SELINUX@ ++ginstall_LDADD = $(LDADD) $(LIB_EACCESS) @LIBACL@ @LIB_SELINUX@ ++mv_LDADD = $(LDADD) $(LIB_EACCESS) @LIBACL@ @LIB_SELINUX@ + pathchk_LDADD = $(LDADD) $(LIB_EACCESS) + rm_LDADD = $(LDADD) $(LIB_EACCESS) + test_LDADD = $(LDADD) $(LIB_EACCESS) +@@ -61,11 +61,18 @@ + + # for clock_gettime and fdatasync + dd_LDADD = $(LDADD) $(LIB_GETHRXTIME) $(LIB_FDATASYNC) -dir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBACL@ -ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBACL@ +dir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBACL@ @LIB_SELINUX@ +ls_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBACL@ @LIB_SELINUX@ - shred_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) + pr_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) + shred_LDADD = $(LDADD) $(LIB_GETHRXTIME) $(LIB_FDATASYNC) -vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBACL@ --cp_LDADD = $(LDADD) @LIBACL@ --ginstall_LDADD = $(LDADD) @LIBACL@ --mv_LDADD = $(LDADD) @LIBACL@ +vdir_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME) @LIBACL@ @LIB_SELINUX@ -+cp_LDADD = $(LDADD) @LIBACL@ @LIB_SELINUX@ -+ginstall_LDADD = $(LDADD) @LIBACL@ @LIB_SELINUX@ -+mv_LDADD = $(LDADD) @LIBACL@ @LIB_SELINUX@ +chcon_LDADD = $(LDADD) @LIB_SELINUX@ +id_LDADD = $(LDADD) @LIB_SELINUX@ +mkdir_LDADD = $(LDADD) @LIB_SELINUX@ @@ -2063,30 +2045,30 @@ unchanged: ## If necessary, add -lm to resolve use of pow in lib/strtod.c. sort_LDADD = $(LDADD) $(POW_LIB) ---- coreutils-5.2.1/src/copy.c.selinux 2004-12-29 12:24:03.382862721 -0500 -+++ coreutils-5.2.1/src/copy.c 2004-12-29 12:24:03.439856303 -0500 -@@ -42,6 +42,11 @@ - #include "utimens.h" +--- coreutils-5.92/src/copy.c.selinux 2005-10-26 17:42:28.000000000 +0100 ++++ coreutils-5.92/src/copy.c 2005-10-26 17:42:29.000000000 +0100 +@@ -51,6 +51,11 @@ #include "xreadlink.h" + #include "yesno.h" +#ifdef WITH_SELINUX +#include /* for is_selinux_enabled() */ +extern int selinux_enabled; +#endif + - #define DO_CHOWN(Chown, File, New_uid, New_gid) \ - (Chown (File, New_uid, New_gid) \ - /* If non-root uses -p, it's ok if we can't preserve ownership. \ -@@ -1289,6 +1294,32 @@ + #ifndef HAVE_FCHMOD + # define HAVE_FCHMOD false + #endif +@@ -1384,6 +1389,32 @@ In such cases, set this variable to zero. */ - preserve_metadata = 1; + preserve_metadata = true; +#ifdef WITH_SELINUX + if (x->preserve_security_context && selinux_enabled) + { + security_context_t con; + -+ if (lgetfilecon (src_path, &con) >= 0) ++ if (lgetfilecon (src_name, &con) >= 0) + { + if (setfscreatecon(con) < 0) + { @@ -2100,7 +2082,7 @@ unchanged: + } + else { + if (( errno != ENOTSUP ) && ( errno != ENODATA )) { -+ error (0, errno, _("cannot lgetfilecon %s"), quote (src_path)); ++ error (0, errno, _("cannot lgetfilecon %s"), quote (src_name)); + return 1; + } + } @@ -2110,22 +2092,22 @@ unchanged: if (S_ISDIR (src_mode)) { struct dir_list *dir; -@@ -1358,8 +1389,13 @@ - } +@@ -1454,7 +1485,13 @@ /* Are we crossing a file system boundary? */ -- if (x->one_file_system && device != 0 && device != src_sb.st_dev) -+ if (x->one_file_system && device != 0 && device != src_sb.st_dev) { + if (x->one_file_system && device != 0 && device != src_sb.st_dev) +- return true; ++ { +#ifdef WITH_SELINUX -+ if (x->preserve_security_context && selinux_enabled) -+ setfscreatecon(NULL); ++ if (x->preserve_security_context && selinux_enabled) ++ setfscreatecon(NULL); +#endif - return 0; -+ } ++ return true; ++ } /* Copy the contents of the directory. */ -@@ -1492,6 +1528,11 @@ +@@ -1590,6 +1627,11 @@ } } @@ -2135,18 +2117,9 @@ unchanged: +#endif + /* There's no need to preserve timestamps or permissions. */ - preserve_metadata = 0; - -@@ -1524,7 +1565,7 @@ - if (command_line_arg) - record_file (x->dest_info, dst_path, NULL); - -- if ( ! preserve_metadata) -+ if ( ! preserve_metadata) - return 0; + preserve_metadata = false; - /* POSIX says that `cp -p' must restore the following: -@@ -1630,6 +1671,11 @@ +@@ -1728,6 +1770,11 @@ un_backup: @@ -2158,8 +2131,8 @@ unchanged: /* We have failed to create the destination file. If we've just added a dev/ino entry via the remember_copied call above (i.e., unless we've just failed to create a hard link), ---- coreutils-5.2.1/src/mknod.c.selinux 2004-01-21 17:27:02.000000000 -0500 -+++ coreutils-5.2.1/src/mknod.c 2004-12-29 12:24:03.440856191 -0500 +--- coreutils-5.92/src/mknod.c.selinux 2005-05-14 08:58:37.000000000 +0100 ++++ coreutils-5.92/src/mknod.c 2005-10-26 17:42:29.000000000 +0100 @@ -36,8 +36,15 @@ /* The name this program was run with. */ char *program_name; @@ -2188,7 +2161,7 @@ unchanged: fputs (_("\ Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); -@@ -103,7 +115,11 @@ +@@ -103,13 +115,31 @@ specified_mode = NULL; @@ -2200,7 +2173,6 @@ unchanged: { switch (optc) { -@@ -112,6 +128,20 @@ case 'm': specified_mode = optarg; break; @@ -2221,9 +2193,9 @@ unchanged: case_GETOPT_HELP_CHAR; case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); default: ---- coreutils-5.2.1/src/cp.c.selinux 2004-12-29 12:24:02.852922400 -0500 -+++ coreutils-5.2.1/src/cp.c 2004-12-29 12:24:03.443855853 -0500 -@@ -49,6 +49,11 @@ +--- coreutils-5.92/src/cp.c.selinux 2005-10-26 17:42:28.000000000 +0100 ++++ coreutils-5.92/src/cp.c 2005-10-26 17:42:29.000000000 +0100 +@@ -51,6 +51,11 @@ #define AUTHORS "Torbjorn Granlund", "David MacKenzie", "Jim Meyering" @@ -2232,20 +2204,20 @@ unchanged: +int selinux_enabled=0; +#endif + - #ifndef _POSIX_VERSION - uid_t geteuid (); - #endif -@@ -143,6 +148,9 @@ + /* Used by do_copy, make_dir_parents_private, and re_protect + to keep a list of leading directories whose protections + need to be fixed after copying. */ +@@ -141,6 +146,9 @@ + {"target-directory", required_argument, NULL, 't'}, {"update", no_argument, NULL, 'u'}, {"verbose", no_argument, NULL, 'v'}, - {"version-control", required_argument, NULL, 'V'}, /* Deprecated. FIXME. */ +#ifdef WITH_SELINUX + {"context", required_argument, NULL, 'Z'}, +#endif {GETOPT_HELP_OPTION_DECL}, {GETOPT_VERSION_OPTION_DECL}, {NULL, 0, NULL, 0} -@@ -192,6 +200,9 @@ +@@ -194,6 +202,9 @@ additional attributes: links, all\n\ "), stdout); fputs (_("\ @@ -2253,8 +2225,8 @@ unchanged: +"), stdout); + fputs (_("\ --no-preserve=ATTR_LIST don't preserve the specified attributes\n\ - --parents append source path to DIRECTORY\n\ - -P same as `--no-dereference'\n\ + --parents use full source file name under DIRECTORY\n\ + "), stdout); @@ -219,6 +230,7 @@ destination file is missing\n\ -v, --verbose explain what is being done\n\ @@ -2263,29 +2235,18 @@ unchanged: "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); -@@ -748,8 +760,8 @@ - { - new_dest = (char *) dest; - } -- -- return copy (source, new_dest, new_dst, x, &unused, NULL); -+ ret=copy (source, new_dest, new_dst, x, &unused, NULL); -+ return ret; - } - - /* unreachable */ -@@ -773,6 +785,10 @@ - x->preserve_mode = 0; - x->preserve_timestamps = 0; +@@ -741,6 +753,10 @@ + x->preserve_mode = false; + x->preserve_timestamps = false; +#ifdef WITH_SELINUX -+ x->preserve_security_context = 0; ++ x->preserve_security_context = false; +#endif + - x->require_preserve = 0; - x->recursive = 0; + x->require_preserve = false; + x->recursive = false; x->sparse_mode = SPARSE_AUTO; -@@ -800,19 +816,20 @@ +@@ -768,18 +784,19 @@ PRESERVE_TIMESTAMPS, PRESERVE_OWNERSHIP, PRESERVE_LINK, @@ -2298,17 +2259,16 @@ unchanged: - PRESERVE_OWNERSHIP, PRESERVE_LINK, PRESERVE_ALL + PRESERVE_OWNERSHIP, PRESERVE_LINK, PRESERVE_CONTEXT, PRESERVE_ALL }; - /* Valid arguments to the `--preserve' option. */ static char const* const preserve_args[] = { "mode", "timestamps", -- "ownership", "links", "all", 0 -+ "ownership", "links", "context", "all", 0 +- "ownership", "links", "all", NULL ++ "ownership", "links", "context", "all", NULL }; + ARGMATCH_VERIFY (preserve_args, preserve_vals); - char *arg_writable = xstrdup (arg); -@@ -847,11 +864,16 @@ +@@ -815,11 +832,16 @@ x->preserve_links = on_off; break; @@ -2325,10 +2285,10 @@ unchanged: break; default: -@@ -875,6 +897,10 @@ - struct cp_options x; - int copy_contents = 0; +@@ -844,6 +866,10 @@ + bool copy_contents = false; char *target_directory = NULL; + bool no_target_directory = false; +#ifdef WITH_SELINUX + security_context_t scontext = NULL; + selinux_enabled= (is_selinux_enabled()>0); @@ -2336,21 +2296,21 @@ unchanged: initialize_main (&argc, &argv); program_name = argv[0]; -@@ -890,7 +916,11 @@ +@@ -859,7 +885,11 @@ we'll actually use backup_suffix_string. */ backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX"); +#ifdef WITH_SELINUX -+ while ((c = getopt_long (argc, argv, "abcdfHilLprsuvxPRS:V:Z:", long_opts, NULL)) ++ while ((c = getopt_long (argc, argv, "abcdfHilLprst:uvxPRS:TZ:", +#else - while ((c = getopt_long (argc, argv, "abdfHilLprsuvxPRS:V:", long_opts, NULL)) + while ((c = getopt_long (argc, argv, "abdfHilLprst:uvxPRS:T", +#endif + long_opts, NULL)) != -1) { - switch (c) -@@ -981,6 +1011,36 @@ - x.preserve_timestamps = 1; - x.require_preserve = 1; +@@ -950,6 +980,36 @@ + case 'R': + x.recursive = true; break; +#ifdef WITH_SELINUX + case 'c': @@ -2383,10 +2343,10 @@ unchanged: + break; +#endif - case PARENTS_OPTION: - flag_path = 1; ---- coreutils-5.2.1/src/mkfifo.c.selinux 2004-01-21 17:27:02.000000000 -0500 -+++ coreutils-5.2.1/src/mkfifo.c 2004-12-29 12:24:03.444855740 -0500 + case REPLY_OPTION: /* Deprecated */ + x.interactive = XARGMATCH ("--reply", optarg, +--- coreutils-5.92/src/mkfifo.c.selinux 2005-05-14 08:58:37.000000000 +0100 ++++ coreutils-5.92/src/mkfifo.c 2005-10-26 17:42:29.000000000 +0100 @@ -32,11 +32,18 @@ #define AUTHORS "David MacKenzie" @@ -2418,7 +2378,7 @@ unchanged: fputs (_("\ Mandatory arguments to long options are mandatory for short options too.\n\ "), stdout); -@@ -93,7 +105,11 @@ +@@ -92,13 +104,30 @@ #ifndef S_ISFIFO error (EXIT_FAILURE, 0, _("fifo files not supported")); #else @@ -2430,7 +2390,6 @@ unchanged: { switch (optc) { -@@ -102,6 +118,19 @@ case 'm': specified_mode = optarg; break; @@ -2450,24 +2409,8 @@ unchanged: case_GETOPT_HELP_CHAR; case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS); default: ---- coreutils-5.2.1/configure.ac.selinux 2004-12-29 12:24:02.947911703 -0500 -+++ coreutils-5.2.1/configure.ac 2004-12-29 12:24:03.446855515 -0500 -@@ -14,6 +14,13 @@ - LIB_PAM="-ldl -lpam -lpam_misc" - AC_SUBST(LIB_PAM)]) - -+dnl Give the chance to enable SELINUX -+AC_ARG_ENABLE(selinux, dnl -+[ --enable-selinux Enable use of the SELINUX libraries], -+[AC_DEFINE(WITH_SELINUX, 1, [Define if you want to use SELINUX]) -+LIB_SELINUX="-lselinux" -+AC_SUBST(LIB_SELINUX)]) -+ - gl_DEFAULT_POSIX2_VERSION - gl_USE_SYSTEM_EXTENSIONS - jm_PERL ---- coreutils-5.2.1/man/mkfifo.1.selinux 2004-03-02 17:52:28.000000000 -0500 -+++ coreutils-5.2.1/man/mkfifo.1 2004-12-29 12:24:03.446855515 -0500 +--- coreutils-5.92/man/mkfifo.1.selinux 2005-10-22 19:14:48.000000000 +0100 ++++ coreutils-5.92/man/mkfifo.1 2005-10-26 17:42:29.000000000 +0100 @@ -12,6 +12,9 @@ .PP Mandatory arguments to long options are mandatory for short options too. @@ -2476,11 +2419,11 @@ unchanged: +set security context (quoted string) +.TP \fB\-m\fR, \fB\-\-mode\fR=\fIMODE\fR - set permission mode (as in chmod), not a=rw - umask + set permission mode (as in chmod), not a=rw \- umask .TP ---- coreutils-5.2.1/man/ls.1.selinux 2004-03-02 17:52:28.000000000 -0500 -+++ coreutils-5.2.1/man/ls.1 2004-12-29 12:24:03.448855290 -0500 -@@ -195,6 +195,20 @@ +--- coreutils-5.92/man/ls.1.selinux 2005-10-22 19:14:47.000000000 +0100 ++++ coreutils-5.92/man/ls.1 2005-10-26 17:42:29.000000000 +0100 +@@ -201,6 +201,20 @@ .TP \fB\-1\fR list one file per line @@ -2501,9 +2444,9 @@ unchanged: .TP \fB\-\-help\fR display this help and exit ---- coreutils-5.2.1/man/dir.1.selinux 2004-03-02 17:51:06.000000000 -0500 -+++ coreutils-5.2.1/man/dir.1 2004-12-29 12:24:03.452854839 -0500 -@@ -195,6 +195,20 @@ +--- coreutils-5.92/man/dir.1.selinux 2005-10-22 19:14:46.000000000 +0100 ++++ coreutils-5.92/man/dir.1 2005-10-26 17:42:29.000000000 +0100 +@@ -201,6 +201,20 @@ .TP \fB\-1\fR list one file per line @@ -2524,8 +2467,8 @@ unchanged: .TP \fB\-\-help\fR display this help and exit ---- coreutils-5.2.1/man/mkdir.1.selinux 2004-03-02 17:52:28.000000000 -0500 -+++ coreutils-5.2.1/man/mkdir.1 2004-12-29 12:24:03.453854727 -0500 +--- coreutils-5.92/man/mkdir.1.selinux 2005-10-22 19:14:48.000000000 +0100 ++++ coreutils-5.92/man/mkdir.1 2005-10-26 17:42:29.000000000 +0100 @@ -12,6 +12,8 @@ .PP Mandatory arguments to long options are mandatory for short options too. @@ -2533,10 +2476,10 @@ unchanged: +\fB\-Z\fR, \fB\-\-context\fR=\fICONTEXT\fR (SELinux) set security context to CONTEXT +.TP \fB\-m\fR, \fB\-\-mode\fR=\fIMODE\fR - set permission mode (as in chmod), not rwxrwxrwx - umask + set permission mode (as in chmod), not rwxrwxrwx \- umask .TP ---- coreutils-5.2.1/man/runcon.1 2004-12-29 12:24:03.454854614 -0500 -+++ coreutils-5.2.1/man/runcon.1 2005-05-16 14:18:12.000000000 -0400 +--- /dev/null 2005-10-10 09:36:06.437701000 +0100 ++++ coreutils-5.92/man/runcon.1 2005-10-26 17:42:29.000000000 +0100 @@ -0,0 +1,43 @@ +.TH RUNCON "1" "February 2005" "runcon (coreutils) 5.0" "selinux" +.SH NAME @@ -2581,27 +2524,115 @@ unchanged: +.PP +Note that only carefully-chosen contexts are likely to successfully +run. ---- coreutils-5.2.1/man/Makefile.in.selinux 2004-03-11 03:58:00.000000000 -0500 -+++ coreutils-5.2.1/man/Makefile.in 2004-12-29 12:24:03.456854389 -0500 -@@ -185,6 +185,7 @@ - INTLLIBS = @INTLLIBS@ +--- coreutils-5.92/man/Makefile.in.selinux 2005-10-22 19:13:19.000000000 +0100 ++++ coreutils-5.92/man/Makefile.in 2005-10-26 17:44:55.000000000 +0100 +@@ -107,25 +107,25 @@ + $(top_srcdir)/m4/onceonly_2_57.m4 $(top_srcdir)/m4/openat.m4 \ + $(top_srcdir)/m4/pathmax.m4 $(top_srcdir)/m4/perl.m4 \ + $(top_srcdir)/m4/physmem.m4 $(top_srcdir)/m4/po.m4 \ +- $(top_srcdir)/m4/posixtm.m4 $(top_srcdir)/m4/posixver.m4 \ +- $(top_srcdir)/m4/prereq.m4 $(top_srcdir)/m4/progtest.m4 \ +- $(top_srcdir)/m4/putenv.m4 $(top_srcdir)/m4/quote.m4 \ +- $(top_srcdir)/m4/quotearg.m4 $(top_srcdir)/m4/readlink.m4 \ +- $(top_srcdir)/m4/readtokens.m4 $(top_srcdir)/m4/readutmp.m4 \ +- $(top_srcdir)/m4/regex.m4 $(top_srcdir)/m4/rename.m4 \ +- $(top_srcdir)/m4/restrict.m4 $(top_srcdir)/m4/rmdir-errno.m4 \ +- $(top_srcdir)/m4/rmdir.m4 $(top_srcdir)/m4/root-dev-ino.m4 \ +- $(top_srcdir)/m4/rpmatch.m4 $(top_srcdir)/m4/safe-read.m4 \ +- $(top_srcdir)/m4/safe-write.m4 $(top_srcdir)/m4/same.m4 \ +- $(top_srcdir)/m4/save-cwd.m4 $(top_srcdir)/m4/savedir.m4 \ +- $(top_srcdir)/m4/setenv.m4 $(top_srcdir)/m4/settime.m4 \ +- $(top_srcdir)/m4/sha1.m4 $(top_srcdir)/m4/sig2str.m4 \ +- $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/socklen.m4 \ +- $(top_srcdir)/m4/sockpfaf.m4 $(top_srcdir)/m4/ssize_t.m4 \ +- $(top_srcdir)/m4/st_dm_mode.m4 $(top_srcdir)/m4/stat-macros.m4 \ +- $(top_srcdir)/m4/stat-prog.m4 $(top_srcdir)/m4/stat-time.m4 \ +- $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stdint_h.m4 \ +- $(top_srcdir)/m4/stdio-safer.m4 \ ++ $(top_srcdir)/m4/posix_acl.m4 $(top_srcdir)/m4/posixtm.m4 \ ++ $(top_srcdir)/m4/posixver.m4 $(top_srcdir)/m4/prereq.m4 \ ++ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/putenv.m4 \ ++ $(top_srcdir)/m4/quote.m4 $(top_srcdir)/m4/quotearg.m4 \ ++ $(top_srcdir)/m4/readlink.m4 $(top_srcdir)/m4/readtokens.m4 \ ++ $(top_srcdir)/m4/readutmp.m4 $(top_srcdir)/m4/regex.m4 \ ++ $(top_srcdir)/m4/rename.m4 $(top_srcdir)/m4/restrict.m4 \ ++ $(top_srcdir)/m4/rmdir-errno.m4 $(top_srcdir)/m4/rmdir.m4 \ ++ $(top_srcdir)/m4/root-dev-ino.m4 $(top_srcdir)/m4/rpmatch.m4 \ ++ $(top_srcdir)/m4/safe-read.m4 $(top_srcdir)/m4/safe-write.m4 \ ++ $(top_srcdir)/m4/same.m4 $(top_srcdir)/m4/save-cwd.m4 \ ++ $(top_srcdir)/m4/savedir.m4 $(top_srcdir)/m4/setenv.m4 \ ++ $(top_srcdir)/m4/settime.m4 $(top_srcdir)/m4/sha1.m4 \ ++ $(top_srcdir)/m4/sig2str.m4 $(top_srcdir)/m4/signed.m4 \ ++ $(top_srcdir)/m4/socklen.m4 $(top_srcdir)/m4/sockpfaf.m4 \ ++ $(top_srcdir)/m4/ssize_t.m4 $(top_srcdir)/m4/st_dm_mode.m4 \ ++ $(top_srcdir)/m4/stat-macros.m4 $(top_srcdir)/m4/stat-prog.m4 \ ++ $(top_srcdir)/m4/stat-time.m4 $(top_srcdir)/m4/stdbool.m4 \ ++ $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/stdio-safer.m4 \ + $(top_srcdir)/m4/stdlib-safer.m4 $(top_srcdir)/m4/stpcpy.m4 \ + $(top_srcdir)/m4/strcase.m4 $(top_srcdir)/m4/strcspn.m4 \ + $(top_srcdir)/m4/strdup.m4 $(top_srcdir)/m4/strftime.m4 \ +@@ -199,7 +199,6 @@ + GLIBC21 = @GLIBC21@ + GMSGFMT = @GMSGFMT@ + GNU_PACKAGE = @GNU_PACKAGE@ +-GREP = @GREP@ + HAVE__BOOL = @HAVE__BOOL@ + HELP2MAN = @HELP2MAN@ + INSTALL_DATA = @INSTALL_DATA@ +@@ -210,6 +209,7 @@ + INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ KMEM_GROUP = @KMEM_GROUP@ LDFLAGS = @LDFLAGS@ +LIBACL = @LIBACL@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ -@@ -192,6 +193,8 @@ - LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ - LIB_CRYPT = @LIB_CRYPT@ +@@ -220,6 +220,8 @@ + LIB_FDATASYNC = @LIB_FDATASYNC@ + LIB_GETHRXTIME = @LIB_GETHRXTIME@ LIB_NANOSLEEP = @LIB_NANOSLEEP@ +LIB_PAM = @LIB_PAM@ +LIB_SELINUX = @LIB_SELINUX@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ -@@ -273,7 +276,7 @@ - rm.1 rmdir.1 seq.1 sha1sum.1 shred.1 sleep.1 sort.1 split.1 stat.1 stty.1 \ +@@ -271,30 +273,23 @@ + build_os = @build_os@ + build_vendor = @build_vendor@ + datadir = @datadir@ +-datarootdir = @datarootdir@ +-docdir = @docdir@ +-dvidir = @dvidir@ + exec_prefix = @exec_prefix@ + host = @host@ + host_alias = @host_alias@ + host_cpu = @host_cpu@ + host_os = @host_os@ + host_vendor = @host_vendor@ +-htmldir = @htmldir@ + includedir = @includedir@ + infodir = @infodir@ + install_sh = @install_sh@ + libdir = @libdir@ + libexecdir = @libexecdir@ +-localedir = @localedir@ + localstatedir = @localstatedir@ + mandir = @mandir@ + mkdir_p = @mkdir_p@ + oldincludedir = @oldincludedir@ +-pdfdir = @pdfdir@ + prefix = @prefix@ + program_transform_name = @program_transform_name@ +-psdir = @psdir@ + sbindir = @sbindir@ + sharedstatedir = @sharedstatedir@ + sysconfdir = @sysconfdir@ +@@ -307,10 +302,10 @@ + link.1 ln.1 logname.1 \ + ls.1 md5sum.1 mkdir.1 mkfifo.1 mknod.1 mv.1 nice.1 nl.1 nohup.1 od.1 \ + paste.1 pathchk.1 pinky.1 pr.1 printenv.1 printf.1 ptx.1 pwd.1 readlink.1 \ +- rm.1 rmdir.1 seq.1 sha1sum.1 shred.1 sleep.1 sort.1 split.1 stat.1 stty.1 \ ++ rm.1 rmdir.1 runuser.1 seq.1 sha1sum.1 shred.1 sleep.1 sort.1 split.1 stat.1 stty.1 \ su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \ tty.1 uname.1 unexpand.1 uniq.1 unlink.1 uptime.1 users.1 vdir.1 wc.1 \ - who.1 whoami.1 yes.1 @@ -2609,7 +2640,15 @@ unchanged: man_aux = $(dist_man_MANS:.1=.x) EXTRA_DIST = $(man_aux) help2man -@@ -595,6 +598,8 @@ +@@ -600,6 +595,7 @@ + readlink.1: $(common_dep) $(srcdir)/readlink.x ../src/readlink.c + rm.1: $(common_dep) $(srcdir)/rm.x ../src/rm.c + rmdir.1: $(common_dep) $(srcdir)/rmdir.x ../src/rmdir.c ++runuser.1: $(common_dep) $(srcdir)/runuser.x ../src/runuser.c + seq.1: $(common_dep) $(srcdir)/seq.x ../src/seq.c + sha1sum.1: $(common_dep) $(srcdir)/sha1sum.x ../src/md5sum.c + shred.1: $(common_dep) $(srcdir)/shred.x ../src/shred.c +@@ -631,6 +627,8 @@ who.1: $(common_dep) $(srcdir)/who.x ../src/who.c whoami.1: $(common_dep) $(srcdir)/whoami.x ../src/whoami.c yes.1: $(common_dep) $(srcdir)/yes.x ../src/yes.c @@ -2618,9 +2657,9 @@ unchanged: # Note the use of $t/$*, rather than just `$*' as in other packages. # That is necessary to avoid failures for programs that are also shell built-in ---- coreutils-5.2.1/man/install.1.selinux 2004-12-29 12:24:02.671942781 -0500 -+++ coreutils-5.2.1/man/install.1 2004-12-29 12:24:03.458854164 -0500 -@@ -60,6 +60,11 @@ +--- coreutils-5.92/man/install.1.selinux 2005-10-22 19:14:47.000000000 +0100 ++++ coreutils-5.92/man/install.1 2005-10-26 17:42:29.000000000 +0100 +@@ -65,6 +65,11 @@ .TP \fB\-v\fR, \fB\-\-verbose\fR print the name of each directory as it is created @@ -2632,8 +2671,8 @@ unchanged: .TP \fB\-\-help\fR display this help and exit ---- coreutils-5.2.1/man/stat.1.selinux 2004-03-02 17:52:31.000000000 -0500 -+++ coreutils-5.2.1/man/stat.1 2004-12-29 12:24:03.459854051 -0500 +--- coreutils-5.92/man/stat.1.selinux 2005-10-22 19:14:49.000000000 +0100 ++++ coreutils-5.92/man/stat.1 2005-10-26 17:42:29.000000000 +0100 @@ -22,6 +22,9 @@ \fB\-t\fR, \fB\-\-terse\fR print the information in terse form @@ -2644,9 +2683,9 @@ unchanged: \fB\-\-help\fR display this help and exit .TP -@@ -42,6 +45,9 @@ - %b - Number of blocks allocated (see %B) +@@ -45,6 +48,9 @@ + %d + Device number in decimal .TP +%C +SELinux security context @@ -2654,8 +2693,8 @@ unchanged: %D Device number in hex .TP ---- /dev/null 2004-12-29 02:13:24.827638832 -0500 -+++ coreutils-5.2.1/man/chcon.1 2004-12-29 12:24:03.461853826 -0500 +--- /dev/null 2005-10-10 09:36:06.437701000 +0100 ++++ coreutils-5.92/man/chcon.1 2005-10-26 17:42:29.000000000 +0100 @@ -0,0 +1,64 @@ +.TH CHCON 1 "July 2003" "chcon (coreutils) 5.0" "User Commands" +.SH NAME @@ -2721,8 +2760,8 @@ unchanged: +.B info chcon +.PP +should give you access to the complete manual. ---- coreutils-5.2.1/man/mknod.1.selinux 2004-03-02 17:52:28.000000000 -0500 -+++ coreutils-5.2.1/man/mknod.1 2004-12-29 12:24:03.463853601 -0500 +--- coreutils-5.92/man/mknod.1.selinux 2005-10-22 19:14:48.000000000 +0100 ++++ coreutils-5.92/man/mknod.1 2005-10-26 17:42:29.000000000 +0100 @@ -12,6 +12,9 @@ .PP Mandatory arguments to long options are mandatory for short options too. @@ -2731,17 +2770,17 @@ unchanged: +set security context (quoted string) +.TP \fB\-m\fR, \fB\-\-mode\fR=\fIMODE\fR - set permission mode (as in chmod), not a=rw - umask + set permission mode (as in chmod), not a=rw \- umask .TP ---- /dev/null 2004-12-29 02:13:24.827638832 -0500 -+++ coreutils-5.2.1/man/chcon.x 2004-12-29 12:24:03.464853488 -0500 +--- /dev/null 2005-10-10 09:36:06.437701000 +0100 ++++ coreutils-5.92/man/chcon.x 2005-10-26 17:42:29.000000000 +0100 @@ -0,0 +1,4 @@ +[NAME] +chcon \- change file security context +[DESCRIPTION] +.\" Add any additional description here ---- coreutils-5.2.1/man/Makefile.am.selinux 2004-12-29 12:24:03.258876684 -0500 -+++ coreutils-5.2.1/man/Makefile.am 2004-12-29 12:24:03.466853263 -0500 +--- coreutils-5.92/man/Makefile.am.selinux 2005-10-26 17:42:29.000000000 +0100 ++++ coreutils-5.92/man/Makefile.am 2005-10-26 17:42:29.000000000 +0100 @@ -10,7 +10,7 @@ rm.1 rmdir.1 runuser.1 seq.1 sha1sum.1 shred.1 sleep.1 sort.1 split.1 stat.1 stty.1 \ su.1 sum.1 sync.1 tac.1 tail.1 tee.1 test.1 touch.1 tr.1 true.1 tsort.1 \ @@ -2760,8 +2799,8 @@ unchanged: SUFFIXES = .x .1 ---- coreutils-5.2.1/man/runcon.x 2004-12-29 12:24:03.467853150 -0500 -+++ coreutils-5.2.1/man/runcon.x 2005-05-16 14:18:12.000000000 -0400 +--- /dev/null 2005-10-10 09:36:06.437701000 +0100 ++++ coreutils-5.92/man/runcon.x 2005-10-26 17:42:29.000000000 +0100 @@ -0,0 +1,14 @@ +[NAME] +runcon \- run command with specified security context @@ -2777,8 +2816,8 @@ unchanged: +.PP +Note that only carefully-chosen contexts are likely to successfully +run. ---- coreutils-5.2.1/man/id.1.selinux 2004-03-02 17:52:27.000000000 -0500 -+++ coreutils-5.2.1/man/id.1 2004-12-29 12:24:03.469852925 -0500 +--- coreutils-5.92/man/id.1.selinux 2005-10-22 19:14:47.000000000 +0100 ++++ coreutils-5.92/man/id.1 2005-10-26 17:42:29.000000000 +0100 @@ -13,6 +13,9 @@ \fB\-a\fR ignore, for compatibility with other versions @@ -2789,8 +2828,8 @@ unchanged: \fB\-g\fR, \fB\-\-group\fR print only the effective group ID .TP ---- coreutils-5.2.1/man/cp.1.selinux 2004-03-02 17:51:05.000000000 -0500 -+++ coreutils-5.2.1/man/cp.1 2004-12-29 12:24:03.470852813 -0500 +--- coreutils-5.92/man/cp.1.selinux 2005-10-22 19:14:46.000000000 +0100 ++++ coreutils-5.92/man/cp.1 2005-10-26 17:42:29.000000000 +0100 @@ -57,7 +57,7 @@ .TP \fB\-\-preserve\fR[=\fIATTR_LIST\fR] @@ -2800,7 +2839,7 @@ unchanged: additional attributes: links, all .TP \fB\-\-no\-preserve\fR=\fIATTR_LIST\fR -@@ -109,6 +109,9 @@ +@@ -105,6 +105,9 @@ \fB\-\-help\fR display this help and exit .TP @@ -2810,9 +2849,9 @@ unchanged: \fB\-\-version\fR output version information and exit .PP ---- coreutils-5.2.1/man/vdir.1.selinux 2004-03-02 17:52:33.000000000 -0500 -+++ coreutils-5.2.1/man/vdir.1 2004-12-29 12:24:03.471852700 -0500 -@@ -195,6 +195,20 @@ +--- coreutils-5.92/man/vdir.1.selinux 2005-10-22 19:14:51.000000000 +0100 ++++ coreutils-5.92/man/vdir.1 2005-10-26 17:42:29.000000000 +0100 +@@ -201,6 +201,20 @@ .TP \fB\-1\fR list one file per line @@ -2833,9 +2872,9 @@ unchanged: .TP \fB\-\-help\fR display this help and exit ---- coreutils-5.2.1/tests/help-version.selinux 2004-12-29 12:24:03.261876346 -0500 -+++ coreutils-5.2.1/tests/help-version 2004-12-29 12:24:03.473852475 -0500 -@@ -42,6 +42,8 @@ +--- coreutils-5.92/tests/help-version.selinux 2005-10-26 17:42:29.000000000 +0100 ++++ coreutils-5.92/tests/help-version 2005-10-26 17:42:29.000000000 +0100 +@@ -45,6 +45,8 @@ # Skip `test'; it doesn't accept --help or --version. test $i = test && continue; @@ -2844,7 +2883,7 @@ unchanged: # false fails even when invoked with --help or --version. if test $i = false; then -@@ -155,7 +157,7 @@ +@@ -161,7 +163,7 @@ for i in $all_programs; do # Skip these. @@ -2853,9 +2892,95 @@ unchanged: rm -rf $tmp_in $tmp_in2 $tmp_dir $tmp_out echo > $tmp_in ---- coreutils-5.2.1/config.hin.selinux 2004-12-29 12:24:02.949911478 -0500 -+++ coreutils-5.2.1/config.hin 2004-12-29 12:24:03.475852250 -0500 -@@ -1374,6 +1374,9 @@ +--- coreutils-5.92/README.selinux 2005-10-26 17:42:29.000000000 +0100 ++++ coreutils-5.92/README 2005-10-26 17:42:29.000000000 +0100 +@@ -7,11 +7,11 @@ + + The programs that can be built with this package are: + +- [ basename cat chgrp chmod chown chroot cksum comm cp csplit cut date dd ++ [ basename cat chcon chgrp chmod chown chroot cksum comm cp csplit cut date dd + df dir dircolors dirname du echo env expand expr factor false fmt fold + ginstall groups head hostid hostname id join kill link ln logname ls + md5sum mkdir mkfifo mknod mv nice nl nohup od paste pathchk pinky pr +- printenv printf ptx pwd readlink rm rmdir runuser seq sha1sum shred sleep sort ++ printenv printf ptx pwd readlink rm rmdir runcon runuser seq sha1sum shred sleep sort + split stat stty su sum sync tac tail tee test touch tr true tsort tty + uname unexpand uniq unlink uptime users vdir wc who whoami yes + +--- coreutils-5.92/configure.ac.selinux 2005-10-26 17:42:28.000000000 +0100 ++++ coreutils-5.92/configure.ac 2005-10-26 17:42:29.000000000 +0100 +@@ -35,6 +35,13 @@ + LIB_PAM="-ldl -lpam -lpam_misc" + AC_SUBST(LIB_PAM)]) + ++dnl Give the chance to enable SELINUX ++AC_ARG_ENABLE(selinux, dnl ++[ --enable-selinux Enable use of the SELINUX libraries], ++[AC_DEFINE(WITH_SELINUX, 1, [Define if you want to use SELINUX]) ++LIB_SELINUX="-lselinux" ++AC_SUBST(LIB_SELINUX)]) ++ + gl_DEFAULT_POSIX2_VERSION + gl_USE_SYSTEM_EXTENSIONS + gl_PERL +--- coreutils-5.92/config.hin.selinux 2005-10-26 17:42:29.000000000 +0100 ++++ coreutils-5.92/config.hin 2005-10-26 17:48:09.000000000 +0100 +@@ -411,10 +411,6 @@ + don't. */ + #undef HAVE_DECL_TTYNAME + +-/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. +- */ +-#undef HAVE_DECL_TZNAME +- + /* Define to 1 if you have the declaration of wcwidth(), and to 0 otherwise. + */ + #undef HAVE_DECL_WCWIDTH +@@ -519,6 +515,9 @@ + /* Define to 1 if you have the `getdelim' function. */ + #undef HAVE_GETDELIM + ++/* Define to 1 if you have the `getgrouplist' function. */ ++#undef HAVE_GETGROUPLIST ++ + /* Define to 1 if your system has a working `getgroups' function. */ + #undef HAVE_GETGROUPS + +@@ -613,9 +612,6 @@ + /* Define to 1 if you have the `lchown' function. */ + #undef HAVE_LCHOWN + +-/* Define to 1 if you have the `acl' library (-lacl). */ +-#undef HAVE_LIBACL +- + /* Define to 1 if you have the `dgc' library (-ldgc). */ + #undef HAVE_LIBDGC + +@@ -1518,17 +1514,17 @@ + /* Define to 1 if unlink (dir) cannot possibly succeed. */ + #undef UNLINK_CANNOT_UNLINK_DIR + +-/* Define to 1 if you want getc etc. to use unlocked I/O if available. +- Unlocked I/O can improve performance in unithreaded apps, but it is not +- safe for multithreaded apps. */ +-#undef USE_UNLOCKED_IO +- + /* Define if you want access control list support. */ + #undef USE_ACL + + /* Define if you want to use PAM */ + #undef USE_PAM + ++/* Define to 1 if you want getc etc. to use unlocked I/O if available. ++ Unlocked I/O can improve performance in unithreaded apps, but it is not ++ safe for multithreaded apps. */ ++#undef USE_UNLOCKED_IO ++ + /* Version number of package */ + #undef VERSION + +@@ -1538,6 +1534,9 @@ /* Define if sys/ptem.h is required for struct winsize. */ #undef WINSIZE_IN_PTEM @@ -2865,3 +2990,21 @@ unchanged: /* Define to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel and VAX). */ #undef WORDS_BIGENDIAN +@@ -1683,7 +1682,7 @@ + /* Define to rpl_nanosleep if the replacement function should be used. */ + #undef nanosleep + +-/* Define to `long int' if does not define. */ ++/* Define to `long' if does not define. */ + #undef off_t + + /* Define to `int' if does not define. */ +@@ -1750,7 +1749,7 @@ + /* Define to empty if the C compiler doesn't support this keyword. */ + #undef signed + +-/* Define to `unsigned int' if does not define. */ ++/* Define to `unsigned' if does not define. */ + #undef size_t + + /* Map `socklen_t' to `int' if it is missing. */ diff --git a/coreutils.spec b/coreutils.spec index 412fcf3..8dbc8db 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: The GNU core utilities: a set of tools commonly used in shell scripts Name: coreutils -Version: 5.2.1 -Release: 56 +Version: 5.92 +Release: 0.1 License: GPL Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -15,11 +15,14 @@ Source105: colorls.sh Source106: colorls.csh Source200: su.pamd +# From upstream +Patch1: coreutils-mkdir.patch +Patch2: coreutils-dircolors.patch +Patch3: coreutils-mkdir2.patch +Patch4: coreutils-tac.patch + # fileutils Patch107: fileutils-4.1.10-timestyle.patch -Patch108: fileutils-4.1.5-afs.patch -Patch116: fileutils-4.1-dircolors_c.patch -Patch153: fileutils-4.1.10-utmp.patch Patch182: coreutils-acl.patch # sh-utils @@ -30,30 +33,15 @@ Patch704: sh-utils-1.16-paths.patch # it here indefinitely. Patch706: coreutils-pam.patch Patch713: coreutils-4.5.3-langinfo.patch -Patch714: coreutils-4.5.3-printf-ll.patch Patch715: coreutils-4.5.3-sysinfo.patch # (sb) lin18nux/lsb compliance Patch800: coreutils-i18n.patch -Patch904: coreutils-5.0-allow_old_options.patch -Patch905: coreutils-jday.patch -Patch906: coreutils-fchown.patch Patch907: coreutils-5.2.1-runuser.patch Patch908: coreutils-getgrouplist.patch -Patch909: coreutils-zh_CN.patch -Patch910: coreutils-gcc4.patch -Patch911: coreutils-brokentest.patch Patch912: coreutils-overflow.patch -# From upstream -Patch920: coreutils-dateseconds.patch -Patch921: coreutils-chown.patch -Patch922: coreutils-rmaccess.patch -Patch923: coreutils-copy.patch -Patch924: coreutils-stale-utmp.patch -Patch925: coreutils-no-sign-extend.patch - #SELINUX Patch Patch950: coreutils-selinux.patch @@ -82,11 +70,14 @@ the old GNU fileutils, sh-utils, and textutils packages. %prep %setup -q +# From upstream +%patch1 -p0 -b .mkdir +%patch2 -p0 -b .dircolors +%patch3 -p0 -b .mkdir2 +%patch4 -p0 -b .tac + # fileutils %patch107 -p1 -b .timestyle -%patch108 -p1 -b .afs -%patch116 -p1 -%patch153 -p1 %patch182 -p1 -b .acl # sh-utils @@ -94,31 +85,16 @@ the old GNU fileutils, sh-utils, and textutils packages. %patch704 -p1 -b .paths %patch706 -p1 -b .pam %patch713 -p1 -b .langinfo -%patch714 -p1 -b .printf-ll %patch715 -p1 -b .sysinfo # li18nux/lsb %patch800 -p1 -b .i18n # Coreutils -%patch904 -p1 -b .allow_old_options -%patch905 -p1 -b .jday -%patch906 -p1 -b .fchown %patch907 -p1 -b .runuser %patch908 -p1 -b .getgrouplist -%patch909 -p1 -b .zh_CN -%patch910 -p1 -b .gcc4 -%patch911 -p1 -b .brokentest %patch912 -p1 -b .overflow -# From upstream -%patch920 -p1 -b .dateseconds -%patch921 -p1 -b .chown -%patch922 -p1 -b .rmaccess -%patch923 -p1 -b .copy -%patch924 -p1 -b .stale-utmp -%patch925 -p1 -b .no-sign-extend - #SELinux %patch950 -p1 -b .selinux @@ -284,6 +260,14 @@ fi /sbin/runuser %changelog +* Mon Oct 24 2005 Tim Waugh 5.92-0.1 +- 5.92. +- No longer need afs, dircolors, utmp, gcc4, brokentest, dateseconds, + chown, rmaccess, copy, stale-utmp, no-sign-extend, fchown patches. +- Updated acl, dateman, pam, langinfo, i18n, getgrouplist, selinux patches. +- Dropped printf-ll, allow_old_options, jday, zh_CN patches. +- NOTE: i18n patch not ported for sort(1) yet. + * Fri Sep 30 2005 Tomas Mraz - 5.2.1-56 - use include instead of pam_stack in pam config diff --git a/sh-utils-2.0.11-dateman.patch b/sh-utils-2.0.11-dateman.patch index 97cdb04..ff9ca67 100644 --- a/sh-utils-2.0.11-dateman.patch +++ b/sh-utils-2.0.11-dateman.patch @@ -1,9 +1,9 @@ ---- sh-utils-2.0.11/man/date.1.man Tue May 15 19:02:55 2001 -+++ sh-utils-2.0.11/man/date.1 Tue May 15 19:06:05 2001 -@@ -152,6 +152,11 @@ - .IP - `-' (hyphen) do not pad the field - `_' (underscore) pad the field with spaces +--- coreutils-5.92/man/date.1.dateman 2005-10-22 19:14:46.000000000 +0100 ++++ coreutils-5.92/man/date.1 2005-10-24 17:57:38.000000000 +0100 +@@ -188,6 +188,11 @@ + then an optional modifier, which is either + E to use the locale's alternate representations if available, or + O to use the locale's alternate numeric symbols if available. +.SH ENVIRONMENT +.TP +TZ diff --git a/sources b/sources index 9c1aa50..b18c9e4 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -172ee3c315af93d3385ddfbeb843c53f coreutils-5.2.1.tar.bz2 +f2ad653731ebc9d5763be5971b4d41e0 coreutils-5.92.tar.bz2