rpms/util-linux/devel util-linux-2.12p-ipcs-typo.patch, NONE, 1.1 util-linux-2.12p-login-lastlog.patch, NONE, 1.1 util-linux-2.12p-mount-duplabel.patch, NONE, 1.1 util-linux-2.12p-mtab-lock.patch, NONE, 1.1 util-linux-2.12p-newgrp-disable.patch, NONE, 1.1 util-linux.spec, 1.63, 1.64

fedora-cvs-commits at redhat.com fedora-cvs-commits at redhat.com
Fri Mar 25 11:45:50 UTC 2005


Update of /cvs/dist/rpms/util-linux/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv16366

Modified Files:
	util-linux.spec 
Added Files:
	util-linux-2.12p-ipcs-typo.patch 
	util-linux-2.12p-login-lastlog.patch 
	util-linux-2.12p-mount-duplabel.patch 
	util-linux-2.12p-mtab-lock.patch 
	util-linux-2.12p-newgrp-disable.patch 
Log Message:
- 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)


util-linux-2.12p-ipcs-typo.patch:
 ipcs.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE util-linux-2.12p-ipcs-typo.patch ---
--- 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;

util-linux-2.12p-login-lastlog.patch:
 login.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- NEW FILE util-linux-2.12p-login-lastlog.patch ---
--- 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) &&

util-linux-2.12p-mount-duplabel.patch:
 mount.8       |   12 ++++++++++++
 mount_blkid.c |   54 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 63 insertions(+), 3 deletions(-)

--- NEW FILE util-linux-2.12p-mount-duplabel.patch ---
--- util-linux-2.12p/mount/mount.8.duplabel	2004-12-19 23:30:14.000000000 +0100
+++ util-linux-2.12p/mount/mount.8	2005-03-25 11:33:27.445603656 +0100
@@ -1896,6 +1965,18 @@
 .BR 64
 some mount succeeded
 
+.SH DUPLICATE LABELS
+.B mount 
+includes support for systems where same partition is shared
+between different devices (e.g. multipath kernel drivers). In particular
+case when mounting device by LABEL, mount command reports problem with
+duplicate labels. You can define priority of devices in
+file 
+.I /etc/fstab.order
+as simple list of devices. The devices listed in
+this file have greater priority than odd devices. Devices in
+configuration file have descending priority.
+
 .SH FILES
 .TP 18n
 .I /etc/fstab
--- util-linux-2.12p/mount/mount_blkid.c.duplabel	2004-12-22 10:54:41.000000000 +0100
+++ util-linux-2.12p/mount/mount_blkid.c	2005-03-25 11:34:28.460328008 +0100
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <sys/param.h>
 #include "mount_blkid.h"
 
 #ifdef HAVE_BLKID
@@ -74,6 +75,47 @@
 	return get_spec_by_uuid(uuid);
 }
 
+#define LABEL_ORDER_FILE "/etc/fstab.order"
+
+static const char *
+resolve_duplicated_label(const char *dev1, const char *dev2)
+{
+	int pos1=0, pos2=0, pos=0;
+	FILE *f;
+	char buf[MAXPATHLEN];
+	
+	if (!(f=fopen(LABEL_ORDER_FILE, "r")))
+		return NULL;
+
+	while (fgets(buf, sizeof(buf) - 1, f)) {
+		char *p = strchr(buf, '#');
+		char *a=NULL, *b=NULL;
+		if (p && p==buf)
+			continue;		/* comment only */
+		if (p)
+			*p = '\0';
+		pos++;
+		if (pos1==0 && (a=strstr(buf, dev1)))
+			pos1=pos;
+		if (pos2==0 && (b=strstr(buf, dev2)))
+			pos2=pos;
+		if (a && b)			/* grrr... both on same line */
+		{
+			if (a < b)			
+				pos2++;
+			else
+				pos1++;
+		}
+		if (pos1 && pos2)
+		{
+			fclose(f);
+			return pos1 < pos2 ? dev1 : dev2;
+		}
+	}
+	fclose(f);
+	return pos1 ? dev1 : pos2 ? dev2 : NULL;
+}
+
 extern char *progname;
 
 const char *
@@ -83,9 +125,15 @@
 	spec = get_spec_by_volume_label(volumelabel);
 	spec2 = second_occurrence_of_vol_label(volumelabel);
 	if (spec2)
