- fix #169628 - /usr/bin/floppy doesn't work with /dev/fd0

- fix #168436 - login will attempt to run if it has no read/write access to
    its terminal
- fix #168434 - login's timeout can fail - needs to call
    siginterrupt(SIGALRM,1)
- fix #165253 – losetup missing option -a [new feature]
- update PAM files (replace pam_stack with new "include" PAM directive)
- remove kbdrate from src.rpm
- update to 2.13pre4
This commit is contained in:
kzak 2005-10-07 19:34:46 +00:00
parent a2f104d878
commit 35b20313b2
8 changed files with 312 additions and 82 deletions

View File

@ -1,4 +1,3 @@
cramfs-1.1.tar.gz
floppy-0.12.tar.gz
kbdrate.tar.gz
util-linux-2.13-pre2.tar.bz2
util-linux-2.13-pre4.tar.bz2

View File

@ -1,4 +1,3 @@
d3912b9f7bf745fbfea68f6a9b9de30f cramfs-1.1.tar.gz
7d3ac81855e26687dada6a31d2677875 floppy-0.12.tar.gz
555e4bd2a23347fddac4268cbf4e1fe4 kbdrate.tar.gz
9df13e6a02ed4292966693533ae768aa util-linux-2.13-pre2.tar.bz2
484f4809876197a07a6c471d320b6d03 util-linux-2.13-pre4.tar.bz2

View File

