Hi again,
here is an updated patch for #333147, since the proposed one doesn't
apply cleanly anymore. I'd also point that the disabled patch also
contains an off-by-one correction, so one might want to keep it somehow.
At last, the package doesn't build even with the updated patch, failing
there:
> cc -pipe -O1 -mtune=i486 -fomit-frame-pointer -I../lib -Wall -Wmissing-prototypes -Wstrict-prototypes -DNCH=1 -D_FILE_OFFSET_BITS=64 -DSBINDIR=\"/sbin\" -DUSRSBINDIR=\"/usr/sbin\" -DLOGDIR=\"/var/log\" -DVARPATH=\"/var\" -DLOCALEDIR=\"/usr/share/locale\" -O1 -s fdformat.c -o fdformat
> fdformat.c:17:22: error: linux/fd.h: No such file or directory
> fdformat.c: In function 'format_disk':
> fdformat.c:28: error: storage size of 'descr' isn't known
> fdformat.c:33: error: 'FDFMTBEG' undeclared (first use in this function)
> fdformat.c:33: error: (Each undeclared identifier is reported only once
> fdformat.c:33: error: for each function it appears in.)
> fdformat.c:34: error: invalid use of undefined type 'struct floppy_struct'
> fdformat.c:37: error: 'FDFMTTRK' undeclared (first use in this function)
> fdformat.c:42: error: invalid use of undefined type 'struct floppy_struct'
> fdformat.c:48: error: 'FDFMTEND' undeclared (first use in this function)
> fdformat.c:28: warning: unused variable 'descr'
> fdformat.c: In function 'verify_disk':
> fdformat.c:58: error: invalid use of undefined type 'struct floppy_struct'
> fdformat.c:58: error: invalid use of undefined type 'struct floppy_struct'
> fdformat.c:63: error: invalid use of undefined type 'struct floppy_struct'
> fdformat.c:78: error: 'FD_FILL_BYTE' undeclared (first use in this function)
> fdformat.c: In function 'main':
> fdformat.c:139: error: 'FDGETPRM' undeclared (first use in this function)
> fdformat.c:142: error: invalid use of undefined type 'struct floppy_struct'
> fdformat.c:143: error: invalid use of undefined type 'struct floppy_struct'
> fdformat.c:143: error: invalid use of undefined type 'struct floppy_struct'
> fdformat.c:143: error: invalid use of undefined type 'struct floppy_struct'
> make[1]: *** [fdformat] Error 1
> make[1]: Leaving directory `/home/kibi/z/util-linux-2.12r/disk-utils'
> make: *** [all] Error 1
So one has to tweak a little more to get this package compile.
Oh, debian/rules is now using a mixture of DEB_HOST_GNU_* and DEB_HOST_ARCH_*,
which might be polished, I guess, although I didn't want to be too intrusive
and probably insert some errors in there, so I tried to keep on only refreshing
the existing patch.
Cheers,
--
Cyril Brulebois
PS: Attached are the original patch, the refreshed one, the disabled patch with
the off-by-one fix.
diff -ur util-linux-2.12p.old/debian/patches/00list util-linux-2.12p/debian/patches/00list
--- util-linux-2.12p.old/debian/patches/00list 2005-10-06 18:45:25.000000000 +0200
+++ util-linux-2.12p/debian/patches/00list 2005-10-06 19:47:00.000000000 +0200
@@ -1,4 +1,3 @@
-10agetty
10cal-widechar
10cfdisk
10debian
diff -ur util-linux-2.12p.old/debian/rules util-linux-2.12p/debian/rules
--- util-linux-2.12p.old/debian/rules 2005-10-06 18:45:25.000000000 +0200
+++ util-linux-2.12p/debian/rules 2005-10-06 19:52:35.000000000 +0200
@@ -25,7 +25,7 @@
sparc = $(findstring $(arch),sparc)
nohwclock = $(findstring $(arch),s390)
-SUBDIRS=po lib getopt disk-utils login-utils misc-utils mount sys-utils text-utils
+SUBDIRS=po lib getopt disk-utils login-utils misc-utils sys-utils text-utils
ifeq ($(arch),$(fdisk_arch))
SUBDIRS += fdisk
endif
@@ -36,6 +36,7 @@
ifneq ($(arch),$(nohwclock))
SUBDIRS += hwclock
endif
+SUBDIRS += mount
endif
ifneq ($(DEB_HOST_GNU_SYSTEM),linux-gnu)
@@ -68,9 +69,12 @@
SUIDFILES = debian/tmp-mount/bin/{u,}mount
BINFILES = sys-utils/arch text-utils/more
-UBINFILES = sys-utils/{ipcs,ipcrm,setsid} \
- misc-utils/{namei,setterm,mcookie,whereis,ddate} \
+UBINFILES = sys-utils/{ipcrm,setsid} \
+ misc-utils/{namei,mcookie,whereis,ddate} \
getopt/getopt text-utils/{rev,line,pg}
+ifeq ($(DEB_HOST_GNU_SYSTEM),linux-gnu)
+UBINFILES += sys-utils/ipcs misc-utils/setterm
+endif
SBINFILES = disk-utils/mkswap
ifeq ($(DEB_HOST_GNU_SYSTEM),linux-gnu)
@@ -79,11 +83,15 @@
SBINFILES += hwclock/hwclock
endif
BINFILES += sys-utils/dmesg
-SBINFILES += disk-utils/{blockdev,raw} mount/pivot_root login-utils/agetty
+SBINFILES += disk-utils/{blockdev,raw} mount/pivot_root
UBINFILES += disk-utils/fdformat
USBINFILES = sys-utils/readprofile disk-utils/elvtune # disk-utils/setfdprm
endif
+ifneq ($(DEB_HOST_GNU_SYSTEM),gnu)
+SBINFILES += login-utils/agetty
+endif
+
UBINFILES2= misc-utils/chkdupexe # debian/fdformat # don't strip these
ifeq ($(DEB_HOST_GNU_SYSTEM),linux-gnu)
@@ -111,11 +119,14 @@
MAN8FILES += hwclock/hwclock.8
endif
MAN1FILES += sys-utils/readprofile.1
-MAN8FILES += login-utils/agetty.8 disk-utils/{blockdev.8,elvtune.8} \
+MAN8FILES += disk-utils/{blockdev.8,elvtune.8} \
sys-utils/dmesg.8 mount/pivot_root.8 \
disk-utils/fdformat.8 disk-utils/raw.8 # disk-utils/setfdprm.8
endif
+ifneq ($(DEB_HOST_GNU_SYSTEM),gnu)
+MAN8FILES += login-utils/agetty.8
+endif
EXAMPLES = fdisk/sfdisk.examples getopt/getopt-{test,parse}.{ba,tc}sh
ifeq ($(DEB_HOST_GNU_SYSTEM),linux-gnu)
@@ -123,8 +134,11 @@
endif
INFOFILES = sys-utils/ipc.info
-ifeq ($(DEB_HOST_GNU_SYSTEM),linux-gnu)
+ifneq ($(DEB_HOST_GNU_SYSTEM),gnu)
DOCFILES = login-utils/{README.getty,README.modems-with-agetty,README.poeigl}
+endif
+
+ifeq ($(DEB_HOST_GNU_SYSTEM),linux-gnu)
ifneq ($(arch),$(nohwclock))
DOCFILES += debian/README.Debian.hwclock
endif
@@ -204,11 +218,11 @@
mv -f debian/tmp/sbin/fdisk debian/tmp/sbin/ddisk
mv -f debian/tmp/usr/share/man/man8/fdisk.8 debian/tmp/usr/share/man/man8/ddisk.8
endif
-ifeq ($(DEB_HOST_GNU_SYSTEM),gnu)
+ifneq ($(DEB_HOST_GNU_SYSTEM),linux-gnu)
(cd debian/tmp/sbin ; mv mkswap mkswap.linux)
(cd debian/tmp/usr/share/man/man8 ; mv mkswap.8 mkswap.linux.8)
endif
-ifeq ($(DEB_HOST_GNU_SYSTEM),linux-gnu)
+ifneq ($(DEB_HOST_GNU_SYSTEM),gnu)
(cd debian/tmp/sbin ; mv agetty getty)
(cd debian/tmp/usr/share/man/man8 ; mv agetty.8 getty.8)
ifneq ($(arch), $(nohwclock))
diff -ur util-linux-2.12r~/debian/patches/00list util-linux-2.12r/debian/patches/00list
--- util-linux-2.12r~/debian/patches/00list 2007-03-30 05:55:55.000000000 +0200
+++ util-linux-2.12r/debian/patches/00list 2007-03-30 05:35:13.000000000 +0200
@@ -1,4 +1,4 @@
-10agetty
+#10agetty
10amd64-rdev
10cal-widechar
10cfdisk
diff -ur util-linux-2.12r~/debian/rules util-linux-2.12r/debian/rules
--- util-linux-2.12r~/debian/rules 2007-03-30 05:55:55.000000000 +0200
+++ util-linux-2.12r/debian/rules 2007-03-30 05:54:55.000000000 +0200
@@ -31,7 +31,7 @@
sparc = $(findstring $(arch),sparc sparc64)
nohwclock = $(findstring $(arch),s390)
-SUBDIRS=po lib getopt disk-utils login-utils misc-utils mount sys-utils text-utils
+SUBDIRS=po lib getopt disk-utils login-utils misc-utils sys-utils text-utils
ifeq ($(arch),$(fdisk_arch))
SUBDIRS += fdisk
endif
@@ -42,6 +42,7 @@
ifneq ($(arch),$(nohwclock))
SUBDIRS += hwclock
endif
+SUBDIRS += mount
endif
ifneq ($(DEB_HOST_ARCH_OS),linux)
@@ -73,9 +74,12 @@
SUIDFILES = debian/tmp-mount/bin/{u,}mount
BINFILES = sys-utils/arch text-utils/more
-UBINFILES = sys-utils/{ipcs,ipcrm,setsid} \
- misc-utils/{namei,setterm,mcookie,whereis,ddate} \
+UBINFILES = sys-utils/{ipcrm,setsid} \
+ misc-utils/{namei,mcookie,whereis,ddate} \
getopt/getopt text-utils/{rev,line,pg}
+ifeq ($(DEB_HOST_GNU_SYSTEM),linux-gnu)
+UBINFILES += sys-utils/ipcs misc-utils/setterm
+endif
SBINFILES = disk-utils/mkswap
ifeq ($(DEB_HOST_ARCH_OS),linux)
@@ -84,11 +88,15 @@
SBINFILES += hwclock/hwclock
endif
BINFILES += sys-utils/dmesg
-SBINFILES += disk-utils/{blockdev,raw,isosize} mount/pivot_root login-utils/agetty
+SBINFILES += disk-utils/{blockdev,raw,isosize} mount/pivot_root
UBINFILES += disk-utils/fdformat
USBINFILES = sys-utils/readprofile disk-utils/elvtune # disk-utils/setfdprm
endif
+ifneq ($(DEB_HOST_GNU_SYSTEM),gnu)
+SBINFILES += login-utils/agetty
+endif
+
UBINFILES2= misc-utils/chkdupexe # debian/fdformat # don't strip these
ifeq ($(DEB_HOST_ARCH_OS),linux)
@@ -116,11 +124,14 @@
MAN8FILES += hwclock/hwclock.8
endif
MAN1FILES += sys-utils/readprofile.1
-MAN8FILES += login-utils/agetty.8 disk-utils/{blockdev.8,elvtune.8,isosize.8} \
+MAN8FILES += disk-utils/{blockdev.8,elvtune.8,isosize.8} \
sys-utils/dmesg.8 mount/pivot_root.8 \
disk-utils/fdformat.8 disk-utils/raw.8 # disk-utils/setfdprm.8
endif
+ifneq ($(DEB_HOST_GNU_SYSTEM),gnu)
+MAN8FILES += login-utils/agetty.8
+endif
EXAMPLES = fdisk/sfdisk.examples getopt/getopt-{test,parse}.{ba,tc}sh
ifeq ($(DEB_HOST_ARCH_OS),linux)
@@ -128,8 +139,11 @@
endif
INFOFILES = sys-utils/ipc.info
-ifeq ($(DEB_HOST_ARCH_OS),linux)
+ifneq ($(DEB_HOST_ARCH_OS),gnu)
DOCFILES = login-utils/{README.getty,README.modems-with-agetty,README.poeigl}
+endif
+
+ifeq ($(DEB_HOST_GNU_SYSTEM),linux-gnu)
ifneq ($(arch),$(nohwclock))
DOCFILES += debian/README.Debian.hwclock
endif
@@ -206,11 +220,11 @@
mv -f debian/tmp/sbin/fdisk debian/tmp/sbin/ddisk
mv -f debian/tmp/usr/share/man/man8/fdisk.8 debian/tmp/usr/share/man/man8/ddisk.8
endif
-ifeq ($(DEB_HOST_GNU_SYSTEM),gnu)
+ifneq ($(DEB_HOST_GNU_SYSTEM),linux-gnu)
(cd debian/tmp/sbin ; mv mkswap mkswap.linux)
(cd debian/tmp/usr/share/man/man8 ; mv mkswap.8 mkswap.linux.8)
endif
-ifeq ($(DEB_HOST_ARCH_OS),linux)
+ifneq ($(DEB_HOST_ARCH_OS),gnu)
(cd debian/tmp/sbin ; mv agetty getty)
(cd debian/tmp/usr/share/man/man8 ; mv agetty.8 getty.8)
ifneq ($(arch), $(nohwclock))
#! /bin/sh /usr/share/dpatch/dpatch-run
## 10agetty.dpatch by LaMont Jones <lamont@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: agetty changes in Debian. The biggest part is switching from
## DP: termio to termios. The only other thing is a block of turned-off
## DP: code trying to interoperate better with gdm.
@DPATCH@
diff -urNad 2.12r-16~/login-utils/agetty.c 2.12r-16/login-utils/agetty.c
--- 2.12r-16~/login-utils/agetty.c 2006-12-19 09:02:16.000000000 -0700
+++ 2.12r-16/login-utils/agetty.c 2007-01-09 11:21:56.000000000 -0700
@@ -30,6 +30,8 @@
#include <getopt.h>
#include <time.h>
#include <sys/file.h>
+#include <sys/vt.h>
+#include <linux/tty.h>
#include "xstrncpy.h"
#include "nls.h"
@@ -402,7 +404,7 @@
while (isascii(c = getopt(argc, argv, "I:LH:f:hil:mt:wn"))) {
switch (c) {
case 'I':
- if (!(op->initstring = malloc(strlen(optarg)))) {
+ if (!(op->initstring = malloc(strlen(optarg)+1))) {
error(_("can't malloc initstring"));
break;
}
@@ -652,6 +654,91 @@
if ((st.st_mode & S_IFMT) != S_IFCHR)
error(_("/dev/%s: not a character device"), tty);
+ /*
+ * Try to avoid opening a vt that is already open, as this will
+ * mean that the keyboard will be unusable.
+ *
+ * Unfortunately, all the kernel gives us to find out is an ioctl
+ * for the next available vt. As the kernel doesn't open the vt for
+ * you with the ioctl, there is still a chance of both processes
+ * opening the same vt, but this check is far better than nothing at
+ * all.
+ *
+ * The kernel API sucks, and is unusable for this situation. What
+ * we really need is an ioctl that says 'does anyone _ELSE_ have
+ * this tty open', and that doesn't exist. Or better yet, the
+ * kernel really shouldn't allow two processes to have read access
+ * on the same tty at the same time (other than with dup...) Opens
+ * of the same tty device shouldn't be able to steal reads from
+ * each other.
+ *
+ * Similar to the check added to gdm.
+ *
+ * For now, just turn off this check, restoring the bug that ?dm
+ * (and the system) occasionally get their keyboard locked out by
+ * getty showing up after they've taken a vt that inittab says
+ * goes to a getty.
+ * Bummer.
+ *
+ */
+#if 0
+ if (strncmp(tty,"tty",3) == 0)
+ {
+ char *end;
+ int vtno;
+
+ vtno = strtol(tty+3,&end,10);
+ if (end != tty+3 && *end == '\0' && vtno > 1)
+ {
+ int fd;
+ int newvtno;
+ int fds[MAX_NR_CONSOLES];
+ int vt_cnt = 0;
+ int i;
+
+ for ( i = 0 ; i < MAX_NR_CONSOLES ; i++ )
+ fds[i] = -1;
+
+ if ((fd = open("/dev/tty0", O_WRONLY, 0) ) < 0
+ && errno != ENOENT)
+ error(_("/dev/tty0: cannot open: %m"));
+
+ if (fd >= 0) do
+ {
+ if ((ioctl(fd, VT_OPENQRY, &newvtno ) < 0))
+ error(_("failed to query next available vt"));
+
+ if (newvtno == -1)
+ error(_("all vts are in use"));
+
+ if (newvtno > vtno)
+ error(_("/dev/%s: already in use"), tty);
+
+ if (newvtno < vtno)
+ {
+ char vtname[TTY_NAME_MAX+3];
+
+ sprintf( vtname, "tty%d", newvtno );
+
+ if ((fds[vt_cnt++] =
+ open(vtname, O_RDWR|O_NONBLOCK, 0)) < 0)
+ {
+ error(_("/dev/%s: cannot open: %m"), tty);
+ }
+ }
+ } while (newvtno != vtno);
+
+ close(fd);
+ for ( i = 0 ; i < MAX_NR_CONSOLES ; i++ )
+ {
+ if (fds[i] == -1)
+ break;
+ close(fds[i]);
+ }
+ }
+ }
+#endif
+
/* Open the tty as standard input. */
(void) close(0);
Attachment:
pgpMXAeP8tt5H.pgp
Description: PGP signature