-		die (EX_FAIL,
-		     _("%s: error: the label %s occurs on both %s and %s\n"),
-		     progname, volumelabel, spec, spec2);
+	{
+		const char *xspec = resolve_duplicated_label(spec, spec2);
+		if (!xspec)
+			die (EX_FAIL,
+			     _("%s: error: the label %s occurs on both %s and %s\n"),
+			     progname, volumelabel, spec, spec2);
+		else
+			spec = xspec;
+	}
 	return spec;
 }
 

util-linux-2.12p-mtab-lock.patch:
 fstab.c |   72 ++++++++++++++++++++++++++++++++++++----------------------------
 1 files changed, 41 insertions(+), 31 deletions(-)

--- NEW FILE util-linux-2.12p-mtab-lock.patch ---
--- 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);
 	}
 }
 

util-linux-2.12p-newgrp-disable.patch:
 Makefile |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

--- NEW FILE util-linux-2.12p-newgrp-disable.patch ---
--- util-linux-2.12p/login-utils/Makefile.newgrp	2005-03-25 12:30:53.755684888 +0100
+++ util-linux-2.12p/login-utils/Makefile	2005-03-25 12:32:10.728983168 +0100
@@ -13,7 +13,8 @@
 
 MAN1.MISC=	last.1 mesg.1 wall.1
 
-MAN1.PUTILS= 	chfn.1 chsh.1 login.1 newgrp.1
+# we use newgrp from shadow-utils
+MAN1.PUTILS= 	chfn.1 chsh.1 login.1 #newgrp.1
 MAN1.PASSWD=    passwd.1
 
 MAN8.GETTY=	agetty.8
@@ -34,7 +35,8 @@
 
 USRBIN.MISC=	last mesg wall
 
-USRBIN.PUTILS=	chfn chsh newgrp
+# we use newgrp from shadow-utils
+USRBIN.PUTILS=	chfn chsh #newgrp
 USRBIN.PASSWD=	passwd
 
 USRSBIN.PUTILS=	vipw
@@ -93,7 +95,7 @@
 cryptocard.o login.o: cryptocard.h
 chfn.o chsh.o islocal.o passwd.o: islocal.h
 chfn.o chsh.o passwd.o setpwnam.o vipw.o: setpwnam.h
-chfn.o chsh.o login.o newgrp.o passwd.o simpleinit.o: my_crypt.h
+chfn.o chsh.o login.o passwd.o simpleinit.o: my_crypt.h
 initctl.o simpleinit.o: simpleinit.h
 agetty.o islocal.o last.o setpwnam.o shutdown.o simpleinit.o \
 	vipw.o: $(LIB)/pathnames.h
@@ -117,8 +119,9 @@
 
 mesg: mesg.o $(ERR_O)
 
-newgrp: newgrp.o 
-	$(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM)
+# we use newgrp from shadow-utils
+#newgrp: newgrp.o 
+#	$(CC) $(LDFLAGS) -o $@ $^ $(CRYPT) $(PAM)
 
 shutdown: shutdown.o $(LIB)/my_reboot.o $(LIB)/xstrncpy.o
 
@@ -131,8 +134,9 @@
 vipw: vipw.o $(LIB)/xstrncpy.o
 	$(CC) $(LDFLAGS) -o $@ $^ $(SELINUXLLIB)
 
-newgrp.o: $(LIB)/pathnames.h
-	$(CC) -c $(CFLAGS) $(PAMFL) newgrp.c 
+# we use newgrp from shadow-utils
+#newgrp.o: $(LIB)/pathnames.h
+#	$(CC) -c $(CFLAGS) $(PAMFL) newgrp.c 
 
 wall: wall.o ttymsg.o $(LIB)/carefulputc.o $(LIB)/xstrncpy.o
 


Index: util-linux.spec
===================================================================
RCS file: /cvs/dist/rpms/util-linux/devel/util-linux.spec,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- util-linux.spec	16 Mar 2005 21:37:37 -0000	1.63
+++ util-linux.spec	25 Mar 2005 11:45:47 -0000	1.64
@@ -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 @@
 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 @@
 %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}%{_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 @@
 
 %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 @@
 /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 @@
 %{_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 @@
 %{_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 @@
 /sbin/losetup
 
 %changelog
-* Wed Mar 16 2005 Elliot Lee <sopwith at redhat.com>
+* Fri Mar 25 2005 Karel Zak <kzak at redhat.com> 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 <sopwith at redhat.com> 2.12p-3
 - rebuilt
 
 * Fri Feb 25 2005 Steve Dickson <SteveD at RedHat.com> 2.12p-2




More information about the fedora-cvs-commits mailing list