@ -0,0 +1,102 @@
--- util-linux-2.12p/floppy-0.12/floppyfloppy.c.generic 2001-02-13 01:15:38.000000000 +0100
+++ util-linux-2.12p/floppy-0.12/floppyfloppy.c 2005-09-30 15:38:08.000000000 +0200
@@ -264,6 +264,33 @@
#endif
}
+/* -1=error, 1=true, 0=false */
+static int check_generic(const char *dev, int n)
+{
+ struct floppy_struct param;
+ int fd;
+
+ if ((fd=open(dev, O_RDONLY)) < 0)
+ {
+ perror(dev);
+ return -1;
+ }
+ if (ioctl(fd,FDGETPRM,(long) &param) < 0)
+ {
+ perror(dev);
+ close(fd);
+ return -1;
+ }
+ close(fd);
+
+ if (param.sect==floppy_type[n].sectors &&
+ param.head==floppy_type[n].heads &&
+ param.track==floppy_type[n].tracks)
+ /* generic device uses expected format */
+ return 1;
+
+ return 0;
+}
static int do_format(const char *dev, int fmtnum,
int (*fmt_func)(const char *, int), int flags)
@@ -275,6 +302,7 @@
struct format_descr curtrack;
int pct;
struct stat stat_buf;
+ int gen = 0;
int i, j;
char *devname;
@@ -297,23 +325,52 @@
strcat(strcpy(devname, dev), floppy_type[fmtnum].dev);
+ if (stat(devname, &stat_buf)==-1 && errno==ENOENT)
+ {
+ /* /dev/fd0xxxxx doesn't exist ...try to use generic device
+ *
+ * Note: we needn't size specific device if the generic device uses
+ * right floppy format (FDGETPRM). -- Karel Zak [30/09/2005]
+ */
+ if ((gen = check_generic(dev, fmtnum))==1) /* true */
+ {
+ fprintf(stderr, _("WARNING: size specific device %s doesn't exist, using generic device: %s\n"),
+ devname, dev);
+ strcpy(devname, dev);
+ }
+ else if (gen==0) /* false */
+ {
+ fprintf(stderr, _("ERROR: size specific device %1$s doesn't exist. Use \"MAKEDEV %1$s\" and try it again.\n"), devname);
+ return (1);
+ }
+ else /* error -- no floppy medium or device? */
+ return(1);
+ }
fd=open(devname, O_WRONLY);
if (fd < 0)
{
perror(devname);
return (1);
}
-
- if (fstat(fd, &stat_buf) ||
- !S_ISBLK(stat_buf.st_mode) ||
- MINOR_DEV(stat_buf.st_rdev) != fmtnum)
+ if (fstat(fd, &stat_buf) < 0)
+ {
+ perror(devname);
+ close(fd);
+ return (1);
+ }
+ if (!S_ISBLK(stat_buf.st_mode))
+ {
+ fprintf(stderr,_("%s: not a block device\n"), devname);
+ close(fd);
+ return (1);
+ }
+ if (gen==0 && MINOR_DEV(stat_buf.st_rdev) != fmtnum)
{
errno=EINVAL;
perror(devname);
close(fd);
return (1);
}
-
if (ioctl(fd, FDGETPRM, &geo) < 0)
{
perror(devname);

View File

@ -1,5 +1,5 @@
--- util-linux-2.13-pre1/fdisk/fdisk.c.gpt 2005-08-12 15:24:28.000000000 +0200
+++ util-linux-2.13-pre1/fdisk/fdisk.c 2005-08-12 15:24:28.000000000 +0200
--- util-linux-2.13-pre4/fdisk/fdisk.c.gpt 2005-10-07 18:40:26.000000000 +0200
+++ util-linux-2.13-pre4/fdisk/fdisk.c 2005-10-07 18:40:26.000000000 +0200
@@ -34,6 +34,8 @@
#include <linux/blkpg.h>
#endif
@ -57,8 +57,8 @@
get_boot(fdisk);
if (osf_label) {
--- /dev/null 2005-08-10 15:18:23.129961080 +0200
+++ util-linux-2.13-pre1/fdisk/gpt.h 2005-08-12 15:24:28.000000000 +0200
--- /dev/null 2005-10-07 17:17:17.781101976 +0200
+++ util-linux-2.13-pre4/fdisk/gpt.h 2005-10-07 18:40:26.000000000 +0200
@@ -0,0 +1,9 @@
+
+#ifndef __GPT_H__
@ -69,9 +69,9 @@
+
+#endif /* __GPT_H__ */
+
--- util-linux-2.13-pre1/fdisk/Makefile.am.gpt 2005-08-12 15:24:59.000000000 +0200
+++ util-linux-2.13-pre1/fdisk/Makefile.am 2005-08-12 15:25:35.000000000 +0200
@@ -3,13 +3,13 @@
--- util-linux-2.13-pre4/fdisk/Makefile.am.gpt 2005-09-12 20:55:27.000000000 +0200
+++ util-linux-2.13-pre4/fdisk/Makefile.am 2005-10-07 18:46:57.000000000 +0200
@@ -5,13 +5,13 @@
sbin_PROGRAMS = fdisk
man_MANS = fdisk.8
fdisk_SOURCES = fdisk.c llseek.c disksize.c fdiskbsdlabel.c fdisksgilabel.c \
@ -87,15 +87,8 @@
if USE_SLANG
sbin_PROGRAMS += cfdisk
@@ -25,4 +25,4 @@
endif
endif
-endif
\ No newline at end of file
+endif
--- util-linux-2.13-pre1/fdisk/fdisk.8.gpt 2005-08-12 15:24:28.000000000 +0200
+++ util-linux-2.13-pre1/fdisk/fdisk.8 2005-08-12 15:24:28.000000000 +0200
--- util-linux-2.13-pre4/fdisk/fdisk.8.gpt 2005-10-07 18:40:26.000000000 +0200
+++ util-linux-2.13-pre4/fdisk/fdisk.8 2005-10-07 18:40:26.000000000 +0200
@@ -42,6 +42,11 @@
partition tables.
It understands DOS type partition tables and BSD or SUN type disklabels.
@ -108,8 +101,8 @@
The
.I device
is usually one of the following:
--- util-linux-2.13-pre1/fdisk/sfdisk.8.gpt 2004-12-31 17:28:30.000000000 +0100
+++ util-linux-2.13-pre1/fdisk/sfdisk.8 2005-08-12 15:24:28.000000000 +0200
--- util-linux-2.13-pre4/fdisk/sfdisk.8.gpt 2004-12-31 17:28:30.000000000 +0100
+++ util-linux-2.13-pre4/fdisk/sfdisk.8 2005-10-07 18:40:26.000000000 +0200
@@ -18,6 +18,11 @@
on a device, check the partitions on a device, and - very dangerous -
repartition a device.
@ -122,8 +115,8 @@
.SS "List Sizes"
.BI "sfdisk \-s " partition
gives the size of
--- /dev/null 2005-08-10 15:18:23.129961080 +0200
+++ util-linux-2.13-pre1/fdisk/gpt.c 2005-08-12 15:24:28.000000000 +0200
--- /dev/null 2005-10-07 17:17:17.781101976 +0200
+++ util-linux-2.13-pre4/fdisk/gpt.c 2005-10-07 18:40:26.000000000 +0200
@@ -0,0 +1,287 @@
+/*
+ GPT (GUID Partition Table) signature detection. Based on libparted and
@ -412,8 +405,8 @@
+ exit(EXIT_SUCCESS);
+}
+#endif
--- util-linux-2.13-pre1/fdisk/sfdisk.c.gpt 2005-08-01 21:35:55.000000000 +0200
+++ util-linux-2.13-pre1/fdisk/sfdisk.c 2005-08-12 15:24:28.000000000 +0200
--- util-linux-2.13-pre4/fdisk/sfdisk.c.gpt 2005-08-14 17:14:18.000000000 +0200
+++ util-linux-2.13-pre4/fdisk/sfdisk.c 2005-10-07 18:40:26.000000000 +0200
@@ -50,6 +50,8 @@
#include "nls.h"
#include "common.h"

View File

@ -0,0 +1,20 @@
--- util-linux-2.13-pre2/login-utils/login.c.hang 2005-10-03 16:02:54.000000000 +0200
+++ util-linux-2.13-pre2/login-utils/login.c 2005-10-03 16:16:16.000000000 +0200
@@ -223,7 +223,8 @@
if (lstat(ttyn, &statbuf)
|| !S_ISCHR(statbuf.st_mode)
- || (statbuf.st_nlink > 1 && strncmp(ttyn, "/dev/", 5))) {
+ || (statbuf.st_nlink > 1 && strncmp(ttyn, "/dev/", 5))
+ || (access(ttyn, R_OK | W_OK) != 0)) {
syslog(LOG_ERR, _("FATAL: bad tty"));
sleep(1);
exit(1);
@@ -332,6 +333,7 @@
pid = getpid();
signal(SIGALRM, timedout);
+ siginterrupt(SIGALRM,1); /* we have to interrupt syscalls like ioclt() */
alarm((unsigned int)timeout);
signal(SIGQUIT, SIG_IGN);
signal(SIGINT, SIG_IGN);

View File

@ -0,0 +1,140 @@
--- util-linux-2.13-pre2/mount/lomount.c.all 2005-08-29 16:59:06.000000000 +0200
+++ util-linux-2.13-pre2/mount/lomount.c 2005-08-29 17:17:49.000000000 +0200
@@ -28,6 +28,8 @@
extern char *xstrdup (const char *s); /* not: #include "sundries.h" */
extern void error (const char *fmt, ...); /* idem */
+#define SIZE(a) (sizeof(a)/sizeof(a[0]))
+
#ifdef LOOP_SET_FD
static int
@@ -128,6 +130,42 @@
close (fd);
return 1;
}
+
+static int
+show_used_loop_devices (void) {
+ char dev[20];
+ char *loop_formats[] = { "/dev/loop%d", "/dev/loop/%d" };
+ int i, j, fd, permission = 0, somedev = 0;
+ struct stat statbuf;
+ struct loop_info loopinfo;
+
+ for (j = 0; j < SIZE(loop_formats); j++) {
+ for(i = 0; i < 256; i++) {
+ sprintf(dev, loop_formats[j], i);
+ if (stat (dev, &statbuf) == 0 && S_ISBLK(statbuf.st_mode)) {
+ somedev++;
+ fd = open (dev, O_RDONLY);
+ if (fd >= 0) {
+ if(ioctl (fd, LOOP_GET_STATUS, &loopinfo) == 0)
+ show_loop(dev);
+ close (fd);
+ somedev++;
+ } else if (errno == EACCES)
+ permission++;
+ continue; /* continue trying as long as devices exist */
+ }
+ break;
+ }
+ }
+
+ if (somedev==0 && permission) {
+ error(_("%s: no permission to look at /dev/loop#"), progname);
+ return 1;
+ }
+ return 0;
+}
+
+
#endif
int
@@ -139,8 +177,6 @@
major(statbuf.st_rdev) == LOOPMAJOR);
}
-#define SIZE(a) (sizeof(a)/sizeof(a[0]))
-
char *
find_unused_loop_device (void) {
/* Just creating a device, say in /tmp, is probably a bad idea -
@@ -403,12 +439,13 @@
static void
usage(void) {
- fprintf(stderr, _("usage:\n\
- %s loop_device # give info\n\
- %s -d loop_device # delete\n\
- %s -f # find unused\n\
- %s [-e encryption] [-o offset] {-f|loop_device} file # setup\n"),
- progname, progname, progname, progname);
+ fprintf(stderr, _("usage:\n"
+ " %1$s loop_device # give info\n"
+ " %1$s -d loop_device # delete\n"
+ " %1$s -f # find unused\n"
+ " %1$s -a # list all used\n"
+ " %1$s [-e encryption] [-o offset] {-f|loop_device} file # setup\n"),
+ progname);
exit(1);
}
@@ -442,7 +479,7 @@
int
main(int argc, char **argv) {
char *p, *offset, *encryption, *passfd, *device, *file;
- int delete, find, c;
+ int delete, find, c, all;
int res = 0;
int ro = 0;
int pfd = -1;
@@ -452,7 +489,7 @@
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- delete = find = 0;
+ delete = find = all = 0;
off = 0;
offset = encryption = passfd = NULL;
@@ -460,8 +497,11 @@
if ((p = strrchr(progname, '/')) != NULL)
progname = p+1;
- while ((c = getopt(argc, argv, "de:E:fo:p:v")) != -1) {
+ while ((c = getopt(argc, argv, "ade:E:fo:p:v")) != -1) {
switch (c) {
+ case 'a':
+ all = 1;
+ break;
case 'd':
delete = 1;
break;
@@ -489,17 +529,22 @@
if (argc == 1) {
usage();
} else if (delete) {
- if (argc != optind+1 || encryption || offset || find)
+ if (argc != optind+1 || encryption || offset || find || all)
usage();
} else if (find) {
- if (argc < optind || argc > optind+1)
+ if (all || argc < optind || argc > optind+1)
+ usage();
+ } else if (all) {
+ if (argc > 2)
usage();
} else {
if (argc < optind+1 || argc > optind+2)
usage();
}
- if (find) {
+ if (all)
+ return show_used_loop_devices();
+ else if (find) {
device = find_unused_loop_device();
if (device == NULL)
return -1;

View File

@ -1,6 +1,6 @@
#%PAM-1.0
auth sufficient pam_rootok.so
auth required pam_stack.so service=system-auth
account required pam_stack.so service=system-auth
password required pam_stack.so service=system-auth
session required pam_stack.so service=system-auth
auth include system-auth
account include system-auth
password include system-auth
session include system-auth

View File

@ -6,12 +6,11 @@
# - upstream maintainer Adrian Bunk <bunk@kernel.org>
#
# TODO:
# - remove deprecated (since release 2.13) the arch command
# - remove deprecated the arch command (since release 2.13)
#
### Features
%define include_raw 0
%define with_kbdrate 0
### Macros
%define floppyver 0.12
@ -28,7 +27,7 @@ BuildRoot: %{_tmppath}/%{name}-root
Summary: A collection of basic system utilities.
Name: util-linux
Version: 2.13
Release: 0.3.pre3
Release: 0.4.pre4
License: distributable
Group: System Environment/Base
@ -46,13 +45,12 @@ BuildRequires: e2fsprogs-devel >= 1.36
BuildRequires: audit-libs-devel
### Sources
# TODO [stable]: s/2.13-pre2/%{version}/
Source0: ftp://ftp.win.tue.nl/pub/linux-local/utils/util-linux/util-linux-2.13-pre2.tar.bz2
# TODO [stable]: s/2.13-pre4/%{version}/
Source0: ftp://ftp.win.tue.nl/pub/linux-local/utils/util-linux/util-linux-2.13-pre4.tar.bz2
Source1: util-linux-selinux.pamd
Source2: util-linux-chsh-chfn.pamd
Source8: nologin.c
Source9: nologin.8
Source10: kbdrate.tar.gz
Source11: http://download.sourceforge.net/floppyutil/floppy-%{floppyver}.tar.gz
Source12: http://download.sourceforge.net/cramfs/cramfs-%{cramfsver}.tar.gz
@ -65,9 +63,6 @@ Obsoletes: clock
Conflicts: initscripts <= 4.58, timeconfig <= 3.0.1
%endif
Requires: pam >= 0.66-4, /etc/pam.d/system-auth
%if %{with_kbdrate}
Requires: usermode
%endif
Conflicts: kernel < 2.2.12-7,
Prereq: /sbin/install-info
Provides: mount = %{version}
@ -150,23 +145,22 @@ Patch204: util-linux-2.12p-mount-ocfs2.patch
Patch205: util-linux-2.12p-execl.patch
# deprecated the arch command (for compatibility only)
Patch206: util-linux-2.13-arch.patch
# upstream build system mistakes
Patch207: util-linux-2.13-agetty-man.patch
Patch208: util-linux-2.13-usrsbin.patch
#159410 - mkswap(8) claims max swap area size is 2 GB
Patch209: util-linux-2.12p-mkswap-man.patch
#165863 - swsusp swaps should be reinitialized
# 165863 - swsusp swaps should be reinitialized
Patch210: util-linux-2.13-swapon-suspend.patch
#170110 - Documentation for 'rsize' and 'wsize' NFS mount options is misleading
# 170110 - Documentation for 'rsize' and 'wsize' NFS mount options is misleading
Patch211: util-linux-2.12p-nfs-manupdate.patch
# 169628 - /usr/bin/floppy doesn't work with /dev/fd0
Patch212: util-linux-2.12p-floppy-generic.patch
# 168436 - login will attempt to run if it has no read/write access to its terminal
# 168434 - login's timeout can fail - needs to call siginterrupt(SIGALRM,1)
Patch213: util-linux-2.13-login-hang.patch
# 165253 losetup missing option -a [new feature]
Patch214: util-linux-2.13-losetup-all.patch
# When adding patches, please make sure that it is easy to find out what bug # the
# patch fixes.
########### END upstreamable
%description
The util-linux package contains a large variety of low-level system
utilities that are necessary for a Linux system to function. Among
@ -175,7 +169,7 @@ program.
%prep
# TODO [stable]: remove -n
%setup -q -a 10 -a 11 -a 12 -n util-linux-2.13-pre2
%setup -q -a 11 -a 12 -n util-linux-2.13-pre4
%patch1 -p1 -b .moretc
%patch70 -p1
@ -225,12 +219,12 @@ cp %{SOURCE8} %{SOURCE9} .
%patch203 -p1 -b .gpt
%patch204 -p1
%patch205 -p1
%patch206 -p1
%patch207 -p1
%patch208 -p1
%patch209 -p1
%patch206 -p1 -b .arch
%patch210 -p1 -b .swsuspend
%patch211 -p1
%patch212 -p1
%patch213 -p1
%patch214 -p1
%build
unset LINGUAS || :
@ -271,13 +265,6 @@ export CFLAGS="%{make_cflags} -DUSE_TTY_GROUP $RPM_OPT_FLAGS"
# build util-linux
make %{?_smp_mflags}
# build kbdrate
%if %{with_kbdrate}
pushd kbdrate
cc $RPM_OPT_FLAGS -o kbdrate kbdrate.c
popd
%endif
# build floppy stuff
pushd floppy-%{floppyver}
# We have to disable floppygtk somehow...
@ -327,12 +314,6 @@ popd
install -m 755 nologin ${RPM_BUILD_ROOT}/sbin
install -m 644 nologin.8 ${RPM_BUILD_ROOT}%{_mandir}/man8
%if %{with_kbdrate}
install -m 755 kbdrate/kbdrate ${RPM_BUILD_ROOT}/sbin
install -m 644 kbdrate/kbdrate.8 ${RPM_BUILD_ROOT}%{_mandir}/man8
ln -s consolehelper ${RPM_BUILD_ROOT}/usr/bin/kbdrate
%endif
%if %{include_raw}
echo '.so man8/raw.8' > $RPM_BUILD_ROOT%{_mandir}/man8/rawdevices.8
%endif
@ -366,11 +347,6 @@ chmod 755 ${RPM_BUILD_ROOT}%{_bindir}/sunhostid
gzip -9nf ${RPM_BUILD_ROOT}%{_infodir}/ipc.info
%if %{with_kbdrate}
install -m644 kbdrate/kbdrate.apps $RPM_BUILD_ROOT%{_sysconfdir}/security/console.apps/kbdrate
install -m644 kbdrate/kbdrate.pam $RPM_BUILD_ROOT%{_sysconfdir}/pam.d/kbdrate
%endif
# PAM settings
{
pushd ${RPM_BUILD_ROOT}%{_sysconfdir}/pam.d
@ -498,15 +474,6 @@ fi
%{_mandir}/man8/nologin.8*
%ghost %attr(0644,root,root) %verify(not md5 size mtime) /var/log/lastlog
# Begin kbdrate stuff
%if %{with_kbdrate}
/sbin/kbdrate
/usr/bin/kbdrate
%{_mandir}/man8/kbdrate.8*
%{_sysconfdir}/pam.d/kbdrate
%{_sysconfdir}/security/console.apps/kbdrate
%endif
%{_bindir}/chrt
%{_bindir}/ionice
%{_bindir}/taskset
@ -652,9 +619,19 @@ fi
/sbin/losetup
%changelog
* Fri Oct 7 2005 Karel Zak <kzak@redhat.com> 2.13-0.4.pre4
- fix #169628 - /usr/bin/floppy doesn't work with /dev/fd0
- fix #168436 - login will attempt to run if it has no read/write access to its terminal
- fix #168434 - login's timeout can fail - needs to call siginterrupt(SIGALRM,1)
- fix #165253 losetup missing option -a [new feature]
- update PAM files (replace pam_stack with new "include" PAM directive)
- remove kbdrate from src.rpm
- update to 2.13pre4
* Fri Oct 7 2005 Steve Dickson <steved@redhat.com> 2.13-0.3.pre3
- fix #170110 - Documentation for 'rsize' and 'wsize' NFS mount options
- fix #170110 - Documentation for 'rsize' and 'wsize' NFS mount options
is misleading
* Fri Sep 2 2005 Karel Zak <kzak@redhat.com> 2.13-0.3.pre2
- fix #166923 - hwclock will not run on a non audit-enabled kernel
- fix #159410 - mkswap(8) claims max swap area size is 2 GB