From 99f347be92c3206616225107942948c1f977561a Mon Sep 17 00:00:00 2001 From: LaMont Jones Date: Sun, 8 Jul 2007 17:05:21 -0600 Subject: [PATCH] v2.12r-1 --- debian/changelog | 36 +++++ debian/control | 11 +- debian/copyright | 8 +- debian/hwclock.sh | 36 +++-- debian/patches/10cramfs-udebsize.dpatch | 28 ++++ debian/patches/30swsusp-resume.dpatch | 172 ++++++++++++++++++++++++ debian/postinst | 4 +- debian/rules | 21 +-- 8 files changed, 283 insertions(+), 33 deletions(-) create mode 100644 debian/patches/10cramfs-udebsize.dpatch create mode 100644 debian/patches/30swsusp-resume.dpatch diff --git a/debian/changelog b/debian/changelog index bbea17fa..57533da3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,39 @@ +util-linux (2.12r-1) unstable; urgency=low + + * New upstream verison and maintainer. + - cfdisk: fix a segfault with ReiserFS partitions + - umount: disallow -r option for non-root users (CAN-2005-2876) + - sfdisk: document -G option in --help output + - updated translations: ca, et, fr + - sfdisk: add -G option (Andries Brouwer) + - updated translations: de, es, ru, sv, tr, nl + * split cfdisk into its own udeb. Closes: #243094, #314368 + * Really move hwclockfirst.sh back to S18 where it belongs. + Put hwclock.sh at S22. See #50572. + * Missing line break in hwclock.sh. Closes: #337955 + * Include swap-suspend patch from Ubuntu. + * Fix variable name typo in hwclock.sh. Closes: #340232 + * Add CPU=$(arch) to make call for building on amd64/i386 mixed systems. + Closes: #305907 + * Cleanup lsb_init function usage. + + -- LaMont Jones Wed, 7 Dec 2005 08:52:21 -0700 + +util-linux (2.12p-8) unstable; urgency=high + + * if /etc/adjtime is a dangling symlink, don't use it in hwclock*.sh + * Applited patch by Max Vozeler to fix a local privilege escalation + vulnerability in umount -r [debian/patches/51security_CAN-2005-2876.dpatch] + Closes: #328141, #329063 + + -- LaMont Jones Wed, 21 Sep 2005 08:36:17 -0600 + +util-linux (2.12p-7) unstable; urgency=low + + * Fix non-posix typo in hwclock.sh. Closes: #323872 + + -- LaMont Jones Thu, 18 Aug 2005 19:27:51 -0600 + util-linux (2.12p-6) unstable; urgency=low * Use helper program in mount for guessed FS types too. Thanks to Manish diff --git a/debian/control b/debian/control index 7fe63ebd..c0d6de81 100644 --- a/debian/control +++ b/debian/control @@ -1,6 +1,7 @@ Source: util-linux Section: base Priority: required +Depends: lsb-base (>= 3.0-6) Build-Depends: libncurses5-dev, libslang2-dev (>=2.0.4-1), gettext, zlib1g-dev, libblkid-dev, uuid-dev, dpatch Maintainer: LaMont Jones Standards-Version: 3.5.6.0 @@ -57,6 +58,14 @@ Package: fdisk-udeb Architecture: alpha amd64 arm hppa i386 ia64 mips mipsel powerpc hurd-i386 sparc s390 Priority: extra Section: debian-installer +Depends: ${fdisk-udeb:Depends} +Description: Partition a hard drive (manual) + fdisk package + +Package: cfdisk-udeb +Architecture: alpha amd64 arm hppa i386 ia64 mips mipsel powerpc hurd-i386 s390 +Priority: extra +Section: debian-installer Depends: ${cfdisk-udeb:Depends} -Description: Partition a hard drive (manual, cfdisk) +Description: Partition a hard drive (cfdisk) Cfdisk package diff --git a/debian/copyright b/debian/copyright index b59fee93..633dbddd 100644 --- a/debian/copyright +++ b/debian/copyright @@ -2,13 +2,17 @@ This is the Debian GNU/Linux prepackaged version of util-linux. This package was put together by Guy Maor and later maintained by Sean 'Shaleh' Perry , and Adrian Bunk -. +. The current maintainer is LaMont Jones . -It was downloaded from ftp://ftp.win.tue.nl/pub/home/aeb/linux-local/utils/util-linux/ +It was downloaded from: + ftp://ftp.us.kernel.org/pub/linux/utils/util-linux/ +and previously was at + ftp://ftp.win.tue.nl/pub/home/aeb/linux-local/utils/util-linux/ Upstream maintainers include: +Maintainer: Adrian Bunk Maintainer: Andries Brouwer Maintainer address: util-linux@math.uio.no Maintainer of getopt: Frodo Looijaard diff --git a/debian/hwclock.sh b/debian/hwclock.sh index a7025636..e459e66f 100644 --- a/debian/hwclock.sh +++ b/debian/hwclock.sh @@ -25,13 +25,8 @@ HWCLOCKPARS= [ ! -x /sbin/hwclock ] && exit 0 . /etc/default/rcS -log_begin_msg () { echo -n "$@"; } -log_success_msg () { echo "$@"; } -log_failure_msg () { echo "$@"; } -log_warning_msg () { echo "$@"; } -log_end_msg () { if [ "$1" == 0 ]; then echo "."; fi; } -log_verbose_success_msg() { if [ "$VERBOSE" != no ]; then echo; echo $@; fi; } -log_verbose_warning_msg() { if [ "$VERBOSE" != no ]; then echo; echo $@; fi; } +. /lib/lsb/init-functions +verbose_log_action_msg() { [ "$VERBOSE" = no ] || log_action_msg $@; } [ "$GMT" = "-u" ] && UTC="yes" case "$UTC" in @@ -39,7 +34,7 @@ case "$UTC" in UTC="" if [ "X$FIRST" = "Xyes" ] && [ ! -r /etc/localtime ]; then if [ -z "$TZ" ]; then - log_warning_msg "System clock was not updated at this time." + log_action_msg "System clock was not updated at this time" exit 1 fi fi @@ -47,18 +42,18 @@ case "$UTC" in yes) GMT="--utc" UTC="--utc" ;; - *) log_failure_msg "Unknown UTC setting: \"$UTC\""; exit 1 ;; + *) log_action_msg "Unknown UTC setting: \"$UTC\""; exit 1 ;; esac case "$BADYEAR" in no|"") BADYEAR="" ;; yes) BADYEAR="--badyear" ;; - *) log_failure_msg "unknown BADYEAR setting: \"$BADYEAR\""; exit 1 ;; + *) log_action_msg "unknown BADYEAR setting: \"$BADYEAR\""; exit 1 ;; esac case "$1" in start) - if [ ! -f /etc/adjtime ]; then + if [ ! -f /etc/adjtime ] && [ ! -e /etc/adjtime ]; then echo "0.0 0 0.0" > /etc/adjtime fi @@ -88,12 +83,12 @@ case "$1" in fi if [ "$HWCLOCKACCESS" != no ]; then - log_begin_msg "Setting the System Clock using the Hardware Clock as reference" + log_daemon_msg "Setting the system clock" # Copies Hardware Clock time to System Clock using the correct # timezone for hardware clocks in local time, and sets kernel # timezone. DO NOT REMOVE. - /sbin/hwclock --hctosys $GMT $HWCLOCPARS $BADYEAR + /sbin/hwclock --hctosys $GMT $HWCLOCKPARS $BADYEAR if [ "$FIRST" = yes ]; then # Copies Hardware Clock time to System Clock using the correct @@ -113,9 +108,9 @@ case "$1" in fi # Announce the local time. - log_verbose_success_msg "System Clock set. Local time: `date $UTC`" + verbose_log_action_msg "System Clock set. Local time: `date $UTC`" else - log_verbose_warning_msg "Not setting System Clock" + verbose_log_action_msg "Not setting System Clock" fi log_end_msg 0 ;; @@ -128,19 +123,20 @@ case "$1" in # clock will not be carried across reboots. # if [ "$HWCLOCKACCESS" != no ]; then - log_begin_msg "Saving the System Clock time to the Hardware Clock" + log_daemon_msg "Saving the system clock" if [ "$GMT" = "-u" ]; then GMT="--utc" fi - /sbin/hwclock --systohc $GMT $HWCLOCPARS $BADYEAR - log_verbose_success_msg "Hardware Clock updated to `date`." + /sbin/hwclock --systohc $GMT $HWCLOCKPARS $BADYEAR + verbose_log_action_msg "Hardware Clock updated to `date`" else - log_verbose_warning_msg "Not saving System Clock" + verbose_log_action_msg "Not saving System Clock" fi + log_end_msg 0 ;; show) if [ "$HWCLOCKACCESS" != no ]; then - /sbin/hwclock --show $GMT $HWCLOCPARS $BADYEAR + /sbin/hwclock --show $GMT $HWCLOCKPARS $BADYEAR fi ;; *) diff --git a/debian/patches/10cramfs-udebsize.dpatch b/debian/patches/10cramfs-udebsize.dpatch new file mode 100644 index 00000000..90a6e716 --- /dev/null +++ b/debian/patches/10cramfs-udebsize.dpatch @@ -0,0 +1,28 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 10cramfs-udebsize.dpatch by LaMont Jones +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: malloc the output buffer, instead of statically creating it. + +@DPATCH@ +diff -urNad --exclude=CVS --exclude=.svn ./disk-utils/fsck.cramfs.c /tmp/dpep-work.XLCGO2/util-linux/disk-utils/fsck.cramfs.c +--- ./disk-utils/fsck.cramfs.c 2005-12-06 11:57:59.000000000 -0700 ++++ /tmp/dpep-work.XLCGO2/util-linux/disk-utils/fsck.cramfs.c 2005-12-06 11:59:18.000000000 -0700 +@@ -95,7 +95,7 @@ + static unsigned long read_buffer_block = ~0UL; + + /* Uncompressing data structures... */ +-static char outbuffer[PAGE_CACHE_SIZE*2]; ++static char *outbuffer; + z_stream stream; + + #endif /* INCLUDE_FS_TESTS */ +@@ -464,6 +464,8 @@ + int c; /* for getopt */ + int start = 0; + ++ outbuffer=(char*)malloc(PAGE_CACHE_SIZE*2); ++ + if (argc) + progname = argv[0]; + diff --git a/debian/patches/30swsusp-resume.dpatch b/debian/patches/30swsusp-resume.dpatch new file mode 100644 index 00000000..fe02711b --- /dev/null +++ b/debian/patches/30swsusp-resume.dpatch @@ -0,0 +1,172 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 30swsusp-resume.dpatch by Jeff Bailey +## +## 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 --exclude=CVS --exclude=.svn ./mount/get_label_uuid.c /tmp/dpep-work.5ak7Cm/util-linux/mount/get_label_uuid.c +--- ./mount/get_label_uuid.c 2004-12-22 08:44:32.000000000 -0700 ++++ /tmp/dpep-work.5ak7Cm/util-linux/mount/get_label_uuid.c 2005-12-06 11:54:33.000000000 -0700 +@@ -93,7 +93,24 @@ + } + return 0; + } +- ++ ++static int ++is_swsuspend_partition(int fd, char **label, char *uuid) { ++ int n = getpagesize(); ++ char *buf = xmalloc(n); ++ struct swap_header_v1_2 *p = (struct swap_header_v1_2 *) buf; ++ ++ if (lseek(fd, 0, SEEK_SET) == 0 ++ && read(fd, buf, n) == n ++ && (strncmp(buf+n-10, "S1SUSPEND", 9)==0 || ++ strncmp(buf+n-10, "S2SUSPEND", 9)==0) ++ && p->version == 1) { ++ store_uuid(uuid, p->uuid); ++ store_label(label, p->volume_name, 16); ++ return 1; ++ } ++ return 0; ++} + + /* + * Get both label and uuid. +@@ -126,6 +143,8 @@ + + if (is_v1_swap_partition(fd, label, uuid)) + goto done; ++ if (is_swsuspend_partition(fd, label, uuid)) ++ goto done; + + if (lseek(fd, 1024, SEEK_SET) == 1024 + && read(fd, (char *) &e2sb, sizeof(e2sb)) == sizeof(e2sb) +diff -urNad --exclude=CVS --exclude=.svn ./mount/swapon.c /tmp/dpep-work.5ak7Cm/util-linux/mount/swapon.c +--- ./mount/swapon.c 2004-12-22 08:44:32.000000000 -0700 ++++ /tmp/dpep-work.5ak7Cm/util-linux/mount/swapon.c 2005-12-06 11:54:33.000000000 -0700 +@@ -11,6 +11,9 @@ + #include + #include + #include ++#include ++#include ++#include + #include "xmalloc.h" + #include "swap_constants.h" + #include "swapargs.h" +@@ -22,6 +25,7 @@ + + #define _PATH_FSTAB "/etc/fstab" + #define PROC_SWAPS "/proc/swaps" ++#define PATH_MKSWAP "/sbin/mkswap" + + #define SWAPON_NEEDS_TWO_ARGS + +@@ -164,6 +168,84 @@ + return 0 ; + } + ++/* ++ * It's better do swsuspend detection by follow routine than ++ * include huge mount_guess_fstype.o to swapon. We need only ++ * swsuspend and no the others filesystems. ++ */ ++#ifdef HAVE_LIBBLKID ++static int ++swap_is_swsuspend(const char *device) { ++ const char *type = blkid_get_tag_value(blkid, "TYPE", device); ++ ++ if (type && strcmp(type, "swsuspend")==0) ++ return 0; ++ return 1; ++} ++#else ++static int ++swap_is_swsuspend(const char *device) { ++ int fd, re = 1, n = getpagesize() - 10; ++ char buf[10]; ++ ++ fd = open(device, O_RDONLY); ++ if (fd < 0) ++ return -1; ++ ++ if (lseek(fd, n, SEEK_SET) >= 0 && ++ read(fd, buf, sizeof buf) == sizeof buf && ++ (memcmp("S1SUSPEND", buf, 9)==0 || ++ memcmp("S2SUSPEND", buf, 9)==0)) ++ re = 0; ++ ++ close(fd); ++ return re; ++} ++#endif ++ ++/* calls mkswap */ ++static int ++swap_reinitialize(const char *device) { ++ const char *label = mount_get_volume_label_by_spec(device); ++ pid_t pid; ++ ++ switch((pid=fork())) { ++ case -1: /* fork error */ ++ fprintf(stderr, _("%s: cannot fork: %s\n"), ++ progname, strerror(errno)); ++ return -1; ++ ++ case 0: /* child */ ++ if (label && *label) ++ execl(PATH_MKSWAP, PATH_MKSWAP, "-L", label, device, NULL); ++ else ++ execl(PATH_MKSWAP, PATH_MKSWAP, device, NULL); ++ exit(1); /* error */ ++ ++ default: /* parent */ ++ { ++ int status; ++ int ret; ++ ++ do { ++ if ((ret = waitpid(pid, &status, 0)) < 0 ++ && errno == EINTR) ++ continue; ++ else if (ret < 0) { ++ fprintf(stderr, _("%s: waitpid: %s\n"), ++ progname, strerror(errno)); ++ return -1; ++ } ++ } while (0); ++ ++ /* mkswap returns: 0=suss, 1=error */ ++ if (WIFEXITED(status) && WEXITSTATUS(status)==0) ++ return 0; /* ok */ ++ } ++ } ++ return -1; /* error */ ++} ++ + static int + do_swapon(const char *orig_special, int prio) { + int status; +@@ -187,6 +269,18 @@ + return -1; + } + ++ /* We have to reinitialize swap with old (=useless) software suspend ++ * data. The problem is that if we don't do it, then we get data ++ * corruption the next time with suspended on. ++ */ ++ if (swap_is_swsuspend(special)==0) { ++ fprintf(stdout, _("%s: %s: software suspend data detected. " ++ "Reinitializing the swap.\n"), ++ progname, special); ++ if (swap_reinitialize(special) < 0) ++ return -1; ++ } ++ + /* people generally dislike this warning - now it is printed + only when `verbose' is set */ + if (verbose) { diff --git a/debian/postinst b/debian/postinst index 9961f994..27df538f 100644 --- a/debian/postinst +++ b/debian/postinst @@ -26,9 +26,9 @@ if [ "$(uname -s)" = "Linux" ]; then model=$(uname -m) if [ ${model%x} != "s390" ]; then update-rc.d -f hwclock.sh remove 2>/dev/null > /dev/null - update-rc.d hwclock.sh start 50 S . stop 25 0 6 . > /dev/null + update-rc.d hwclock.sh start 22 S . stop 25 0 6 . > /dev/null update-rc.d -f hwclockfirst.sh remove 2>/dev/null > /dev/null - update-rc.d hwclockfirst.sh start 22 S . > /dev/null + update-rc.d hwclockfirst.sh start 18 S . > /dev/null fi fi diff --git a/debian/rules b/debian/rules index e6bef32e..b19dad67 100755 --- a/debian/rules +++ b/debian/rules @@ -48,7 +48,7 @@ CFDISK_POT=$(CFDISK_PO_DIR)/cfdisk.pot build: patch $(checkdir) ./configure - $(MAKE) all arch=$(arch) SUBDIRS="${SUBDIRS}" + $(MAKE) all CPU=$(arch) arch=$(arch) SUBDIRS="${SUBDIRS}" # $(MAKE) disk-utils/raw - this is done above if linux/raw.h exists touch build @@ -249,12 +249,12 @@ endif ifeq ($(arch),$(fdisk_arch)) # Do the udeb - install -d debian/tmp-fdisk-udeb/usr/sbin - install -d debian/tmp-fdisk-udeb/DEBIAN - install -m 755 fdisk/cfdisk fdisk/fdisk fdisk/sfdisk \ - debian/tmp-fdisk-udeb/usr/sbin + install -d debian/tmp-{c,}fdisk-udeb/usr/sbin + install -d debian/tmp-{c,}fdisk-udeb/DEBIAN + install -m 755 fdisk/cfdisk debian/tmp-cfdisk-udeb/usr/sbin + install -m 755 fdisk/fdisk fdisk/sfdisk debian/tmp-fdisk-udeb/usr/sbin strip --remove-section=.comment --remove-section=.note \ - debian/tmp-fdisk-udeb/usr/sbin/* + debian/tmp-{c,}fdisk-udeb/usr/sbin/* # Generate a po translations needed for cfdisk mkdir $(CFDISK_PO_DIR) @@ -263,14 +263,19 @@ ifeq ($(arch),$(fdisk_arch)) LANG=`basename $$po | cut -f1 -d.` ; \ msgmerge $$po $(CFDISK_POT) > $(CFDISK_PO_DIR)/$$LANG.po ; \ msgfmt $(CFDISK_PO_DIR)/$$LANG.po -o $(CFDISK_PO_DIR)/$$LANG.gmo ; \ - mkdir -p debian/tmp-fdisk-udeb/usr/share/locale/$$LANG/LC_MESSAGES ; \ - cp $(CFDISK_PO_DIR)/$$LANG.gmo debian/tmp-fdisk-udeb/usr/share/locale/$$LANG/LC_MESSAGES/util-linux.mo ; \ + mkdir -p debian/tmp-cfdisk-udeb/usr/share/locale/$$LANG/LC_MESSAGES ; \ + cp $(CFDISK_PO_DIR)/$$LANG.gmo debian/tmp-cfdisk-udeb/usr/share/locale/$$LANG/LC_MESSAGES/util-linux.mo ; \ done ls debian/tmp-fdisk-udeb/usr/sbin/* | xargs dpkg-shlibdeps -pfdisk-udeb dpkg-gencontrol -isp -pfdisk-udeb -Pdebian/tmp-fdisk-udeb -fdebian/files~ dpkg-distaddfile fdisk-udeb_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(arch).udeb debian-installer extra dpkg --build debian/tmp-fdisk-udeb ../fdisk-udeb_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(arch).udeb + + ls debian/tmp-cfdisk-udeb/usr/sbin/* | xargs dpkg-shlibdeps -pcfdisk-udeb + dpkg-gencontrol -isp -pcfdisk-udeb -Pdebian/tmp-cfdisk-udeb -fdebian/files~ + dpkg-distaddfile cfdisk-udeb_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(arch).udeb debian-installer extra + dpkg --build debian/tmp-cfdisk-udeb ../cfdisk-udeb_$(shell dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)_$(arch).udeb endif ifeq ($(arch),$(sparc)) # Do the udeb -- 2.39.5