diff --git a/util-linux-2.12p-ipcs-typo.patch b/util-linux-2.12p-ipcs-typo.patch new file mode 100644 index 0000000..18f4529 --- /dev/null +++ b/util-linux-2.12p-ipcs-typo.patch @@ -0,0 +1,11 @@ +--- util-linux-2.12p/sys-utils/ipcs.c.ipcs-typo 2005-03-17 17:28:32.006952664 +0100 ++++ util-linux-2.12p/sys-utils/ipcs.c 2005-03-17 17:28:48.823396176 +0100 +@@ -423,7 +423,7 @@ + break; + + case TIME: +- printf (_("------ Shared Memory Operation/Change Times --------\n")); ++ printf (_("------ Semaphore Operation/Change Times --------\n")); + printf (_("%-8s %-10s %-26.24s %-26.24s\n"), + _("shmid"),_("owner"),_("last-op"),_("last-changed")); + break; diff --git a/util-linux-2.12p-login-lastlog.patch b/util-linux-2.12p-login-lastlog.patch new file mode 100644 index 0000000..cd1b4f7 --- /dev/null +++ b/util-linux-2.12p-login-lastlog.patch @@ -0,0 +1,11 @@ +--- util-linux-2.12p/login-utils/login.c.login-lastlog 2005-03-24 13:26:06.516865128 +0100 ++++ util-linux-2.12p/login-utils/login.c 2005-03-24 13:26:58.136017824 +0100 +@@ -1397,7 +1397,7 @@ + struct lastlog ll; + int fd; + +- if ((fd = open(_PATH_LASTLOG, O_RDWR, 0)) >= 0) { ++ if ((fd = open(_PATH_LASTLOG, O_RDWR|O_CREAT, 0)) >= 0) { + lseek(fd, (off_t)pwd->pw_uid * sizeof(ll), SEEK_SET); + if (!quiet) { + if (read(fd, (char *)&ll, sizeof(ll)) == sizeof(ll) && diff --git a/util-linux-2.12p-mtab-lock.patch b/util-linux-2.12p-mtab-lock.patch new file mode 100644 index 0000000..98ea4d1 --- /dev/null +++ b/util-linux-2.12p-mtab-lock.patch @@ -0,0 +1,150 @@ +--- util-linux-2.12p/mount/fstab.c.mtab-lock 2005-03-22 14:05:22.481297072 +0100 ++++ util-linux-2.12p/mount/fstab.c 2005-03-22 14:50:55.719781664 +0100 +@@ -395,6 +395,7 @@ + + /* Flag for already existing lock file. */ + static int we_created_lockfile = 0; ++static int lockfile_fd = -1; + + /* Flag to indicate that signals have been set up. */ + static int signals_have_been_setup = 0; +@@ -416,6 +417,8 @@ + void + unlock_mtab (void) { + if (we_created_lockfile) { ++ close(lockfile_fd); ++ lockfile_fd = -1; + unlink (MOUNTED_LOCK); + we_created_lockfile = 0; + } +@@ -443,7 +446,7 @@ + + void + lock_mtab (void) { +- int tries = 3; ++ int tries = 100000, i; + char linktargetfile[MOUNTLOCK_LINKTARGET_LTH]; + + at_die = unlock_mtab; +@@ -469,45 +472,48 @@ + + sprintf(linktargetfile, MOUNTLOCK_LINKTARGET, getpid ()); + ++ i = open (linktargetfile, O_WRONLY|O_CREAT, 0); ++ if (i < 0) { ++ int errsv = errno; ++ /* linktargetfile does not exist (as a file) ++ and we cannot create it. Read-only filesystem? ++ Too many files open in the system? ++ Filesystem full? */ ++ die (EX_FILEIO, _("can't create lock file %s: %s " ++ "(use -n flag to override)"), ++ linktargetfile, strerror (errsv)); ++ } ++ close(i); ++ + /* Repeat until it was us who made the link */ + while (!we_created_lockfile) { + struct flock flock; +- int errsv, fd, i, j; +- +- i = open (linktargetfile, O_WRONLY|O_CREAT, 0); +- if (i < 0) { +- int errsv = errno; +- /* linktargetfile does not exist (as a file) +- and we cannot create it. Read-only filesystem? +- Too many files open in the system? +- Filesystem full? */ +- die (EX_FILEIO, _("can't create lock file %s: %s " +- "(use -n flag to override)"), +- linktargetfile, strerror (errsv)); +- } +- close(i); ++ int errsv, j; + + j = link(linktargetfile, MOUNTED_LOCK); + errsv = errno; + +- (void) unlink(linktargetfile); +- + if (j == 0) + we_created_lockfile = 1; + + if (j < 0 && errsv != EEXIST) { ++ (void) unlink(linktargetfile); + die (EX_FILEIO, _("can't link lock file %s: %s " + "(use -n flag to override)"), + MOUNTED_LOCK, strerror (errsv)); + } + +- fd = open (MOUNTED_LOCK, O_WRONLY); ++ lockfile_fd = open (MOUNTED_LOCK, O_WRONLY); + +- if (fd < 0) { ++ if (lockfile_fd < 0) { + int errsv = errno; + /* Strange... Maybe the file was just deleted? */ +- if (errno == ENOENT && tries-- > 0) ++ if (errno == ENOENT && tries-- > 0) { ++ if (tries % 200 == 0) ++ usleep(30); + continue; ++ } ++ (void) unlink(linktargetfile); + die (EX_FILEIO, _("can't open lock file %s: %s " + "(use -n flag to override)"), + MOUNTED_LOCK, strerror (errsv)); +@@ -520,7 +526,7 @@ + + if (j == 0) { + /* We made the link. Now claim the lock. */ +- if (fcntl (fd, F_SETLK, &flock) == -1) { ++ if (fcntl (lockfile_fd, F_SETLK, &flock) == -1) { + if (verbose) { + int errsv = errno; + printf(_("Can't lock lock file %s: %s\n"), +@@ -528,13 +534,15 @@ + } + /* proceed anyway */ + } ++ (void) unlink(linktargetfile); + } else { + static int tries = 0; + + /* Someone else made the link. Wait. */ + alarm(LOCK_TIMEOUT); +- if (fcntl (fd, F_SETLKW, &flock) == -1) { ++ if (fcntl (lockfile_fd, F_SETLKW, &flock) == -1) { + int errsv = errno; ++ (void) unlink(linktargetfile); + die (EX_FILEIO, _("can't lock lock file %s: %s"), + MOUNTED_LOCK, (errno == EINTR) ? + _("timed out") : strerror (errsv)); +@@ -542,16 +550,18 @@ + alarm(0); + /* Limit the number of iterations - maybe there + still is some old /etc/mtab~ */ +- if (tries++ > 3) { +- if (tries > 5) +- die (EX_FILEIO, _("Cannot create link %s\n" +- "Perhaps there is a stale lock file?\n"), +- MOUNTED_LOCK); +- sleep(1); +- } ++ ++tries; ++ if (tries % 200 == 0) ++ usleep(30); ++ if (tries > 100000) { ++ (void) unlink(linktargetfile); ++ close(lockfile_fd); ++ die (EX_FILEIO, _("Cannot create link %s\n" ++ "Perhaps there is a stale lock file?\n"), ++ MOUNTED_LOCK); ++ } ++ close(lockfile_fd); + } +- +- close(fd); + } + } + diff --git a/util-linux.spec b/util-linux.spec index 2d459ee..f8b43cd 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -27,7 +27,7 @@ Summary: A collection of basic system utilities. Name: util-linux Version: 2.12p -Release: 3 +Release: 4 License: distributable Group: System Environment/Base @@ -95,13 +95,27 @@ Patch159: util-linux-2.12j-pamconsole.patch Patch160: raw-handle-nonpresent-devs.patch Patch164: util-linux-2.12j-113790-hotkeys.patch -Patch168: util-linux-2.12j-143597-newgrp.patch + +# newgrp disabled +#Patch168: util-linux-2.12j-143597-newgrp.patch + +# disable newgrp, in shadow-utils is better implementation (#149997, #151613) +Patch169: util-linux-2.12p-newgrp-disable.patch # patches required for NFSv4 support -Patch1000: util-linux-2.12p-nfsv4.patch -Patch1001: util-linux-2.12a-mount-proto.patch -Patch1002: util-linux-2.12a-nfsmount-overflow.patch -Patch1003: util-linux-2.12a-nfsmount-reservp.patch +Patch170: util-linux-2.12p-nfsv4.patch +Patch171: util-linux-2.12a-mount-proto.patch +Patch172: util-linux-2.12a-nfsmount-overflow.patch +Patch173: util-linux-2.12a-nfsmount-reservp.patch + +# Makeing /var/log/lastlog (#151635) +Patch180: util-linux-2.12p-login-lastlog.patch +# Improved /etc/mtab lock (#143118) +Patch181: util-linux-2.12p-mtab-lock.patch +# Stupid typo (#151156) +Patch182: util-linux-2.12p-ipcs-typo.patch +# priority for duplicated labels (multipath) (#116300) +Patch183: util-linux-2.12p-mount-duplabel.patch # When adding patches, please make sure that it is easy to find out what bug # the # patch fixes. @@ -207,12 +221,20 @@ mv MCONFIG.new MCONFIG %endif %patch164 -p1 -%patch168 -p1 -%patch1000 -p1 -b .nfsv4 -%patch1001 -p1 -%patch1002 -p1 -%patch1003 -p1 +# newgrp disabled +#%patch168 -p1 + +%patch169 -p1 +%patch170 -p1 -b .nfsv4 +%patch171 -p1 +%patch172 -p1 +%patch173 -p1 + +%patch180 -p1 -b .lastlog +%patch181 -p1 +%patch182 -p1 +%patch183 -p1 -b .duplabel %build unset LINGUAS || : @@ -256,6 +278,8 @@ mkdir -p ${RPM_BUILD_ROOT}%{_infodir} mkdir -p ${RPM_BUILD_ROOT}%{_mandir}/man{1,6,8,5} mkdir -p ${RPM_BUILD_ROOT}%{_sbindir} mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/{pam.d,security/console.apps} +mkdir -p ${RPM_BUILD_ROOT}/var/log/ +touch ${RPM_BUILD_ROOT}/var/log/lastlog make \ OPT="$RPM_OPT_FLAGS %{make_cflags}" \ @@ -375,6 +399,9 @@ ln -sf ../../bin/kill $RPM_BUILD_ROOT%{_bindir}/kill %post /sbin/install-info %{_infodir}/ipc.info* %{_infodir}/dir +touch /var/log/lastlog +chown root:root /var/log/lastlog +chmod 0400 /var/log/lastlog %postun if [ "$1" = 0 ]; then @@ -426,6 +453,7 @@ fi /sbin/rescuept /sbin/nologin %{_mandir}/man8/nologin.8* +%ghost %attr(0400,root,root) /var/log/lastlog # Begin kbdrate stuff %if %{with_kbdrate} @@ -469,7 +497,10 @@ fi %{_mandir}/man8/floppy.8* %endif %{_bindir}/namei -%attr(4711,root,root) %{_bindir}/newgrp + +# newgrp disabled +#%attr(4711,root,root) %{_bindir}/newgrp + %if %{include_raw} %{_bindir}/raw %endif @@ -528,7 +559,10 @@ fi %{_mandir}/man1/mcookie.1* %{_mandir}/man1/more.1* %{_mandir}/man1/namei.1* -%{_mandir}/man1/newgrp.1* + +# newgrp disabled +#%{_mandir}/man1/newgrp.1* + %{_mandir}/man1/readprofile.1* %{_mandir}/man1/rename.1* %{_mandir}/man1/rev.1* @@ -590,7 +624,14 @@ fi /sbin/losetup %changelog -* Wed Mar 16 2005 Elliot Lee +* Fri Mar 25 2005 Karel Zak 2.12p-4 +- added /var/log/lastlog to util-linux (#151635) +- disabled 'newgrp' in util-linux (enabled in shadow-utils) (#149997, #151613) +- improved mtab lock (#143118) +- fixed ipcs typo (#151156) +- implemented mount workaround for duplicated labels (#116300) + +* Wed Mar 16 2005 Elliot Lee 2.12p-3 - rebuilt * Fri Feb 25 2005 Steve Dickson 2.12p-2