From 07270aee02c13e53fa2c46bb5df2bd373d55bb29 Mon Sep 17 00:00:00 2001 From: Wichert Akkerman Date: Sun, 9 Jan 2000 01:31:17 +0000 Subject: [PATCH] scripts/cl-debian.pl: Allow space between `#' and the bugnumber in the changelog scripts scripts/start-stop-daemon.c: test for __sparc__ instead scripts/Makefile.in: add optlib to CFLAGS utils/start-stop-daemon.c: add option to chroot first, patch from Marco d'Itri utils/start-stop-daemon.8: document chroot option dselect/pkgtop.cc: use waddnstr to print package description instead of waddch --- ChangeLog | 10 ++++++++++ THANKS | 1 + TODO | 7 +++++++ configure.in | 2 +- debian/changelog | 8 ++++++++ dselect/pkgtop.cc | 2 +- scripts/cl-debian.pl | 2 +- utils/Makefile.in | 2 ++ utils/start-stop-daemon.8 | 6 ++++++ utils/start-stop-daemon.c | 17 +++++++++++++++-- 10 files changed, 52 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index cf583970..10b969e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Sun Jan 9 01:40:23 CET 2000 Wichert Akkerman + + * scripts/cl-debian.pl: Allow space between `#' and the bugnumber in the + changelog scripts + * scripts/start-stop-daemon.c: test for __sparc__ instead + * scripts/Makefile.in: add optlib to CFLAGS + * utils/start-stop-daemon.c: add option to chroot first, patch from Marco d'Itri + * utils/start-stop-daemon.8: document chroot option + * dselect/pkgtop.cc: use waddnstr to print package description instead of waddch + Fri Jan 7 18:24:45 CET 2000 Wichert Akkerman * dselect/method.cc: pass admindir to dpkg diff --git a/THANKS b/THANKS index b9bd37cc..c3c9ccda 100644 --- a/THANKS +++ b/THANKS @@ -29,6 +29,7 @@ Juergen Menden Juho Vuori Kim-Minh Kaplan Klee Dienes +Marco d'Itri Marcus Brinkmann Masato Taruishi Matt Welsh diff --git a/TODO b/TODO index 5dbc9756..435d771d 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,10 @@ + +* start-stop-daemon: write pidfile before we chroot? + +------------------------------------------------------------------------------ + +Old TODO entries from IWJ: + Here are some currently-known inadequacies: urgent diff --git a/configure.in b/configure.in index 57a337f6..1320e1f3 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. -AC_PREREQ([2.12]) +AC_PREREQ([2.13]) AC_INIT(include/dpkg.h.in) AC_CONFIG_HEADER(config.h) diff --git a/debian/changelog b/debian/changelog index 86d978d8..26cf51d4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +dpkg (1.6.7) unstable; urgency=low + + * start-stop-daemon can chroot now, Closes: Bug#54513 + * Allow space between # and the bugnumber in the changelog + * Display package description with waddnstr, Closes: Bug#54313 + + -- Wichert Akkerman UNRELEASED + dpkg (1.6.6) unstable; urgency=low * dpkg-buildpackage supports debsign, Closes: Bug#58333 diff --git a/dselect/pkgtop.cc b/dselect/pkgtop.cc index ade9428f..f6466eda 100644 --- a/dselect/pkgtop.cc +++ b/dselect/pkgtop.cc @@ -221,7 +221,7 @@ void packagelist::redraw1itemsel(int index, int selected) { i= description_width; p= info->description ? info->description : ""; - while (i>0 && *p && *p != '\n') { waddch(listpad,*p); i--; p++; } + while (i>0 && *p && *p != '\n') { waddnstr(listpad,p,1); i--; p++; } } else { diff --git a/scripts/cl-debian.pl b/scripts/cl-debian.pl index dc823f2d..5ec9f54e 100755 --- a/scripts/cl-debian.pl +++ b/scripts/cl-debian.pl @@ -138,7 +138,7 @@ $expect eq 'next heading or eof' || die "found eof where expected $expect"; $f{'Changes'} =~ s/\n$//; $f{'Changes'} =~ s/^/\n/; -while ($f{'Changes'} =~ /closes:\s*(?:bug)?\#\d+(?:,\s*(?:bug)?\#\d+)*/ig) { +while ($f{'Changes'} =~ /closes:\s*(?:bug)?\#\s*\d+(?:,\s*(?:bug)?\#\s*\d+)*/ig) { push(@closes, $& =~ /\#(\d+)/g); } $f{'Closes'} = join(' ',sort { $a <=> $b} @closes); diff --git a/utils/Makefile.in b/utils/Makefile.in index 99a7342f..09cbf464 100644 --- a/utils/Makefile.in +++ b/utils/Makefile.in @@ -5,6 +5,8 @@ top_srcdir = @top_srcdir@ include ../Makefile.conf +CFLAGS += $(top_srcdir)/optlib + SSD_SOURCES = start-stop-daemon.c SSD_OBJECTS = $(patsubst %.c, %.o, $(SSD_SOURCES)) SSD_MANPAGES = start-stop-daemon.8 diff --git a/utils/start-stop-daemon.8 b/utils/start-stop-daemon.8 index 71bed3ec..0b7bad09 100644 --- a/utils/start-stop-daemon.8 +++ b/utils/start-stop-daemon.8 @@ -130,6 +130,12 @@ even if the `group' options is not specified. The group option is only for groups that the user isn't normally a member of (like adding per/process group membership for generic users like `nobody'). .TP +.I -r|--chroot root +Chdir and chroot to +.B root +before starting the process. Please note that the pidfile is also written +after the chroot. +.TP .I -b|--background Typically used with programs that don't detach on their own. This option will force diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c index def1026d..47a974dc 100644 --- a/utils/start-stop-daemon.c +++ b/utils/start-stop-daemon.c @@ -21,7 +21,7 @@ #define OSLinux #elif defined(__GNU__) #define OSHURD -#elif defined(Sparc) +#elif defined(__sparc__) #define OSsunos #else #error Unknown architecture - cannot build start-stop-daemon @@ -73,6 +73,7 @@ static int runas_gid = -1; static const char *userspec = NULL; static char *changeuser = NULL; static char *changegroup = NULL; +static char *changeroot = NULL; static const char *cmdname = NULL; static char *execname = NULL; static char *startas = NULL; @@ -255,6 +256,7 @@ parse_options(int argc, char * const *argv) { "signal", 1, NULL, 's'}, { "test", 0, NULL, 't'}, { "user", 1, NULL, 'u'}, + { "chroot", 1, NULL, 'r'}, { "verbose", 0, NULL, 'v'}, { "exec", 1, NULL, 'x'}, { "chuid", 1, NULL, 'c'}, @@ -265,7 +267,7 @@ parse_options(int argc, char * const *argv) int c; for (;;) { - c = getopt_long(argc, argv, "HKSVa:n:op:qs:tu:vx:c:bm", + c = getopt_long(argc, argv, "HKSVa:n:op:qr:s:tu:vx:c:bm", longopts, (int *) 0); if (c == -1) break; @@ -319,6 +321,9 @@ parse_options(int argc, char * const *argv) changeuser = strtok(changeuser, ":"); changegroup = strtok(NULL, ":"); break; + case 'r': /* --chroot /new/root */ + changeroot = optarg; + break; case 'b': /* --background */ background = 1; break; @@ -650,12 +655,20 @@ main(int argc, char **argv) else printf(")"); } + if (changeroot != NULL) + printf(" in directory %s", changeroot); printf(".\n"); exit(0); } if (quietmode < 0) printf("Starting %s...\n", startas); *--argv = startas; + if (changeroot != NULL) { + if (chdir(changeroot) < 0) + fatal("Unable to chdir() to %s", changeroot); + if (chroot(changeroot) < 0) + fatal("Unable to chroot() to %s", changeroot); + } if (changeuser != NULL) { if (setgid(runas_gid)) fatal("Unable to set gid to %d", runas_gid); -- 2.39.5