diff --git a/coreutils-7.6-who-msgstatus.patch b/coreutils-7.6-who-msgstatus.patch new file mode 100644 index 0000000..17c55a7 --- /dev/null +++ b/coreutils-7.6-who-msgstatus.patch @@ -0,0 +1,75 @@ +diff -urNp coreutils-7.6-orig/m4/jm-macros.m4 coreutils-7.6/m4/jm-macros.m4 +--- coreutils-7.6-orig/m4/jm-macros.m4 2010-04-28 17:44:36.000000000 +0200 ++++ coreutils-7.6/m4/jm-macros.m4 2010-04-28 17:45:01.000000000 +0200 +@@ -146,6 +146,25 @@ AC_DEFUN([coreutils_MACROS], + ]) + + AC_REQUIRE([AM_LANGINFO_CODESET]) ++ ++ # Accept configure options: --with-tty-group[=GROUP], --without-tty-group ++ # You can determine the group of a TTY via 'stat --format %G /dev/tty' ++ # Omitting this option is equivalent to using --without-tty-group. ++ AC_ARG_WITH([tty-group], ++ AS_HELP_STRING([--with-tty-group[[[=NAME]]]], ++ [group used by system for TTYs, "tty" when not specified] ++ [ (default: do not rely on any group used for TTYs)]), ++ [tty_group_name=$withval], ++ [tty_group_name=no]) ++ ++ if test "x$tty_group_name" != xno; then ++ if test "x$tty_group_name" = xyes; then ++ tty_group_name=tty ++ fi ++ AC_MSG_NOTICE([TTY group used by system set to "$tty_group_name"]) ++ AC_DEFINE_UNQUOTED([TTY_GROUP_NAME], ["$tty_group_name"], ++ [group used by system for TTYs]) ++ fi + ]) + + AC_DEFUN([gl_CHECK_ALL_HEADERS], +diff -urNp coreutils-7.6-orig/src/who.c coreutils-7.6/src/who.c +--- coreutils-7.6-orig/src/who.c 2010-04-28 17:44:36.000000000 +0200 ++++ coreutils-7.6/src/who.c 2010-04-28 17:45:01.000000000 +0200 +@@ -36,6 +36,10 @@ + #include "error.h" + #include "quote.h" + ++#ifdef TTY_GROUP_NAME ++# include ++#endif ++ + /* The official name of this program (e.g., no `g' prefix). */ + #define PROGRAM_NAME "who" + +@@ -307,6 +311,22 @@ print_line (int userlen, const char *use + free (x_exitstr); + } + ++/* Return true if a terminal device given as PSTAT allows other users ++ to send messages to; false otherwise */ ++static bool ++is_tty_writable (struct stat const *pstat) ++{ ++#ifdef TTY_GROUP_NAME ++ /* Ensure the group of the TTY device matches TTY_GROUP_NAME, more info at ++ https://bugzilla.redhat.com/454261 */ ++ struct group *ttygr = getgrnam (TTY_GROUP_NAME); ++ if (!ttygr || (pstat->st_gid != ttygr->gr_gid)) ++ return false; ++#endif ++ ++ return pstat->st_mode & S_IWGRP; ++} ++ + /* Send properly parsed USER_PROCESS info to print_line. The most + recent boot time is BOOTTIME. */ + static void +@@ -345,7 +365,7 @@ print_user (const STRUCT_UTMP *utmp_ent, + + if (stat (line, &stats) == 0) + { +- mesg = (stats.st_mode & S_IWGRP) ? '+' : '-'; ++ mesg = is_tty_writable (&stats) ? '+' : '-'; + last_change = stats.st_atime; + } + else diff --git a/coreutils-colorls.csh b/coreutils-colorls.csh index 2d259a8..7e3d794 100755 --- a/coreutils-colorls.csh +++ b/coreutils-colorls.csh @@ -2,7 +2,7 @@ # color-ls initialization if ( $?USER_LS_COLORS ) then if ( "$USER_LS_COLORS" != "" ) then - #when USER_LS_COLORS defined do not override user + #when USER_LS_COLORS defined do not override user #specified LS_COLORS and use them goto finish endif @@ -12,14 +12,14 @@ alias ll 'ls -l' alias l. 'ls -d .*' set COLORS=/etc/DIR_COLORS if ($?TERM) then - if ( -e "/etc/DIR_COLORS.$TERM" ) then + if ( -e "/etc/DIR_COLORS.$TERM" ) then set COLORS="/etc/DIR_COLORS.$TERM" endif endif if ( -e "/etc/DIR_COLORS.256color" ) then - if ( "`tput colors`" == "256" ) then + if ( "`tty -s && tput colors`" == "256" ) then set COLORS=/etc/DIR_COLORS.256color - endif + endif endif if ( -f ~/.dircolors ) set COLORS=~/.dircolors if ( -f ~/.dir_colors ) set COLORS=~/.dir_colors @@ -30,11 +30,11 @@ endif if ( ! -e "$COLORS" ) exit -eval `dircolors -c $COLORS` +eval "`dircolors -c $COLORS`" if ( "$LS_COLORS" == '' ) exit set color_none=`sed -n '/^COLOR.*none/Ip' < $COLORS` -if ( "$color_none" != '' ) then +if ( "$color_none" != '' ) then unset color_none exit endif diff --git a/coreutils-colorls.sh b/coreutils-colorls.sh index 928667e..dc5c223 100755 --- a/coreutils-colorls.sh +++ b/coreutils-colorls.sh @@ -18,7 +18,7 @@ if [ -z "$USER_LS_COLORS" ]; then done [ -z "$COLORS" ] && [ -e "/etc/DIR_COLORS.256color" ] && \ - [ "x`tput colors 2>/dev/null`" = "x256" ] && \ + [ "x`tty -s && tput colors 2>/dev/null`" = "x256" ] && \ COLORS="/etc/DIR_COLORS.256color" if [ -z "$COLORS" ]; then @@ -30,7 +30,7 @@ if [ -z "$USER_LS_COLORS" ]; then # Existence of $COLORS already checked above. [ -n "$COLORS" ] || return - eval `dircolors --sh "$COLORS" 2>/dev/null` + eval "`dircolors --sh "$COLORS" 2>/dev/null`" [ -z "$LS_COLORS" ] && return grep -qi "^COLOR.*none" $COLORS >/dev/null 2>/dev/null && return fi diff --git a/coreutils-pam.patch b/coreutils-pam.patch index 6e9a0f2..b096791 100644 --- a/coreutils-pam.patch +++ b/coreutils-pam.patch @@ -265,7 +265,7 @@ shell_basename = last_component (shell); arg0 = xmalloc (strlen (shell_basename) + 2); arg0[0] = '-'; -@@ -360,6 +512,66 @@ +@@ -360,6 +512,67 @@ error (0, errno, "%s", shell); exit (exit_status); } @@ -303,12 +303,12 @@ + + pid = waitpid(-1, &status, WUNTRACED); + -+ if (WIFSTOPPED(status)) { -+ kill(getpid(), SIGSTOP); ++ if (((pid_t)-1 != pid) && (0 != WIFSTOPPED (status))) { ++ kill(getpid(), WSTOPSIG(status)); + /* once we get here, we must have resumed */ + kill(pid, SIGCONT); + } -+ } while (WIFSTOPPED(status)); ++ } while (0 != WIFSTOPPED(status)); + } + + if (caught) { @@ -327,7 +327,8 @@ + fprintf(stderr, " ...killed.\n"); + exit(-1); + } -+ exit (WEXITSTATUS(status)); ++ exit ((0 != WIFEXITED (status)) ? WEXITSTATUS (status) ++ : WTERMSIG (status) + 128); +#endif /* USE_PAM */ } diff --git a/coreutils.spec b/coreutils.spec index ac1f1a7..3ec2a36 100644 --- a/coreutils.spec +++ b/coreutils.spec @@ -1,7 +1,7 @@ Summary: A set of basic GNU tools commonly used in shell scripts Name: coreutils Version: 7.2 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv3+ Group: System Environment/Base Url: http://www.gnu.org/software/coreutils/ @@ -27,6 +27,7 @@ Patch5: coreutils-CVE-2009-4135.patch Patch6: coreutils-7.2-ls-infloop.patch Patch7: coreutils-7.2-ls-derefdanglinginode.patch Patch8: coreutils-7.2-trueexecve.patch +Patch9: coreutils-7.6-who-msgstatus.patch # Our patches Patch100: coreutils-6.10-configuration.patch @@ -116,6 +117,7 @@ the old GNU fileutils, sh-utils, and textutils packages. %patch5 -p1 -b .unsafetmp %patch6 -p1 -b .infloop %patch8 -p1 -b .execve +%patch9 -p1 -b .whomsg # Our patches %patch100 -p1 -b .configure @@ -174,6 +176,7 @@ automake --copy --add-missing %configure --enable-largefile --with-afs %{?!nopam:--enable-pam} \ --enable-selinux \ --enable-install-program=su,hostname,arch \ + --with-tty-group \ DEFAULT_POSIX2_VERSION=200112 alternative=199209 || : # Regenerate manpages @@ -209,15 +212,15 @@ bzip2 -9f ChangeLog # let be compatible with old fileutils, sh-utils and textutils packages : mkdir -p $RPM_BUILD_ROOT{/bin,%_bindir,%_sbindir,/sbin} %{?!nopam:mkdir -p $RPM_BUILD_ROOT%_sysconfdir/pam.d} -for f in arch basename cat chgrp chmod chown cp cut date dd df echo env false link ln ls mkdir mknod mktemp mv nice pwd rm rmdir sleep sort stty sync touch true uname unlink +for f in arch basename cat chgrp chmod chown cp cut date dd df echo env false link ln ls mkdir mknod mktemp mv nice pwd readlink rm rmdir sleep sort stty sync touch true uname unlink do mv $RPM_BUILD_ROOT{%_bindir,/bin}/$f done # chroot was in /usr/sbin : mv $RPM_BUILD_ROOT{%_bindir,%_sbindir}/chroot -# {cat,sort,cut} were previously moved from bin to /usr/bin and linked into -for i in env cut; do ln -sf ../../bin/$i $RPM_BUILD_ROOT/usr/bin; done +# {env,cut,readlink} were previously moved from /usr/bin to /bin and linked into +for i in env cut readlink; do ln -sf ../../bin/$i $RPM_BUILD_ROOT/usr/bin; done mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d install -p -c -m644 %SOURCE101 $RPM_BUILD_ROOT%{_sysconfdir}/DIR_COLORS @@ -319,6 +322,7 @@ fi /bin/mv /bin/nice /bin/pwd +/bin/readlink /bin/rm /bin/rmdir /bin/sleep @@ -338,6 +342,18 @@ fi /sbin/runuser %changelog +* Wed Apr 28 2010 Ondrej Vasik - 7.2-8 +- doublequote LS_COLORS in colorls.*sh scripts to speedup + shell start(#586029) +- move readlink from /usr/bin to bin, keep symlink in + /usr/bin(#580682) +- run tput colors in colorls profile.d scripts only + in the interactive mode(#450424) +- fix exit status of terminated child processes in su with + pam(#559098) +- who doesn't determine user's message status correctly + (#454261) + * Thu Jan 14 2010 Ondrej Vasik - 7.2-7 - fix typo in DIR_COLORS* files