cowdancer-0.73/0000755000000000000000000000000012173570424010303 5ustar cowdancer-0.73/cowdancer-ilistdump.10000644000000000000000000000123711220436222014332 0ustar .TH "cowdancer\-ilistdump" 1 "2007 Aug 31" "cowdancer" "cowdancer" .SH "NAME" cowdancer\-ilistdump \- Dump contents of ilist file. .SH "SYNOPSIS" .BI "cowdancer-ilistdump " "ilist-path" .SH "DESCRIPTION" .B cowdancer\-ilistdump Dumps the contents of .ilist file used in cowdancer. .SH "EXAMPLES" .TP .B "cowdancer-ilistdump .ilist" dumps the content of .ilist file. Output is in the form of 'device number' 'inode number' for one file per line. Also gives header information to stderr. .SH "AUTHOR" Junichi Uekawa (dancer@debian.org) Upstream page is available at .B "http://www.netfort.gr.jp/~dancer/software/cowdancer.html" .SH "SEE ALSO" .BR "cow-shell (" 1 ")" cowdancer-0.73/main.c0000644000000000000000000000025511304446105011366 0ustar /** Just calls app_main. Makes easier for testing individual functions. */ int app_main(int ac, char** av); int main(int ac, char** av) { return app_main(ac, av); } cowdancer-0.73/NEWS0000644000000000000000000000421511220436222010771 0ustar 0.26 4 Mar 2007 + add RPM spec file. 0.22 26 Aug 2006 + cowbuilder documentation update. 0.21 20 Aug 2006 + cowbuilder bugfix 0.15 29 May 2006 + add help message to cowbuilder. + fix --basepath handling, --distribution handling + fix other option handling + update testsuite 0.14 24 May 2006 + introducing an application "cowbuilder", a pbuilder frontend to use cowdancer. 0.13 5 Mar 2006 + Fix: support quote and space in filenames (use exec instead of system.) 0.12 5 Mar 2006 + Fix: support space in filenames. Currently still doesn't support filename with "'", is there a need? 0.11 25 Jan 2006 + Check for error values on COW operation, and return error to application, with ENOMEM. 0.10 14 Jan 2006 + fixes hangs with applications that are using pthread. + Added more checks in the testsuite. 0.9 8 Jan 2006 + Change order of copying. for the case when /lib/ld.so binary is written to; I cannot fork/exec shared binaries while ld.so does not exist. 0.8 28 Dec 2005 + Speed improvement 1: save binary ilist in cow-shell and load the binary data with mmap in cowdancer. + Speed improvement 2: sort ilist and do a binary search within it. + Make code a bit more thread-safe than it was. 0.7 23 Nov 2005 + Bug fix: Work around 5.3.0 coreutils 'feature' which stat no longer emits a newline for --format option. + Bug fix: Work around recent coreutils failing to do cp -al 1/ 2/ when 2/ does not already exist. + Environment variable COWDANCER_DEBUG can now be used for debugging e.g. COWDANCER_DEBUG=1 make -k check (warning, log is massive) 0.6 28 Oct 2005 + Add support for chown and chmod + Fix problem with powerpc, fill structs with memset. 0.5 21 Sep 2005 + Support the case when SHELL is not a full path 0.4 30 Aug 2005 + Fix Error checking so that it does more than kill(SIGSEGV) to self. 0.3 20 Aug 2005 + Add regression testsuite. + Support symbollic links + fopen/fopen64 is now trapped + only COW regular files + do not try to cross device boundaries when creating the ilink list. + Now it is able to run pbuilder 0.130. 0.2 13 Aug 2005 + Buffer overflow bug fixed. 0.1 13 Aug 2005 + Initial Public Release. cowdancer-0.73/cowbuilder_util.h0000644000000000000000000000026712124574554013661 0ustar #ifndef COWBUILDER_UTIL_H #define COWBUILDER_UTIL_H int check_mountpoint(const char* mountpoint); void canonicalize_doubleslash(const char* buildplace, char* dest); #endif cowdancer-0.73/cowdancer-ilistcreate.10000644000000000000000000000140211220436222014622 0ustar .TH "cowdancer\-ilistcreate" 1 "2007 Aug 31" "cowdancer" "cowdancer" .SH "NAME" cowdancer\-ilistcreate \- create .ilist file for use with cowdancer. .SH "SYNOPSIS" .BI "cowdancer-ilistcreate " "ilist-path find-option " .SH "DESCRIPTION" .B cowdancer\-ilistcreate generates .ilist file with custom find operation. Low-level command for use internally. .SH "EXAMPLES" .TP .B "cowdancer-ilistcreate .ilist 'find . -xdev -path ./home -prune -o \( \( -type l -o -type f \) -a -links +1 -print0 \) | xargs -0 stat --format \"%d %i \"'" Create .ilist file with excluding "./home/" directory. .SH "AUTHOR" Junichi Uekawa (dancer@debian.org) Upstream page is available at .B "http://www.netfort.gr.jp/~dancer/software/cowdancer.html" .SH "SEE ALSO" .BR "cow-shell (" 1 ")" cowdancer-0.73/test_cowbuilder.c0000755000000000000000000000202612124602320013633 0ustar /*BINFMTC: cowbuilder.c parameter.c forkexec.c ilistcreate.c cowbuilder_util.c */ #define _GNU_SOURCE #include #include #include #include #include #include #include "file.h" #include "parameter.h" // utility to check hardlink count of file. static int check_hardlink_count(const char* filename) { struct stat buf; stat(filename, &buf); return buf.st_nlink; } int break_cowlink(const char* s); void test_break_cowlink() { char *temp = strdupa("/tmp/cowtestXXXXXX"); char *temp2 = strdupa("/tmp/cowtestXXXXXX"); close(mkstemp(temp)); close(mkstemp(temp2)); assert(check_hardlink_count(temp2) == 1); assert(check_hardlink_count(temp) == 1); assert(-1!=unlink(temp2)); assert(-1!=link(temp, temp2)); assert(check_hardlink_count(temp2) == 2); assert(check_hardlink_count(temp) == 2); break_cowlink(temp2); assert(check_hardlink_count(temp2) == 1); assert(check_hardlink_count(temp) == 1); } int main() { test_break_cowlink(); return 0; } cowdancer-0.73/cowdancer-ilistdump.c0000755000000000000000000000217111220436222014415 0ustar /*BINFMTC: ilistcreate.c * * Debug program for dumping ilist file contents. */ #define _GNU_SOURCE #include #include #include #include "ilist.h" const char* ilist_PRGNAME="cowdancer-ilistdump"; int main(int argc, char** argv) { struct ilist_struct s; struct ilist_header h; FILE*f; if (argc != 2) { fprintf (stderr, "%s ilist-path \n\n\tdump contents of .ilist file\n\n", argv[0]); return 1; } fprintf (stderr, "ilist_struct size on this architecture: %i\n", (int)sizeof(struct ilist_struct)); f=fopen (argv[1], "r"); if (!f) { fprintf (stderr, "%s: cannot open file %s\n", argv[0], argv[1]); return 1; } fread(&h, sizeof(struct ilist_header), 1, f); fprintf(stderr, "Signature: %x (expect %x)\n" "Revision: %i (expect %i)\n" "Struct size: %i\n\n", h.ilistsig, ILISTSIG, h.revision, ILISTREVISION, h.ilist_struct_size ); while(fread(&s, sizeof(struct ilist_struct), 1, f)) { printf ("%li %li\n", (long)s.dev, (long)s.inode); } fclose(f); return 0; } cowdancer-0.73/parameter.c0000644000000000000000000004017412126404445012432 0ustar /*BINFMTC: * parameter handling for cpbuilder. * Copyright (C) 2007-2009 Junichi Uekawa * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #define _GNU_SOURCE #include #include #include #include #include #include #include "parameter.h" #include /* The pbuilder command-line to pass 0: pbuilder 1: build/create/login etc. offset: the next command The last-command will be PBUILDER_ADD_PARAM(NULL); */ char* pbuildercommandline[MAXPBUILDERCOMMANDLINE]; int offset=2; /* get size of Null Terminated array of strings */ int size_of_ntarray(char ** buf) { int i = 0; while(buf[i]) { ++i; assert(i < MAX_CUSTOM_FILES); } return i; } /** * @returns strdup of string with optionally removing the starting and * trailing "'". bash 'set' command will quote. * ... for ', ''"'" */ char* strdup_strip_quote(const char* p) { if (*p == 0) { return strdup(""); } size_t len = strlen(p); if (*p == '\'' && p[len-1] == '\'') { char* ret = strdup(p+1); assert(strlen(ret) == len - 1); ret[len-2] = 0; return ret; } return strdup(p); } /** * load configuration. * * Returns bash return codes or -1 on popen error. * * Most interesting codes: * -1 = popen failed * 0 = ok * 1 = file not found * 2 = syntax error */ int load_config_file(const char* config, pbuilderconfig* pc) { char *s; FILE* f; char* buf=NULL; size_t bufsiz=0; char* delim; int result; asprintf(&s, "env bash -c 'set -e ; . %s; set ' 2>&1", config); f=popen(s, "r"); if( NULL == f ) return -1; while ( (0 == feof(f)) && (getline(&buf,&bufsiz,f)>0) ) { if (strrchr(buf,'\n')) { *(strrchr(buf,'\n'))=0; } if ((delim=strchr(buf,'='))) { /* assuming config entry */ *(delim++)=0; if (!strcmp(buf, "MIRRORSITE")) { pc->mirror=strdup_strip_quote(delim); } else if (!strcmp(buf, "BUILDRESULT")) { pc->buildresult=strdup_strip_quote(delim); } else if (!strcmp(buf, "DISTRIBUTION")) { pc->distribution=strdup_strip_quote(delim); } else if (!strcmp(buf, "KERNEL_IMAGE")) { pc->kernel_image=strdup_strip_quote(delim); } else if (!strcmp(buf, "INITRD")) { pc->initrd=strdup_strip_quote(delim); } else if (!strcmp(buf, "MEMORY_MEGS")) { pc->memory_megs=atoi(delim); } else if (!strcmp(buf, "ARCHITECTURE")) { pc->arch=strdup_strip_quote(delim); } else if (!strcmp(buf, "ARCH")) { pc->arch=strdup_strip_quote(delim); } else if (!strcmp(buf, "BASEPATH")) { pc->basepath=strdup_strip_quote(delim); } else if (!strcmp(buf, "BUILDPLACE")) { pc->buildplace=strdup_strip_quote(delim); } else if (!strcmp(buf, "COMPONENTS")) { pc->components=strdup_strip_quote(delim); } else if (!strcmp(buf, "OTHERMIRROR")) { pc->othermirror=strdup_strip_quote(delim); } else if (!strcmp(buf, "SMP")) { pc->smp=strdup_strip_quote(delim); } else if (!strcmp(buf, "DEBBUILDOPTS")) { pc->debbuildopts=strdup_strip_quote(delim); } else if (!strcmp(buf, "BINARY_ARCH")) { pc->binary_arch=1; } else if (!strcmp(buf, "NO_COWDANCER_UPDATE")) { pc->no_cowdancer_update=1; } else if (!strcmp(buf, "DEBIAN_ETCH_WORKAROUND")) { pc->debian_etch_workaround=1; } else if (!strcmp(buf, "ARCH_DISKDEVICE")) { pc->arch_diskdevice=strdup_strip_quote(delim); } else if (!strcmp(buf, "HTTP_PROXY")) { pc->http_proxy=strdup_strip_quote(delim); } } } result = WEXITSTATUS( pclose(f) ); if(buf) { // Don't warn of missing config files if( result > 1 ) printf( "(exit %i) -> %s\n", result, buf ); free(buf); } if(s) free(s); return result; } int cpbuilder_dumpconfig(pbuilderconfig* pc) { /* dump configuration */ int i; printf("dump config\n"); #define DUMPINT(S) printf(" "#S": %i\n", pc->S); #define DUMPSTR(S) printf(" "#S": %s\n", pc->S); #define DUMPSTRARRAY(S) i=0; \ while (pc->S[i]) \ { \ printf(" "#S"[%i]: %s\n", i, pc->S[i]); \ i++; \ } DUMPINT(mountproc); DUMPINT(mountdev); DUMPINT(mountdevpts); DUMPINT(save_after_login); DUMPINT(debug); DUMPSTR(buildplace); DUMPSTR(buildresult); DUMPSTR(basepath); DUMPSTR(mirror); DUMPSTR(distribution); DUMPSTR(components); DUMPSTR(othermirror); DUMPSTR(smp); DUMPSTR(debbuildopts); DUMPINT(binary_arch); DUMPSTR(http_proxy); DUMPSTRARRAY(inputfile); DUMPSTRARRAY(outputfile); DUMPINT(no_cowdancer_update); DUMPSTR(kernel_image); DUMPSTR(initrd); DUMPINT(memory_megs); DUMPSTR(arch); return 0; } int parse_parameter(int ac, char** av, const char* keyword) { int c; /* option */ int index_point; int config_ok = -1, load_ok; char * cmdstr=NULL; static pbuilderconfig pc; static struct option long_options[]= { {"basepath", required_argument, 0, 'b'}, {"buildplace", required_argument, 0, 'B'}, {"mountproc", no_argument, &(pc.mountproc), 1}, {"mountdev", no_argument, &(pc.mountdev), 1}, {"mountdevpts", no_argument, &(pc.mountdevpts), 1}, {"nomountproc", no_argument, &(pc.mountproc), 0}, {"nomountdev", no_argument, &(pc.mountdev), 0}, {"nomountdevpts", no_argument, &(pc.mountdevpts), 0}, {"save-after-login", no_argument, &(pc.save_after_login), 1}, {"save-after-exec", no_argument, &(pc.save_after_login), 1}, {"build", no_argument, (int*)&(pc.operation), pbuilder_build}, {"create", no_argument, (int*)&(pc.operation), pbuilder_create}, {"update", no_argument, (int*)&(pc.operation), pbuilder_update}, {"login", no_argument, (int*)&(pc.operation), pbuilder_login}, {"execute", no_argument, (int*)&(pc.operation), pbuilder_execute}, {"help", no_argument, (int*)&(pc.operation), pbuilder_help}, {"dumpconfig", no_argument, (int*)&(pc.operation), pbuilder_dumpconfig}, {"version", no_argument, 0, 'v'}, {"debug", no_argument, 0, 0}, {"configfile", required_argument, 0, 'c'}, {"mirror", required_argument, 0, 0}, {"buildresult", required_argument, 0, 0}, {"distribution", required_argument, 0, 0}, {"components", required_argument, 0, 0}, {"othermirror", required_argument, 0, 0}, {"smp", required_argument, 0, 0}, {"debbuildopts", required_argument, 0, 0}, {"binary-arch", no_argument, 0, 0}, {"inputfile", required_argument, 0, 0}, {"outputfile", required_argument, 0, 0}, {"architecture", required_argument, 0, 0}, {"http-proxy", required_argument, 0, 0}, /* cowbuilder specific options */ {"no-cowdancer-update", no_argument, 0, 0}, {"debian-etch-workaround", no_argument, 0, 0}, /* qemubuilder specific options */ {"arch-diskdevice", no_argument, 0, 0}, /* verbatim options with argument, synced as of pbuilder 0.153 */ {"aptcache", required_argument, 0, 'M'}, {"extrapackages", required_argument, 0, 'M'}, {"hookdir", required_argument, 0, 'M'}, {"debemail", required_argument, 0, 'M'}, {"logfile", required_argument, 0, 'M'}, {"aptconfdir", required_argument, 0, 'M'}, {"keyring", required_argument, 0, 'M'}, {"timeout", required_argument, 0, 'M'}, {"bindmounts", required_argument, 0, 'M'}, {"debootstrapopts", required_argument, 0, 'M'}, {"debootstrap", required_argument, 0, 'M'}, /* verbatim options without argument, synced as of pbuilder 0.153 */ {"allow-untrusted", no_argument, 0, 'm'}, {"removepackages", no_argument, 0, 'm'}, {"override-config", no_argument, 0, 'm'}, {"pkgname-logfile", no_argument, 0, 'm'}, {"preserve-buildplace", no_argument, 0, 'm'}, {"autocleanaptcache", no_argument, 0, 'm'}, {"twice", no_argument, 0, 'm'}, {0,0,0,0} }; /* define pc to be clear. */ memset (&pc, 0, sizeof(pbuilderconfig)); /* default command-line component */ pbuildercommandline[0]="pbuilder"; /** * Try to load all standard config files. * Skip non existing, but exit on broken ones. * config_ok is 0, if any load was successfull **/ load_ok = load_config_file("/usr/share/pbuilder/pbuilderrc", &pc); if( load_ok > 1 ) exit( 2 ); if( config_ok != 0 ) config_ok = load_ok; load_ok = load_config_file("/etc/pbuilderrc", &pc); if( load_ok > 1 ) exit( 3 ); if( config_ok != 0 ) config_ok = load_ok; load_ok = load_config_file("~/.pbuilderrc", &pc); if( load_ok > 1 ) exit( 4 ); if( config_ok != 0 ) config_ok = load_ok; #define PASS_TO_PBUILDER_WITH_PARAM PBUILDER_ADD_PARAM(cmdstr); \ PBUILDER_ADD_PARAM(strdup(optarg)); /* load config files here. */ while((c = getopt_long (ac, av, "b:d:Mmhv", long_options, &index_point)) != -1) { switch (c) { case 'b': /* basepath */ if (pc.operation == pbuilder_create) { if (mkdir(optarg, 0777)<0) { perror("mkdir"); return 1; } } else if (!pc.operation) { fprintf(stderr, "need to specify operation before --basepath option\n"); return 1; } if (!(pc.basepath = canonicalize_file_name(optarg))) { fprintf(stderr, "cannot canonicalize filename %s, does not exist\n", optarg); return 1; } break; case 'B': /* buildplace */ pc.buildplace = strdup(optarg); break; case 'c': /* --config */ load_ok = load_config_file(optarg, &pc); if( load_ok > 1 ) exit( 5 ); if( config_ok != 0 ) config_ok = load_ok; if (0>asprintf(&cmdstr, "--%s", long_options[index_point].name)) { /* error */ fprintf(stderr, "out of memory constructing command-line options\n"); exit (1); } PASS_TO_PBUILDER_WITH_PARAM break; case 'M': /* pass through to pbuilder: duplicate with param */ if (0>asprintf(&cmdstr, "--%s", long_options[index_point].name)) { /* error */ fprintf(stderr, "out of memory constructing command-line options\n"); exit (1); } PASS_TO_PBUILDER_WITH_PARAM break; case 'm': /* pass through to pbuilder: duplicate without param */ if (0>asprintf(&cmdstr, "--%s", long_options[index_point].name)) { /* error */ fprintf(stderr, "out of memory constructing command-line options\n"); exit (1); } PBUILDER_ADD_PARAM(cmdstr); break; case 0: /* other cases with long option with flags, this is expected behavior, so ignore it, for most of the time. */ /* handle specific options which also give 0. */ /* first, generate 'cmdstr' which is useful anyway */ if (0>asprintf(&cmdstr, "--%s", long_options[index_point].name)) { /* error */ fprintf(stderr, "out of memory constructing command-line options\n"); exit (1); } if (!strcmp(long_options[index_point].name,"mirror")) { pc.mirror=strdup(optarg); } else if (!strcmp(long_options[index_point].name,"buildresult")) { pc.buildresult=strdup(optarg); } else if (!strcmp(long_options[index_point].name,"distribution")) { pc.distribution=strdup(optarg); } else if (!strcmp(long_options[index_point].name,"no-cowdancer-update")) { pc.no_cowdancer_update=1; } else if (!strcmp(long_options[index_point].name,"debian-etch-workaround")) { pc.debian_etch_workaround=1; } else if (!strcmp(long_options[index_point].name,"architecture")) { pc.arch=strdup(optarg); } else if (!strcmp(long_options[index_point].name,"arch-diskdevice")) { pc.arch_diskdevice=strdup(optarg); } else if (!strcmp(long_options[index_point].name,"debug")) { pc.debug=1; PBUILDER_ADD_PARAM(cmdstr); } else if (!strcmp(long_options[index_point].name,"inputfile")) { pc.inputfile[size_of_ntarray(pc.inputfile)]=strdup(optarg); if (size_of_ntarray(pc.inputfile) >= MAX_CUSTOM_FILES) { fprintf(stderr, "too many inputfile options\n"); exit (1); } PASS_TO_PBUILDER_WITH_PARAM } else if (!strcmp(long_options[index_point].name,"outputfile")) { pc.inputfile[size_of_ntarray(pc.outputfile)]=strdup(optarg); if (size_of_ntarray(pc.outputfile) >= MAX_CUSTOM_FILES) { fprintf(stderr, "too many outputfile options\n"); exit (1); } } else if (!strcmp(long_options[index_point].name,"components")) { /* this is for qemubuilder */ pc.components=strdup(optarg); /* pass it for cowbuilder */ PASS_TO_PBUILDER_WITH_PARAM } else if (!strcmp(long_options[index_point].name,"othermirror")) { /* this is for qemubuilder */ pc.othermirror=strdup(optarg); /* pass it for cowbuilder */ PASS_TO_PBUILDER_WITH_PARAM } else if (!strcmp(long_options[index_point].name,"smp")) { /* this is for qemubuilder */ pc.smp=strdup(optarg); /* pass it for cowbuilder */ PASS_TO_PBUILDER_WITH_PARAM } else if (!strcmp(long_options[index_point].name,"http-proxy")) { /* this is for qemubuilder */ pc.http_proxy=strdup(optarg); /* pass it for cowbuilder */ PASS_TO_PBUILDER_WITH_PARAM } else if (!strcmp(long_options[index_point].name,"debbuildopts")) { /* this is for qemubuilder */ pc.debbuildopts=strdup(optarg); /* pass it for cowbuilder */ PASS_TO_PBUILDER_WITH_PARAM } else if (!strcmp(long_options[index_point].name,"binary-arch")) { pc.binary_arch=1; PBUILDER_ADD_PARAM(cmdstr); } break; case 'h': /* -h */ case 'v': /* -v --version */ pc.operation=pbuilder_help; break; default: fprintf(stderr, "Unhandled option\n"); /* Error case. */ return 1; } } if( 0 != config_ok ) { printf( "Couldn't load any valid config file.\n" ); exit( 6 ); } /* set default values */ if (!pc.basepath) asprintf(&(pc.basepath), "/var/cache/pbuilder/base.%s", keyword); if (!pc.buildplace) { fprintf(stderr, "E: BUILDPLACE is not set\n"); return 1; } else { char* buildplace_ = pc.buildplace; mkdir(buildplace_,0777); /* create if it does not exist */ /* Bug: 573126 This adds '//' if buildplace already ends with / */ asprintf(&(pc.buildplace), "%s/%s.%i", buildplace_, keyword, (int)getpid()); free(buildplace_); } if (!pc.distribution) pc.distribution=strdup("sid"); if (!pc.memory_megs) pc.memory_megs=128; switch(pc.operation) { case pbuilder_build: if (!av[optind]) { /* parameter missing */ fprintf(stderr, "E: parameter missing for build operation\n"); return 1; } return cpbuilder_build(&pc, av[optind]); case pbuilder_create: if (av[optind]) { /* extra parameter */ fprintf(stderr, "E: too many parameters for create\n"); return 1; } return cpbuilder_create(&pc); case pbuilder_update: if (av[optind]) { /* extra parameter */ fprintf(stderr, "E: too many parameters for update\n"); return 1; } return cpbuilder_update(&pc); case pbuilder_login: return cpbuilder_login(&pc); case pbuilder_execute: if (!av[optind]) { /* parameter missing */ fprintf(stderr, "E: parameter missing for execute operation\n"); return 1; } return cpbuilder_execute(&pc, &av[optind]); case pbuilder_help: return cpbuilder_help(); case pbuilder_dumpconfig: return cpbuilder_dumpconfig(&pc); default: fprintf (stderr, "E: No operation specified\n"); return 1; } return 0; } cowdancer-0.73/perf.data0000644000000000000000000004123412052527640012074 0ustar PERFFILEhXˆX(8;ąHü Hčh cyclesP’’’’’’’Ÿ’’’’’’’’[kernel.kallsyms]_stextx’’’’ ’’’’’o/lib/modules/3.2.0-4-amd64/kernel/drivers/usb/usb-common.kox’’’’p ’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/usb/core/usbcore.kox’’’’€ ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/arch/x86/crypto/aes-x86_64.ko€’’’’ą ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/arch/x86/crypto/crc32c-intel.kop’’’’0 ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/lib/crc-t10dif.koc32cx’’’’ ’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/scsi/scsi_mod.kop’’’’  ’’’’’Ÿ/lib/modules/3.2.0-4-amd64/kernel/crypto/aes_generic.kox’’’’Ą ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/ata/ata_generic.koh’’’’ ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/fs/mbcache.kop’’’’` ’’’’’?/lib/modules/3.2.0-4-amd64/kernel/drivers/ata/libata.koˆ’’’’   ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/arch/x86/crypto/ghash-clmulni-intel.kox’’’’š  ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/drivers/hid/hid-apple.koulni-x’’’’P  ’’’’’Æ/lib/modules/3.2.0-4-amd64/kernel/drivers/hid/usbhid/usbhid.ko-p’’’’  ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/crypto/cryptd.kod/usbp’’’’P  ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/hid/hid.kousbx’’’’   ’’’’’Ÿ/lib/modules/3.2.0-4-amd64/kernel/drivers/scsi/sd_mod.kop’’’’@  ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/sound/soundcore.ko.kop’’’’  ’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/scsi/sg.ko.kop’’’’ ’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/md/dm-mod.koox’’’’  ’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/acpi/processor.kox’’’’  ’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/acpi/battery.kooˆ’’’’0 ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/watchdog/iTCO_vendor_support.kox’’’’€ ’’’’’Æ/lib/modules/3.2.0-4-amd64/kernel/drivers/usb/host/ehci-hcd.kosh’’’’0 ’’’’’ļ/lib/modules/3.2.0-4-amd64/kernel/fs/jbd/jbd.ko€’’’’  ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/drivers/thermal/thermal_sys.koˆ’’’’€ ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/drivers/media/video/v4l2-compat-ioctl32.kox’’’’ą ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/power/power_supply.ko€’’’’0 ’’’’’ß/lib/modules/3.2.0-4-amd64/kernel/arch/x86/crypto/aesni-intel.ko€’’’’ ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/i2c/algos/i2c-algo-bit.kox’’’’` ’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/ata/ata_piix.kogo-bitx’’’’š ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/acpi/button.kogo-bitx’’’’@ ’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/usb/host/uhci-hcd.kotp’’’’Ą ’’’’’/lib/modules/3.2.0-4-amd64/kernel/fs/ext3/ext3.ko/uhci-€’’’’P ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/drivers/i2c/busses/i2c-i801.kox’’’’° ’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/input/misc/pcspkr.koo€’’’’0 ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/input/input-polldev.kop’’’’€ ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/net/rfkill/rfkill.koo’’’’ą ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/net/wireless/brcm80211/brcmutil/brcmutil.kox’’’’0 ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/drivers/media/media.kocm80211x’’’’ ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/drivers/watchdog/iTCO_wdt.ko1p’’’’š ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/drivers/acpi/video.kop’’’’P ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/acpi/ac.kokox’’’’  ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/drivers/hwmon/applesmc.kox’’’’ ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/hwmon/coretemp.ko€’’’’P ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/drivers/cpufreq/acpi-cpufreq.ko€’’’’° ’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/video/backlight/apple_bl.kox’’’’0 ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/cpufreq/mperf.kopple_x’’’’€ ’’’’’o/lib/modules/3.2.0-4-amd64/kernel/drivers/i2c/i2c-core.kopple_€’’’’š ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/sound/core/seq/snd-seq-midi-event.koh’’’’@ ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/lib/crc8.koeqh’’’’ ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/lib/crc16.koqx’’’’ą ’’’’’o/lib/modules/3.2.0-4-amd64/kernel/drivers/input/joydev.kox’’’’P ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/drivers/input/evdev.kox’’’’° ’’’’’/lib/modules/3.2.0-4-amd64/kernel/sound/core/snd-rawmidi.ko€’’’’@  ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/input/mouse/bcm5974.kox’’’’  ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/drivers/bluetooth/btusb.ko.ko€’’’’š  ’’’’’//lib/modules/3.2.0-4-amd64/kernel/drivers/media/video/videodev.ko€’’’’ " ’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/gpu/drm/drm_kms_helper.koh’’’’ " ’’’’’o/lib/modules/3.2.0-4-amd64/kernel/lib/cordic.kox’’’’# ’’’’’ļ/lib/modules/3.2.0-4-amd64/kernel/net/bluetooth/bluetooth.kox’’’’% ’’’’’//lib/modules/3.2.0-4-amd64/kernel/net/wireless/cfg80211.koop’’’’0' ’’’’’ß/lib/modules/3.2.0-4-amd64/kernel/sound/core/snd.ko211.x’’’’( ’’’’’Ÿ/lib/modules/3.2.0-4-amd64/kernel/drivers/gpu/drm/drm.kox’’’’°* ’’’’’o/lib/modules/3.2.0-4-amd64/kernel/sound/core/snd-timer.ko€’’’’ + ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/sound/core/seq/snd-seq-device.ko€’’’’p+ ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/sound/core/seq/snd-seq-midi.koox’’’’Ą+ ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/sound/core/snd-page-alloc.koo€’’’’, ’’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/media/video/uvc/uvcvideo.kox’’’’- ’’’’’/lib/modules/3.2.0-4-amd64/kernel/net/mac80211/mac80211.kovcvidx’’’’ 0 ’’’’’Ÿ/lib/modules/3.2.0-4-amd64/kernel/drivers/gpu/drm/i915/i915.kod€’’’’Ą5 ’’’’’/lib/modules/3.2.0-4-amd64/kernel/sound/pci/hda/snd-hda-codec-hdmi.kop’’’’P6 ’’’’’o/lib/modules/3.2.0-4-amd64/kernel/drivers/block/loop.kox’’’’Ą6 ’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/md/dm-crypt.ko’’’’P7 ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/net/wireless/brcm80211/brcmsmac/brcmsmac.ko€’’’’ > ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/sound/core/oss/snd-mixer-oss.korcmsma€’’’’? ’’’’’Ÿ/lib/modules/3.2.0-4-amd64/kernel/sound/pci/hda/snd-hda-intel.korcmsmax’’’’ ? ’’’’’Ļ/lib/modules/3.2.0-4-amd64/kernel/sound/core/seq/snd-seq.kol.kop’’’’p@ ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/crypto/arc4.kosnd-seqp’’’’Ą@ ’’’’’/lib/modules/3.2.0-4-amd64/kernel/sound/core/snd-pcm.kox’’’’ŠA ’’’’’æ/lib/modules/3.2.0-4-amd64/kernel/sound/core/oss/snd-pcm-oss.kox’’’’B ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/sound/core/snd-hwdep.koss.ko€’’’’ąB ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/sound/pci/hda/snd-hda-codec.ko€’’’’0D ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/sound/pci/hda/snd-hda-codec-cirrus.ko€’’’’D ’’’’’Ļ/lib/modules/3.2.0-4-amd64/kernel/net/sunrpc/auth_gss/auth_rpcgss.kokop’’’’`E ’’’’’/lib/modules/3.2.0-4-amd64/kernel/arch/x86/kvm/kvm.koaup’’’’ąI ’’’’’Ÿ/lib/modules/3.2.0-4-amd64/kernel/fs/fscache/fscache.kox’’’’€J ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/fs/nfs_common/nfs_acl.kox’’’’ŠJ ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/drivers/input/misc/uinput.kop’’’’0K ’’’’’/lib/modules/3.2.0-4-amd64/kernel/fs/binfmt_misc.ko/uinx’’’’°K ’’’’’ļ/lib/modules/3.2.0-4-amd64/kernel/arch/x86/kvm/kvm-intel.kop’’’’ M ’’’’’æ/lib/modules/3.2.0-4-amd64/kernel/net/sunrpc/sunrpc.kolp’’’’`P ’’’’’/lib/modules/3.2.0-4-amd64/kernel/fs/lockd/lockd.kokolh’’’’€Q ’’’’’ß/lib/modules/3.2.0-4-amd64/kernel/fs/nfs/nfs.kop’’’’`V ’’’’’/lib/modules/3.2.0-4-amd64/kernel/fs/fuse/fuse.ko€’’’’pW ’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/cpufreq/cpufreq_stats.kop’’’’X ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/fs/nfsd/nfsd.kocpufre€’’’’P[ ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/cpufreq/cpufreq_userspace.ko€’’’’ [ ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/cpufreq/cpufreq_powersave.koˆ’’’’š[ ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/cpufreq/cpufreq_conservative.kox’’’’@\ ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/sound/core/snd-hrtimer.konser€’’’’\ ’’’’’Ÿ/lib/modules/3.2.0-4-amd64/kernel/net/bluetooth/rfcomm/rfcomm.kop’’’’0] ’’’’’_/lib/modules/3.2.0-4-amd64/kernel/drivers/char/lp.kom/rx’’’’] ’’’’’Ÿ/lib/modules/3.2.0-4-amd64/kernel/net/bluetooth/bnep/bnep.kox’’’’0^ ’’’’’/lib/modules/3.2.0-4-amd64/kernel/drivers/parport/parport.kop’’’’Ą^ ’’’’’O/lib/modules/3.2.0-4-amd64/kernel/drivers/char/ppdev.kox’’’’_ ’’’’’ļ _/lib/modules/3.2.0-4-amd64/kernel/drivers/parport/parport_pc.ko0||perf_3.2P||@@ /usr/bin/perf_3.2`||P/¬‹P/lib/x86_64-linux-gnu/libgcc_s.so.1h||°P¬‹`/usr/lib/x86_64-linux-gnu/libcrypto.so.1.0.0h||šŽ¬‹@/usr/lib/x86_64-linux-gnu/libssl.so.1.0.0.0`||Š“¬‹`/lib/x86_64-linux-gnu/libz.so.1.2.71.0.`||@Ö¬‹š/lib/x86_64-linux-gnu/libbz2.so.1.0.40.`||@÷¬‹/lib/x86_64-linux-gnu/liblzma.so.5.0.0.X||p­‹0(/usr/lib/libpython2.7.so.1.0.so`||`i­‹ /lib/x86_64-linux-gnu/libutil-2.13.so`||‰­‹€/lib/x86_64-linux-gnu/libcrypt-2.13.so`||­­‹Š/lib/x86_64-linux-gnu/libc-2.13.so.so`||p孋 /lib/x86_64-linux-gnu/libdl-2.13.sosoX||°®‹p/usr/lib/libperl.so.5.14.2-2.13`||°=®‹P/lib/x86_64-linux-gnu/libslang.so.2.2.4h||w®‹°/usr/lib/x86_64-linux-gnu/libnewt.so.0.52.14P||И®‹0/usr/lib/libdw-0.152.so`|| ¼®‹/lib/x86_64-linux-gnu/libm-2.13.soX||@䮋@/usr/lib/libelf-0.152.som-2.13.`||Ƌp/lib/x86_64-linux-gnu/librt-2.13.soh||&Ƌp/lib/x86_64-linux-gnu/libpthread-2.13.so`||ŠGƋ/lib/x86_64-linux-gnu/ld-2.13.so2.13.so@||š’q’[vdso]6 (ٳ’’’’||žR}ļ2 (ٳ’’’’||Č`}ļ2 (ٳ’’’’||Ög}ļ2! (ٳ’’’’||o}ļ2ā (+Ē ’’’’||ļt}ļ2šM (KcHƋ||g\~ļ2ē,­0=Čų=D<>D€>DÄ>D??DT?D˜? ?“@ølAŌ@B\d’’’’lpcGfʘģ rā²lµœ?ˆ×[kernel.kallsyms]d’’’’Ü䃜V·XĪ,1ņxƒÉq&z/lib/x86_64-linux-gnu/ld-2.13.so@corei7@3.2.0-4-amd64@3.2.17@x86_64@Intel(R) Core(TM) i7-2677M CPU @ 1.80GHz@GenuineIntel,6,42,7¬“<@/usr/bin/perf_3.2@record@cowbuilder@--loginHHč@cycles @0-3@0,2@1,3›>ų@0-3cowdancer-0.73/tests/0000755000000000000000000000000012127767534011456 5ustar cowdancer-0.73/tests/015_test_ilistdelete.c0000755000000000000000000000250711665146431015555 0ustar /*BINFMTC: -pthread * * Check deleting .ilist file is handled gracefully. * */ #include #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include /* returns NULL on failure, "success" on success The first open should fail, since .ilist doesn't exist. */ static void* openclosetest(void*p) { int fd; if (-1==(fd=open("a", O_WRONLY))) { perror("open"); return "success"; } if (5 !=write(fd, "test\n", 5)) { perror("write"); return NULL; } if (-1==close(fd)) { perror("close"); return NULL; } return NULL; } int main(int argc, char** argv) { /* remove ilist file */ void *ret; pthread_t pth; unlink(".ilist"); /* test behavior when threads exist */ pthread_create(&pth, NULL, openclosetest, NULL); if (!openclosetest(NULL)) { fprintf(stderr, "parent thread failure\n"); return 1; } if (!pthread_join(pth, &ret)) { if (!ret) { fprintf(stderr, "child thread failure\n"); return 1; } } else { perror("pthread_join"); return 1; } return 0; } cowdancer-0.73/tests/101_test_qemubuilder_dumpconfig.sh0000755000000000000000000000051312125255542020152 0ustar #!/bin/bash # check qemubuilder commnad-line option parsing. # # Apparently, this test requires config files to exist in order not to # die of error, so we need to have qemubuilder installed. set -ex [ "$(./qemubuilder --inputfile one --inputfile two --dumpconfig | grep inputfile)" = \ " inputfile[0]: one inputfile[1]: two" ]cowdancer-0.73/tests/log/0000755000000000000000000000000012127767571012240 5ustar cowdancer-0.73/tests/log/test_qemuipsanitize.c.log0000644000000000000000000000000012127767541017255 0ustar cowdancer-0.73/tests/log/010_test_noilistfile.sh.log0000644000000000000000000000064612127767551017320 0ustar env var COWDANCER_ILISTFILE not defined cowdancer: Fatal, initialize_functions failed env var COWDANCER_ILISTFILE not defined dd: `/dev/zero' を開いています: ćƒ”ćƒ¢ćƒŖć‚’ē¢ŗäæć§ćć¾ć›ć‚“ cowdancer: cannot open ilistfile ./nonexistent-file cowdancer: Fatal, initialize_functions failed cowdancer: cannot open ilistfile ./nonexistent-file dd: `/dev/zero' を開いています: ćƒ”ćƒ¢ćƒŖć‚’ē¢ŗäæć§ćć¾ć›ć‚“ cowdancer-0.73/tests/log/014_ilistdump_test.sh.log0000644000000000000000000000147112127767556017017 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX ++ readlink -f cowdancer-ilistdump + TESTCODE=/home/dancer/DEBIAN/cowdancer/cowdancer/cowdancer-ilistdump + cd /tmp/XXXX + mkdir 1/ + touch 1/a 1/b 1/c 1/d + ln 1/a 1/aa + ln 1/b 1/bb + cp -al 1 2 + dd if=/dev/zero of=1/e bs=512 count=2 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 2.4751e-05 秒、 41.4 MB/ē§’ + cd 1 + find -links +1 -type f -printf '%D %i\n' + sort -k 2 -n + cow-shell /home/dancer/DEBIAN/cowdancer/cowdancer/cowdancer-ilistdump /tmp/XXXX/1/.ilist + sort -k 2 -n ilist_struct size on this architecture: 16 Signature: 4f434457 (expect 4f434457) Revision: 2 (expect 2) Struct size: 16 cow-shell unlink .ilist: No such file or directory + RET=0 + diff -u /tmp/XXXX/mylist.1 /tmp/XXXX/mylist.2 + rm -rf /tmp/XXXX + exit 0 cowdancer-0.73/tests/log/004_test_fopen64.sh.log0000644000000000000000000000276212127767551016264 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX ++ readlink -f tests/004_test_fopen64.c + TESTCODE=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/004_test_fopen64.c ++ readlink -f tests/run_c.sh + RUNC=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh + cd /tmp/XXXX + mkdir 1/ + touch 1/a 1/b 1/c 1/d + dd if=/dev/zero of=1/e bs=512 count=2 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 3.401e-05 秒、 30.1 MB/ē§’ + ls -li 1/ + sleep 1s + cp -al 1/ 2 + echo ' 2/ before' 2/ before + ls -li 2/ 合計 4 4179363 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 a 4179364 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 b 4179365 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 c 4179366 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 d 4179367 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e + cow-shell /home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh /home/dancer/DEBIAN/cowdancer/cowdancer/tests/004_test_fopen64.c 2/a 2/b 2/c + echo ' 2/ after' 2/ after + ls -li 2/ 合計 12 4179363 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 a 4179372 -rw-r--r-- 1 dancer dancer 4 4月 6 18:48 b 4179373 -rw-r--r-- 1 dancer dancer 4 4月 6 18:48 c 4179366 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 d 4179367 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e + rm -rf 2/ + ls -li 1/ + echo ' 1/ differences; should not exist' 1/ differences; should not exist + diff -u ls.prev ls.after + rm -rf /tmp/XXXX cow-shell unlink .ilist: No such file or directory cowdancer-0.73/tests/log/test_cowbuilder.c.log0000644000000000000000000000000012127767537016352 0ustar cowdancer-0.73/tests/log/001_test_symlink.sh.log0000644000000000000000000000273512127767543016467 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX + cd /tmp/XXXX + mkdir 1/ + touch 1/b 1/c 1/d 1/a.real + dd if=/dev/zero of=1/e bs=512 count=2 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 3.27e-05 秒、 31.3 MB/ē§’ + ln -s a.real 1/a + ls -li 1/ + sleep 1s + cp -al 1/ 2 + echo ' 2/ before' 2/ before + ls -li 2/ 合計 4 4179504 lrwxrwxrwx 2 dancer dancer 6 4月 6 18:48 a -> a.real 4179517 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 a.real 4179514 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 b 4179515 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 c 4179516 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 d 4179518 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e + cow-shell + echo 'cd 2 && echo a > a && mv b c && touch c && dd if=e of=d' Invoking /bin/sh 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 3.535e-05 秒、 29.0 MB/ē§’ + echo ' 2/ after' 2/ after + ls -li 2/ 合計 12 4179504 lrwxrwxrwx 2 dancer dancer 6 4月 6 18:48 a -> a.real 4179363 -rw-r--r-- 1 dancer dancer 2 4月 6 18:48 a.real 4179364 -rw-r--r-- 1 dancer dancer 0 4月 6 18:48 c 4179365 -rw-r--r-- 1 dancer dancer 1024 4月 6 18:48 d 4179518 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e + rm -rf 2/ + ls -li 1/ + echo ' 1/ differences; should not exist' 1/ differences; should not exist + diff -u ls.prev ls.after + rm -rf /tmp/XXXX cow-shell unlink .ilist: No such file or directory cowdancer-0.73/tests/log/003_test_fopen.sh.log0000644000000000000000000000275512127767547016120 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX ++ readlink -f tests/003_test_fopen.c + TESTCODE=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/003_test_fopen.c ++ readlink -f tests/run_c.sh + RUNC=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh + cd /tmp/XXXX + mkdir 1/ + touch 1/a 1/b 1/c 1/d + dd if=/dev/zero of=1/e bs=512 count=2 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 2.5288e-05 秒、 40.5 MB/ē§’ + ls -li 1/ + sleep 1s + cp -al 1/ 2 + echo ' 2/ before' 2/ before + ls -li 2/ 合計 4 4179363 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 a 4179364 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 b 4179365 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 c 4179366 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 d 4179367 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e + cow-shell /home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh /home/dancer/DEBIAN/cowdancer/cowdancer/tests/003_test_fopen.c 2/a 2/b 2/c + echo ' 2/ after' 2/ after + ls -li 2/ 合計 12 4179363 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 a 4179372 -rw-r--r-- 1 dancer dancer 4 4月 6 18:48 b 4179374 -rw-r--r-- 1 dancer dancer 4 4月 6 18:48 c 4179366 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 d 4179367 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e + rm -rf 2/ + ls -li 1/ + echo ' 1/ differences; should not exist' 1/ differences; should not exist + diff -u ls.prev ls.after + rm -rf /tmp/XXXX cow-shell unlink .ilist: No such file or directory cowdancer-0.73/tests/log/test_ilistcreate.c.log0000644000000000000000000000003212127767541016523 0ustar E: testcode: hello world cowdancer-0.73/tests/log/020_test_lchown.sh.log0000644000000000000000000000363012127767567016275 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX ++ readlink -f tests/012_test_chown.c + TESTCODE=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/012_test_chown.c ++ readlink -f tests/run_c.sh + RUNC=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh ++ id -G + set -- 1000 24 25 29 30 44 46 109 110 113 115 + ORIGID=1000 + NEWID=24 + (( 11 < 3 )) + cd /tmp/XXXX + mkdir 1/ + touch 1/a 1/b 1/c 1/d + ln -s a 1/f + ln -s b 1/g + dd if=/dev/zero of=1/e bs=512 count=2 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 3.0099e-05 秒、 34.0 MB/ē§’ + chgrp 1000 1/a 1/b 1/c 1/d + ls -li 1/ + sleep 1s + cp -al 1/ 2 + echo ' 2/ before' 2/ before + ls -li 2/ 合計 4 4179366 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 a 4179367 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 b 4179368 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 c 4179369 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 d 4179372 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e 4179370 lrwxrwxrwx 2 dancer dancer 1 4月 6 18:48 f -> a 4179371 lrwxrwxrwx 2 dancer dancer 1 4月 6 18:48 g -> b + cow-shell /home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh /home/dancer/DEBIAN/cowdancer/cowdancer/tests/012_test_chown.c 24 2/f 2/b 2/g chown 2/f lchown 2/g + echo ' 2/ after' 2/ after + ls -li 2/ 合計 4 4179378 -rw-r--r-- 1 dancer cdrom 0 4月 6 18:48 a 4179367 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 b 4179368 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 c 4179369 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 d 4179372 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e 4179370 lrwxrwxrwx 2 dancer dancer 1 4月 6 18:48 f -> a 4179379 lrwxrwxrwx 1 dancer cdrom 1 4月 6 18:48 g -> b + rm -rf 2/ + ls -li 1/ + echo ' 1/ differences; should not exist' 1/ differences; should not exist + diff -u ls.prev ls.after + rm -rf /tmp/XXXX cow-shell unlink .ilist: No such file or directory cowdancer-0.73/tests/log/test_forkexec.c.log0000644000000000000000000000026612127767540016031 0ustar forking: /bin/true forking: /bin/false forking: /bin/echo Hello world Hello world forking: /bin/true forking: /bin/false forking: /bin/echo Hello World Hello World cowdancer-0.73/tests/log/013_test_chmod.sh.log0000644000000000000000000000300412127767555016067 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX ++ readlink -f tests/013_test_chmod.c + TESTCODE=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/013_test_chmod.c ++ readlink -f tests/run_c.sh + RUNC=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh + cd /tmp/XXXX + mkdir 1/ + touch 1/a 1/b 1/c 1/d + dd if=/dev/zero of=1/e bs=512 count=2 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 3.5999e-05 秒、 28.4 MB/ē§’ + chmod 600 1/a 1/b 1/c 1/d + ls -li 1/ + sleep 1s + cp -al 1/ 2 + echo ' 2/ before' 2/ before + ls -li 2/ 合計 4 4179381 -rw------- 2 dancer dancer 0 4月 6 18:48 a 4179382 -rw------- 2 dancer dancer 0 4月 6 18:48 b 4179383 -rw------- 2 dancer dancer 0 4月 6 18:48 c 4179384 -rw------- 2 dancer dancer 0 4月 6 18:48 d 4179385 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e + cow-shell /home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh /home/dancer/DEBIAN/cowdancer/cowdancer/tests/013_test_chmod.c 2/a 2/b + echo ' 2/ after' 2/ after + ls -li 2/ 合計 4 4179367 -r-------- 1 dancer dancer 0 4月 6 18:48 a 4179382 -rw------- 2 dancer dancer 0 4月 6 18:48 b 4179383 -rw------- 2 dancer dancer 0 4月 6 18:48 c 4179384 -rw------- 2 dancer dancer 0 4月 6 18:48 d 4179385 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e + rm -rf 2/ + ls -li 1/ + echo ' 1/ differences; should not exist' 1/ differences; should not exist + diff -u ls.prev ls.after + rm -rf /tmp/XXXX cow-shell unlink .ilist: No such file or directory cowdancer-0.73/tests/log/002_test_open.sh.log0000644000000000000000000000275212127767545015744 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX ++ readlink -f tests/002_test_open.c + TESTCODE=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/002_test_open.c ++ readlink -f tests/run_c.sh + RUNC=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh + cd /tmp/XXXX + mkdir 1/ + touch 1/a 1/b 1/c 1/d + dd if=/dev/zero of=1/e bs=512 count=2 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 2.5061e-05 秒、 40.9 MB/ē§’ + ls -li 1/ + sleep 1s + cp -al 1/ 2 + echo ' 2/ before' 2/ before + ls -li 2/ 合計 4 4179363 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 a 4179364 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 b 4179365 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 c 4179366 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 d 4179367 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e + cow-shell /home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh /home/dancer/DEBIAN/cowdancer/cowdancer/tests/002_test_open.c 2/a 2/b 2/c + echo ' 2/ after' 2/ after + ls -li 2/ 合計 12 4179363 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 a 4179372 -rw-r--r-- 1 dancer dancer 3 4月 6 18:48 b 4179374 -rw-r--r-- 1 dancer dancer 3 4月 6 18:48 c 4179366 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 d 4179367 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e + rm -rf 2/ + ls -li 1/ + echo ' 1/ differences; should not exist' 1/ differences; should not exist + diff -u ls.prev ls.after + rm -rf /tmp/XXXX cow-shell unlink .ilist: No such file or directory cowdancer-0.73/tests/log/901_test_pbuilder_create.sh.log0000644000000000000000000000016711220436222020114 0ustar ++ uname -mn + [[ core2duo x86_64 != \d\a\n\c\e\r\6\4\ \x\8\6\_\6\4 ]] + echo 'skip this test' skip this test + exit 0 cowdancer-0.73/tests/log/test_file.c.log0000644000000000000000000000033512127767540015137 0ustar /root//dev: Permission denied forking: diff -u /proc/mounts /tmp/testfileh8xfLN file copy: open for write: No such file or directory creat: No such file or directory E: Could not create /tmp/nonexisting/file/path/here cowdancer-0.73/tests/log/102_test_cowbuilder_debbuildopts.sh.log0000644000000000000000000000065512127767571021702 0ustar + CONFIGFILE=tests/102_test_cowbuilder_debbuildopts.config ++ ./cowbuilder --configfile tests/102_test_cowbuilder_debbuildopts.config --dumpconfig ++ grep debbuildopts: + '[' ' debbuildopts: -j2 -I' = ' debbuildopts: -j2 -I' ']' ++ ./cowbuilder --configfile tests/102_test_cowbuilder_debbuildopts.config --dumpconfig ++ grep kernel_image: + '[' ' kernel_image: /boot/vmlinuz-x.y.z' = ' kernel_image: /boot/vmlinuz-x.y.z' ']' cowdancer-0.73/tests/log/022_kernel_waitpid.sh.log0000644000000000000000000000056112127767571016742 0ustar ++ readlink -f tests/022_kernel_waitpid.c + TESTCODE=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/022_kernel_waitpid.c ++ readlink -f tests/run_c.sh + RUNC=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh + /home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh /home/dancer/DEBIAN/cowdancer/cowdancer/tests/022_kernel_waitpid.c /bin/cp: `/tmp/XXXX waitpid: 100 cowdancer-0.73/tests/log/901_test_pbuilder_create_distributions.log0000644000000000000000000000014011220436222022454 0ustar [OK] debootstrap etch [OK] debootstrap sid [OK] cdebootstrap etch [OK] cdebootstrap sid cowdancer-0.73/tests/log/018_testcxx.sh.log0000644000000000000000000000154112127767563015450 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX ++ readlink -f tests/018_testcxx.cc + TESTCODE=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/018_testcxx.cc ++ readlink -f tests/run_cxx.sh + RUNCXX=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_cxx.sh + set -ex + cd /tmp/XXXX + mkdir 1/ + touch 1/a 1/b 1/c 1/d + dd if=/dev/zero of=1/e bs=512 count=2 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 2.5402e-05 秒、 40.3 MB/ē§’ + cp -al 1 0 + cow-shell /home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_cxx.sh /home/dancer/DEBIAN/cowdancer/cowdancer/tests/018_testcxx.cc + cat 1/a Hello world + cat 0/a + diff -u 1/a 0/a --- 1/a 2013-04-06 18:48:34.000000000 +0900 +++ 0/a 2013-04-06 18:48:34.000000000 +0900 @@ -1 +0,0 @@ -Hello world + RESULT=0 + rm -rf /tmp/XXXX + exit 0 cow-shell unlink .ilist: No such file or directory cowdancer-0.73/tests/log/012_test_chown.sh.log0000644000000000000000000000320412127767553016112 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX ++ readlink -f tests/012_test_chown.c + TESTCODE=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/012_test_chown.c ++ readlink -f tests/run_c.sh + RUNC=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh ++ id -G + set -- 1000 24 25 29 30 44 46 109 110 113 115 + ORIGID=1000 + NEWID=24 + (( 11 < 3 )) + cd /tmp/XXXX + mkdir 1/ + touch 1/a 1/b 1/c 1/d + dd if=/dev/zero of=1/e bs=512 count=2 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 0.000107535 秒、 9.5 MB/ē§’ + chgrp 1000 1/a 1/b 1/c 1/d + ls -li 1/ + sleep 1s + cp -al 1/ 2 + echo ' 2/ before' 2/ before + ls -li 2/ 合計 4 4179366 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 a 4179367 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 b 4179368 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 c 4179369 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 d 4179370 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e + cow-shell /home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh /home/dancer/DEBIAN/cowdancer/cowdancer/tests/012_test_chown.c 24 2/a 2/b 2/c chown 2/a lchown 2/c + echo ' 2/ after' 2/ after + ls -li 2/ 合計 4 4179379 -rw-r--r-- 1 dancer cdrom 0 4月 6 18:48 a 4179367 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 b 4179380 -rw-r--r-- 1 dancer cdrom 0 4月 6 18:48 c 4179369 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 d 4179370 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e + rm -rf 2/ + ls -li 1/ + echo ' 1/ differences; should not exist' 1/ differences; should not exist + diff -u ls.prev ls.after + rm -rf /tmp/XXXX cow-shell unlink .ilist: No such file or directory cowdancer-0.73/tests/log/017_tempfilecheck.sh.log0000644000000000000000000000063112127767562016546 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX + set -ex + cd /tmp/XXXX + mkdir 1/ + touch 1/a 1/b 1/c 1/d 1/a~~ + dd if=/dev/zero of=1/e bs=512 count=2 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 4.0699e-05 秒、 25.2 MB/ē§’ + cp -al 1 2 + cow-shell touch 1/a + ls 1/a~~ 1/a~~ + RESULT=0 + rm -rf /tmp/XXXX + exit 0 cow-shell unlink .ilist: No such file or directory cowdancer-0.73/tests/log/015_test_ilistdelete.sh.log0000644000000000000000000000153712127767560017313 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX ++ readlink -f tests/015_test_ilistdelete.c + TESTCODE=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/015_test_ilistdelete.c ++ readlink -f tests/run_c.sh + RUNC=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh + cd /tmp/XXXX + mkdir 1/ + touch 1/a 1/b 1/c 1/d + cp -al 1 2 + dd if=/dev/zero of=1/e bs=512 count=2 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 3.5376e-05 秒、 28.9 MB/ē§’ + cow-shell /home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh /home/dancer/DEBIAN/cowdancer/cowdancer/tests/015_test_ilistdelete.c open: No such file or directory open: No such file or directory cowdancer: cannot open ilistfile /tmp/XXXX/.ilist cowdancer: Fatal, initialize_functions failed + RET=0 + rm -rf /tmp/XXXX + exit 0 cow-shell unlink .ilist: No such file or directory cowdancer-0.73/tests/log/902_test_cowbuilder_fail.sh.log0000644000000000000000000000016711220436222020116 0ustar ++ uname -mn + [[ core2duo x86_64 != \d\a\n\c\e\r\6\4\ \x\8\6\_\6\4 ]] + echo 'skip this test' skip this test + exit 0 cowdancer-0.73/tests/log/test_cowbuilder_util.c.log0000644000000000000000000000011112127767540017404 0ustar E: Something (/) is still mounted under /; unmount and remove / manually cowdancer-0.73/tests/log/900_test_pbuilder.sh.log0000644000000000000000000000001711220436222016562 0ustar skip this test cowdancer-0.73/tests/log/test_qemuarch.c.log0000644000000000000000000000060112127767541016022 0ustar /tmp/dancerT1QEYJ/dev/console: Operation not permitted /tmp/dancerT1QEYJ/dev/ttyS0: Operation not permitted /tmp/dancerT1QEYJ/dev/ttyAMA0: Operation not permitted /tmp/dancerT1QEYJ/dev/sda: Operation not permitted /tmp/dancerT1QEYJ/dev/sdb: Operation not permitted /tmp/dancerT1QEYJ/dev/hda: Operation not permitted /tmp/dancerT1QEYJ/dev/hdb: Operation not permitted /tmp/dancerT1QEYJ cowdancer-0.73/tests/log/016_memleakcheck.sh.log0000644000000000000000000000624112127767561016355 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX ++ readlink -f tests/016_memleakcheck.c + TESTCODE=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/016_memleakcheck.c ++ readlink -f cow-shell + COW_SHELL=/home/dancer/DEBIAN/cowdancer/cowdancer/cow-shell + gcc /home/dancer/DEBIAN/cowdancer/cowdancer/tests/016_memleakcheck.c -o /tmp/XXXX/tracer -g + set -ex + cd /tmp/XXXX + mkdir 1/ + touch 1/a 1/b 1/c 1/d + dd if=/dev/zero of=1/e bs=512 count=2 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 2.7972e-05 秒、 36.6 MB/ē§’ + cp -al 1 2 + LD_PRELOAD= + MALLOC_TRACE=log + /home/dancer/DEBIAN/cowdancer/cowdancer/cow-shell /tmp/XXXX/tracer 00400000-00401000 r-xp 00000000 08:05 4179938 /tmp/XXXX/tracer 00600000-00601000 rw-p 00000000 08:05 4179938 /tmp/XXXX/tracer 014b0000-014d1000 rw-p 00000000 00:00 0 [heap] 2b9a555fc000-2b9a5561c000 r-xp 00000000 08:05 4096412 /lib/x86_64-linux-gnu/ld-2.13.so 2b9a5561c000-2b9a5561e000 rw-p 00000000 00:00 0 2b9a5581b000-2b9a5581c000 r--p 0001f000 08:05 4096412 /lib/x86_64-linux-gnu/ld-2.13.so 2b9a5581c000-2b9a5581d000 rw-p 00020000 08:05 4096412 /lib/x86_64-linux-gnu/ld-2.13.so 2b9a5581d000-2b9a5581e000 rw-p 00000000 00:00 0 2b9a5581e000-2b9a55822000 r-xp 00000000 08:05 3694668 /home/dancer/DEBIAN/cowdancer/cowdancer/libcowdancer.so 2b9a55822000-2b9a55a21000 ---p 00004000 08:05 3694668 /home/dancer/DEBIAN/cowdancer/cowdancer/libcowdancer.so 2b9a55a21000-2b9a55a22000 rw-p 00003000 08:05 3694668 /home/dancer/DEBIAN/cowdancer/cowdancer/libcowdancer.so 2b9a55a22000-2b9a55a23000 r--p 00000000 08:05 4179940 /tmp/XXXX/.ilist 2b9a55a23000-2b9a55a27000 rw-p 00000000 00:00 0 2b9a55a44000-2b9a55bc4000 r-xp 00000000 08:05 12279892 /lib/x86_64-linux-gnu/libc-2.13.so 2b9a55bc4000-2b9a55dc4000 ---p 00180000 08:05 12279892 /lib/x86_64-linux-gnu/libc-2.13.so 2b9a55dc4000-2b9a55dc8000 r--p 00180000 08:05 12279892 /lib/x86_64-linux-gnu/libc-2.13.so 2b9a55dc8000-2b9a55dc9000 rw-p 00184000 08:05 12279892 /lib/x86_64-linux-gnu/libc-2.13.so 2b9a55dc9000-2b9a55dcf000 rw-p 00000000 00:00 0 2b9a55dcf000-2b9a55dd1000 r-xp 00000000 08:05 12279885 /lib/x86_64-linux-gnu/libdl-2.13.so 2b9a55dd1000-2b9a55fd1000 ---p 00002000 08:05 12279885 /lib/x86_64-linux-gnu/libdl-2.13.so 2b9a55fd1000-2b9a55fd2000 r--p 00002000 08:05 12279885 /lib/x86_64-linux-gnu/libdl-2.13.so 2b9a55fd2000-2b9a55fd3000 rw-p 00003000 08:05 12279885 /lib/x86_64-linux-gnu/libdl-2.13.so 2b9a55fd3000-2b9a55fd5000 rw-p 00000000 00:00 0 7fff1ec7f000-7fff1eca0000 rw-p 00000000 00:00 0 [stack] 7fff1ed61000-7fff1ed62000 r-xp 00000000 00:00 0 [vdso] ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall] + RESULT=0 + mtrace /tmp/XXXX/tracer /tmp/XXXX/log No memory leaks. + rm -rf /tmp/XXXX + exit 0 cow-shell unlink .ilist: No such file or directory cowdancer-0.73/tests/log/021_test_open.sh.log0000644000000000000000000000152612127767570015741 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX ++ readlink -f tests/021_test_open.c + TESTCODE=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/021_test_open.c ++ readlink -f tests/run_c.sh + RUNC=/home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh + cd /tmp/XXXX + mkdir 1/ + touch 1/a 1/b 1/c 1/d + ln -s a 1/f + ln -s b 1/g + cp -al 1/ 2 + /home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh /home/dancer/DEBIAN/cowdancer/cowdancer/tests/021_test_open.c /home/dancer/DEBIAN/cowdancer/cowdancer/tests/021_test_open.c close(0)open(): try1: 0, try2: 0 + cow-shell /home/dancer/DEBIAN/cowdancer/cowdancer/tests/run_c.sh /home/dancer/DEBIAN/cowdancer/cowdancer/tests/021_test_open.c /home/dancer/DEBIAN/cowdancer/cowdancer/tests/021_test_open.c close(0)open(): try1: 0, try2: 0 + RET=0 + echo 0 0 + rm -rf /tmp/XXXX cow-shell unlink .ilist: No such file or directory cowdancer-0.73/tests/log/test_parameter.c.log0000644000000000000000000000000012127767541016166 0ustar cowdancer-0.73/tests/log/000_test_basic.sh.log0000644000000000000000000000247012127767541016053 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX + cd /tmp/XXXX + mkdir 1/ + touch 1/a 1/b 1/c 1/d + dd if=/dev/zero of=1/e bs=512 count=2 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 3.5937e-05 秒、 28.5 MB/ē§’ + ls -li 1/ + sleep 1s + cp -al 1/ 2 + echo ' 2/ before' 2/ before + ls -li 2/ 合計 4 4179987 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 a 4179988 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 b 4179989 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 c 4179990 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 d 4179991 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e + echo 'cd 2 && echo a > a && mv b c && touch c && dd if=e of=d' + cow-shell Invoking /bin/sh 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 4.6086e-05 秒、 22.2 MB/ē§’ + echo ' 2/ after' 2/ after + ls -li 2/ 合計 12 4180005 -rw-r--r-- 1 dancer dancer 2 4月 6 18:48 a 4180010 -rw-r--r-- 1 dancer dancer 0 4月 6 18:48 c 4180011 -rw-r--r-- 1 dancer dancer 1024 4月 6 18:48 d 4179991 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e + rm -rf 2/ + ls -li 1/ + echo ' 1/ differences; should not exist' 1/ differences; should not exist + diff -u ls.prev ls.after + rm -rf /tmp/XXXX cow-shell unlink .ilist: No such file or directory cowdancer-0.73/tests/log/019_test_filename_with_space.sh.log0000644000000000000000000000263212127767565021000 0ustar ++ mktemp -d + TESTDIR=/tmp/XXXX + cd /tmp/XXXX + mkdir 1/ + touch '1/a'\''f' '1/b g' '1/c h' '1/d i' + dd if=/dev/zero 'of=1/e j' bs=512 count=2 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 3.1818e-05 秒、 32.2 MB/ē§’ + ls -li 1/ + sleep 1s + cp -al 1/ 2 + echo ' 2/ before' 2/ before + ls -li 2/ 合計 4 4179999 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 a'f 4180000 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 b g 4180001 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 c h 4180002 -rw-r--r-- 2 dancer dancer 0 4月 6 18:48 d i 4180003 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e j + echo 'cd 2 && echo a > "a'\''f" && mv '\''b g'\'' '\''c h'\'' && touch '\''c h'\'' && dd if='\''e j'\'' of='\''d i'\''' + cow-shell Invoking /bin/sh 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å…„åŠ› 2+0 ćƒ¬ć‚³ćƒ¼ćƒ‰å‡ŗåŠ› 1024 惐悤惈 (1.0 kB) ć‚³ćƒ”ćƒ¼ć•ć‚Œć¾ć—ćŸć€ 3.7084e-05 秒、 27.6 MB/ē§’ + echo ' 2/ after' 2/ after + ls -li 2/ 合計 12 4179366 -rw-r--r-- 1 dancer dancer 2 4月 6 18:48 a'f 4179367 -rw-r--r-- 1 dancer dancer 0 4月 6 18:48 c h 4179368 -rw-r--r-- 1 dancer dancer 1024 4月 6 18:48 d i 4180003 -rw-r--r-- 2 dancer dancer 1024 4月 6 18:48 e j + rm -rf 2/ + ls -li 1/ + echo ' 1/ differences; should not exist' 1/ differences; should not exist + diff -u ls.prev ls.after + rm -rf /tmp/XXXX cow-shell unlink .ilist: No such file or directory cowdancer-0.73/tests/log/101_test_qemubuilder_dumpconfig.sh.log0000644000000000000000000000026012127767571021523 0ustar ++ ./qemubuilder --inputfile one --inputfile two --dumpconfig ++ grep inputfile + '[' ' inputfile[0]: one inputfile[1]: two' = ' inputfile[0]: one inputfile[1]: two' ']' cowdancer-0.73/tests/002_test_open.c0000755000000000000000000000065311220436222014166 0ustar /*BINFMTC: open test */ #include #include #include void writeandclose(int a) { write(a,"abc",3); close(a); } int main(int argc, char** argv) { /* test that the three args work. */ int a,b,c; if(argc < 4) exit(1); a=open(argv[1], O_RDONLY); b=open(argv[2], O_WRONLY); c=open(argv[3], O_RDWR); writeandclose(a); writeandclose(b); writeandclose(c); return 0; } cowdancer-0.73/tests/run_cxx.sh0000755000000000000000000000051411220436222013457 0ustar #!/bin/bash # Run C program which might be ran with binfmtc # parameter parsing SOURCEFILE="$1" CMDOPTS=$(head -1 "${SOURCEFILE}" | sed -n 's,/[*]BINFMTCXX: ,,p') DEFAULT=" -O2 -Wall " TEMPFILE=$(tempfile -m 700) shift g++ ${DEFAULT} ${CMDOPTS} "${SOURCEFILE}" -o ${TEMPFILE} ${TEMPFILE} "$@" RET=$? rm -f ${TEMPFILE} exit ${RET}cowdancer-0.73/tests/003_test_fopen.c0000755000000000000000000000055511220436222014336 0ustar /*BINFMTC: fopen test */ #include #include void writeandclose(FILE* a) { fprintf(a,"abc\n"); fclose(a); } int main(int argc, char** argv) { /* test that the three args work. */ if(argc < 4) exit(1); writeandclose(fopen(argv[1], "r")); writeandclose(fopen(argv[2], "w")); writeandclose(fopen(argv[3], "a")); return 0; } cowdancer-0.73/tests/016_memleakcheck.sh0000755000000000000000000000116012125255215014774 0ustar #!/bin/bash # test if there is much memory leaking. set -ex TESTDIR=$(mktemp -d ) TESTCODE=$(readlink -f tests/016_memleakcheck.c) COW_SHELL=$(readlink -f cow-shell) gcc ${TESTCODE} -o ${TESTDIR}/tracer -g ( set -ex cd ${TESTDIR} mkdir 1/ # make a few files for testing. touch 1/a 1/b 1/c 1/d dd if=/dev/zero of=1/e bs=512 count=2 cp -al 1 2 # undefine LD_PRELOAD because it seems like loading cowdancer lib twice is causing memory leak? LD_PRELOAD= MALLOC_TRACE="log" ${COW_SHELL} ${TESTDIR}/tracer ) RESULT=$? mtrace ${TESTDIR}/tracer ${TESTDIR}/log rm -rf ${TESTDIR} exit $RESULT cowdancer-0.73/tests/000_test_basic.sh0000755000000000000000000000110611220436222014466 0ustar #!/bin/bash # test that things are working as expected. # # Requires a installed cowdancer, and will test the installed cowdancer. set -ex TESTDIR=$(mktemp -d ) cd ${TESTDIR} mkdir 1/ # make a few files for testing. touch 1/a 1/b 1/c 1/d dd if=/dev/zero of=1/e bs=512 count=2 ls -li 1/ > ls.prev sleep 1s cp -al 1/ 2 echo " 2/ before" ls -li 2/ echo "cd 2 && echo a > a && mv b c && touch c && dd if=e of=d" | cow-shell echo " 2/ after" ls -li 2/ rm -rf 2/ ls -li 1/ > ls.after echo " 1/ differences; should not exist" diff -u ls.prev ls.after rm -rf ${TESTDIR} cowdancer-0.73/tests/016_memleakcheck.c0000755000000000000000000000247512125253445014621 0ustar /*BINFMTC: -g * * check memory leak * */ #include #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include void dump_procmap() { FILE*f; int c; f=fopen("/proc/self/maps", "r"); while (EOF!=(c=fgetc(f))) fputc(c,stdout); fclose(f); } int main(int argc, char** argv) { int fd; int i; FILE* f; /* Initialize */ if (-1==(fd=open("1/a", O_WRONLY))) { perror("open"); return 1; } if (5 !=write(fd, "test\n", 5)) { perror("write"); return 1; } if (-1==close(fd)) { perror("close"); return 1; } /* try open/close 100 times. */ mtrace(); for (i=0; i<100; ++i) { if (-1==(fd=open("1/b", O_WRONLY))) { perror("open"); return 1; } if (5 !=write(fd, "test\n", 5)) { perror("write"); return 1; } if (-1==close(fd)) { perror("close"); return 1; } if (!(f=fopen("1/c", "w"))) { return 1; } if (5 !=fwrite("test\n", 1, 5, f)) { return 1; } if (EOF==fclose(f)) { return 1; } } muntrace(); dump_procmap(); return 0; } cowdancer-0.73/tests/018_testcxx.cc0000755000000000000000000000020011220436222014026 0ustar /*BINFMTCXX: */ #include int main(int argc, char** argv) { std::ofstream ofs("1/a"); ofs << "Hello world\n"; } cowdancer-0.73/tests/015_test_ilistdelete.sh0000644000000000000000000000071711220436222015726 0ustar #!/bin/bash # test if ilist deletion is handled gracefully # 0.9 used to hang if pthread was used and ilist was not available. set -ex TESTDIR=$(mktemp -d ) TESTCODE=$(readlink -f tests/015_test_ilistdelete.c) RUNC=$(readlink -f tests/run_c.sh) ( cd ${TESTDIR} mkdir 1/ # make a few files for testing. touch 1/a 1/b 1/c 1/d cp -al 1 2 dd if=/dev/zero of=1/e bs=512 count=2 cow-shell $RUNC $TESTCODE ) RET=$? rm -rf ${TESTDIR} exit $RETcowdancer-0.73/tests/014_ilistdump_test.sh0000644000000000000000000000106711220436222015427 0ustar #!/bin/bash # test ilist dumping, and content check. set -ex TESTDIR=$(mktemp -d ) TESTCODE=$(readlink -f cowdancer-ilistdump) ( cd ${TESTDIR} mkdir 1/ # make a few files for testing. touch 1/a 1/b 1/c 1/d ln 1/a 1/aa ln 1/b 1/bb cp -al 1 2 dd if=/dev/zero of=1/e bs=512 count=2 cd 1 find -links +1 -type f -printf "%D %i\n" | sort -k 2 -n > ../mylist.1 cow-shell "${TESTCODE}" ${TESTDIR}/1/.ilist | sort -k 2 -n > ${TESTDIR}/mylist.2 ) RET=$? diff -u ${TESTDIR}/mylist.1 ${TESTDIR}/mylist.2 rm -rf ${TESTDIR} exit $RET cowdancer-0.73/tests/018_testcxx.sh0000755000000000000000000000063511220436222014067 0ustar #!/bin/bash # test the case with C++ source set -ex TESTDIR=$(mktemp -d ) TESTCODE=$(readlink -f tests/018_testcxx.cc) RUNCXX=$(readlink -f tests/run_cxx.sh) ( set -ex cd ${TESTDIR} mkdir 1/ touch 1/a 1/b 1/c 1/d dd if=/dev/zero of=1/e bs=512 count=2 cp -al 1 0 cow-shell $RUNCXX $TESTCODE cat 1/a cat 0/a ! diff -u 1/a 0/a ) RESULT=$? rm -rf ${TESTDIR} exit $RESULT cowdancer-0.73/tests/021_test_open.c0000755000000000000000000000064611220436222014171 0ustar /*BINFMTC: test close(0); open(XXX,XXX); will return '0' as file ID. */ #include #include #include #include #include #include int main(int ac, const char** av) { int fd1, fd2; close(0); fd1=open(av[1], O_RDONLY); close(0); fd2=open(av[1], O_RDONLY); printf("close(0)open(): try1: %i, try2: %i\n", fd1, fd2); return fd1; } cowdancer-0.73/tests/012_test_chown.c0000755000000000000000000000130211220436222014334 0ustar /*BINFMTC: chown test Used by 012 and 020 tests. */ /* for fchown */ /*#define _BSD_SOURCE*/ #include #include #include //#include //#include //#include int main(int argc, char** argv) { uid_t uid=getuid(); gid_t gid; //int fid; /* test that four args are given. */ if(argc < 5) exit(1); gid=atoi(argv[1]); /* get the gid to change to */ printf("chown %s\n", argv[2]); chown(argv[2], uid, gid); //fid=open(argv[3], O_RDONLY); //if (fchown(fid, uid, gid)!=-1) /* this func will fail */ // return 1; //close(fid); printf("lchown %s\n", argv[4]); lchown(argv[4], uid, gid); return 0; } cowdancer-0.73/tests/022_kernel_waitpid.sh0000755000000000000000000000025111220436222015353 0ustar #!/bin/bash # just test kernel functionality on waitpid. set -ex TESTCODE=$(readlink -f tests/022_kernel_waitpid.c) RUNC=$(readlink -f tests/run_c.sh) $RUNC $TESTCODE cowdancer-0.73/tests/017_tempfilecheck.sh0000755000000000000000000000067411220436222015172 0ustar #!/bin/bash # test the case where there is already a tilde file. # 0.10 uses mkstemp, so it should work. set -ex TESTDIR=$(mktemp -d ) ( set -ex cd ${TESTDIR} mkdir 1/ # make a few files for testing. touch 1/a 1/b 1/c 1/d 1/a~~ dd if=/dev/zero of=1/e bs=512 count=2 cp -al 1 2 cow-shell touch 1/a # 0.9 deleted this file, not good. Test that it works now. ls 1/a~~ ) RESULT=$? rm -rf ${TESTDIR} exit $RESULT cowdancer-0.73/tests/002_test_open.sh0000755000000000000000000000103011220436222014344 0ustar #!/bin/bash # test open function handling. set -ex TESTDIR=$(mktemp -d ) TESTCODE=$(readlink -f tests/002_test_open.c) RUNC=$(readlink -f tests/run_c.sh) cd ${TESTDIR} mkdir 1/ # make a few files for testing. touch 1/a 1/b 1/c 1/d dd if=/dev/zero of=1/e bs=512 count=2 ls -li 1/ > ls.prev sleep 1s cp -al 1/ 2 echo " 2/ before" ls -li 2/ cow-shell $RUNC $TESTCODE 2/a 2/b 2/c echo " 2/ after" ls -li 2/ rm -rf 2/ ls -li 1/ > ls.after echo " 1/ differences; should not exist" diff -u ls.prev ls.after rm -rf ${TESTDIR} cowdancer-0.73/tests/012_test_chown.sh0000755000000000000000000000145511220436222014535 0ustar #!/bin/bash # test chown function handling. set -ex TESTDIR=$(mktemp -d ) TESTCODE=$(readlink -f tests/012_test_chown.c) RUNC=$(readlink -f tests/run_c.sh) set -- $(id -G) #export COWDANCER_DEBUG=yes # assumes that this user has multiple groups. ORIGID=$1 NEWID=$2 if (( $# < 3 )); then echo "W: Needs multiple groups for user $(id) for this test to succeed, test skipped" exit 0 fi cd ${TESTDIR} mkdir 1/ # make a few files for testing. touch 1/a 1/b 1/c 1/d dd if=/dev/zero of=1/e bs=512 count=2 chgrp $ORIGID 1/a 1/b 1/c 1/d ls -li 1/ > ls.prev sleep 1s cp -al 1/ 2 echo " 2/ before" ls -li 2/ cow-shell $RUNC $TESTCODE $NEWID 2/a 2/b 2/c echo " 2/ after" ls -li 2/ rm -rf 2/ ls -li 1/ > ls.after echo " 1/ differences; should not exist" diff -u ls.prev ls.after rm -rf ${TESTDIR} cowdancer-0.73/tests/004_test_fopen64.c0000755000000000000000000000060411220436222014504 0ustar /*BINFMTC: -D_FILE_OFFSET_BITS=64 fopen test */ #include #include void writeandclose(FILE* a) { fprintf(a,"abc\n"); fclose(a); } int main(int argc, char** argv) { /* test that the three args work. */ if(argc < 4) exit(1); writeandclose(fopen(argv[1], "r")); writeandclose(fopen(argv[2], "w")); writeandclose(fopen(argv[3], "a")); return 0; } cowdancer-0.73/tests/001_test_symlink.sh0000755000000000000000000000077511220436222015107 0ustar #!/bin/bash # test symlink handling. set -ex TESTDIR=$(mktemp -d ) cd ${TESTDIR} mkdir 1/ # make a few files for testing. touch 1/b 1/c 1/d 1/a.real dd if=/dev/zero of=1/e bs=512 count=2 ln -s a.real 1/a ls -li 1/ > ls.prev sleep 1s cp -al 1/ 2 echo " 2/ before" ls -li 2/ echo "cd 2 && echo a > a && mv b c && touch c && dd if=e of=d" | cow-shell echo " 2/ after" ls -li 2/ rm -rf 2/ ls -li 1/ > ls.after echo " 1/ differences; should not exist" diff -u ls.prev ls.after rm -rf ${TESTDIR} cowdancer-0.73/tests/004_test_fopen64.sh0000755000000000000000000000103411220436222014672 0ustar #!/bin/bash # test fopen function handling. set -ex TESTDIR=$(mktemp -d ) TESTCODE=$(readlink -f tests/004_test_fopen64.c) RUNC=$(readlink -f tests/run_c.sh) cd ${TESTDIR} mkdir 1/ # make a few files for testing. touch 1/a 1/b 1/c 1/d dd if=/dev/zero of=1/e bs=512 count=2 ls -li 1/ > ls.prev sleep 1s cp -al 1/ 2 echo " 2/ before" ls -li 2/ cow-shell $RUNC $TESTCODE 2/a 2/b 2/c echo " 2/ after" ls -li 2/ rm -rf 2/ ls -li 1/ > ls.after echo " 1/ differences; should not exist" diff -u ls.prev ls.after rm -rf ${TESTDIR} cowdancer-0.73/tests/022_kernel_waitpid.c0000755000000000000000000000103012125255331015164 0ustar /*BINFMTC: test that waitpid works expected way */ #include #include #include #include int main() { pid_t pid; int status; switch(pid=fork()) { case 0: execl("/bin/cp", "/bin/cp", "-a", "/tmp/test", "/tmp/test2", NULL); exit (0); case -1: perror("fork()"); exit (1); default: sleep(1); if(-1==waitpid(pid, &status, 0)) { perror("waitpid:cp"); exit(2); } printf("waitpid: %x\n", status); exit (0); } } cowdancer-0.73/tests/102_test_cowbuilder_debbuildopts.config0000644000000000000000000000006612126404650021151 0ustar DEBBUILDOPTS="-j2 -I" KERNEL_IMAGE=/boot/vmlinuz-x.y.zcowdancer-0.73/tests/run_c.sh0000755000000000000000000000051211220436222013075 0ustar #!/bin/bash # Run C program which might be ran with binfmtc # parameter parsing SOURCEFILE="$1" CMDOPTS=$(head -1 "${SOURCEFILE}" | sed -n 's,/[*]BINFMTC: ,,p') DEFAULT=" -O2 -Wall " TEMPFILE=$(tempfile -m 700) shift gcc ${DEFAULT} ${CMDOPTS} "${SOURCEFILE}" -o ${TEMPFILE} ${TEMPFILE} "$@" RET=$? rm -f ${TEMPFILE} exit ${RET}cowdancer-0.73/tests/003_test_fopen.sh0000755000000000000000000000103211220436222014515 0ustar #!/bin/bash # test fopen function handling. set -ex TESTDIR=$(mktemp -d ) TESTCODE=$(readlink -f tests/003_test_fopen.c) RUNC=$(readlink -f tests/run_c.sh) cd ${TESTDIR} mkdir 1/ # make a few files for testing. touch 1/a 1/b 1/c 1/d dd if=/dev/zero of=1/e bs=512 count=2 ls -li 1/ > ls.prev sleep 1s cp -al 1/ 2 echo " 2/ before" ls -li 2/ cow-shell $RUNC $TESTCODE 2/a 2/b 2/c echo " 2/ after" ls -li 2/ rm -rf 2/ ls -li 1/ > ls.after echo " 1/ differences; should not exist" diff -u ls.prev ls.after rm -rf ${TESTDIR} cowdancer-0.73/tests/010_test_noilistfile.sh0000755000000000000000000000113511220436222015731 0ustar #!/bin/bash # test ILISTFILE=NULL case # original error message example: #LD_PRELOAD=/usr/lib/cowdancer/libcowdancer.so dd if=/dev/zero of=/dev/null count=1 bs=512 #cannot open ilistfile (null) #dd: opening `/dev/zero': ÉŌĄµ¤Ź„¢„Ʉ섹¤Ē¤¹ set -e [ -n "${COWDANCER_SO}" ] # sanity check if COWDANCER_SO is set. unset COWDANCER_ILISTFILE if LD_PRELOAD="${COWDANCER_SO}" dd if=/dev/zero of=/dev/null count=1 bs=512; then exit 1; else true; fi if COWDANCER_ILISTFILE=./nonexistent-file LD_PRELOAD="${COWDANCER_SO}" dd if=/dev/zero of=/dev/null count=1 bs=512; then exit 1; else true; fi cowdancer-0.73/tests/013_test_chmod.c0000755000000000000000000000067611220436222014326 0ustar /*BINFMTC: chmod test */ #include #include #include #include #include #include /* chmod to 0400 */ int main(int argc, char** argv) { int fid; /* test that the two args work. */ if(argc < 3) exit(1); chmod(argv[1], 0400); fid=open(argv[2], O_RDONLY); //if (fchmod(fid, 0400)!=-1) // return 1; /* this func will fail */ close(fid); return 0; } cowdancer-0.73/tests/102_test_cowbuilder_debbuildopts.sh0000755000000000000000000000071212126406354020322 0ustar #!/bin/bash # check cowbuilder command-line parsing, for debbuildopts. # # Do not yet check for failure or success because it's broken right now. set -ex CONFIGFILE=tests/102_test_cowbuilder_debbuildopts.config [ "$(./cowbuilder --configfile ${CONFIGFILE} --dumpconfig | grep debbuildopts:)" = \ " debbuildopts: -j2 -I" ] [ "$(./cowbuilder --configfile ${CONFIGFILE} --dumpconfig | grep kernel_image:)" = \ " kernel_image: /boot/vmlinuz-x.y.z" ]cowdancer-0.73/tests/README0000644000000000000000000000041111220436222012306 0ustar This directory contains testsuite; which is ran against the installed version of cowdancer. 0XX: basic functional tests 8XX: applicational system tests that do not require root privilege 9XX: applicational system tests that may require root privilege. (use sudo) cowdancer-0.73/tests/013_test_chmod.sh0000755000000000000000000000106011220436222014502 0ustar #!/bin/bash # test chmod function handling. set -ex TESTDIR=$(mktemp -d ) TESTCODE=$(readlink -f tests/013_test_chmod.c) RUNC=$(readlink -f tests/run_c.sh) cd ${TESTDIR} mkdir 1/ # make a few files for testing. touch 1/a 1/b 1/c 1/d dd if=/dev/zero of=1/e bs=512 count=2 chmod 600 1/a 1/b 1/c 1/d ls -li 1/ > ls.prev sleep 1s cp -al 1/ 2 echo " 2/ before" ls -li 2/ cow-shell $RUNC $TESTCODE 2/a 2/b echo " 2/ after" ls -li 2/ rm -rf 2/ ls -li 1/ > ls.after echo " 1/ differences; should not exist" diff -u ls.prev ls.after rm -rf ${TESTDIR} cowdancer-0.73/tests/019_test_filename_with_space.sh0000755000000000000000000000125511220436222017412 0ustar #!/bin/bash # test that things are working as expected, with filename with space # add a test for quote as well. # # Requires a installed cowdancer, and will test the installed cowdancer. set -ex TESTDIR=$(mktemp -d ) cd ${TESTDIR} mkdir 1/ # make a few files for testing. touch "1/a'f" "1/b g" "1/c h" "1/d i" dd if=/dev/zero of="1/e j" bs=512 count=2 ls -li 1/ > ls.prev sleep 1s cp -al 1/ 2 echo " 2/ before" ls -li 2/ echo "cd 2 && echo a > \"a'f\" && mv 'b g' 'c h' && touch 'c h' && dd if='e j' of='d i'" | cow-shell echo " 2/ after" ls -li 2/ rm -rf 2/ ls -li 1/ > ls.after echo " 1/ differences; should not exist" diff -u ls.prev ls.after rm -rf ${TESTDIR} cowdancer-0.73/tests/021_test_open.sh0000755000000000000000000000073011220436222014353 0ustar #!/bin/bash # test close(0); open() pair will create FD=0 set -ex TESTDIR=$(mktemp -d ) TESTCODE=$(readlink -f tests/021_test_open.c) RUNC=$(readlink -f tests/run_c.sh) cd "${TESTDIR}" mkdir 1/ # make a few files for testing. touch 1/a 1/b 1/c 1/d ln -s a 1/f ln -s b 1/g cp -al 1/ 2 # first, exclude non-cowdancer problem "$RUNC" "${TESTCODE}" "${TESTCODE}" #check that cowdancer works. cow-shell "$RUNC" "${TESTCODE}" "${TESTCODE}" RET=$? echo $RET rm -rf ${TESTDIR} cowdancer-0.73/tests/020_test_lchown.sh0000755000000000000000000000145211220436222014705 0ustar #!/bin/bash # test chown function handling. set -ex TESTDIR=$(mktemp -d ) TESTCODE=$(readlink -f tests/012_test_chown.c) RUNC=$(readlink -f tests/run_c.sh) set -- $(id -G) # assumes that this user has multiple groups. ORIGID=$1 NEWID=$2 if (( $# < 3 )); then echo "W: Needs multiple groups for user $(id) for this test to succeed, test skipped" exit 0 fi cd ${TESTDIR} mkdir 1/ # make a few files for testing. touch 1/a 1/b 1/c 1/d ln -s a 1/f ln -s b 1/g dd if=/dev/zero of=1/e bs=512 count=2 chgrp $ORIGID 1/a 1/b 1/c 1/d ls -li 1/ > ls.prev sleep 1s cp -al 1/ 2 echo " 2/ before" ls -li 2/ cow-shell $RUNC $TESTCODE $NEWID 2/f 2/b 2/g echo " 2/ after" ls -li 2/ rm -rf 2/ ls -li 1/ > ls.after echo " 1/ differences; should not exist" diff -u ls.prev ls.after rm -rf ${TESTDIR} cowdancer-0.73/cowdancer-ilistcreate.c0000755000000000000000000000264011220436222014714 0ustar /*BINFMTC: ilistcreate.c * * ilist creation command-line interface * Copyright (C) 2007-2009 Junichi Uekawa * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * ./cowdancer-ilistcreate.c .ilist 'find . -xdev -path ./home -prune -o \( \( -type l -o -type f \) -a -links +1 -print0 \) | xargs -0 stat --format "%d %i "' */ #include #include #include #include "ilist.h" const char* ilist_PRGNAME="cowdancer-ilistcreate"; int main(int argc, char** argv) { /* Wrapper to invoke ilistcreate. */ if (argc != 3) { fprintf (stderr, "%s ilist-path find-option\n\n\tcreate .ilist file for use with cow-shell\n\n", argv[0]); return 1; } return ilistcreate(argv[1], argv[2]); } cowdancer-0.73/test_file.c0000755000000000000000000000316411267615371012440 0ustar /*BINFMTC: file.c forkexec.c */ #define _GNU_SOURCE #include #include #include #include #include #include #include "file.h" #include "parameter.h" void test_copy_file() { char* temp=strdupa("/tmp/testfileXXXXXX"); mkstemp(temp); assert(copy_file("/proc/mounts", temp)==0); assert(forkexeclp("diff", "diff", "-u", "/proc/mounts", temp, NULL)==0); assert(copy_file("/proc/mounts", "/dev/path/does/not/exist")==-1); } void test_create_sparse_file() { char* temp=strdupa("/tmp/sparseXXXXXX"); mkstemp(temp); assert(create_sparse_file(temp,18UL*1UL<<30UL)==0); } void test_fail_create_sparse_file() { assert(create_sparse_file("/tmp/nonexisting/file/path/here",18UL*1UL<<30UL)==1); } int test_mknod_inside_chroot() { /* if you are running this in normal user, or running through fakeroot, you would (probably) get this */ if (getuid()!=0 || (getenv("FAKEROOTKEY") && strcmp(getenv("FAKEROOTKEY"),""))) { assert(mknod_inside_chroot("/root", "/dev", S_IFCHR, makedev(204, 64)) == -1); } else { /* if you are running this as root, this would be the tested codepath. */ struct stat s; umask(S_IWOTH); unlink("/root/dev5"); assert(mknod_inside_chroot("/root", "/dev5", S_IFCHR | 0660, makedev(204, 64)) == 0); assert(stat("/root/dev5", &s)==0); assert(S_ISCHR(s.st_mode)); } return 0; } int main() { test_mknod_inside_chroot(); test_copy_file(); test_create_sparse_file(); test_fail_create_sparse_file(); return 0; } cowdancer-0.73/file.h0000644000000000000000000000211611220436222011360 0ustar /* * qemubuilder: pbuilder with qemu * Basic file operations code. * * Copyright (C) 2009 Junichi Uekawa * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef __FILE_H__ #define __FILE_H__ int copy_file(const char*orig, const char*dest); int create_sparse_file(const char* filename, unsigned long int size); int mknod_inside_chroot(const char* chroot, const char* pathname, mode_t mode, dev_t dev); #endif cowdancer-0.73/file.c0000644000000000000000000000725411267615510011375 0ustar /* * qemubuilder: pbuilder with qemu * Basic file operations code. * * Copyright (C) 2009 Junichi Uekawa * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ /** copy file contents to temporary filesystem, so that it can be used inside qemu. return -1 */ #include #include #include #include #include #include #include #include #include #include "file.h" /** * Copy file from orig to dest. * * returns 0 on success, -1 on failure. */ int copy_file(const char*orig, const char*dest) { const int buffer_size=4096; char *buf=malloc(buffer_size); int ret=-1; int fin=-1; int fout=-1; size_t count; if (!buf) { fprintf(stderr, "Out of memory\n"); goto out; } if (-1==(fin=open(orig,O_RDONLY))) { perror("file copy: open for read"); goto out; } if (-1==(fout=creat(dest,0666))) { perror("file copy: open for write"); goto out; } while((count=read(fin, buf, buffer_size))>0) { if (-1==write(fout, buf, count)) { /* error */ perror("file copy: write"); fprintf(stderr, "%i\n", fin); fprintf(stderr, "%i %i\n", fout, (int)count); goto out; } } if(count==-1) { perror("file copy: read "); goto out; } if (-1==close(fin) || -1==close(fout)) { perror("file copy: close "); goto out; } ret=0; out: free(buf); return ret; } /** Create sparse file of specified size. returns 0 on success, 1 on fail. */ int create_sparse_file(const char* filename, unsigned long int size) { int fd=creat(filename, 0660); if (-1==fd) { perror("creat"); fprintf(stderr, "E: Could not create %s\n", filename); return 1; } const off_t seeksize = 1 << 30; /* try with 30-bit seeks (1GB / seek) */ assert(size > 1); size--; if (-1==lseek(fd, 0, SEEK_SET)) { perror("initial lseek"); return 1; } while(size > seeksize) { if (-1==lseek(fd, seeksize, SEEK_CUR)) { perror("intermediate lseek"); return 1; } size -= seeksize; } if (-1==lseek(fd, size - 1, SEEK_CUR)) { perror("final lseek"); return 1; } if (-1==write(fd, "", 1)) /* A string consists of \0, write 0 to end of file */ { perror("write"); return 1; } if (-1==close(fd)) { perror("close"); return 1; } return 0; } /* mknod with prepended pathname return -1 on failure. */ int mknod_inside_chroot(const char* chroot, const char* pathname, mode_t mode, dev_t dev) { char* p = alloca(strlen(chroot)+strlen(pathname)+2); int ret; if (!p) { fprintf(stderr, "error on alloca\n"); return -1; } if (-1==sprintf(p, "%s/%s", chroot, pathname)) { fprintf(stderr, "error on sprintf\n"); return -1; } ret=mknod(p, mode, dev); if (ret == -1) { /* output the error message for debug, but ignore it here. */ perror(p); } return ret; } cowdancer-0.73/libpeerconnection.log0000644000000000000000000000000012173440365014476 0ustar cowdancer-0.73/Makefile0000644000000000000000000000666612126513016011751 0ustar SHELL=/bin/bash BINARY=libcowdancer.so cow-shell cowbuilder qemubuilder cowdancer-ilistcreate \ cowdancer-ilistdump INSTALL_DIR=install -d -o root -g root -m 755 INSTALL_FILE=install -o root -g root -m 644 INSTALL_PROGRAM=install -o root -g root -m 755 DESTDIR= PREFIX=/usr LIBDIR=$(PREFIX)/lib CFLAGS=-O2 -Wall -g -fno-strict-aliasing CFLAGS_LFS=$(CFLAGS) $(shell getconf LFS_CFLAGS) PWD=$(shell pwd) export VERSION=$(shell sed -n '1s/.*(\(.*\)).*$$/\1/p' < debian/changelog ) all: $(BINARY) install: $(BINARY) $(INSTALL_DIR) $(DESTDIR)${PREFIX}/bin $(INSTALL_DIR) $(DESTDIR)${LIBDIR}/cowdancer $(INSTALL_DIR) $(DESTDIR)${PREFIX}/share/man/man1 $(INSTALL_DIR) $(DESTDIR)${PREFIX}/share/man/man8 $(INSTALL_FILE) cow-shell.1 $(DESTDIR)/usr/share/man/man1/cow-shell.1 $(INSTALL_FILE) cowdancer-ilistcreate.1 $(DESTDIR)/usr/share/man/man1/cowdancer-ilistcreate.1 $(INSTALL_FILE) cowdancer-ilistdump.1 $(DESTDIR)/usr/share/man/man1/cowdancer-ilistdump.1 $(INSTALL_FILE) cowbuilder.8 $(DESTDIR)/usr/share/man/man8/cowbuilder.8 $(INSTALL_FILE) qemubuilder.8 $(DESTDIR)/usr/share/man/man8/qemubuilder.8 $(INSTALL_FILE) libcowdancer.so $(DESTDIR)${LIBDIR}/cowdancer/libcowdancer.so $(INSTALL_PROGRAM) cow-shell $(DESTDIR)/usr/bin/cow-shell $(INSTALL_PROGRAM) cowbuilder $(DESTDIR)/usr/sbin/cowbuilder $(INSTALL_PROGRAM) qemubuilder $(DESTDIR)/usr/sbin/qemubuilder $(INSTALL_PROGRAM) cowdancer-ilistcreate $(DESTDIR)/usr/bin/cowdancer-ilistcreate $(INSTALL_PROGRAM) cowdancer-ilistdump $(DESTDIR)/usr/bin/cowdancer-ilistdump $(INSTALL_DIR) $(DESTDIR)/etc/bash_completion.d $(INSTALL_FILE) bash_completion.qemubuilder $(DESTDIR)/etc/bash_completion.d/qemubuilder $(INSTALL_FILE) bash_completion.cowbuilder $(DESTDIR)/etc/bash_completion.d/cowbuilder libcowdancer.so: cowdancer.lo ilistcreate.lo $(CC) $(CFLAGS) -shared -o $@ $^ -ldl cow-shell: cow-shell.o ilistcreate.o $(CC) $(CFLAGS) -o $@ $^ cowdancer-ilistcreate: cowdancer-ilistcreate.o ilistcreate.o $(CC) $(CFLAGS) -o $@ $^ cowbuilder: cowbuilder.o parameter.o forkexec.o ilistcreate.o main.o cowbuilder_util.o $(CC) $(CFLAGS) -o $@ $^ qemubuilder: qemubuilder.lfso parameter.lfso forkexec.lfso qemuipsanitize.lfso qemuarch.lfso file.lfso main.lfso $(CC) $(CFLAGS) -o $@ $^ %.lo: %.c $(CC) $(CFLAGS) -fPIC $< -o $@ -c %.lfso: %.c $(CC) $(CFLAGS_LFS) $< -o $@ -c %.o: %.c parameter.h $(CC) $(CFLAGS) $< -o $@ -c -D LIBDIR="\"${LIBDIR}\"" clean: -rm -f *~ *.o *.lo *.lfso $(BINARY) -make -C initrd clean upload-dist-all: scp ../cowdancer_$(VERSION).tar.gz aegis.netfort.gr.jp:public_html/software/downloads fastcheck: set -e; set -o pipefail; for A in ./test_*.c; do echo $$A; \ ./tests/run_c.sh $$A 2>&1 | \ tee tests/log/$${A/*\//}.log; done slowcheck: cowdancer-ilistdump qemubuilder cow-shell # FIXME: The tests are running installed cowdancer, not the just-built set -e; set -o pipefail; for A in tests/[0-9][0-9][0-9]_*.sh; \ do echo $$A; \ PATH="$(PWD):$(PWD)/tests:/usr/bin/:/bin" \ COWDANCER_SO=$(PWD)/libcowdancer.so \ bash $$A 2>&1 | \ sed -e's,/tmp/[^/]*,/tmp/XXXX,g' \ -e "s,^Current time:.*,Current time: TIME," \ -e "s,^pbuilder-time-stamp: .*,pbuilder-time-stamp: XXXX," \ -e "s,^Fetched .*B in .*s (.*B/s),Fetched XXXB in Xs (XXXXXB/s)," \ | tee tests/log/$${A/*\//}.log; done check: fastcheck slowcheck check-syntax: $(CC) -c $(CFLAGS) $(CHK_SOURCES) -o/dev/null -D LIBDIR="\"${LIBDIR}\"" .PHONY: clean check upload-dist-all check-syntax fastcheck slowcheck cowdancer-0.73/debian/0000755000000000000000000000000012173574256011534 5ustar cowdancer-0.73/debian/watch0000644000000000000000000000013211220436222012537 0ustar version=2 http://www.netfort.gr.jp/~dancer/software/downloads cowdancer-([\d+\.]+).tar.gz cowdancer-0.73/debian/copyright0000644000000000000000000000034011761516363013461 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: cowdancer Upstream-Contact: Junichi Uekawa Files: * Copyright: Copyright 2005-2009 Junichi Uekawa License: GPL-2+ cowdancer-0.73/debian/compat0000644000000000000000000000000111220436222012707 0ustar 4cowdancer-0.73/debian/changelog0000644000000000000000000006171712173574256013422 0ustar cowdancer (0.73) unstable; urgency=low * debbuildopts quoting is wrong from ~/.pbuilderrc (closes: #704247) * do not fail test when '/' is not mounted inside chroot. (closes: #713511) -- Junichi Uekawa Wed, 24 Jul 2013 06:41:33 +0900 cowdancer (0.72) unstable; urgency=low [ Jean-Baptiste Lallement ] * cowbuilder deletes content of bind-mounted directories (closes: #703406) - A directory bind-mounted into pc->buildplace, will be cleaned out by rmrf() To avoid this disaster, we skip buildplace clean-up if a directory is bind-mounted under the chroot (LP: #1156540) [ Junichi Uekawa ] * Some refactoring, and removing memory leaks. * Mark some functions to be static in cowdancer so that they are not exported. -- Junichi Uekawa Sat, 30 Mar 2013 11:05:19 +0900 cowdancer (0.71) unstable; urgency=low * copyright file in copyright-format-1.0 as specified in policy version 3.9.3.1 -- Junichi Uekawa Fri, 24 Aug 2012 04:51:56 +0900 cowdancer (0.70) unstable; urgency=low [ Junichi Uekawa ] * update to policy 3.9.2 - delimit build-depends with a newline. - add parallel= support for DEB_BUILD_OPTIONS - remove -D_REENTRANT from build scripts, they are linuxthreads requirement, and probably obsolete by now. - rather than /run use some other script name /runscript for 'execute' - add 'nocheck' DEB_BUILD_OPTIONS support - removed unneeded files. [ Julian Taylor ] * expose --twice to cowbuilder too. (closes: #563089) -- Junichi Uekawa Wed, 30 May 2012 19:02:00 +0900 cowdancer (0.69) unstable; urgency=low [ Mike Gabriel ] * Add SMP support to qemubuilder (closes: #661856) [ Junichi Uekawa ] * add --keyring and --allow-untrusted options to cowbuilder. -- Junichi Uekawa Fri, 30 Mar 2012 01:19:48 +0900 cowdancer (0.68) unstable; urgency=low [ Junichi Uekawa ] * remove build-dependency and dependency on qemu, and depend on qemu- system. [ Dmitry Smirnov ] * Bug#660823: qemubuilder: Gnu Hurd support (doesn't quite yet work but first step) -- Junichi Uekawa Sat, 10 Mar 2012 09:40:54 +0900 cowdancer (0.67) unstable; urgency=low [ Junichi Uekawa ] * qemubuilder: work around case when othermirror is NULL (unset). * qemubuilder: Add --http-proxy to list of parameters for qemubuilder to override. [ Werner Mahr ] * qemubuilder: Apt inside the emulated system doesn't know about outside proxy (closes: #653162) -- Junichi Uekawa Sun, 25 Dec 2011 16:21:03 +0900 cowdancer (0.66) unstable; urgency=low [ Colin Watson ] * Bug#648438: cowdancer: FTBFS with ld that defaults to --as-needed: bad link order [ Junichi Uekawa ] * note down where 573126 happens. -- Junichi Uekawa Sun, 04 Dec 2011 22:44:38 +0900 cowdancer (0.65) unstable; urgency=low [ Junichi Uekawa ] * remove cowbuilder-cowdancer loop dependency. (closes: #519130) [ David Paleino ] * update cowbuilder bash completion (closes: #546725) -- Junichi Uekawa Thu, 22 Sep 2011 11:29:48 +0900 cowdancer (0.64) unstable; urgency=low [ Junichi Uekawa ] * change default to use arch diskdevice of sd; most arches probably switched to /dev/sda by now. * binary-arch support for cowbuilder and qemubuilder (closes: #623978, #631967) * fix spelling mistake (closes: #623971) [ BenoĆ®t Knecht ] * qemubuilder: low read/write performance on qemu block devices (closes: #600056) [ Mike Gabriel ] * adds --othermirror option functionality to qemubuilder (closes: #624012) -- Junichi Uekawa Tue, 02 Aug 2011 07:19:33 +0900 cowdancer (0.63) unstable; urgency=low * Acknowledge NMUs. (closes: #597102, #564425) -- Junichi Uekawa Sun, 26 Jun 2011 09:21:02 +0900 cowdancer (0.62+nmu2) unstable; urgency=medium * Non-maintainer upload. * Apply patch by Beno?t Knecht to add the required additional arguments for networking (Closes: #597102) * Set urgency medium due to RC bug fix -- Alexander Reichle-Schmehl Thu, 02 Dec 2010 14:11:51 +0100 cowdancer (0.62+nmu1) unstable; urgency=low * Non-maintainer upload. * Apply fix to qemubuilder's mount problem (Closes: #564425) Thanks to Beno?t Knecht, Gregor Herrmann and Martijn van Brummelen for working on the issue! -- Alexander Reichle-Schmehl Fri, 26 Nov 2010 16:16:26 +0100 cowdancer (0.62) unstable; urgency=low [ Stefan Kisdaroczi ] * set serial console baudrate to 115200 (closes: #587424) * use kvm for i386 on amd64 host (closes: #587421) [ Junichi Uekawa ] * probably, ARM does support 115200n8 too. * remove implied -serial=stdio by adding -nodefault. (closes: #591470) -- Junichi Uekawa Sun, 15 Aug 2010 23:43:49 +0900 cowdancer (0.61) unstable; urgency=low * add --architecture option to qemubuilder and cowbuilder and support ARCHITECTURE option in pbuilderrc. (closes: #564796) ARCHITECTURE is preferred over ARCH option, but both options will work. * add basepath to cowbuilder bash_completion. * add basepath and architecture to bash completion for qemubuilder. -- Junichi Uekawa Fri, 29 Jan 2010 23:30:35 +0900 cowdancer (0.60) unstable; urgency=low * cowbuilder: output a more helpful error message when flock/fchmod/fchown is called. * cowbuilder: call break_cowlink on templates.dat and password.dat. (closes: #558832) -- Junichi Uekawa Wed, 02 Dec 2009 23:14:33 +0900 cowdancer (0.59) unstable; urgency=low [ Junichi Uekawa ] * cowbuilder fix "cannot lock DBdriver config" during parallel usage (closes: #553616) * qemubuilder: use malta architecture for mips and mipsel. * Update README.Debian for qemubuilder -- Junichi Uekawa Sun, 29 Nov 2009 19:28:48 +0900 cowdancer (0.58) unstable; urgency=low * support --debbuildopts for cowbuilder (closes: #548209) * add debug message so that what's happening is more obvious. * make qemubuilder create output more descriptive error message on error to create file (closes: #551614) * Improve description for cowbuilder and qemubuilder (closes: #551365) -- Junichi Uekawa Sun, 01 Nov 2009 23:33:31 +0900 cowdancer (0.57) unstable; urgency=low [ LoĆÆc Minier ] * Set SHELL=/bin/bash for pipefail; (closes: #532444) * Allow for lpia dpkg arch for __i386__ arches [ Junichi Uekawa ] * modify changelog spelling mistake. * add homepage for cowdancer and qemubuilder. * remove 'man .hy' typo from cowbuilder.8 (closes: #541820) -- Junichi Uekawa Tue, 25 Aug 2009 22:24:06 +0900 cowdancer (0.56) unstable; urgency=low * minor fix to grammar in cowbuilder.README.Debian (closes: #528559) -- Junichi Uekawa Sun, 31 May 2009 11:10:53 +0900 cowdancer (0.55) unstable; urgency=low * COWDANCER_DEBUG=1 sent some output to stdout which broke some cases, now outputs to stderr, which is more safe. (closes: #523575) * Now make check runs. * environment variable COWDANCER_SO specifies location of libcowdancer.so, default is /usr/lib/cowdancer/libcowdancer.so, useful for running tests on just-built cowdancer. -- Junichi Uekawa Mon, 13 Apr 2009 07:58:24 +0900 cowdancer (0.54) unstable; urgency=low * Really fix i386 qemubuilder; compile with LFS option. * Run 'make fastcheck' after build so that I know builds are reasonable. Running 'make slowcheck' needs a bit more work. * change bash completion * add work-around for udev bug #520742, add /etc/udev/disabled -- Junichi Uekawa Fri, 10 Apr 2009 07:38:47 +0900 cowdancer (0.53) unstable; urgency=low * Fix i386 cowdancer, rollback to only use large file support for qemubuilder. cowbuilder and cowdancer seem to need more changes to get LFS working. (closes: #520994) -- Junichi Uekawa Wed, 25 Mar 2009 08:57:45 +0900 cowdancer (0.52) unstable; urgency=low * Fix build error on i386. libcowdancer cannot be built with LFS on i386. Disable LFS for now. (closes: #520861) -- Junichi Uekawa Mon, 23 Mar 2009 22:27:51 +0900 cowdancer (0.51) unstable; urgency=low * add largefile support flags so that qemubuilder works properly in 32-bit mode. (closes: #520721) -- Junichi Uekawa Mon, 23 Mar 2009 08:32:54 +0900 cowdancer (0.50) unstable; urgency=low * add handling for inputfile / outputfile options, --inputfile is implemented. * do not use external resolv.conf inside qemu. * add 'quiet' option to kernel booting inside qemu. * Set the current time inside chroot for pbuilder create target as well. -- Junichi Uekawa Sat, 21 Mar 2009 11:08:44 +0900 cowdancer (0.49) unstable; urgency=low * qemubuilder: depend on debootstrap. (closes: #496077) * cowbuilder package: split out from cowdancer. cowdancer can be useful in more cases than cowbuilder. (closes: #459436) The two packages depend on both packages in order to not break backward compatibility. * Add a README.Debian for cowbuilder (closes: #496458) * Handle IPv4 'lo' device address (127.0.0.0) for --mirror option specially, so that they are translated to 10.0.2.2 inside qemu. * qemu: mount sysfs and devpts (closes: #511190) -- Junichi Uekawa Fri, 20 Feb 2009 22:11:22 +0900 cowdancer (0.48) unstable; urgency=low * qemubuilder: add support for armel. * qemubuilder: add support for --arch-diskdevice option so that users of Ubuntu i386 kernels can override from default hd to sd. -- Junichi Uekawa Sun, 10 Aug 2008 23:40:39 +0900 cowdancer (0.47) unstable; urgency=low * Bug fix: "cowdancer: unexpected WIFEXITED status in waitpid", thanks to Andreas Beckmann (Closes: #466709). Block SIGCHLD when forking cp. -- Junichi Uekawa Tue, 20 May 2008 07:58:24 +0900 cowdancer (0.46) unstable; urgency=low * make cowbuilder work with cowbuilder in etch. Bug 410723 will revive, so it will need --debian-etch-workaround option to enable. "provide cowdancer etch support", thanks to Patrick Winnertz (Closes: #481344). * Add reference to --no-cowdancer-update option in the error message so that it's more obvious. (Closes: #481609). -- Junichi Uekawa Sun, 18 May 2008 12:24:21 +0900 cowdancer (0.45) unstable; urgency=low * cowbuilder, qemubuilder: Give error message when '--build' is invoked without .dsc file parameter. (Closes: #460041). * output more useful info on waitpid WIFEXITED debug message. * add header to .ilist, so that it is possible to know a little bit more about the structure. Note that upgrade will fail within cowdancer session, please re-create chroot, or use the --no-cowdancer-update option: Unpacking cowdancer (from .../cowdancer_0.45_amd64.deb) ... ERROR: ld.so: object '/usr/lib/cowdancer/libcowdancer.so' from LD_PRELOAD cannot be preloaded: ignored. cowdancer: .ilist header unexpected cowdancer: .ilist header unexpected cowdancer: .ilist header unexpected dpkg-split: unable to read part file `/tmp/buildd/qemubuilder_0.45_amd64.deb': Cannot allocate memory dpkg: error processing /tmp/buildd/qemubuilder_0.45_amd64.deb (--install): * Bug fix: "qemubuilder --create installs many useless? packages", thanks to David Bremner (Closes: #476547). Do not install recommended packages. Qemubuilder now creates '/etc/apt/apt.conf.d/15pbuilder' in the same manner as pbuilder. * Bug fix: "qemubuilder: Please add kvm as alternate dependency", thanks to Josh Triplett (Closes: #479277). -- Junichi Uekawa Mon, 12 May 2008 08:47:40 +0900 cowdancer (0.44) unstable; urgency=low * add Vcs-Git, Vcs-Browser. * fix invocation to cowdancer-ilistcreate -- Junichi Uekawa Wed, 21 Nov 2007 22:47:22 +0900 cowdancer (0.43) unstable; urgency=low * make cowbuilder work with pdebuild. --debbuildopts handling was broken for cowbuilder. (Closes: #448330). -- Junichi Uekawa Sun, 28 Oct 2007 23:13:42 +0900 cowdancer (0.42) unstable; urgency=low * Bug fix: "cowdancer: Please ship a (basic) bash completion file", thanks to Cyril Brulebois (Closes: #446498). * --components support. * Bug fix: "qemubuilder doesn't pass --debbuildopts to dpkg-buildpackage", thanks to Alexander Gerasiov (Closes: #447510). -- Junichi Uekawa Thu, 25 Oct 2007 20:18:28 +0900 cowdancer (0.41) unstable; urgency=low * Bug fix: "qemubuilder: build of package failing due to date problems", thanks to Jean-Baptiste Note (Closes: #441132). * Bug fix: "newly created cowdancer chroot cannot be updated", thanks to Paul Wise (Closes: #441463). - there was a race condition with .ilist handling. -- Junichi Uekawa Mon, 10 Sep 2007 19:50:31 +0900 cowdancer (0.40) unstable; urgency=low * Bug fix: "cowdancer: Should remove base directory when failed to create it", thanks to Nelson A. de Oliveira (Closes: #440651). * cow-shell: if COWDANCER_REUSE is not set, remove .ilist file after use. (Closes: #350268). * Bug fix: "cowdancer: needed in cowdancer-ilistcreate.c for Etch backport", thanks to Sven Hartge (Closes: #440879). * update qemubuilder README.Debian * Don't assume network is always available as 'eth0', and try to find out. patch thanks to Jean-Baptiste Note (Closes: #440888). -- Junichi Uekawa Fri, 07 Sep 2007 08:29:31 +0900 cowdancer (0.39) unstable; urgency=low * Bug fix: "qemubuilder: Problem when non-US locale", thanks to Jean-Baptiste Note (Closes: #440558). * Give fd0 directly to qemu to allow tty control. * Handle exit codes. * apply patch to more easily handle newer architecture support, thanks to Jean-Baptiste Note: #440555 -- Junichi Uekawa Tue, 04 Sep 2007 08:31:55 +0900 cowdancer (0.38) unstable; urgency=low [ Jan-Marek Glogowski ] * Don't clean the environment when invoking dumpconfig (closes: #431993) * Better error handling when loading config [ Junichi Uekawa ] * add aptitude into chroot for pbuilder-satisfydepends-aptitude. * add cowdancer-ilistcreate command, which creates ilist file. * add cowdancer-ilistdump command, for debugging purposes. It was included in the testsuite, but it is generally useful for troubleshooting. * run cowdancer-ilistcreate within chroot if it exists - Bug fix: "cowbuilder cross-arch building support." (Closes: #432573). -- Junichi Uekawa Sat, 01 Sep 2007 13:10:45 +0900 cowdancer (0.37) unstable; urgency=low * Trying to fix: "tar segfaulting within cowbuilder chroot", thanks to Michael Ablassmeier (closes: #430636). - work around glibc bug on dlvsym/dlerror failure case. * close mmap fd after use. -- Junichi Uekawa Wed, 27 Jun 2007 07:12:20 +0900 cowdancer (0.36) unstable; urgency=low * fix logic for running amd64 on i386. * add example for cowbuilder manpage. * add --dumpconfig option. * Bug fix: "cowbuilder ignores BUILDPLACE", thanks to Guido Guenther (Closes: #429058). * Bug fix: "qemubuilder: --distribution is not honored", thanks to Ben Voui (Closes: #429026). * load proper chown for architectures (e.g. i386) which have two versions of chown. * Bug fix: "qemubuilder: manpage talks of cowbuilder instead of qemubuilder", thanks to Ben Voui (Closes: #428959). -- Junichi Uekawa Mon, 25 Jun 2007 21:26:02 +0900 cowdancer (0.35) unstable; urgency=low * add README.Debian to qemubuilder. * libcowdancer: change exported symbol names to be less generic. -- Junichi Uekawa Sat, 09 Jun 2007 22:37:45 +0900 cowdancer (0.34) unstable; urgency=low * qemubuilder: fix segv. * Bug fix: "big bind mounts make login take a looong time", thanks to Joey Hess (Closes: #410723). Special-case ./home/ so that it's not scanned for cowbuilder. Usually, only the filesystem outside of /home is interesting for cowbuilder sessions. -- Junichi Uekawa Sat, 09 Jun 2007 15:16:07 +0900 cowdancer (0.33) unstable; urgency=low * qemubuilder: support signed .dsc files * qemubuilder: install to /usr/sbin/ instead of /usr/bin. (Closes: #427786). -- Junichi Uekawa Wed, 06 Jun 2007 21:00:46 +0900 cowdancer (0.32) unstable; urgency=low * Try again, call debhelper with '-s' so that it doesn't try to build everything on all architectures (Closes: #427650). -- Junichi Uekawa Wed, 06 Jun 2007 08:11:54 +0900 cowdancer (0.31) unstable; urgency=low * cowbuilder: pass --configfile option through to pbuilder. * cowbuilder, qemubuilder: reorganize code, to put shared code into parameter.[ch] -- Junichi Uekawa Wed, 06 Jun 2007 07:54:24 +0900 cowdancer (0.30) unstable; urgency=low * Bug fix: "FTBFS: cowdancer_0.29(alpha/unstable): b-d on qemu not satisfiable on all archs", thanks to Steve Langasek (Closes: #427650). only build on i386, amd64, and powerpc. -- Junichi Uekawa Tue, 05 Jun 2007 22:50:30 +0900 cowdancer (0.29) unstable; urgency=low * qemubuilder, cowbuilder: 'set -e' when sourcing configuration file. * Build-Depend on qemu, which is needed for testing. -- Junichi Uekawa Tue, 05 Jun 2007 21:12:02 +0900 cowdancer (0.28) unstable; urgency=low * qemubuilder: add example pbuilderrc and document ARCH= option in manpage. * Build-Depend on pbuilder, since cowbuilder/qemubuilder testsuite requires pbuilder to run. -- Junichi Uekawa Mon, 04 Jun 2007 07:28:22 +0900 cowdancer (0.27) unstable; urgency=low * support configuration files in cowbuilder. - fixes: "no easy way to specify an alternative basepath", thanks to Guido Guenther (Closes: #426589). - change Recommends to Depends on pbuilder, since configuration files are provided by pbuilder. * add reference to pbuilder documentation from cowbuilder documentation. * add qemubuilder package. -- this is more of a prototype, but enjoy. -- Junichi Uekawa Wed, 30 May 2007 09:20:22 +0900 cowdancer (0.26) unstable; urgency=low * spec file, port to rpm-based systems. * load .ilist file in the constructor, which should make .ilist file be loaded at file descriptor 3. (closes: #413912) - add test for close(0);open() not returning 0 for fd. -- Junichi Uekawa Thu, 8 Mar 2007 09:19:38 +0900 cowdancer (0.25) unstable; urgency=low * Bug fix: "cowdancer: Better explain how to use cowbuilder to build packages", thanks to Nelson A. de Oliveira (Closes: #405090). * Bug fix: "cowdancer: cannot build gnustep-base with cowbuilder", thanks to Hubert Chan (Closes: #402669). Do not canonicalize lchown. -- Junichi Uekawa Sun, 31 Dec 2006 15:54:09 +0900 cowdancer (0.24) unstable; urgency=low * testsuite update * Bug fix: "--save-after-login hardlinks aptcache contents in base.cow", thanks to Matti Lindell (Closes: #384132). -- Junichi Uekawa Thu, 23 Nov 2006 15:00:59 +0900 cowdancer (0.23) unstable; urgency=low * cowbuilder --update ignored command-line options; fix. -- Junichi Uekawa Thu, 31 Aug 2006 07:30:23 +0900 cowdancer (0.22) unstable; urgency=low * Bug fix: "cowdancer: documentation fix to document that --debootstrapopts etc can be used with cowbuilder", thanks to Pierre Habouzit (Closes: #384030). * update README.Debian -- Junichi Uekawa Sat, 26 Aug 2006 09:07:25 +0900 cowdancer (0.21) unstable; urgency=low * Do not clean up if return code from pbuilder looks wrong. -- Junichi Uekawa Sun, 20 Aug 2006 15:08:43 +0900 cowdancer (0.20) unstable; urgency=low * Bug fix: "cowdancer: cowbuilder removes base.cow after failed --update", thanks to Jorda Polo (Closes: #379797). -- Junichi Uekawa Wed, 26 Jul 2006 08:35:42 +0900 cowdancer (0.19) unstable; urgency=low * actually support --buildplace and fix --basepath. Thanks to Jonas Smedegaard for the patch. (closes: #375019) -- Junichi Uekawa Tue, 27 Jun 2006 00:07:08 +0900 cowdancer (0.18) unstable; urgency=low * cow-shell: COWDANCER_REUSE=yes: reuse .ilist instead of regenerating. * cowbuilder: use COWDANCER_REUSE=yes option to avoid excessive call to find/xargs. Speeds up pbuilder-satisfydepends considerably, making cowbuilder build faster. -- Junichi Uekawa Wed, 21 Jun 2006 08:34:39 +0900 cowdancer (0.17) unstable; urgency=low * mkdir with right permission 0777, not 777. -- Junichi Uekawa Thu, 15 Jun 2006 08:36:43 +0900 cowdancer (0.16) unstable; urgency=low * add test case for sid/etc debootstrap with cdebootstrap and debootstrap. * Avoid unneeded cowlinkbreak when hardlink number is 1. Caused some problems with dpkg-gencontrol. (Closes: #369261). * Standards-version: 3.7.2 * Error out when there is no file in directory to cowprotect. -- Junichi Uekawa Sun, 11 Jun 2006 15:04:49 +0900 cowdancer (0.15) unstable; urgency=low * cowbuilder: give out help message * Bug fix: "cowbuilder silently ignore --basepath option if argument does not exists", thanks to Marco Nenciarini (Closes: #369220). * Bug fix: "manpage for cowbuilder speaks about nonexistent --basetgz option", thanks to Marco Nenciarini (Closes: #369211). * Bug fix: "cowdancer: cowbuilder fails after invocation of `pbuilder clean`", thanks to Edward J. Shornock (Closes: #369258). -- Junichi Uekawa Mon, 29 May 2006 07:24:07 +0900 cowdancer (0.14) unstable; urgency=low * Welcome to cowbuilder, which can be used along with pbuilder. -- Junichi Uekawa Fri, 26 May 2006 06:32:21 +0900 cowdancer (0.13) unstable; urgency=low * use exec instead of system, so that it will work with ' and spaces. -- Junichi Uekawa Sun, 5 Mar 2006 22:58:16 +0900 cowdancer (0.12) unstable; urgency=low * add support for space in filenames. - Bug fix: "cowdancer: dpatches with spaces in their name fail to apply", thanks to Paul Wise (Closes: #355358). -- Junichi Uekawa Sun, 5 Mar 2006 19:31:34 +0900 cowdancer (0.11) unstable; urgency=low * add error-handling -- Junichi Uekawa Thu, 26 Jan 2006 08:14:22 +0900 cowdancer (0.10) unstable; urgency=low * fixed pthread race condition. -- Junichi Uekawa Sat, 14 Jan 2006 22:28:03 +0900 cowdancer (0.9) unstable; urgency=low * Reorder the flow of execution for the case when /lib/ld.so binary is written to; I cannot fork/exec shared binaries while modifying ld.so. -- Junichi Uekawa Mon, 9 Jan 2006 00:48:17 +0900 cowdancer (0.8) unstable; urgency=low * speed improvement when handling ilist file; when handling linux kernel source tree, performance degradation was around 6x in 0.7, but it's now 1.1x on my test system. - Use mmap and binary data format - Use qsort/bsearch on this data format. * update README.Debian. -- Junichi Uekawa Sat, 7 Jan 2006 11:56:06 +0900 cowdancer (0.7) unstable; urgency=low * Work around stat change with coreutils 5.3.0 and later * Fix testsuite * COWDANCER_DEBUG environmental variable enables debug messages. -- Junichi Uekawa Wed, 23 Nov 2005 14:08:51 +0900 cowdancer (0.6) unstable; urgency=low * add chmod/chown support. (closes: #329383) - does not fully support fchmod/fchown, apt/dpkg apparently uses that operation. will need to investigate further. - debian/TODO: added * Clear memory before use on ilist; fixes problem on ppc. -- Junichi Uekawa Wed, 2 Nov 2005 09:07:01 +0900 cowdancer (0.5) unstable; urgency=low * cowdancer: cow-shell does not start, gives error (closes: #329344) -- Junichi Uekawa Wed, 21 Sep 2005 22:54:34 +0900 cowdancer (0.4) unstable; urgency=low * added some error checking * Initial upload to Debian archive (closes: #325370) -- Junichi Uekawa Tue, 30 Aug 2005 08:36:07 +0900 cowdancer (0.3) unstable; urgency=low * add testsuite. * find -xdev to avoid looking into /proc * Try not to COW device files, only handle regular files * symlinks support * trap fopen/fopen64 as well as open/open64. - enough features to run pbuilder 0.130 -- Junichi Uekawa Sat, 20 Aug 2005 10:10:47 +0900 cowdancer (0.2) unstable; urgency=low * Fix buffer overflow. -- Junichi Uekawa Sat, 13 Aug 2005 21:38:22 +0900 cowdancer (0.1) unstable; urgency=low * Initial Release -- Junichi Uekawa Sat, 13 Aug 2005 21:08:03 +0900 cowdancer-0.73/debian/cowbuilder.README.Debian0000644000000000000000000000107011220436222015707 0ustar cowbuilder for Debian --------------------- This is a note on how to use cowbuilder First, create the chroot image in /var/cache/pbuilder/base.cow/ with cowbuilder --create You can update this image with cowbuilder --update To build a package, run: cowbuilder --build XXX.dsc or perhaps more conveniently: pdebuild --pbuilder cowbuilder or even more conveniently: edit /etc/pbuilderrc to have PDEBUILD_PBUILDER=cowbuilder pdebuild -- Junichi Uekawa , Thu, 14 May 2009 20:35:12 +0900 cowdancer-0.73/debian/TODO0000644000000000000000000000243011304446264012213 0ustar * make cowdancer LFS * qemubuilder to gracefully exit qemu - not get killed on usual case - sending return code via control file - not overriding serial output to be handled via qemubuilder, but directly interacting with user * initrd support - klibc is a win, but file size with glibc is <1MB, which doesn't look too bad. Do I need to work with nonfunctional and incomplete implementation of libc ? -rwxr-xr-x 1 dancer dancer 659557 2009-04-12 15:31 qemuinit-static -rwxr-xr-x 1 dancer dancer 20504 2009-04-12 15:31 qemuinit-static-klibc - add some daemon to monitor inside of chroot via some HTTP request? * biarch support ? * fix segv in parameter parsing sudo cowbuilder -M aaa bbb cccc * signal handling; do I support ctrl-C reasonably? (no) * hardlink behavior. If I had a hardlinked file, I would expect both files to be updated at the same time. Currently, it will only update one of the files. mkdir 1 touch 1/a ln 1/a 1/b cp -al 1 2 cowdancer echo test > 2/b will result in 2/b being different to 2/a. This has implications, and I think this should be documented. * Investigate fchmod/fchown It is partially implemented, but difficult to really do. open(, RDONLY) and fchmod/fchown is hard to do, because we're handling inodes at that timing. flock has similar problems. cowdancer-0.73/debian/qemubuilder.README.Debian0000644000000000000000000001514711275034640016110 0ustar = qemubuilder = This page is README.Debian of qemubuilder, a pbuilder implementation using qemu. See also [[cowbuilder]]. = Usage = pbuilderrc-arch.config: {{{ KERNEL_IMAGE=/boot/vmlinuz-2.6.21-1-686 INITRD=/boot/initrd.img-2.6.21-1-686 MIRRORSITE=http://ftp.cz.debian.org/debian ARCH=i386 BASEPATH=/var/cache/pbuilder/base-i386.qemu MEMORY_MEGS=64 }}} and adjust the KERNEL_IMAGE and INITRD paths, so that they point to the kernel and initrd that you want to use in qemu (so obviously, for ARCH=i386, use i386 kernel, for amd64, use amd64 kernel, etc.). Adjust the MIRRORSITE to your favourite Debian mirror. Create the base image: {{{ $ sudo qemubuilder --create --configfile pbuilder-arch.config [...] Setting up g++ (4:4.2.1-6) ... Setting up dpkg-dev (1.14.6) ... Setting up build-essential (11.3) ... -> received termination signal with exit-code 0, killing child process (qemu) -> killed (qemu) -> child process terminated with status: f }}} This is a correct behavior and the qemu image `/var/cache/pbuilder/base-i386.qemu` was successfully created (it will have 3.1GB). If this step doesn't work, read the logs first, then if you can't figure out what's wrong, please report a bug. Compile a package: {{{ $ sudo qemubuilder --configfile pbuilder-arch.config --build something.dsc [...] dpkg-genchanges dpkg-genchanges: including full source code in upload dpkg-buildpackage: full upload; Debian-native package (full source is included) -> received termination signal with exit-code 0, killing child process (qemu) -> killed (qemu) -> child process terminated with status: f -> running post-run process running host command: cp -p "/var/cache/pbuilder/build//qemu.16459"/*_* "/var/cache/pbuilder/result/" 2>/dev/null || true -> clean up COW device files }}} and the source and binary package will be in `/var/cache/pbuilder/result/`. See also `man qemubuilder`, `man pbuilder` and /usr/share/doc/pbuilder/pbuilder-doc.html. = Architecture specific information = To run qemubuilder you need a kernel image, and optionally initrd. To get qemubuilder working, qemu support for that target architecture, the kernel image (and optionally initrd image) for the target architecture, and a way to invoke the kernel from the command-line using -kernel command-line option is required. Support for specifying disk devices through -hda and -hdb is required for operation. You might have some luck finding some of the kernels from http://people.debian.org/~aurel32/qemu/ Ideally you should be able to find the kernels from Debian archive, but we're not there yet. == i386 == Files from Debian kernel package (linux-image-xxx) should work. An example of a working configuration as of September 7, 2007 - use sid, run on i386, emulate i386: {{{ $ sudo apt-get install linux-image-2.6.22-2-686 $ cat pbuilderrc-i386.config KERNEL_IMAGE=/boot/vmlinuz-2.6.22-2-686 INITRD=/boot/initrd.img-2.6.22-2-686 MIRRORSITE=http://ftp.cz.debian.org/debian ARCH=i386 BASEPATH=/var/cache/pbuilder/base-i386.qemu MEMORY_MEGS=64 $ sudo qemubuilder --configfile pbuilderrc-i386.config --create [...] }}} and a working qemu image `base-i386.qemu` is created in `/var/cache/pbuilder/`. use sid, run on amd64, emulate i386: {{{ # on i386 machine do: $ scp /boot/vmlinuz-2.6.22-2-686 /boot/initrd.img-2.6.22-2-686 some.amd64.computer.cz:debian/ # on the amd64 machine, in the "debian" directory $ cat pbuilderrc-i386.config KERNEL_IMAGE=vmlinuz-2.6.22-2-686 INITRD=initrd.img-2.6.22-2-686 MIRRORSITE=http://ftp.cz.debian.org/debian ARCH=i386 BASEPATH=/var/cache/pbuilder/base-i386.qemu MEMORY_MEGS=64 $ sudo qemubuilder --configfile pbuilderrc-i386.config --create [...] }}} and a working qemu image `base-i386.qemu` is created in `/var/cache/pbuilder/`. == amd64 == Files from Debian kernel package (linux-image-xxx) should work. An example of a working configuration as of September 7, 2007 - use sid, run on i386, emulate amd64: {{{ $ sudo apt-get install linux-image-2.6.22-2-amd64 $ cat pbuilderrc-amd64.config KERNEL_IMAGE=/boot/vmlinuz-2.6.22-2-amd64 INITRD=/boot/initrd.img-2.6.22-2-amd64 MIRRORSITE=http://cdn.debian.net/debian ARCH=amd64 BASEPATH=/home/ondra/debian/base-amd64.qemu MEMORY_MEGS=64 $ sudo qemubuilder --configfile pbuilderrc-amd64.config --create [...] }}} and a working qemu image `base-amd64.qemu` is created in `/home/ondra/debian/`. I found that MEMORY_MEGS=64 was too small. It seemed to work much better for me with MEMORY_MEGS=512 [DavidBremner] == arm == kernel for versatile architecture is available from Debian archive: http://cdn.debian.net/debian/pool/main/l/linux-latest-2.6/ for example, linux-image-2.6.26-1-versatile_2.6.26-12_armel.deb This kernel requires initrd, and ext3 and ethernet driver module is not built-in. Currently you cannot use this kernel. == mips == For etch, there was qemu architecture, for lenny it's malta. Get the kernel and initrd from http://cdn.debian.net/debian/pool/main/l/linux-latest-2.6/ for malta architecture, is this too modularized too? == mipsel == For etch, there was qemu architecture, for lenny it's malta. Get the kernel and initrd from http://cdn.debian.net/debian/pool/main/l/linux-latest-2.6/ for malta architecture, is this too modularized too? == powerpc == Running fine for etch, with some quirks. Solution pending for sid. DebianBug:440555 * Extract vmlinuz-2.4.27-001 from the [[http://www.overselfresearch.com/kb/download/qemu/kernel-2.4.27-ppc32-prep-debian_sarge_patches-preptool_patch.zip|following tarball]]; * Download preptool from http://www.olifantasia.com/qemu/kernels/2.4.25/preptool * Then run prepool on the kernel image, so as to pass correct parameters to the kernel directly: {{{ $ preptool -s"ide0=0x1f0,0x3f6,13 ide1=0x170,0x376,13 netdev=9,0x300,eth0 console=ttyS0 root=/dev/hda init=/pbuilder-run ro" vmlinuz-2.4.27.001 }}} You're done. Package successfully build as of 15 of september 2007. == sparc == requires openbios. found it from: http://fly.srk.fer.hr/~jelly/qemu/openbios-builtin.elf http://mirror/debian/dists/sid/main/installer-sparc/20070308/images/combined/2.6/mini.iso Does not support loading kernel through -kernel ? == other architecture == support needs to be added. Please mail Junichi Uekawa with information on a kernel configuration that works. = troubleshooting = == kernel panic! == The last log message may say kernel panic, but that's the symptom, not the problem. Look for the messages above it. Trying out different kernel versions may help sometimes. = Location of README.Debian = canonical version is available at http://wiki.debian.org/qemubuilder the file in Debian package is updated from the contents from time to time by running debian/rules debian/qemubuilder.README.Debian cowdancer-0.73/debian/rules0000755000000000000000000000431711757652124012617 0ustar #!/usr/bin/make -f # Sample debian/rules that uses debhelper. # GNU copyright 1997 to 1999 by Joey Hess. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 CFLAGS = -Wall -g -fno-strict-aliasing INSTALL = install export INSTALL_FILE = $(INSTALL) -p -o root -g root -m 644 export INSTALL_PROGRAM = $(INSTALL) -p -o root -g root -m 755 export INSTALL_SCRIPT = $(INSTALL) -p -o root -g root -m 755 export INSTALL_DIR = $(INSTALL) -p -d -o root -g root -m 755 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) CFLAGS += -O0 else CFLAGS += -O2 endif ifeq (,$(findstring nostrip,$(DEB_BUILD_OPTIONS))) INSTALL_PROGRAM += -s endif ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS))) MAKEFLAGS += -j$(NUMJOBS) endif configure: configure-stamp configure-stamp: dh_testdir touch configure-stamp build: configure-stamp build-stamp build-stamp: dh_testdir $(MAKE) ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS))) # Code to run the package test suite. $(MAKE) check endif touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp configure-stamp -$(MAKE) clean dh_clean install: build dh_testdir dh_testroot dh_clean -k dh_installdirs $(MAKE) install DESTDIR=$(CURDIR)/debian/cowdancer dh_movefiles -pqemubuilder --sourcedir=debian/cowdancer dh_movefiles -pcowbuilder --sourcedir=debian/cowdancer # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install dh_testdir -s dh_testroot -s dh_installdocs -s NEWS dh_installexamples -s dh_installmenu -s dh_installman -s dh_installchangelogs -s ChangeLog dh_link -s dh_strip -s dh_shlibdeps -s dh_compress -s dh_fixperms -s dh_installdeb -s dh_gencontrol -s dh_md5sums -s dh_builddeb -s # (shell-command "cd ../ ; debian/rules debian/qemubuilder.README.Debian") debian/qemubuilder.README.Debian: w3m -dump 'http://wiki.debian.org/qemubuilder?action=raw' > $@.tmp mv $@.tmp $@ binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install configure debian/qemubuilder.README.Debian cowdancer-0.73/debian/README.Debian0000644000000000000000000000151611220436222013556 0ustar cowdancer for Debian -------------------- This is a cowdancer. Restrictions: Usage with chroot needs cow-shell invoked inside chroot. e.g. chroot /path/to/chroot cow-shell command-to-execute cowbuilder handles this for you. Might potentially have some problems with fakeroot; although it seems to be working fine at the moment. BUGS: Requires a file descriptor for maintaining '.ilist' file. May break applications that have expectations on having a reliable file descriptor number. O_CREAT may be better implemented without cp -a, but the implication of owner of created file vs truncated file is unclear. fchown/fchmod cannot possibly work reliably upgrading cowdancer while running under cowdancer causes problems due to incompatibility in data format. -- Junichi Uekawa , Sun, 6 May 2007 08:35:04 +0900 cowdancer-0.73/debian/pbuilder-test/0000755000000000000000000000000011220436222014275 5ustar cowdancer-0.73/debian/pbuilder-test/001_makecheck0000644000000000000000000000013711220436222016514 0ustar #!/bin/bash cd /tmp/buildd/*/debian/.. chown -R 1555:1555 tests/log echo make check | su user1 cowdancer-0.73/debian/pbuilder-test/000_prepinstall0000644000000000000000000000040711220436222017135 0ustar #!/bin/bash apt-get update apt-get -y --force-yes install binfmtc sudo adduser addgroup --gid 1555 user1 addgroup --gid 1556 test1 addgroup --gid 1557 test2 adduser --uid 1555 --gid 1555 user1 --disabled-login --gecos '' adduser user1 test1 adduser user1 test2 cowdancer-0.73/debian/control0000644000000000000000000000440511757653252013143 0ustar Source: cowdancer Section: utils Priority: optional Maintainer: Junichi Uekawa Build-Depends: cpio, busybox-static, debhelper (>> 4.0.0), klibc-utils, libklibc-dev, pbuilder, qemu-system [i386 amd64 powerpc] Standards-Version: 3.9.2 Vcs-Git: git://git.debian.org/git/pbuilder/cowdancer.git Vcs-Browser: http://git.debian.org/?p=pbuilder/cowdancer.git Package: cowdancer Architecture: any Depends: ${shlibs:Depends} Homepage: http://www.netfort.gr.jp/~dancer/software/cowdancer.html Description: Copy-on-write directory tree utility. Tries to make copy-on-write semantics upon hard-link copied directory trees generated with 'cp -la' . 'cow-shell' command invokes a shell session. Within that session, under the directory cow-shell was invoked, cowdancer will create a new file when existing i-nodes are opened for write. Useful for quick scratch workspace and experimentation. . For a useful Debian tool, try cowbuilder. Package: cowbuilder Architecture: any Depends: ${shlibs:Depends}, pbuilder, cowdancer Replaces: cowdancer (<= 0.49) Description: pbuilder running on cowdancer 'cowbuilder' command is a wrapper for pbuilder which allows using pbuilder-like interface over cowdancer environment. . pbuilder is a tool for building and testing Debian package inside a clean chroot, and cowbuilder allows chroot to be recreated using hard-linked copies with copy-on-write, which makes creation and destruction of chroots fast. Package: qemubuilder Architecture: i386 amd64 powerpc Depends: ${shlibs:Depends}, qemu-system | kvm, pbuilder (>= 0.174), debootstrap Homepage: http://wiki.debian.org/qemubuilder Description: pbuilder using QEMU as backend pbuilder implementation for QEMU. . qemubuilder create -- builds QEMU cow base image. . qemubuilder update -- updates QEMU cow base image. . qemubuilder build -- builds package inside QEMU cow base image. . Gives a pbuilder interface for emulated cross-building environments using qemu. . pbuilder is a tool for building and testing Debian package inside a clean chroot, and qemubuilder implements similar experience over emulated CPUs. This tool allows building package inside emulated Debian environment for different CPU architectures supported by qemu. cowdancer-0.73/debian/cowbuilder.files0000644000000000000000000000013011220436222014667 0ustar /usr/sbin/cowbuilder /usr/share/man/man8/cowbuilder.8 /etc/bash_completion.d/cowbuilder cowdancer-0.73/debian/dirs0000644000000000000000000000004311220436222012373 0ustar usr/bin usr/sbin usr/lib/cowdancer cowdancer-0.73/debian/qemubuilder.files0000644000000000000000000000013311220436222015051 0ustar /usr/sbin/qemubuilder /usr/share/man/man8/qemubuilder.8 /etc/bash_completion.d/qemubuilder cowdancer-0.73/buildarch.txt0000644000000000000000000012420211615143367013004 0ustar $ sudo ./cowbuilder --build ../../pbuilder/pbuilder/testsuite/random-manual-test-material/buildarchpkg/buildarchpkg_0.1.dsc -> Copying COW directory forking: rm -rf /var/cache/pbuilder/build//cow.30004 forking: cp -al /var/cache/pbuilder/base.cow /var/cache/pbuilder/build//cow.30004 I: removed stale ilistfile /var/cache/pbuilder/build//cow.30004/.ilist forking: chroot /var/cache/pbuilder/build//cow.30004 cowdancer-ilistcreate /.ilist find . -xdev -path ./home -prune -o \( \( -type l -o -type f \) -a -links +1 -print0 \) | xargs -0 stat --format '%d %i ' -> Invoking pbuilder forking: pbuilder build --buildplace /var/cache/pbuilder/build//cow.30004 --buildresult /var/cache/pbuilder/result/ --debbuildopts --no-targz --internal-chrootexec chroot /var/cache/pbuilder/build//cow.30004 cow-shell /home/dancer/DEBIAN/pbuilder/pbuilder/testsuite/random-manual-test-material/buildarchpkg/buildarchpkg_0.1.dsc W: /root/.pbuilderrc does not exist I: Running in no-targz mode I: using fakeroot in build. I: Current time: Sun Jul 31 11:58:32 JST 2011 I: pbuilder-time-stamp: 1312081112 I: copying local configuration I: mounting /proc filesystem I: mounting /dev/pts filesystem I: Mounting /var/cache/pbuilder/ccache I: policy-rc.d already exists I: Obtaining the cached apt archive contents I: Setting up ccache I: Installing the build-deps I: user script /var/cache/pbuilder/build/cow.30004/tmp/hooks/D80no-man-db-rebuild starting I: Preseed man-db/auto-update to false I: user script /var/cache/pbuilder/build/cow.30004/tmp/hooks/D80no-man-db-rebuild finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy Version: 0.invalid.0 Architecture: i386 Maintainer: Debian Pbuilder Team Description: Dummy package to satisfy dependencies with aptitude - created by pbuilder This package was created automatically by pbuilder to satisfy the build-dependencies of the package being currently built. Depends: debhelper (>= 5), ghostscript dpkg-deb: building package `pbuilder-satisfydepends-dummy' in `/tmp/satisfydepends-aptitude/pbuilder-satisfydepends-dummy.deb'. Selecting previously deselected package pbuilder-satisfydepends-dummy. (Reading database ... 11477 files and directories currently installed.) Unpacking pbuilder-satisfydepends-dummy (from .../pbuilder-satisfydepends-dummy.deb) ... dpkg: dependency problems prevent configuration of pbuilder-satisfydepends-dummy: pbuilder-satisfydepends-dummy depends on debhelper (>= 5); however: Package debhelper is not installed. pbuilder-satisfydepends-dummy depends on ghostscript; however: Package ghostscript is not installed. dpkg: error processing pbuilder-satisfydepends-dummy (--install): dependency problems - leaving unconfigured Errors were encountered while processing: pbuilder-satisfydepends-dummy The following NEW packages will be installed: bsdmainutils{a} debhelper{a} file{a} fontconfig-config{a} gettext{a} gettext-base{a} ghostscript{a} groff-base{a} gs-cjk-resource{a} gsfonts{a} html2text{a} intltool-debian{a} libavahi-client3{a} libavahi-common-data{a} libavahi-common3{a} libcroco3{a} libcups2{a} libcupsimage2{a} libdbus-1-3{a} libexpat1{a} libfontconfig1{a} libfreetype6{a} libgcrypt11{a} libglib2.0-0{a} libgnutls26{a} libgpg-error0{a} libgs9{a} libgs9-common{a} libgssapi-krb5-2{a} libijs-0.35{a} libjasper1{a} libjbig2dec0{a} libjpeg62{a} libjpeg8{a} libk5crypto3{a} libkeyutils1{a} libkrb5-3{a} libkrb5support0{a} liblcms1{a} libmagic1{a} libpaper1{a} libpcre3{a} libpipeline1{a} libpng12-0{a} libtasn1-3{a} libtiff4{a} libunistring0{a} libxml2{a} man-db{a} po-debconf{a} ttf-dejavu-core{a} ucf{a} The following partially installed packages will be configured: pbuilder-satisfydepends-dummy The following packages are RECOMMENDED but will NOT be installed: autopoint cmap-adobe-cns1 cmap-adobe-gb1 cmap-adobe-japan1 cmap-adobe-japan2 cmap-adobe-korea1 dbus libglib2.0-data libmail-sendmail-perl libpaper-utils shared-mime-info xml-core 0 packages upgraded, 52 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/26.8 MB of archives. After unpacking 67.8 MB will be used. debconf: delaying package configuration, since apt-utils is not installed Selecting previously deselected package libmagic1. (Reading database ... 11477 files and directories currently installed.) Unpacking libmagic1 (from .../libmagic1_5.04-5+b1_i386.deb) ... Selecting previously deselected package file. Unpacking file (from .../file_5.04-5+b1_i386.deb) ... Selecting previously deselected package html2text. Unpacking html2text (from .../html2text_1.3.2a-15_i386.deb) ... Selecting previously deselected package libpcre3. Unpacking libpcre3 (from .../libpcre3_8.12-3_i386.deb) ... Selecting previously deselected package libglib2.0-0. Unpacking libglib2.0-0 (from .../libglib2.0-0_2.28.6-1_i386.deb) ... Selecting previously deselected package libxml2. Unpacking libxml2 (from .../libxml2_2.7.8.dfsg-4_i386.deb) ... Selecting previously deselected package libcroco3. Unpacking libcroco3 (from .../libcroco3_0.6.2-1_i386.deb) ... Selecting previously deselected package libunistring0. Unpacking libunistring0 (from .../libunistring0_0.9.3-4_i386.deb) ... Selecting previously deselected package gettext-base. Unpacking gettext-base (from .../gettext-base_0.18.1.1-3_i386.deb) ... Selecting previously deselected package gettext. Unpacking gettext (from .../gettext_0.18.1.1-3_i386.deb) ... Selecting previously deselected package intltool-debian. Unpacking intltool-debian (from .../intltool-debian_0.35.0+20060710.1_all.deb) ... Selecting previously deselected package po-debconf. Unpacking po-debconf (from .../po-debconf_1.0.16+nmu1_all.deb) ... Selecting previously deselected package groff-base. Unpacking groff-base (from .../groff-base_1.21-6_i386.deb) ... Selecting previously deselected package bsdmainutils. Unpacking bsdmainutils (from .../bsdmainutils_8.2.3_i386.deb) ... Selecting previously deselected package libpipeline1. Unpacking libpipeline1 (from .../libpipeline1_1.2.0-3_i386.deb) ... Selecting previously deselected package man-db. Unpacking man-db (from .../man-db_2.6.0.2-2_i386.deb) ... Selecting previously deselected package debhelper. Unpacking debhelper (from .../debhelper_8.9.3_all.deb) ... Selecting previously deselected package libavahi-common-data. Unpacking libavahi-common-data (from .../libavahi-common-data_0.6.30-5_i386.deb) ... Selecting previously deselected package libavahi-common3. Unpacking libavahi-common3 (from .../libavahi-common3_0.6.30-5_i386.deb) ... Selecting previously deselected package libdbus-1-3. Unpacking libdbus-1-3 (from .../libdbus-1-3_1.4.14-1_i386.deb) ... Selecting previously deselected package libavahi-client3. Unpacking libavahi-client3 (from .../libavahi-client3_0.6.30-5_i386.deb) ... Selecting previously deselected package libgpg-error0. Unpacking libgpg-error0 (from .../libgpg-error0_1.10-0.3_i386.deb) ... Selecting previously deselected package libgcrypt11. Unpacking libgcrypt11 (from .../libgcrypt11_1.4.6-8_i386.deb) ... Selecting previously deselected package libtasn1-3. Unpacking libtasn1-3 (from .../libtasn1-3_2.9-4_i386.deb) ... Selecting previously deselected package libgnutls26. Unpacking libgnutls26 (from .../libgnutls26_2.10.5-3_i386.deb) ... Selecting previously deselected package libkeyutils1. Unpacking libkeyutils1 (from .../libkeyutils1_1.4-6_i386.deb) ... Selecting previously deselected package libkrb5support0. Unpacking libkrb5support0 (from .../libkrb5support0_1.9.1+dfsg-1_i386.deb) ... Selecting previously deselected package libk5crypto3. Unpacking libk5crypto3 (from .../libk5crypto3_1.9.1+dfsg-1_i386.deb) ... Selecting previously deselected package libkrb5-3. Unpacking libkrb5-3 (from .../libkrb5-3_1.9.1+dfsg-1_i386.deb) ... Selecting previously deselected package libgssapi-krb5-2. Unpacking libgssapi-krb5-2 (from .../libgssapi-krb5-2_1.9.1+dfsg-1_i386.deb) ... Selecting previously deselected package libcups2. Unpacking libcups2 (from .../libcups2_1.4.7-1_i386.deb) ... Selecting previously deselected package libjpeg8. Unpacking libjpeg8 (from .../libjpeg8_8c-2_i386.deb) ... Selecting previously deselected package libpng12-0. Unpacking libpng12-0 (from .../libpng12-0_1.2.46-3_i386.deb) ... Selecting previously deselected package libjpeg62. Unpacking libjpeg62 (from .../libjpeg62_6b1-2_i386.deb) ... Selecting previously deselected package libtiff4. Unpacking libtiff4 (from .../libtiff4_3.9.5-1_i386.deb) ... Selecting previously deselected package libcupsimage2. Unpacking libcupsimage2 (from .../libcupsimage2_1.4.7-1_i386.deb) ... Selecting previously deselected package libexpat1. Unpacking libexpat1 (from .../libexpat1_2.0.1-7_i386.deb) ... Selecting previously deselected package libfreetype6. Unpacking libfreetype6 (from .../libfreetype6_2.4.4-2_i386.deb) ... Selecting previously deselected package ucf. Unpacking ucf (from .../ucf_3.0025+nmu2_all.deb) ... Moving old data out of the way Selecting previously deselected package ttf-dejavu-core. Unpacking ttf-dejavu-core (from .../ttf-dejavu-core_2.33-1_all.deb) ... Selecting previously deselected package fontconfig-config. Unpacking fontconfig-config (from .../fontconfig-config_2.8.0-3_all.deb) ... Selecting previously deselected package libfontconfig1. Unpacking libfontconfig1 (from .../libfontconfig1_2.8.0-3_i386.deb) ... Selecting previously deselected package libijs-0.35. Unpacking libijs-0.35 (from .../libijs-0.35_0.35-7_i386.deb) ... Selecting previously deselected package libjasper1. Unpacking libjasper1 (from .../libjasper1_1.900.1-9_i386.deb) ... Selecting previously deselected package libjbig2dec0. Unpacking libjbig2dec0 (from .../libjbig2dec0_0.11-1_i386.deb) ... Selecting previously deselected package liblcms1. Unpacking liblcms1 (from .../liblcms1_1.19.dfsg-1_i386.deb) ... Selecting previously deselected package libpaper1. Unpacking libpaper1 (from .../libpaper1_1.1.24+nmu1_i386.deb) ... Selecting previously deselected package gs-cjk-resource. Unpacking gs-cjk-resource (from .../gs-cjk-resource_1.20100103-2_all.deb) ... Selecting previously deselected package libgs9-common. Unpacking libgs9-common (from .../libgs9-common_9.02~dfsg-3_all.deb) ... Selecting previously deselected package libgs9. Unpacking libgs9 (from .../libgs9_9.02~dfsg-3_i386.deb) ... Selecting previously deselected package gsfonts. Unpacking gsfonts (from .../gsfonts_1%3a8.11+urwcyr1.0.7~pre44-4.2_all.deb) ... Selecting previously deselected package ghostscript. Unpacking ghostscript (from .../ghostscript_9.02~dfsg-3_i386.deb) ... Setting up libmagic1 (5.04-5+b1) ... Setting up file (5.04-5+b1) ... Setting up html2text (1.3.2a-15) ... Setting up libpcre3 (8.12-3) ... Setting up libglib2.0-0 (2.28.6-1) ... No schema files found: doing nothing. Setting up libxml2 (2.7.8.dfsg-4) ... Setting up libcroco3 (0.6.2-1) ... Setting up libunistring0 (0.9.3-4) ... Setting up gettext-base (0.18.1.1-3) ... Setting up gettext (0.18.1.1-3) ... Setting up intltool-debian (0.35.0+20060710.1) ... Setting up po-debconf (1.0.16+nmu1) ... Setting up groff-base (1.21-6) ... Setting up bsdmainutils (8.2.3) ... update-alternatives: using /usr/bin/bsd-write to provide /usr/bin/write (write) in auto mode. update-alternatives: using /usr/bin/bsd-from to provide /usr/bin/from (from) in auto mode. Setting up libpipeline1 (1.2.0-3) ... Setting up man-db (2.6.0.2-2) ... Building database of manual pages ... Setting up debhelper (8.9.3) ... Setting up libavahi-common-data (0.6.30-5) ... Setting up libavahi-common3 (0.6.30-5) ... Setting up libdbus-1-3 (1.4.14-1) ... Setting up libavahi-client3 (0.6.30-5) ... Setting up libgpg-error0 (1.10-0.3) ... Setting up libgcrypt11 (1.4.6-8) ... Setting up libtasn1-3 (2.9-4) ... Setting up libgnutls26 (2.10.5-3) ... Setting up libkeyutils1 (1.4-6) ... Setting up libkrb5support0 (1.9.1+dfsg-1) ... Setting up libk5crypto3 (1.9.1+dfsg-1) ... Setting up libkrb5-3 (1.9.1+dfsg-1) ... Setting up libgssapi-krb5-2 (1.9.1+dfsg-1) ... Setting up libcups2 (1.4.7-1) ... Setting up libjpeg8 (8c-2) ... Setting up libpng12-0 (1.2.46-3) ... Setting up libjpeg62 (6b1-2) ... Setting up libtiff4 (3.9.5-1) ... Setting up libcupsimage2 (1.4.7-1) ... Setting up libexpat1 (2.0.1-7) ... Setting up libfreetype6 (2.4.4-2) ... Setting up ucf (3.0025+nmu2) ... Setting up ttf-dejavu-core (2.33-1) ... Setting up fontconfig-config (2.8.0-3) ... Setting up libfontconfig1 (2.8.0-3) ... Setting up libijs-0.35 (0.35-7) ... Setting up libjasper1 (1.900.1-9) ... Setting up libjbig2dec0 (0.11-1) ... Setting up liblcms1 (1.19.dfsg-1) ... Setting up libpaper1 (1.1.24+nmu1) ... Creating config file /etc/papersize with new version Setting up libgs9-common (9.02~dfsg-3) ... Setting up gsfonts (1:8.11+urwcyr1.0.7~pre44-4.2) ... Setting up ghostscript (9.02~dfsg-3) ... Setting up gs-cjk-resource (1.20100103-2) ... Setting up pbuilder-satisfydepends-dummy (0.invalid.0) ... Setting up libgs9 (9.02~dfsg-3) ... Current status: 0 broken [-1]. -> Finished parsing the build-deps Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: fakeroot 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/129 kB of archives. After this operation, 471 kB of additional disk space will be used. debconf: delaying package configuration, since apt-utils is not installed Selecting previously deselected package fakeroot. (Reading database ... 13824 files and directories currently installed.) Unpacking fakeroot (from .../fakeroot_1.16-1_i386.deb) ... Processing triggers for man-db ... Setting up fakeroot (1.16-1) ... update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode. I: Copying back the cached apt archive contents I: Copying source file I: copying [/home/dancer/DEBIAN/pbuilder/pbuilder/testsuite/random-manual-test-material/buildarchpkg/buildarchpkg_0.1.dsc] I: copying [/home/dancer/DEBIAN/pbuilder/pbuilder/testsuite/random-manual-test-material/buildarchpkg/buildarchpkg_0.1.tar.gz] I: Extracting source dpkg-source: warning: extracting unsigned source package (buildarchpkg_0.1.dsc) dpkg-source: info: extracting buildarchpkg in buildarchpkg-0.1 dpkg-source: info: unpacking buildarchpkg_0.1.tar.gz I: Building the package W: no hooks of type A found -- ignoring I: Running cd tmp/buildd/*/ && dpkg-buildpackage -us -uc -rfakeroot dpkg-buildpackage: export CFLAGS from dpkg-buildflags (origin: vendor): -g -O2 dpkg-buildpackage: export CPPFLAGS from dpkg-buildflags (origin: vendor): dpkg-buildpackage: export CXXFLAGS from dpkg-buildflags (origin: vendor): -g -O2 dpkg-buildpackage: export FFLAGS from dpkg-buildflags (origin: vendor): -g -O2 dpkg-buildpackage: export LDFLAGS from dpkg-buildflags (origin: vendor): dpkg-buildpackage: source package buildarchpkg dpkg-buildpackage: source version 0.1 dpkg-buildpackage: source changed by Junichi Uekawa dpkg-buildpackage: host architecture i386 dpkg-source --before-build buildarchpkg-0.1 fakeroot debian/rules clean dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. dh_clean dh_clean: Compatibility levels before 5 are deprecated. dpkg-source -b buildarchpkg-0.1 dpkg-source: warning: no source format specified in debian/source/format, see dpkg-source(1) dpkg-source: info: using source format `1.0' dpkg-source: info: building buildarchpkg in buildarchpkg_0.1.tar.gz dpkg-source: info: building buildarchpkg in buildarchpkg_0.1.dsc debian/rules build dh_testdir # Add here commands to configure the package. touch configure-stamp dh_testdir # Add here commands to compile the package. touch build-stamp fakeroot debian/rules binary dh_testdir dh_testroot dh_clean -k dh_clean: dh_clean -k is deprecated; use dh_prep instead dh_clean: Compatibility levels before 5 are deprecated. dh_installdirs dh_installdirs: Compatibility levels before 5 are deprecated. dh_testdir dh_testroot dh_installchangelogs dh_installchangelogs: Compatibility levels before 5 are deprecated. dh_installdocs dh_installdocs: Compatibility levels before 5 are deprecated. dh_installexamples dh_installexamples: Compatibility levels before 5 are deprecated. dh_installman dh_installman: Compatibility levels before 5 are deprecated. dh_link dh_link: Compatibility levels before 5 are deprecated. dh_strip dh_strip: Compatibility levels before 5 are deprecated. dh_compress dh_compress: Compatibility levels before 5 are deprecated. dh_fixperms dh_fixperms: Compatibility levels before 5 are deprecated. dh_installdeb dh_installdeb: Compatibility levels before 5 are deprecated. dh_shlibdeps dh_shlibdeps: Compatibility levels before 5 are deprecated. dh_gencontrol dh_gencontrol: Compatibility levels before 5 are deprecated. dpkg-gencontrol: warning: Depends field of package buildarchpkg: unknown substitution variable ${shlibs:Depends} dpkg-gencontrol: warning: Depends field of package buildindeppkg: unknown substitution variable ${shlibs:Depends} dh_md5sums dh_md5sums: Compatibility levels before 5 are deprecated. dh_builddeb dh_builddeb: Compatibility levels before 5 are deprecated. dpkg-deb: building package `buildarchpkg' in `../buildarchpkg_0.1_i386.deb'. dh_builddeb: Compatibility levels before 5 are deprecated. dpkg-deb: building package `buildindeppkg' in `../buildindeppkg_0.1_all.deb'. dh_builddeb: Compatibility levels before 5 are deprecated. dpkg-genchanges >../buildarchpkg_0.1_i386.changes dpkg-genchanges: including full source code in upload dpkg-source --after-build buildarchpkg-0.1 dpkg-buildpackage: full upload; Debian-native package (full source is included) I: user script /var/cache/pbuilder/build/cow.30004/tmp/hooks/B90linda starting Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: diffstat libapt-pkg-perl libclass-accessor-perl libdigest-hmac-perl libemail-valid-perl libio-pty-perl libio-string-perl libipc-run-perl libmailtools-perl libnet-dns-perl libnet-domain-tld-perl libnet-ip-perl libparse-debianchangelog-perl libsub-name-perl liburi-perl locales netbase unzip Suggested packages: libio-socket-inet6-perl libwww-perl binutils-multiarch libtext-template-perl zip Recommended packages: libhtml-parser-perl libhtml-template-perl libxml-simple-perl ifupdown The following NEW packages will be installed: diffstat libapt-pkg-perl libclass-accessor-perl libdigest-hmac-perl libemail-valid-perl libio-pty-perl libio-string-perl libipc-run-perl libmailtools-perl libnet-dns-perl libnet-domain-tld-perl libnet-ip-perl libparse-debianchangelog-perl libsub-name-perl liburi-perl lintian locales netbase unzip 0 upgraded, 19 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/6561 kB of archives. After this operation, 19.8 MB of additional disk space will be used. debconf: delaying package configuration, since apt-utils is not installed Selecting previously deselected package netbase. (Reading database ... 13861 files and directories currently installed.) Unpacking netbase (from .../archives/netbase_4.46_all.deb) ... Selecting previously deselected package locales. Unpacking locales (from .../locales_2.13-11_all.deb) ... Selecting previously deselected package diffstat. Unpacking diffstat (from .../diffstat_1.54-1_i386.deb) ... Selecting previously deselected package libapt-pkg-perl. Unpacking libapt-pkg-perl (from .../libapt-pkg-perl_0.1.24+b2_i386.deb) ... Selecting previously deselected package libsub-name-perl. Unpacking libsub-name-perl (from .../libsub-name-perl_0.05-1+b1_i386.deb) ... Selecting previously deselected package libclass-accessor-perl. Unpacking libclass-accessor-perl (from .../libclass-accessor-perl_0.34-1_all.deb) ... Selecting previously deselected package libdigest-hmac-perl. Unpacking libdigest-hmac-perl (from .../libdigest-hmac-perl_1.03+dfsg-1_all.deb) ... Selecting previously deselected package libmailtools-perl. Unpacking libmailtools-perl (from .../libmailtools-perl_2.08-1_all.deb) ... Selecting previously deselected package libnet-ip-perl. Unpacking libnet-ip-perl (from .../libnet-ip-perl_1.25-3_all.deb) ... Selecting previously deselected package libnet-dns-perl. Unpacking libnet-dns-perl (from .../libnet-dns-perl_0.66-2+b1_i386.deb) ... Selecting previously deselected package libnet-domain-tld-perl. Unpacking libnet-domain-tld-perl (from .../libnet-domain-tld-perl_1.69-1_all.deb) ... Selecting previously deselected package libemail-valid-perl. Unpacking libemail-valid-perl (from .../libemail-valid-perl_0.184-1_all.deb) ... Selecting previously deselected package libio-pty-perl. Unpacking libio-pty-perl (from .../libio-pty-perl_1%3a1.08-1+b1_i386.deb) ... Selecting previously deselected package libio-string-perl. Unpacking libio-string-perl (from .../libio-string-perl_1.08-2_all.deb) ... Selecting previously deselected package libipc-run-perl. Unpacking libipc-run-perl (from .../libipc-run-perl_0.90-1_all.deb) ... Selecting previously deselected package libparse-debianchangelog-perl. Unpacking libparse-debianchangelog-perl (from .../libparse-debianchangelog-perl_1.2.0-1_all.deb) ... Selecting previously deselected package liburi-perl. Unpacking liburi-perl (from .../liburi-perl_1.58-1_all.deb) ... Selecting previously deselected package unzip. Unpacking unzip (from .../archives/unzip_6.0-5_i386.deb) ... Selecting previously deselected package lintian. Unpacking lintian (from .../archives/lintian_2.5.1_all.deb) ... Processing triggers for man-db ... Setting up netbase (4.46) ... Setting up locales (2.13-11) ... Generating locales (this might take a while)... Generation complete. Setting up diffstat (1.54-1) ... Setting up libapt-pkg-perl (0.1.24+b2) ... Setting up libsub-name-perl (0.05-1+b1) ... Setting up libclass-accessor-perl (0.34-1) ... Setting up libdigest-hmac-perl (1.03+dfsg-1) ... Setting up libmailtools-perl (2.08-1) ... Setting up libnet-ip-perl (1.25-3) ... Setting up libnet-dns-perl (0.66-2+b1) ... Setting up libnet-domain-tld-perl (1.69-1) ... Setting up libemail-valid-perl (0.184-1) ... Setting up libio-pty-perl (1:1.08-1+b1) ... Setting up libio-string-perl (1.08-2) ... Setting up libipc-run-perl (0.90-1) ... Setting up libparse-debianchangelog-perl (1.2.0-1) ... Setting up liburi-perl (1.58-1) ... Setting up unzip (6.0-5) ... Setting up lintian (2.5.1) ... Generating en_US.UTF-8 locale for internal Lintian use.... warning: the authors of lintian do not recommend running it with root privileges! E: buildarchpkg: no-copyright-file E: buildarchpkg: description-is-dh_make-template E: buildarchpkg: section-is-dh_make-template W: buildarchpkg: empty-binary-package E: buildindeppkg: no-copyright-file E: buildindeppkg: description-is-dh_make-template E: buildindeppkg: section-is-dh_make-template W: buildindeppkg: empty-binary-package 1 I: user script /var/cache/pbuilder/build/cow.30004/tmp/hooks/B90linda finished I: user script /var/cache/pbuilder/build/cow.30004/tmp/hooks/B92test-pkg starting Installing the prerequisites Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package buildarchpkg Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package buildarchpkg Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package buildindeppkg Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package buildindeppkg Selecting previously deselected package buildarchpkg. (Reading database ... 15163 files and directories currently installed.) Unpacking buildarchpkg (from .../buildarchpkg_0.1_i386.deb) ... Selecting previously deselected package buildindeppkg. Unpacking buildindeppkg (from .../buildindeppkg_0.1_all.deb) ... Setting up buildarchpkg (0.1) ... Setting up buildindeppkg (0.1) ... Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. chmod: cannot access `/tmp/buildd/*/debian/pbuilder-test/*': No such file or directory W: no pbuilder-test script found, skipping I: user script /var/cache/pbuilder/build/cow.30004/tmp/hooks/B92test-pkg finished I: Copying back the cached apt archive contents I: unmounting /var/cache/pbuilder/ccache filesystem I: unmounting dev/pts filesystem I: unmounting proc filesystem I: Current time: Sun Jul 31 11:59:48 JST 2011 I: pbuilder-time-stamp: 1312081188 -> Cleaning COW directory forking: rm -rf /var/cache/pbuilder/build//cow.30004 $ sudo ./cowbuilder --build --binary-arch ../../pbuilder/pbuilder/testsuite/random-manual-test-material/buildarchpkg/buildarchpkg_0.1.dsc -> Copying COW directory forking: rm -rf /var/cache/pbuilder/build//cow.2978 forking: cp -al /var/cache/pbuilder/base.cow /var/cache/pbuilder/build//cow.2978 I: removed stale ilistfile /var/cache/pbuilder/build//cow.2978/.ilist forking: chroot /var/cache/pbuilder/build//cow.2978 cowdancer-ilistcreate /.ilist find . -xdev -path ./home -prune -o \( \( -type l -o -type f \) -a -links +1 -print0 \) | xargs -0 stat --format '%d %i ' -> Invoking pbuilder forking: pbuilder build --binary-arch --buildplace /var/cache/pbuilder/build//cow.2978 --buildresult /var/cache/pbuilder/result/ --debbuildopts --binary-arch --no-targz --internal-chrootexec chroot /var/cache/pbuilder/build//cow.2978 cow-shell /home/dancer/DEBIAN/pbuilder/pbuilder/testsuite/random-manual-test-material/buildarchpkg/buildarchpkg_0.1.dsc W: /root/.pbuilderrc does not exist I: Running in no-targz mode I: using fakeroot in build. I: Current time: Sun Jul 31 12:00:08 JST 2011 I: pbuilder-time-stamp: 1312081208 I: copying local configuration I: mounting /proc filesystem I: mounting /dev/pts filesystem I: Mounting /var/cache/pbuilder/ccache I: policy-rc.d already exists I: Obtaining the cached apt archive contents I: Setting up ccache I: Installing the build-deps I: user script /var/cache/pbuilder/build/cow.2978/tmp/hooks/D80no-man-db-rebuild starting I: Preseed man-db/auto-update to false I: user script /var/cache/pbuilder/build/cow.2978/tmp/hooks/D80no-man-db-rebuild finished -> Attempting to satisfy build-dependencies -> Creating pbuilder-satisfydepends-dummy package Package: pbuilder-satisfydepends-dummy Version: 0.invalid.0 Architecture: i386 Maintainer: Debian Pbuilder Team Description: Dummy package to satisfy dependencies with aptitude - created by pbuilder This package was created automatically by pbuilder to satisfy the build-dependencies of the package being currently built. Depends: debhelper (>= 5) dpkg-deb: building package `pbuilder-satisfydepends-dummy' in `/tmp/satisfydepends-aptitude/pbuilder-satisfydepends-dummy.deb'. Selecting previously deselected package pbuilder-satisfydepends-dummy. (Reading database ... 11477 files and directories currently installed.) Unpacking pbuilder-satisfydepends-dummy (from .../pbuilder-satisfydepends-dummy.deb) ... dpkg: dependency problems prevent configuration of pbuilder-satisfydepends-dummy: pbuilder-satisfydepends-dummy depends on debhelper (>= 5); however: Package debhelper is not installed. dpkg: error processing pbuilder-satisfydepends-dummy (--install): dependency problems - leaving unconfigured Errors were encountered while processing: pbuilder-satisfydepends-dummy The following NEW packages will be installed: bsdmainutils{a} debhelper{a} file{a} gettext{a} gettext-base{a} groff-base{a} html2text{a} intltool-debian{a} libcroco3{a} libglib2.0-0{a} libmagic1{a} libpcre3{a} libpipeline1{a} libunistring0{a} libxml2{a} man-db{a} po-debconf{a} The following partially installed packages will be configured: pbuilder-satisfydepends-dummy The following packages are RECOMMENDED but will NOT be installed: autopoint libglib2.0-data libmail-sendmail-perl shared-mime-info xml-core 0 packages upgraded, 17 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/8869 kB of archives. After unpacking 26.6 MB will be used. debconf: delaying package configuration, since apt-utils is not installed Selecting previously deselected package libmagic1. (Reading database ... 11477 files and directories currently installed.) Unpacking libmagic1 (from .../libmagic1_5.04-5+b1_i386.deb) ... Selecting previously deselected package file. Unpacking file (from .../file_5.04-5+b1_i386.deb) ... Selecting previously deselected package html2text. Unpacking html2text (from .../html2text_1.3.2a-15_i386.deb) ... Selecting previously deselected package libpcre3. Unpacking libpcre3 (from .../libpcre3_8.12-3_i386.deb) ... Selecting previously deselected package libglib2.0-0. Unpacking libglib2.0-0 (from .../libglib2.0-0_2.28.6-1_i386.deb) ... Selecting previously deselected package libxml2. Unpacking libxml2 (from .../libxml2_2.7.8.dfsg-4_i386.deb) ... Selecting previously deselected package libcroco3. Unpacking libcroco3 (from .../libcroco3_0.6.2-1_i386.deb) ... Selecting previously deselected package libunistring0. Unpacking libunistring0 (from .../libunistring0_0.9.3-4_i386.deb) ... Selecting previously deselected package gettext-base. Unpacking gettext-base (from .../gettext-base_0.18.1.1-3_i386.deb) ... Selecting previously deselected package gettext. Unpacking gettext (from .../gettext_0.18.1.1-3_i386.deb) ... Selecting previously deselected package intltool-debian. Unpacking intltool-debian (from .../intltool-debian_0.35.0+20060710.1_all.deb) ... Selecting previously deselected package po-debconf. Unpacking po-debconf (from .../po-debconf_1.0.16+nmu1_all.deb) ... Selecting previously deselected package groff-base. Unpacking groff-base (from .../groff-base_1.21-6_i386.deb) ... Selecting previously deselected package bsdmainutils. Unpacking bsdmainutils (from .../bsdmainutils_8.2.3_i386.deb) ... Selecting previously deselected package libpipeline1. Unpacking libpipeline1 (from .../libpipeline1_1.2.0-3_i386.deb) ... Selecting previously deselected package man-db. Unpacking man-db (from .../man-db_2.6.0.2-2_i386.deb) ... Selecting previously deselected package debhelper. Unpacking debhelper (from .../debhelper_8.9.3_all.deb) ... Setting up libmagic1 (5.04-5+b1) ... Setting up file (5.04-5+b1) ... Setting up html2text (1.3.2a-15) ... Setting up libpcre3 (8.12-3) ... Setting up libglib2.0-0 (2.28.6-1) ... No schema files found: doing nothing. Setting up libxml2 (2.7.8.dfsg-4) ... Setting up libcroco3 (0.6.2-1) ... Setting up libunistring0 (0.9.3-4) ... Setting up gettext-base (0.18.1.1-3) ... Setting up gettext (0.18.1.1-3) ... Setting up intltool-debian (0.35.0+20060710.1) ... Setting up po-debconf (1.0.16+nmu1) ... Setting up groff-base (1.21-6) ... Setting up bsdmainutils (8.2.3) ... update-alternatives: using /usr/bin/bsd-write to provide /usr/bin/write (write) in auto mode. update-alternatives: using /usr/bin/bsd-from to provide /usr/bin/from (from) in auto mode. Setting up libpipeline1 (1.2.0-3) ... Setting up man-db (2.6.0.2-2) ... Building database of manual pages ... Setting up debhelper (8.9.3) ... Setting up pbuilder-satisfydepends-dummy (0.invalid.0) ... Current status: 0 broken [-1]. -> Finished parsing the build-deps Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: fakeroot 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/129 kB of archives. After this operation, 471 kB of additional disk space will be used. debconf: delaying package configuration, since apt-utils is not installed Selecting previously deselected package fakeroot. (Reading database ... 12795 files and directories currently installed.) Unpacking fakeroot (from .../fakeroot_1.16-1_i386.deb) ... Processing triggers for man-db ... Setting up fakeroot (1.16-1) ... update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode. I: Copying back the cached apt archive contents I: Copying source file I: copying [/home/dancer/DEBIAN/pbuilder/pbuilder/testsuite/random-manual-test-material/buildarchpkg/buildarchpkg_0.1.dsc] I: copying [/home/dancer/DEBIAN/pbuilder/pbuilder/testsuite/random-manual-test-material/buildarchpkg/buildarchpkg_0.1.tar.gz] I: Extracting source dpkg-source: warning: extracting unsigned source package (buildarchpkg_0.1.dsc) dpkg-source: info: extracting buildarchpkg in buildarchpkg-0.1 dpkg-source: info: unpacking buildarchpkg_0.1.tar.gz I: Building the package W: no hooks of type A found -- ignoring I: Running cd tmp/buildd/*/ && dpkg-buildpackage -us -uc -B -rfakeroot dpkg-buildpackage: export CFLAGS from dpkg-buildflags (origin: vendor): -g -O2 dpkg-buildpackage: export CPPFLAGS from dpkg-buildflags (origin: vendor): dpkg-buildpackage: export CXXFLAGS from dpkg-buildflags (origin: vendor): -g -O2 dpkg-buildpackage: export FFLAGS from dpkg-buildflags (origin: vendor): -g -O2 dpkg-buildpackage: export LDFLAGS from dpkg-buildflags (origin: vendor): dpkg-buildpackage: source package buildarchpkg dpkg-buildpackage: source version 0.1 dpkg-buildpackage: source changed by Junichi Uekawa dpkg-buildpackage: host architecture i386 dpkg-source --before-build buildarchpkg-0.1 fakeroot debian/rules clean dh_testdir dh_testroot rm -f build-stamp configure-stamp # Add here commands to clean up after the build process. dh_clean dh_clean: Compatibility levels before 5 are deprecated. debian/rules build dh_testdir # Add here commands to configure the package. touch configure-stamp dh_testdir # Add here commands to compile the package. touch build-stamp fakeroot debian/rules binary-arch dh_testdir dh_testroot dh_clean -k dh_clean: dh_clean -k is deprecated; use dh_prep instead dh_clean: Compatibility levels before 5 are deprecated. dh_installdirs dh_installdirs: Compatibility levels before 5 are deprecated. dh_testdir dh_testroot dh_installchangelogs dh_installchangelogs: Compatibility levels before 5 are deprecated. dh_installdocs dh_installdocs: Compatibility levels before 5 are deprecated. dh_installexamples dh_installexamples: Compatibility levels before 5 are deprecated. dh_installman dh_installman: Compatibility levels before 5 are deprecated. dh_link dh_link: Compatibility levels before 5 are deprecated. dh_strip dh_strip: Compatibility levels before 5 are deprecated. dh_compress dh_compress: Compatibility levels before 5 are deprecated. dh_fixperms dh_fixperms: Compatibility levels before 5 are deprecated. dh_installdeb dh_installdeb: Compatibility levels before 5 are deprecated. dh_shlibdeps dh_shlibdeps: Compatibility levels before 5 are deprecated. dh_gencontrol dh_gencontrol: Compatibility levels before 5 are deprecated. dpkg-gencontrol: warning: Depends field of package buildarchpkg: unknown substitution variable ${shlibs:Depends} dpkg-gencontrol: warning: Depends field of package buildindeppkg: unknown substitution variable ${shlibs:Depends} dh_md5sums dh_md5sums: Compatibility levels before 5 are deprecated. dh_builddeb dh_builddeb: Compatibility levels before 5 are deprecated. dpkg-deb: building package `buildarchpkg' in `../buildarchpkg_0.1_i386.deb'. dh_builddeb: Compatibility levels before 5 are deprecated. dpkg-deb: building package `buildindeppkg' in `../buildindeppkg_0.1_all.deb'. dh_builddeb: Compatibility levels before 5 are deprecated. dpkg-genchanges -B >../buildarchpkg_0.1_i386.changes dpkg-genchanges: arch-specific upload - not including arch-independent packages dpkg-genchanges: binary-only upload - not including any source code dpkg-source --after-build buildarchpkg-0.1 dpkg-buildpackage: binary only upload (no source included) I: user script /var/cache/pbuilder/build/cow.2978/tmp/hooks/B90linda starting Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: diffstat libapt-pkg-perl libclass-accessor-perl libdigest-hmac-perl libemail-valid-perl libio-pty-perl libio-string-perl libipc-run-perl libmailtools-perl libnet-dns-perl libnet-domain-tld-perl libnet-ip-perl libparse-debianchangelog-perl libsub-name-perl liburi-perl locales netbase unzip Suggested packages: libio-socket-inet6-perl libwww-perl binutils-multiarch libtext-template-perl zip Recommended packages: libhtml-parser-perl libhtml-template-perl libxml-simple-perl ifupdown The following NEW packages will be installed: diffstat libapt-pkg-perl libclass-accessor-perl libdigest-hmac-perl libemail-valid-perl libio-pty-perl libio-string-perl libipc-run-perl libmailtools-perl libnet-dns-perl libnet-domain-tld-perl libnet-ip-perl libparse-debianchangelog-perl libsub-name-perl liburi-perl lintian locales netbase unzip 0 upgraded, 19 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/6561 kB of archives. After this operation, 19.8 MB of additional disk space will be used. debconf: delaying package configuration, since apt-utils is not installed Selecting previously deselected package netbase. (Reading database ... 12832 files and directories currently installed.) Unpacking netbase (from .../archives/netbase_4.46_all.deb) ... Selecting previously deselected package locales. Unpacking locales (from .../locales_2.13-11_all.deb) ... Selecting previously deselected package diffstat. Unpacking diffstat (from .../diffstat_1.54-1_i386.deb) ... Selecting previously deselected package libapt-pkg-perl. Unpacking libapt-pkg-perl (from .../libapt-pkg-perl_0.1.24+b2_i386.deb) ... Selecting previously deselected package libsub-name-perl. Unpacking libsub-name-perl (from .../libsub-name-perl_0.05-1+b1_i386.deb) ... Selecting previously deselected package libclass-accessor-perl. Unpacking libclass-accessor-perl (from .../libclass-accessor-perl_0.34-1_all.deb) ... Selecting previously deselected package libdigest-hmac-perl. Unpacking libdigest-hmac-perl (from .../libdigest-hmac-perl_1.03+dfsg-1_all.deb) ... Selecting previously deselected package libmailtools-perl. Unpacking libmailtools-perl (from .../libmailtools-perl_2.08-1_all.deb) ... Selecting previously deselected package libnet-ip-perl. Unpacking libnet-ip-perl (from .../libnet-ip-perl_1.25-3_all.deb) ... Selecting previously deselected package libnet-dns-perl. Unpacking libnet-dns-perl (from .../libnet-dns-perl_0.66-2+b1_i386.deb) ... Selecting previously deselected package libnet-domain-tld-perl. Unpacking libnet-domain-tld-perl (from .../libnet-domain-tld-perl_1.69-1_all.deb) ... Selecting previously deselected package libemail-valid-perl. Unpacking libemail-valid-perl (from .../libemail-valid-perl_0.184-1_all.deb) ... Selecting previously deselected package libio-pty-perl. Unpacking libio-pty-perl (from .../libio-pty-perl_1%3a1.08-1+b1_i386.deb) ... Selecting previously deselected package libio-string-perl. Unpacking libio-string-perl (from .../libio-string-perl_1.08-2_all.deb) ... Selecting previously deselected package libipc-run-perl. Unpacking libipc-run-perl (from .../libipc-run-perl_0.90-1_all.deb) ... Selecting previously deselected package libparse-debianchangelog-perl. Unpacking libparse-debianchangelog-perl (from .../libparse-debianchangelog-perl_1.2.0-1_all.deb) ... Selecting previously deselected package liburi-perl. Unpacking liburi-perl (from .../liburi-perl_1.58-1_all.deb) ... Selecting previously deselected package unzip. Unpacking unzip (from .../archives/unzip_6.0-5_i386.deb) ... Selecting previously deselected package lintian. Unpacking lintian (from .../archives/lintian_2.5.1_all.deb) ... Processing triggers for man-db ... Setting up netbase (4.46) ... Setting up locales (2.13-11) ... Generating locales (this might take a while)... Generation complete. Setting up diffstat (1.54-1) ... Setting up libapt-pkg-perl (0.1.24+b2) ... Setting up libsub-name-perl (0.05-1+b1) ... Setting up libclass-accessor-perl (0.34-1) ... Setting up libdigest-hmac-perl (1.03+dfsg-1) ... Setting up libmailtools-perl (2.08-1) ... Setting up libnet-ip-perl (1.25-3) ... Setting up libnet-dns-perl (0.66-2+b1) ... Setting up libnet-domain-tld-perl (1.69-1) ... Setting up libemail-valid-perl (0.184-1) ... Setting up libio-pty-perl (1:1.08-1+b1) ... Setting up libio-string-perl (1.08-2) ... Setting up libipc-run-perl (0.90-1) ... Setting up libparse-debianchangelog-perl (1.2.0-1) ... Setting up liburi-perl (1.58-1) ... Setting up unzip (6.0-5) ... Setting up lintian (2.5.1) ... Generating en_US.UTF-8 locale for internal Lintian use.... warning: the authors of lintian do not recommend running it with root privileges! E: buildarchpkg: no-copyright-file E: buildarchpkg: description-is-dh_make-template E: buildarchpkg: section-is-dh_make-template W: buildarchpkg: empty-binary-package E: buildindeppkg: no-copyright-file E: buildindeppkg: description-is-dh_make-template E: buildindeppkg: section-is-dh_make-template W: buildindeppkg: empty-binary-package 1 I: user script /var/cache/pbuilder/build/cow.2978/tmp/hooks/B90linda finished I: user script /var/cache/pbuilder/build/cow.2978/tmp/hooks/B92test-pkg starting Installing the prerequisites Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package buildarchpkg Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package buildarchpkg Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package buildindeppkg Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package buildindeppkg Selecting previously deselected package buildarchpkg. (Reading database ... 14134 files and directories currently installed.) Unpacking buildarchpkg (from .../buildarchpkg_0.1_i386.deb) ... Selecting previously deselected package buildindeppkg. Unpacking buildindeppkg (from .../buildindeppkg_0.1_all.deb) ... Setting up buildarchpkg (0.1) ... Setting up buildindeppkg (0.1) ... Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. chmod: cannot access `/tmp/buildd/*/debian/pbuilder-test/*': No such file or directory W: no pbuilder-test script found, skipping I: user script /var/cache/pbuilder/build/cow.2978/tmp/hooks/B92test-pkg finished I: Copying back the cached apt archive contents I: unmounting /var/cache/pbuilder/ccache filesystem I: unmounting dev/pts filesystem I: unmounting proc filesystem I: Current time: Sun Jul 31 12:01:10 JST 2011 I: pbuilder-time-stamp: 1312081270 -> Cleaning COW directory forking: rm -rf /var/cache/pbuilder/build//cow.2978 $ cowdancer-0.73/qemubuilder.80000644000000000000000000000725711727577760012743 0ustar .TH "qemubuilder" 8 "2008 Aug 10" "pbuilder" "pbuilder" .SH "NAME" qemubuilder \- a pbuilder wrapper for qemu. .SH SYNOPSIS .BI "qemubuilder [" "commands" "] [" "options" "]" .SH DESCRIPTION .B qemubuilder Executes the specified pbuilder operation with .B qemu .SH "COMMANDS" Most commands imitate pbuilder, see pbuilder manual for details. .TP .B "--create" Create the base.qemu image. .TP .B "--update" Update the base.qemu image. .TP .BI "--build " ".dsc-file" Build a package given a .dsc file .TP .B "--login" Start a session within the base.qemu. .TP .B "--execute" Execute a command within the base.qemu. .TP .B "--dumpconfig" dump configuration information. .TP .BI "--arch-diskdevice " "sd/hd" specify whether disk device inside the virtual machine is called /dev/sda or /dev/hda. The possible value is 'sd' or 'hd'. .TP .BI "--smp " "2" The option passed to SMP. .SH "OPTIONS" Most options are the same as pbuilder, except for the following which are handled specially. .TP .BI "SMP " "2" The SMP option for qemu. I don't think I can support bind-mounts in qemu. Documentation here should be updated according to what's defined in parameter.c, but it isn't. .SH "CONFIGURATION FILES" qemubuilder reads the following configuration files per default. .TP .B "/usr/share/pbuilder/pbuilderrc" Application default, not to be changed. .TP .B "/etc/pbuilderrc" System-wide default. .TP .B "~/.pbuilderrc" User default .TP .I "anything specified with \-\-configfile option" Additional configuration at runtime. .SH "CONFIGURATION FILE OPTIONS" The possible configuration options are as follows. Others are ignored. .TP .BI "DISTRIBUTION=" "distribution" .TP .BI "BUILDRESULT=" "directory" .TP .BI "BUILDPLACE=" "directory" .TP .BI "BASEPATH=" "path" .TP .BI "MIRRORSITE=" "http://mirror" .TP .BI "KERNEL_IMAGE=" "vmlinuz" Linux kernel to use. .TP .BI "INITRD=" "initrd" initrd to use. .TP .BI "ARCHITECTURE=" "arch" The target architecture. You can also use .BI "ARCH=" "arch" for compatibility with 0.60 or older. .TP .BI "MEMORY_MEGS=" "64" memory size to use in qemu session, in MB. .TP .BI "ARCH_DISKDEVICE=" "hd" The architecture-specific disk device specifier. Most arches use sd these days. The only exceptions were i386 and amd64, which used to use hd. .SH "EXAMPLES" .TP .B "qemubuilder --create" Create a base.qemu image. .TP .B "qemubuilder --update" Update the base.qemu image. .TP .B "qemubuilder --build test_0.1.dsc" Build the package specified in dsc file, with the base.qemu image. .TP .B "pdebuild --pbuilder qemubuilder" Run .B "qemubuilder --build" against the current directory. The current directory should be an extracted Debian source package directory. Edit .B /etc/pbuilderrc to have .B PDEBUILD_PBUILDER=qemubuilder to make this the default behavior for .B pdebuild. .TP .B "qemubuilder --create --distribution sid --basepath /var/cache/pbuilder/base-test.qemu" Create a base.qemu image with the path .B "/var/cache/pbuilder/base-test.qemu" and distribution sid. .TP .B "Example pbuilderrc for i386" .nf KERNEL_IMAGE=vmlinuz-2.6.18-4-k7 INITRD=initrd.img-2.6.18-4-k7 ARCHITECTURE=i386 BASEPATH=/home/dancer/tmp/base-i386.qemu MEMORY_MEGS=64 .qy Note. INITRD may or may not be required for your system. Debian Installer initrd may or may not work depending on which one you choose, use the one from an installed system. .TP .B "CAVEATS" Note that for mirror specification, http://localhost/debian/ usually doesn't work, it will be searching for files on the virtual machine itself, not the host OS. .SH "AUTHOR" Junichi Uekawa (dancer@debian.org) .SH "SEE ALSO" .BR "/usr/share/doc/pbuilder/pbuilder-doc.html, " .BR "pbuilder (" 8 "), " .BR "pdebuild (" 1 ") " cowdancer-0.73/ilist.h0000644000000000000000000000077511220436222011576 0ustar /* define ilist common struct, shared between cowdancer, and cow-shell. */ #define ILISTREVISION 2 /* 'COWD' in the host-order */ #define ILISTSIG 0x4f434457 struct ilist_header { int ilistsig; int revision; int ilist_struct_size; int dummy; }; struct ilist_struct { dev_t dev; ino_t inode; }; void ilist_outofmemory(const char* msg); int ilistcreate(const char* ilistpath, const char* findcommandline); int compare_ilist (const void *a, const void *b); extern const char* ilist_PRGNAME; cowdancer-0.73/cowdancer.c0000644000000000000000000004317212125254603012416 0ustar /* * cowdancer -- a Copy-on-write data-access; No-cow-easy-replacement * * Copyright 2005-2009 Junichi Uekawa * GPL v2 or later. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ilist.h" const char* ilist_PRGNAME="cowdancer"; /* libc functions. */ static int (*origlibc_open)(const char *, int, ...) = NULL; static int (*origlibc_open64)(const char *, int, ...) = NULL; static int (*origlibc_creat)(const char *, mode_t) = NULL; static int (*origlibc_creat64)(const char *, mode_t) = NULL; static FILE* (*origlibc_fopen)(const char *, const char*) = NULL; static FILE* (*origlibc_fopen64)(const char *, const char*) = NULL; static int (*origlibc_chown)(const char *, uid_t, gid_t) = NULL; static int (*origlibc_fchown)(int fd, uid_t, gid_t) = NULL; static int (*origlibc_lchown)(const char *, uid_t, gid_t) = NULL; static int (*origlibc_chmod)(const char *, mode_t) = NULL; static int (*origlibc_fchmod)(int fd, mode_t) = NULL; static int (*origlibc_flock)(int fd, int) = NULL; static struct ilist_struct* ilist=NULL; static long ilist_len=0; /* verify the header content */ static int verify_ilist_header(struct ilist_header header) { if (header.revision != ILISTREVISION || header.ilistsig != ILISTSIG || header.ilist_struct_size != sizeof (struct ilist_struct)) { ilist_outofmemory(".ilist header unexpected"); return 1; } return 0; } /* load ilist file @return 1 on error, 0 on success */ static int load_ilist(void) { FILE* f=0; int fd=0; struct stat stbuf; struct ilist_struct* local_ilist=NULL; struct ilist_header header; long local_ilist_len=0; if (!getenv("COWDANCER_ILISTFILE")) { fprintf(stderr, "env var COWDANCER_ILISTFILE not defined\n"); return 1; } if (-1==(fd=origlibc_open(getenv("COWDANCER_ILISTFILE"),O_RDONLY,0))) { fprintf(stderr, "%s: cannot open ilistfile %s\n", ilist_PRGNAME, getenv("COWDANCER_ILISTFILE")); return 1; } if (-1==fstat(fd,&stbuf)) { fprintf(stderr, "%s: cannot fstat ilistfile %s\n", ilist_PRGNAME, getenv("COWDANCER_ILISTFILE")); return 1; } local_ilist_len=(stbuf.st_size - sizeof (struct ilist_header)) / sizeof(struct ilist_struct); if (stbuf.st_size != (sizeof(struct ilist_struct) * local_ilist_len + sizeof (struct ilist_header))) { fprintf(stderr, "%s: .ilist size: %li\n", ilist_PRGNAME, (long)stbuf.st_size); ilist_outofmemory(".ilist size unexpected"); return 1; } if (((void*)-1)== (local_ilist=mmap(NULL, stbuf.st_size, PROT_READ, MAP_PRIVATE, fd, 0))) { perror("mmap failed, failback to other method"); /* fall back to non-mmap method. */ if (NULL==(f=fdopen(fd, "r"))) { fprintf(stderr, "%s: cannot fdopen ilistfile %s\n", ilist_PRGNAME, getenv("COWDANCER_ILISTFILE")); return 1; } if (NULL==(local_ilist=malloc(stbuf.st_size))) { fprintf(stderr, "%s: out of memory while trying to allocate memory for ilist\n", ilist_PRGNAME); return 1; } fread(&header, sizeof(struct ilist_header), 1, f); if(verify_ilist_header(header)) return 1; fread(local_ilist, sizeof(struct ilist_struct), local_ilist_len, f); fclose(f); } else { if (verify_ilist_header(*(struct ilist_header *)local_ilist)) return 1; local_ilist=(void*)local_ilist+sizeof (struct ilist_header); close(fd); } /* commit, this should really be atomic, but I don't want to have a lock here. Pray that same result will result in multiple invocations, and ask for luck. It shouldn't change the result very much if it was called multiple times. */ sched_yield(); /* Do I need to make them volatile? I want the following assignment to happen at this exact timing, to make this quasi-lock-free logic to be remotely successful. */ ilist_len = local_ilist_len; ilist = local_ilist; return 0; } static void debug_cowdancer (const char * s) { if (getenv("COWDANCER_DEBUG")) fprintf (stderr, "%s: DEBUG %s\n", ilist_PRGNAME, s); } static void debug_cowdancer_2 (const char * s, const char*e) { if (getenv("COWDANCER_DEBUG")) fprintf (stderr, "%s: DEBUG %s:%s\n", ilist_PRGNAME, s, e); } /** initialize functions to override libc functions. @return 1 on error */ __attribute__ ((warn_unused_result)) static int initialize_functions () { static volatile int initialized = 0; /* this code is quasi-reentrant; shouldn't suffer too much if it is called multiple times. */ /* this code is __unlikely__ to be true It is initialized==0 only for the first time so should be !initialized==0 most of the time. */ if (__builtin_expect(!initialized,0)) { initialized = 1; origlibc_open = dlsym(RTLD_NEXT, "open"); origlibc_open64 = dlsym(RTLD_NEXT, "open64"); origlibc_creat = dlsym(RTLD_NEXT, "creat"); origlibc_creat64 = dlsym(RTLD_NEXT, "creat64"); origlibc_fopen = dlsym(RTLD_NEXT, "fopen64"); origlibc_fopen64 = dlsym(RTLD_NEXT, "fopen64"); dlerror(); if (!(origlibc_chown = dlvsym(RTLD_NEXT, "chown", "GLIBC_2.1"))) { /* I should really check dlerror, but due to a possible bug in glibc, dlerror doesn't seem to work at all. */ const char* d=dlerror(); if(!d) { debug_cowdancer("dlerror does not return anything, chown returned NULL but OK"); /* success */ } else { debug_cowdancer(d); } /* fallback to loading unversioned symbol doing it anyway since glibc does not seem to set dlerror on dlsym failure. */ origlibc_chown = dlsym(RTLD_NEXT, "chown"); } origlibc_fchown = dlsym(RTLD_NEXT, "fchown"); origlibc_lchown = dlsym(RTLD_NEXT, "lchown"); origlibc_chmod = dlsym(RTLD_NEXT, "chmod"); origlibc_fchmod = dlsym(RTLD_NEXT, "fchmod"); origlibc_flock = dlsym(RTLD_NEXT, "flock"); if (getenv("COWDANCER_DEBUG")) { fprintf(stderr, "chown:%p lchown:%p\n", origlibc_chown, origlibc_lchown); } /* load the ilist */ if (!ilist) { if (load_ilist()) { initialized = 0; return 1; } initialized = 2; debug_cowdancer ("Initialization successfully finished.\n"); } } /* Wait until somebody else finishes his job This is very unlikely */ while (__builtin_expect(initialized == 1,0)) sched_yield(); if (initialized==0) return 1; /* that somebody else failed */ else return 0; } /* the constructor for this library */ __attribute__ ((constructor)) void ctor() { if (initialize_functions()) { fprintf(stderr, "%s: Fatal, initialize_functions failed\n", ilist_PRGNAME); } } /** check if i-node is to be protected, and if so, copy the file. This function may fail, but the error cannot really be recovered; how should the default be ? canonicalize flag should be 1 except for non-symlink-following functions. @return 1 on failure, 0 on success */ __attribute__ ((warn_unused_result)) static int check_inode_and_copy(const char* s, int canonicalize) { struct ilist_struct search_target; char* canonical=NULL;/* the canonical filename, the filename of the protected inode and the newly generated*/ struct stat buf; char* backup_file=NULL;/* filename of backup file, the new file with new inode that will be used for future writes */ int ret; pid_t pid; int status; sigset_t newmask, omask; debug_cowdancer_2("DEBUG: test for", s); if(lstat(s, &buf)) return 0; /* if stat fails, the file probably doesn't exist; return, success */ if (canonicalize && S_ISLNK(buf.st_mode)) { /* for symbollic link, canonicalize and get the real filename */ if (!(canonical=canonicalize_file_name(s))) return 0; /* if canonicalize_file_name fails, the file probably doesn't exist. */ if(stat(canonical, &buf)) /* if I can't stat this file, I don't think I can write to it; ignore */ return 0; } else canonical=strdup(s); memset(&search_target, 0, sizeof(search_target)); search_target.inode = buf.st_ino; search_target.dev = buf.st_dev; //do some hardcore debugging here: if (getenv("COWDANCER_DEBUG")) { fprintf (stderr, "ciac: s:%s=canonical:%s nlink:%i reg:%i lnk:%i match:%p\n", s, canonical, (int)buf.st_nlink, S_ISREG(buf.st_mode), S_ISLNK(buf.st_mode), bsearch(&search_target, ilist, ilist_len, sizeof(search_target), compare_ilist)); } if((buf.st_nlink > 1) && /* it is hardlinked */ (S_ISREG(buf.st_mode) || S_ISLNK(buf.st_mode)) && /* it is a regular file or a symbollic link */ bsearch(&search_target, ilist, ilist_len, sizeof(search_target), compare_ilist)) /* and a match is found in ilist file */ { /* There is a file that needs to be protected, Copy-on-write hardlink files. we copy the file first to a backup place, and then mv the backup to the original file, to break the hardlink. */ if (asprintf(&backup_file, "%sXXXXXX", canonical)==-1) { ilist_outofmemory("out of memory in check_inode_and_copy, 1"); goto error_canonical; } close(ret=mkstemp(backup_file)); if (ret==-1) { perror("mkstemp"); goto error_buf; } /* mask the SIGCHLD signal, I want waitpid to work. */ sigemptyset (&newmask); sigaddset (&newmask, SIGCHLD); if (sigprocmask (SIG_BLOCK, &newmask, &omask) < 0) { perror("sigprocmask"); goto error_buf; } /* let cp do the task, it probably knows about filesystem details more than I do. forking here is really difficult; I should rewrite this code to not fork/exec. Signal handling and process waiting is too unreliable. */ switch(pid=fork()) { case 0: /* child process, run cp */ putenv("COWDANCER_IGNORE=yes"); sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL); /* unmask SIGCHLD signal */ execl("/bin/cp", "/bin/cp", "-a", canonical, backup_file, NULL); perror("execl:cp:"); exit(EXIT_FAILURE); case -1: /* error condition in fork(); something is really wrong */ ilist_outofmemory("out of memory in check_inode_and_copy, 2"); goto error_spm; default: /* parent process, waiting for cp -a to terminate */ if(-1==waitpid(pid, &status, 0)) { perror("waitpid:cp"); fprintf(stderr, "%s: unexpected waitpid error when waiting for process %i with status %x\n", ilist_PRGNAME, pid, status); goto error_spm; } if (!WIFEXITED(status)) { /* something unexpected */ fprintf(stderr, "%s: unexpected WIFEXITED status in waitpid: %x\n", ilist_PRGNAME, (int)status); goto error_spm; } else if (WEXITSTATUS(status)) { /* cp -a failed */ fprintf(stderr, "%s: cp -a failed for %s\n", ilist_PRGNAME, backup_file); goto error_spm; } /* when cp -a succeeded, overwrite the target file from the temporary file with rename */ else if (-1==rename(backup_file, canonical)) { perror ("file overwrite with rename"); fprintf(stderr, "%s: while trying rename of %s to %s\n", ilist_PRGNAME, canonical, backup_file); goto error_spm; } } free(backup_file); sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL); } else debug_cowdancer_2("DEBUG: did not match ", s); free(canonical); return 0; /* error-processing routine. */ error_spm: sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL); error_buf: free(backup_file); error_canonical: free(canonical); return 1; } int open(const char * a, int flags, ...) { int fd; mode_t mode; va_list args; va_start(args, flags); mode = va_arg(args, mode_t); va_end(args); if (initialize_functions()) { errno=ENOMEM; return -1; } if(!getenv("COWDANCER_IGNORE")) { debug_cowdancer_2 ("open", a); switch(flags & O_ACCMODE) { case O_WRONLY: case O_RDWR: if (check_inode_and_copy(a,1)) { errno=ENOMEM; return -1; } break; } } fd = origlibc_open (a, flags, mode); return fd; } int open64(const char * a, int flags, ...) { int fd; mode_t mode; va_list args; va_start(args, flags); mode = va_arg(args, mode_t); va_end(args); if (initialize_functions()) { errno=ENOMEM; return -1; } if(!getenv("COWDANCER_IGNORE")) { debug_cowdancer_2 ("open64", a); switch(flags & O_ACCMODE) { case O_WRONLY: case O_RDWR: if (check_inode_and_copy(a,1)) { errno=ENOMEM; return -1; } break; } } fd = origlibc_open64 (a, flags, mode); return fd; } int creat(const char * a, mode_t mode) { int fd; if (initialize_functions()) { errno=ENOMEM; return -1; } if(!getenv("COWDANCER_IGNORE")) { debug_cowdancer_2 ("creat", a); if (check_inode_and_copy(a,1)) { errno=ENOMEM; return -1; } } fd = origlibc_creat (a, mode); return fd; } int creat64(const char * a, mode_t mode) { int fd; if (initialize_functions()) { errno=ENOMEM; return -1; } if(!getenv("COWDANCER_IGNORE")) { debug_cowdancer_2 ("creat64", a); if (check_inode_and_copy(a,1)) { errno=ENOMEM; return -1; } } fd = origlibc_creat64 (a, mode); return fd; } static int likely_fopen_write(const char *t) { /* checks if it is likely to be a write fopen */ return strspn(t, "aw+"); } #undef fopen FILE* fopen(const char* s, const char* t) { FILE *f; if (initialize_functions()) { errno=ENOMEM; return NULL; } if(!getenv("COWDANCER_IGNORE")&& likely_fopen_write(t)) { debug_cowdancer_2 ("fopen", s); if (check_inode_and_copy(s,1)) { errno=ENOMEM; return NULL; } } f = origlibc_fopen (s, t); return f; } #undef fopen64 FILE* fopen64(const char* s, const char* t) { FILE *f; if(initialize_functions()) { errno=ENOMEM; return NULL; } if(!getenv("COWDANCER_IGNORE")&& likely_fopen_write(t)) { debug_cowdancer_2 ("fopen64", s); if(check_inode_and_copy(s,1)) { errno=ENOMEM; return NULL; } } f = origlibc_fopen64(s, t); return f; } #undef chown int chown(const char* s, uid_t u, gid_t g) { int ret; if(initialize_functions()) { errno=ENOMEM; return -1; } if(!getenv("COWDANCER_IGNORE")) { debug_cowdancer_2 ("chown", s); if(check_inode_and_copy(s,1)) { errno=ENOMEM; return -1; } } ret = origlibc_chown(s, u, g); debug_cowdancer_2 ("end-chown", s); return ret; } /* Check out file descriptor * * This function is currently a dummy, which does not return 1. * * @return 1 on failure, 0 on success * */ static int check_fd_inode_and_warn(int fd, const char* operation) { struct stat buf; struct ilist_struct search_target; fstat(fd, &buf); memset(&search_target, 0, sizeof(search_target)); search_target.inode = buf.st_ino; search_target.dev = buf.st_dev; if(bsearch(&search_target, ilist, ilist_len, sizeof(search_target), compare_ilist) && S_ISREG(buf.st_mode)) { /* Someone opened file read-only, and called fchown/fchmod/flock; I don't really know how to do salvation in that case, since the original filename is probably not available, and file is already open. If there is any better way, I'd like to know. */ fprintf(stderr, "W: cowdancer: unsupported operation %s, read-only open and fchown/fchmod/flock are not supported: tried opening dev:inode of %li:%li\n", operation, (long)buf.st_dev, (long)buf.st_ino); /* emit a warning and do not fail, if you want to make it fail, add a return 1; apt seems to want to use this operation; thus apt will always fail. */ } return 0; } #undef fchown int fchown(int fd, uid_t u, gid_t g) { int ret; if(initialize_functions()) return -1; if(!getenv("COWDANCER_IGNORE")) { debug_cowdancer ("fchown"); if (check_fd_inode_and_warn(fd, "fchown")) { errno=ENOMEM; return -1; } } ret = origlibc_fchown(fd, u, g); return ret; } #undef lchown /* chown that does not follow the symbollic links. */ int lchown(const char* s, uid_t u, gid_t g) { int ret; if(initialize_functions()) { errno=ENOMEM; return -1; } if(!getenv("COWDANCER_IGNORE")) { debug_cowdancer_2 ("lchown", s); if (check_inode_and_copy(s,0)) { errno=ENOMEM; return -1; } } ret = origlibc_lchown(s, u, g); debug_cowdancer_2 ("end-lchown", s); return ret; } #undef chmod int chmod(const char* s, mode_t mode) { int ret; if(initialize_functions()) { errno=ENOMEM; return -1; } if(!getenv("COWDANCER_IGNORE")) { debug_cowdancer_2 ("chmod", s); if (check_inode_and_copy(s,1)) { errno=ENOMEM; return -1; } } ret = origlibc_chmod(s, mode); return ret; } #undef fchmod int fchmod(int fd, mode_t mode) { int ret; if(initialize_functions()) { errno=ENOMEM; return -1; } if(!getenv("COWDANCER_IGNORE")) { debug_cowdancer ("fchmod"); if (check_fd_inode_and_warn(fd, "fchmod")) { errno=ENOMEM; return -1; } } ret = origlibc_fchmod(fd, mode); return ret; } #undef flock int flock(int fd, int operation) { int ret; if(initialize_functions()) { errno=ENOMEM; return -1; } if(!getenv("COWDANCER_IGNORE")) { debug_cowdancer ("flock"); if (check_fd_inode_and_warn(fd, "flock")) { errno=ENOMEM; return -1; } } ret = origlibc_flock(fd, operation); return ret; } cowdancer-0.73/parameter.h0000644000000000000000000000615512126403144012433 0ustar /*BINFMTC: * parameter handling for cpbuilder. * Copyright (C) 2007-2009 Junichi Uekawa * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifndef __PARAMETER_H__ #define __PARAMETER_H__ #define MAX_CUSTOM_FILES 32 typedef struct pbuilderconfig { /* if you edit here, please add to parameter.c: dumpconfig */ int mountproc; int mountdev; int mountdevpts; int save_after_login; int debug; char* buildplace; /* /var/cache/pbuilder/build/XXX.$$ */ char* buildresult; /* /var/cache/pbuilder/result/ */ char* basepath; /* /var/cache/pbuilder/cow */ char* mirror; char* distribution; char* components; char* othermirror; char* debbuildopts; int binary_arch; char* http_proxy; /* files to be copied into the chroot, and copied out of the chroot */ char* inputfile[MAX_CUSTOM_FILES+1]; char* outputfile[MAX_CUSTOM_FILES+1]; /* cow-specific options */ int no_cowdancer_update; /* --no-cowdancer-update */ int debian_etch_workaround; /* --debian-etch-workaround */ /* more qemu-isque options */ char* kernel_image; char* initrd; char* smp; int memory_megs; /* megabytes of memory */ char* arch; char* arch_diskdevice; enum { pbuilder_do_nothing=0, pbuilder_help, pbuilder_build, pbuilder_create, pbuilder_update, pbuilder_execute, pbuilder_login, pbuilder_dumpconfig } operation; } pbuilderconfig; int load_config_file(const char* config, pbuilderconfig* pc); int size_of_ntarray(char ** buf); int forkexeclp (const char *path, const char *arg0, ...); int forkexecvp (char *const argv[]); int parse_parameter(int ac, char** av, const char* keyword); int cpbuilder_build(const struct pbuilderconfig* pc, const char* dscfile); int cpbuilder_login(const struct pbuilderconfig* pc); int cpbuilder_execute(const struct pbuilderconfig* pc, char** av); int cpbuilder_update(const struct pbuilderconfig* pc); int cpbuilder_help(void); int cpbuilder_create(const struct pbuilderconfig* pc); /* The pbuilder command-line to pass 0: pbuilder 1: build/create/login etc. offset: the next command The last-command will be PBUILDER_ADD_PARAM(NULL); */ #define MAXPBUILDERCOMMANDLINE 256 #define PBUILDER_ADD_PARAM(a) \ if(offset<(MAXPBUILDERCOMMANDLINE-1)) \ {pbuildercommandline[offset++]=a;} \ else \ {pbuildercommandline[offset]=NULL; fprintf(stderr, "pbuilder-command-line: Max command-line exceeded\n");} extern char* pbuildercommandline[MAXPBUILDERCOMMANDLINE]; extern int offset; #endif cowdancer-0.73/qemuarch.h0000644000000000000000000000101111220436222012237 0ustar /* arch-specific code for qemubuilder. */ #ifndef __QEMUARCH_H__ #define __QEMUARCH_H__ #include "parameter.h" const char* qemu_arch_diskdevice(const struct pbuilderconfig* pc); const int qemu_create_arch_serialdevice(const char* basedir, const char* arch); const int qemu_create_arch_devices(const char* basedir, const char* arch); char* get_host_dpkg_arch(); const char* qemu_arch_qemu(const char* arch); const char* qemu_arch_qemumachine(const char* arch); const char* qemu_arch_tty(const char* arch); #endif cowdancer-0.73/doc/0000755000000000000000000000000011220436222011035 5ustar cowdancer-0.73/doc/speedup-mke2fs.txt0000644000000000000000000000166711220436222014442 0ustar mke2fs time speedup =================== 2009-05-01 Junichi Uekawa Background ========== dd / mke2fs sequence takes around 7 seconds on my system (core2duo macbook). This is ran every time for create / update and build, which means it can be optimized. There are other parts, like kernel booting time and apt install time and dpkg configuration time that are taking majority of time (e.g. 2 minutes), and they will need to be looked at for individual cases, but this looks like a clear win on all cases. Plan ==== create_ext3_block_device currently creates a sparse file, and then runs mke2fs and tune2fs on the resulting file. This can be modified so that a ext3 block device creater will create an empty file for the first time, and then reusing it with a copy. Initial measurement =================== *TODO* Say that copying a 10G sparse file is faster than rerunning mke2fs Final measurement ================= *TODO* Actual results cowdancer-0.73/doc/README0000644000000000000000000000040511220436222011714 0ustar This directory contains some design documents and discussions on design. The documents are current as of writing the documents, but hopefully they will be useful memo to look back and see why certain decisions were made at one point. 2009-05-01 Junichi Uekawa cowdancer-0.73/cowbuilder_util.c0000644000000000000000000000256112124576736013657 0ustar #include #include #include #include #include "cowbuilder_util.h" /** * @return 0 if not mounted, 1 if something under the mountpoint is mounted. */ int check_mountpoint(const char* mountpoint) { /* Check if a subdirectory under buildplace is still mounted, which may happen when there's a stale bind mount or whatnot. */ FILE *mtab = NULL; struct mntent * part = NULL; if ((mtab = setmntent("/etc/mtab", "r")) != NULL) { while ((part = getmntent(mtab) ) != NULL) { if ( part->mnt_fsname != NULL ) { if (strstr(part->mnt_dir, mountpoint) == part->mnt_dir) { printf("E: Something (%s) is still mounted under %s; unmount and remove %s manually\n", part->mnt_dir, mountpoint, mountpoint); endmntent(mtab); return 1; } } } endmntent(mtab); } return 0; } /** * Remove double slash "//" from pc->buildplace and use "/" * dest needs to be large enough to hold buildplace string. */ void canonicalize_doubleslash(const char* buildplace, char* dest) { char prev=0; int i, j; for (i = 0, j = 0; buildplace[i]; ++i) { if (prev == '/' && buildplace[i] == '/') { continue; } prev = dest[j++] = buildplace[i]; } dest[j] = '\0'; } cowdancer-0.73/test_qemuipsanitize.c0000755000000000000000000000237711220436222014556 0ustar /*BINFMTC: qemuipsanitize.c * test qemubuilder code */ #include #include #include #include #include "qemuipsanitize.h" #define assert_streq(a,b) \ assert_streq_f(__FILE__, __LINE__, a, b) void assert_streq_f(const char*f, int l, const char* a, const char* b) { if(!strcmp(a,b)) return; printf("%s:%i: [%s] and [%s] are different\n", f, l, a, b); exit(1); } int test_sanitize_ipaddress() { assert_streq("10.0.2.2", sanitize_ipaddress("localhost")); assert_streq("10.0.2.2", sanitize_ipaddress("127.0.0.1")); assert_streq("10.0.2.2", sanitize_ipaddress("127.0.0.2")); assert_streq("www.netfort.gr.jp", sanitize_ipaddress("www.netfort.gr.jp")); return 0; } int test_sanitize_mirror() { assert_streq("http://www.netfort.gr.jp/debian", sanitize_mirror("http://www.netfort.gr.jp/debian")); assert_streq("http://www.netfort.gr.jp:9999/debian", sanitize_mirror("http://www.netfort.gr.jp:9999/debian")); assert_streq("http://10.0.2.2:9999/debian", sanitize_mirror("http://localhost:9999/debian")); assert_streq("http://10.0.2.2/debian", sanitize_mirror("http://localhost/debian")); return 0; } int main() { int val=0; val+=test_sanitize_ipaddress(); val+=test_sanitize_mirror(); return val; } cowdancer-0.73/bash_completion.cowbuilder0000644000000000000000000000261611636513704015540 0ustar # Debian GNU/Linux cowbuilder(1) completion # Copyright 2007 Cyril Brulebois # Copyright 2011 David Paleino # # This script can be distributed under the same license as the # cowdancer or bash packages. have cowbuilder && _cowbuilder() { local initialcommand initialcommand_options cur prev words other_options distribution COMPREPLY=() _get_comp_words_by_ref cur prev words initialcommand=${words[1]} initialcommand_options='--create --update --build --login --execute' other_options='--dumpconfig --distribution --mirror --basepath --architecture' distribution='sid sarge etch woody lenny squeeze' case $prev in --distribution) COMPREPLY=( $(compgen -W "$distribution" | grep "^$cur" ) ) return 0 ;; --basepath) _filedir -d return 0 ;; *) ;; esac case $initialcommand in --build) COMPREPLY=( $( compgen -W "$other_options" -- "$cur" ) $( compgen -o filenames -G "$cur*.dsc" ) ) ;; --execute) COMPREPLY=( $( compgen -W "$other_options" -- "$cur" ) $( compgen -o filenames -G "$cur*" ) ) ;; *) COMPREPLY=( $( compgen -W "$initialcommand_options $other_options" -- "$cur" ) ) ;; esac return 0 } && complete -F _cowbuilder cowbuilder cowdancer-0.73/COPYING0000644000000000000000000004311011220436222011322 0ustar GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. cowdancer-0.73/qemutool/0000755000000000000000000000000011220436222012135 5ustar cowdancer-0.73/qemutool/crossapt.sh0000755000000000000000000000073711220436222014341 0ustar #!/bin/bash # some way to download the kernel. --- prototype idea? # # references: crosshurd: /usr/share/crosshurd/functions # TODO: actually think about implementation. DEB_TARGET_ARCH=$1 shift apt_options="--option Debug::Nolocking=true --option APT::Architecture=$DEB_TARGET_ARCH --option APT::Get::Force-Yes=true --option APT::Get::Download-Only=true" apt-get $apt_options "$@" # ./crossapt.sh update # ./crossapt.sh install (fails, because too many things are missing.)cowdancer-0.73/qemutool/extractdebkernel.sh0000755000000000000000000000043411220436222016023 0ustar #!/bin/bash # extract kernel file from DEB file. # actually implement it. FILENAMES=$(dpkg-deb --fsys-tarfile "$1" | tar xf - --wildcards ./boot/vmlinu\* ) echo extracting $FILENAMES for f in $FILENAMES; do dpkg-deb --fsys-tarfile "$1" | tar xf - -O $f $(basename $f) > $f done cowdancer-0.73/test_forkexec.c0000755000000000000000000000140711220436222013306 0ustar /*BINFMTC: forkexec.c */ #include #include #include #include #include #include "parameter.h" int main() { char *const successvp[] = { "/bin/true", NULL }; char *const failurevp[] = { "/bin/false", NULL }; char *const echovp[] = { "/bin/echo", "Hello world", NULL }; assert(forkexecvp(successvp) == 0); assert(forkexecvp(failurevp) == 1); assert(forkexecvp(echovp) == 0); assert(forkexeclp("/bin/true", "/bin/true", NULL) == 0); assert(forkexeclp("/bin/false", "/bin/false", NULL) == 1); assert(forkexeclp("/bin/echo", "/bin/echo", "Hello World", NULL) == 0); return 0; } cowdancer-0.73/qemuarch.c0000644000000000000000000001152512145703065012256 0ustar /* * qemubuilder: pbuilder with qemu * arch-specific code. * * Copyright (C) 2009 Junichi Uekawa * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "parameter.h" #include "qemuarch.h" #include "file.h" /** * arch-specific routine; disk device name to use */ const char* qemu_arch_diskdevice(const struct pbuilderconfig* pc) { if (pc->arch_diskdevice) return pc->arch_diskdevice; return "sd"; } /** * arch-specific routine; the console device to make */ const int qemu_create_arch_serialdevice(const char* basedir, const char* arch) { dev_t consoledev; if (!strcmp(arch, "arm") || !strcmp(arch, "armel")) { consoledev = makedev(204, 64); } else { consoledev = makedev(4, 64); } return mknod_inside_chroot(basedir, "dev/console", S_IFCHR | 0660, consoledev); } /** * arch-specific routine; make device files inside chroot */ const int qemu_create_arch_devices(const char* basedir, const char* arch) { int ret=0; char* s=0; asprintf(&s, "%s/%s", basedir, "dev"); if (-1==mkdir(s, 0777)) { perror("mkdir chroot-/dev"); ret=1; } free(s); ret+=qemu_create_arch_serialdevice(basedir, arch); ret+=mknod_inside_chroot(basedir, "dev/ttyS0", S_IFCHR | 0660, makedev(4, 64)); ret+=mknod_inside_chroot(basedir, "dev/ttyAMA0", S_IFCHR | 0660, makedev(204, 64)); ret+=mknod_inside_chroot(basedir, "dev/sda", S_IFBLK | 0660, makedev(8, 0)); ret+=mknod_inside_chroot(basedir, "dev/sdb", S_IFBLK | 0660, makedev(8, 16)); ret+=mknod_inside_chroot(basedir, "dev/hda", S_IFBLK | 0660, makedev(3, 0)); ret+=mknod_inside_chroot(basedir, "dev/hdb", S_IFBLK | 0660, makedev(3, 64)); return ret; } /** * get output of dpkg --print-architecture * returns a malloc'd string, you need to free it. */ char* get_host_dpkg_arch() { FILE*f=popen("dpkg --print-architecture", "r"); char*host_arch; fscanf(f, "%ms", &host_arch); pclose(f); return host_arch; } /** * arch-specific routine; qemu command to use. */ const char* qemu_arch_qemu(const char* arch) { if (!strcmp(arch, "arm") || !strcmp(arch, "armel")) { return "qemu-system-arm"; } if (!strcmp(arch, "mips")) return "qemu-system-mips"; else if (!strcmp(arch, "mipsel")) return "qemu-system-mipsel"; else if (!strcmp(arch, "i386") || !strcmp(arch, "amd64") || !strcmp(arch, "hurd-i386") ) { /* we're leaking this memory, but don't care too much */ char* host_arch = get_host_dpkg_arch(); /* special-case use kvm if possible use qemu if i386/i386 use qemu-system-x86_64 otherwise */ int kvm_exists = !system("which kvm"); if(!strcmp(host_arch,arch) && kvm_exists) return "kvm"; else if(!strcmp(host_arch, "amd64") && kvm_exists) return "kvm"; else if((!strcmp(host_arch, "i386")) && (!strcmp(arch, "i386"))) return "qemu"; else return "qemu-system-x86_64"; } else if (!strcmp(arch, "hurd-i386")) return "qemu"; else if (!strcmp(arch, "powerpc")) return "qemu-system-ppc"; else if (!strcmp(arch, "sparc")) return "qemu-system-sparc"; else return NULL; } /** * arch-specific routine; the machine spec for this arch */ const char* qemu_arch_qemumachine(const char* arch) { if (!strcmp(arch, "arm") || !strcmp(arch, "armel")) return "versatilepb"; else if (!strcmp(arch, "i386") || !strcmp(arch, "hurd-i386") || !strcmp(arch, "amd64")) return "pc"; else if (!strcmp(arch, "mips")|| !strcmp(arch, "mipsel")) return "malta"; else if (!strcmp(arch, "powerpc")) return "prep"; else if (!strcmp(arch, "sparc")) return "SS-5"; return NULL; } /** * arch-specific routine; the serial device */ const char* qemu_arch_tty(const char* arch) { if (!strcmp(arch, "arm")|| !strcmp(arch, "armel")) { return "ttyAMA0,115200n8"; } return "ttyS0,115200n8"; } cowdancer-0.73/bash_completion.qemubuilder0000644000000000000000000000256711326521313015713 0ustar #!/bin/bash # Debian GNU/Linux cowbuilder(1) completion # Copyright 2007 Cyril Brulebois # Copyright 2009 Junichi Uekawa # # This script can be distributed under the same license as the # cowdancer or bash packages. have qemubuilder && _qemubuilder() { local initialcommand initialcommand_options cur prev other_options distribution COMPREPLY=() cur=$(_get_cword) prev=${COMP_WORDS[COMP_CWORD-1]} initialcommand=${COMP_WORDS[1]} initialcommand_options='--create --update --build --login --execute' other_options='--dumpconfig --distribution --mirror --basepath --architecture' distribution='sid sarge etch woody lenny squeeze' case $initialcommand in --build) COMPREPLY=( $( compgen -W "$other_options" | grep "^$cur" ) $( compgen -o filenames -G "$cur*.dsc" ) ) ;; --execute) COMPREPLY=( $( compgen -W "$other_options" | grep "^$cur" ) $( compgen -o filenames -G "$cur*" ) ) ;; *) COMPREPLY=( $( compgen -W "$initialcommand_options" | grep "^$cur" ) $( compgen -W "$other_options" | grep "^$cur" ) ) ;; esac case $prev in --distribution) COMPREPLY=( $(compgen -W "$distribution" | grep "^$cur" ) ) ;; *) esac return 0 } [ "$have" ] && complete -F _qemubuilder -o filenames qemubuilder cowdancer-0.73/cow-shell.10000644000000000000000000000574611220436222012263 0ustar .TH "cow\-shell" 1 "2006 Jan 25" "cowdancer" "cowdancer" .SH "NAME" cow\-shell \- Start a copy-on-write session and invoke a shell. .SH SYNOPSIS .BI "cow-shell [" "commandline" "]" .SH DESCRIPTION .B cow\-shell Executes specified command with .B cowdancer or a shell if no command-line option is given. Inside the cowdancer session, files under the current directory are protected in a way so that a write operation to an i-node which existed at the point of running cow-shell is not modified. Useful for managing hard-linked source-trees and scratch-filesystems. .SH "EXAMPLES" .TP .B "cp -al cowdancer/ cowdancer.new && cd cowdancer.new && cow-shell " Create a hardlinked tree, and cd into the newly created tree. After invoking cow-shell inside that tree, a write operation against a file that is hardlinked with the original tree will be copied to a new file before write. .TP .B "cp -al cowdancer/ cowdancer.new && cd cowdancer.new && cow-shell debuild" Tries to run dpkg-buildpackage on the new tree, to avoid damage to the original tree. Configure debuild to ignore .B ".ilist" files, through .B "-i" or .B "-I" option. .PP .SH "FILES" .TP .B ".ilist" Generated dynamically in the current directory. The file contains the list of i-node numbers that should be protected from write operation. .TP .B "/usr/lib/cowdancer/libcowdancer.so" The shared library used internally that overrides some functions that potentially write to files. This library implements the COW feature and is preloaded with LD_PRELOAD. .TP .B "/bin/cp" Used for copying. Requires GNU option .B "\-a" to be functional. .SH "ENVIRONMENT" .TP .B "COWDANCER_ILISTFILE" The path to the current .B .ilist file. .TP .B "COWDANCER_IGNORE" Used internally to work around infinite loops. It will be unset. .TP .B "LD_PRELOAD" Utilized to preload .B libcowdancer.so .TP .B "COWDANCER_DEBUG" Debugging option. Enables debug messages. cowdancer will give verbose debug messages in standard error output. .TP .B "COWDANCER_SO" Debugging option. Specifies a different path for libcowdancer.so. .TP .B "COWDANCER_REUSE=yes" Enables reuse of cowdancer .ilist file found for consecutive runs of cow-shell. .SH "RETURN VALUE" The functions that are overridden with cowdancer will give an errno value of .B ENOMEM when there is a problem. System isn't really out of memory, but this error code is chosen because this error is usually handled gracefully by applications. .SH "RESTRICTIONS" Can only support directories that are scanned by .B cow-shell command. The operation is not semantically correct when files are originally hardlinked, hardlinks are always broken. Does not support anything when LD_PRELOAD trick does not work. Does not work unless hardlinks are supported on the filesystem. Not very user-friendly. Leaves .B ".ilist" file around. .SH "AUTHOR" Junichi Uekawa (dancer@debian.org) Upstream page is available at .B "http://www.netfort.gr.jp/~dancer/software/cowdancer.html" .SH "SEE ALSO" .BR "cowdancer-ilistcreate (" 1 ")" cowdancer-0.73/cowbuilder.c0000755000000000000000000004033412124717337012617 0ustar /*BINFMTC: parameter.c forkexec.c ilistcreate.c main.c * cowbuilder / pbuilder with cowdancer * Copyright (C) 2005-2009 Junichi Uekawa * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ /* sudo ./cowbuilder --create --distribution sid --basepath /mnt/120g-1/dancer/cow/cow sudo ./cowbuilder --update --basepath /mnt/120g-1/dancer/cow/cow sudo mkdir /mnt/120g-1/dancer/cow/cow cd /mnt/120g-1/dancer/cow/cow sudo tar xfzp /var/cache/pbuilder/base.tgz sudo chroot . dpkg -i tmp/cowdancer_0.3_i386.deb sudo ./cowbuilder.c --build --basepath /mnt/120g-1/dancer/cow/cow $FILENAME i.e. requires cowdancer inside the chroot. How to find out changed times of chroot: $ sudo find /var/cache/pbuilder/build/cow -mtime -1 -ls will show the list of files changed. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include "cowbuilder_util.h" #include "ilist.h" #include "parameter.h" const char* ilist_PRGNAME="cowbuilder"; /** remove a directory. be careful about bind-mounted directories. @return 0 on success */ static int rmrf(const char* path) { return forkexeclp("rm", "rm", "-rf", path, NULL); } /** * @return .ilist path as malloc()ed string, or NULL on error. */ static char* get_ilistfile_path(const struct pbuilderconfig* pc) { char *ilistfile; if (0>asprintf(&ilistfile, "%s/.ilist", pc->buildplace)) { /* outofmemory */ fprintf(stderr, "cowdancer: out of memory.\n"); return NULL; } return ilistfile; } /** break hardlink. return 0 on success, 1 on fail. */ int break_cowlink(const char* s) { char *backup_file; struct stat buf; int pid; int status; if(lstat(s, &buf)) return 1; /* if stat fails, the file probably doesn't exist; return, success */ if (S_ISLNK(buf.st_mode)) return 1; /* ignore symbollic link */ if((buf.st_nlink > 1) && /* it is hardlinked */ S_ISREG(buf.st_mode)) { if (asprintf(&backup_file, "%sXXXXXX", s)==-1) { ilist_outofmemory("out of memory in break_cowlink"); return 1; } switch(pid=fork()) { case 0: /* child process, run cp */ putenv("COWDANCER_IGNORE=yes"); execl("/bin/cp", "/bin/cp", "-a", s, backup_file, NULL); perror("execl:cp:"); exit(EXIT_FAILURE); case -1: /* error condition in fork(); something is really wrong */ ilist_outofmemory("out of memory in check_inode_and_copy, 2"); break; default: /* parent process, waiting for cp -a to terminate */ if(-1==waitpid(pid, &status, 0)) { perror("waitpid:cp"); fprintf(stderr, "%s: unexpected waitpid error when waiting for process %i with status %x\n", ilist_PRGNAME, pid, status); goto error_spm; } if (!WIFEXITED(status)) { /* something unexpected */ fprintf(stderr, "%s: unexpected WIFEXITED status in waitpid: %x\n", ilist_PRGNAME, (int)status); goto error_spm; } else if (WEXITSTATUS(status)) { /* cp -a failed */ fprintf(stderr, "%s: cp -a failed for %s\n", ilist_PRGNAME, backup_file); goto error_spm; } /* when cp -a succeeded, overwrite the target file from the temporary file with rename */ else if (-1==rename(backup_file, s)) { perror ("file overwrite with rename"); fprintf(stderr, "while trying rename of %s to %s\n", backup_file, s); goto error_spm; } } } return 0; error_spm: free(backup_file); return 1; } /** Convenience function to call break_cowlink with basepath prepended. */ static void break_cowlink_inside_chroot(const char* basepath, const char* filepath) { char* filename; asprintf(&filename, "%s%s", basepath, filepath); break_cowlink(filename); free(filename); } /** hardlink-copy directory for COW use. Un-hardlink some files which do not work with hardlinking. @return 0 on success, 1 on failure. */ static int cpbuilder_internal_cowcopy(const struct pbuilderconfig* pc) { char *ilistfile; printf(" -> Copying COW directory\n"); if (0!=rmrf(pc->buildplace)) return 1; if (0!=forkexeclp("cp", "cp", "-al", pc->basepath, pc->buildplace, NULL)) return 1; /* ilist file handling. Delete existing ilist file if it exists, because I use COWDANCER_REUSE */ if(!(ilistfile=get_ilistfile_path(pc))) { /* outofmemory */ fprintf(stderr, "cowdancer: out of memory.\n"); return 1; } if (unlink(ilistfile)) { /* if there was no ilist file in the beginning, that's not a problem. */ fprintf(stderr, "I: unlink for ilistfile %s failed, it didn't exist?\n", ilistfile); } else { fprintf(stderr, "I: removed stale ilistfile %s\n", ilistfile); } free(ilistfile); /* Non-hardlinkable file support */ break_cowlink_inside_chroot(pc->buildplace, "/var/cache/debconf/config.dat"); break_cowlink_inside_chroot(pc->buildplace, "/var/cache/debconf/templates.dat"); break_cowlink_inside_chroot(pc->buildplace, "/var/cache/debconf/passwords.dat"); return 0; } /* @return 0 on success, 1 on failure. */ static int cpbuilder_internal_cleancow(const struct pbuilderconfig* pc) { /* * A directory bind-mounted into pc->buildplace, will be cleaned out * by rmrf() To avoid that potential disaster we want to detect if * there's something mounted under the chroot before running the * cleanup procedure. */ char* canonicalized_buildplace = strdupa(pc->buildplace); printf(" -> Cleaning COW directory\n"); canonicalize_doubleslash(pc->buildplace, canonicalized_buildplace); if (check_mountpoint(canonicalized_buildplace)) { return 1; } if (0!=rmrf(pc->buildplace)) return 1; return 0; } /* * @return: return code of pbuilder, or <0 on failure */ int cpbuilder_build(const struct pbuilderconfig* pc, const char* dscfile_) { const char* dscfile=canonicalize_file_name(dscfile_); char* ilistfile; char* buf_chroot=NULL; int ret; char * prevdir; if (!dscfile) { fprintf(stderr, "File not found: %s\n", dscfile_); return 1; } if (cpbuilder_internal_cowcopy(pc)) { fprintf(stderr, "Failed cowcopy.\n"); return 1; } if (0>asprintf(&buf_chroot, "chroot %s cow-shell", pc->buildplace)) { /* outofmemory */ fprintf(stderr, "cowdancer: out of memory.\n"); return -1; } if(!(ilistfile=get_ilistfile_path(pc))) { /* outofmemory */ fprintf(stderr, "cowdancer: out of memory.\n"); return 1; } prevdir=get_current_dir_name(); chdir(pc->buildplace); if (forkexeclp("chroot", "chroot", pc->buildplace, "cowdancer-ilistcreate", "/.ilist", "find . -xdev -path ./home -prune -o \\( \\( -type l -o -type f \\) -a -links +1 -print0 \\) | xargs -0 stat --format '%d %i '", NULL)) { /* if there was an error, back off to manual form */ /* but first, try etch-workaround */ if (pc->debian_etch_workaround) { fprintf(stderr, "W: Trying my backup method for working with Debian Etch chroots.\n"); if (forkexeclp("chroot", "chroot", pc->buildplace, "cow-shell", "/bin/true", NULL)) { /* I failed, what can I do? noooo */ fprintf(stderr, "E: failed running Debian Etch compatibility backup plan, I'm in panic, eek.\n"); return 1; } } else { /* try the normal backup method It probably doesn't work but try it anyway. */ fprintf(stderr, "W: cowdancer-ilistcreate failed to run within chroot, falling back to old method\n"); ilistcreate(ilistfile, "find . -xdev -path ./home -prune -o \\( \\( -type l -o -type f \\) -a -links +1 -print0 \\) | xargs -0 stat --format '%d %i '"); } } chdir(prevdir); free(prevdir); printf(" -> Invoking pbuilder\n"); pbuildercommandline[1]="build"; PBUILDER_ADD_PARAM("--buildplace"); PBUILDER_ADD_PARAM(pc->buildplace); if (pc->buildresult) { PBUILDER_ADD_PARAM("--buildresult"); PBUILDER_ADD_PARAM(pc->buildresult); } if (pc->debbuildopts) { PBUILDER_ADD_PARAM("--debbuildopts"); PBUILDER_ADD_PARAM(pc->debbuildopts); } if (pc->binary_arch) { PBUILDER_ADD_PARAM("--binary-arch"); } PBUILDER_ADD_PARAM("--no-targz"); PBUILDER_ADD_PARAM("--internal-chrootexec"); PBUILDER_ADD_PARAM(buf_chroot); PBUILDER_ADD_PARAM(strdup(dscfile)); PBUILDER_ADD_PARAM(NULL); ret=forkexecvp(pbuildercommandline); free(buf_chroot); if (ret < 128) cpbuilder_internal_cleancow(pc); else printf("pbuilder build aborted, not cleaning\n"); free(ilistfile); return ret; } int cpbuilder_create(const struct pbuilderconfig* pc) { int ret; mkdir(pc->basepath,0777); printf(" -> Invoking pbuilder\n"); pbuildercommandline[1]="create"; PBUILDER_ADD_PARAM("--buildplace"); PBUILDER_ADD_PARAM(pc->basepath); if (pc->mirror) { PBUILDER_ADD_PARAM("--mirror"); PBUILDER_ADD_PARAM(pc->mirror); } if (pc->arch) { PBUILDER_ADD_PARAM("--architecture"); PBUILDER_ADD_PARAM(pc->arch); } PBUILDER_ADD_PARAM("--distribution"); PBUILDER_ADD_PARAM(pc->distribution); PBUILDER_ADD_PARAM("--no-targz"); PBUILDER_ADD_PARAM("--extrapackages"); PBUILDER_ADD_PARAM("cowdancer"); PBUILDER_ADD_PARAM(NULL); ret=forkexecvp(pbuildercommandline); if (ret) { printf("pbuilder create failed\n"); if (0!=rmrf(pc->basepath)) { fprintf(stderr, "Could not remove original tree\n"); } } return ret; } /* mv basepath basepath- mv buildplace basepath rm -rf basepath- return 0 on success, nonzero on error. */ int cpbuilder_internal_saveupdate(const struct pbuilderconfig* pc) { int ret=0; char* buf_tmpfile=NULL; if (0>asprintf(&buf_tmpfile, "%s-%i-tmp", pc->buildplace, (int)getpid())) { /* outofmemory */ return -1; } printf(" -> Moving work directory [%s] to final location [%s] and cleaning up old copy\n", pc->buildplace, pc->basepath); if(-1==rename(pc->basepath, buf_tmpfile)) { perror("rename"); ret=-1; goto out; } if(-1==rename(pc->buildplace, pc->basepath)) { perror("rename"); ret=-1; goto out; } if (0!=rmrf(buf_tmpfile)) { printf("Could not remove original tree\n"); ret=-1; goto out; } out: free(buf_tmpfile); return ret; } int cpbuilder_login(const struct pbuilderconfig* pc) { char *buf_chroot; int ret; if (cpbuilder_internal_cowcopy(pc)) { fprintf(stderr, "Failed cowcopy.\n"); return 1; } /* this is the option passed to internal-chrootexec */ if (0>asprintf(&buf_chroot, "chroot %s cow-shell", pc->buildplace)) { /* outofmemory */ return -1; } printf(" -> Invoking pbuilder\n"); pbuildercommandline[1]="login"; PBUILDER_ADD_PARAM("--buildplace"); PBUILDER_ADD_PARAM(pc->buildplace); PBUILDER_ADD_PARAM("--no-targz"); PBUILDER_ADD_PARAM("--internal-chrootexec"); PBUILDER_ADD_PARAM(buf_chroot); PBUILDER_ADD_PARAM(NULL); ret=forkexecvp(pbuildercommandline); free(buf_chroot); if (ret < 128) { if (pc->save_after_login) { if (0!=forkexeclp("chroot", "chroot", pc->buildplace, "apt-get", "clean", NULL)) ret=-1; if (cpbuilder_internal_saveupdate(pc)) ret=-1; } else { cpbuilder_internal_cleancow(pc); } } else printf("pbuilder login aborted, not cleaning\n"); return ret; } /* Mostly a copy of pbuilder login, executes a script. */ int cpbuilder_execute(const struct pbuilderconfig* pc, char** av) { char *buf_chroot; int ret; int i=0; if (cpbuilder_internal_cowcopy(pc)) { fprintf(stderr, "Failed cowcopy.\n"); return 1; } if (0>asprintf(&buf_chroot, "chroot %s cow-shell", pc->buildplace)) { /* outofmemory */ return -1; } printf(" -> Invoking pbuilder\n"); pbuildercommandline[1]="execute"; PBUILDER_ADD_PARAM("--buildplace"); PBUILDER_ADD_PARAM(pc->buildplace); PBUILDER_ADD_PARAM("--no-targz"); PBUILDER_ADD_PARAM("--internal-chrootexec"); PBUILDER_ADD_PARAM(buf_chroot); /* add all additional parameters */ while(av[i]) { PBUILDER_ADD_PARAM(av[i]); i++; } PBUILDER_ADD_PARAM(NULL); ret=forkexecvp(pbuildercommandline); free(buf_chroot); if (ret < 128) { if (pc->save_after_login) { if (0!=forkexeclp("chroot", "chroot", pc->buildplace, "apt-get", "clean", NULL)) ret=-1; if (cpbuilder_internal_saveupdate(pc)) ret=-1; } else { cpbuilder_internal_cleancow(pc); } } else printf("pbuilder execute aborted, not cleaning\n"); return ret; } /* find matching parameter, and check if it's set. @returns found=1, not found=0. */ int find_matching_param(const char* option) { int i; int found=0; for (i=0; iasprintf(&buf_chroot, (pc->no_cowdancer_update)?"chroot %s": /* try to not use cow-shell, when no-cowdancer-update option is used */ "chroot %s cow-shell", pc->buildplace)) { /* if outofmemory, die. */ fprintf(stderr, "Out of memory.\n"); return -1; } if (cpbuilder_internal_cowcopy(pc)) { fprintf(stderr, "Failed cowcopy.\n"); return 1; } printf(" -> Invoking pbuilder\n"); pbuildercommandline[1]="update"; PBUILDER_ADD_PARAM("--buildplace"); PBUILDER_ADD_PARAM(pc->buildplace); if (find_matching_param("--override-config")) { if (pc->mirror) { PBUILDER_ADD_PARAM("--mirror"); PBUILDER_ADD_PARAM(pc->mirror); } PBUILDER_ADD_PARAM("--distribution"); PBUILDER_ADD_PARAM(pc->distribution); } PBUILDER_ADD_PARAM("--no-targz"); PBUILDER_ADD_PARAM("--internal-chrootexec"); PBUILDER_ADD_PARAM(buf_chroot); PBUILDER_ADD_PARAM(NULL); ret=forkexecvp(pbuildercommandline); if (ret) { if (ret < 128) { fprintf(stderr, "pbuilder update failed\n"); if (!pc->no_cowdancer_update) { /* advise the user to try this option first */ fprintf(stderr, "E: could not update with cowdancer, try --no-cowdancer-update option\n"); } if (0!=rmrf(pc->buildplace)) { fprintf(stderr, "Could not remove original tree\n"); } } else printf("pbuilder update aborted, not cleaning\n"); /* either way, I don't want to touch the original tree */ goto out; } printf(" -> removing %s working copy\n", ilist_PRGNAME); cpbuilder_internal_saveupdate(pc); out: free(buf_chroot); return ret; } int cpbuilder_help(void) { printf("%s [operation] [options]\n" "operation:\n" " --build\n" " --create\n" " --update\n" " --login\n" " --execute\n" " --help\n" " --dumpconfig\n" "options:\n" " --basepath:\n" " --buildplace:\n" " --distribution:\n" " ... and other pbuilder options \n", ilist_PRGNAME ); return 0; } int app_main(int ac, char** av) { setenv("COWDANCER_REUSE","yes",1); return parse_parameter(ac, av, "cow"); } cowdancer-0.73/qemubuilder.c0000755000000000000000000005514112145703076012776 0ustar /*BINFMTC: parameter.c forkexec.c qemuipsanitize.c qemuarch.c file.c main.c * qemubuilder: pbuilder with qemu * Copyright (C) 2007-2009 Junichi Uekawa * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "parameter.h" #include "qemuipsanitize.h" #include "qemuarch.h" #include "file.h" /* * example exit codes: * * END OF WORK EXIT CODE=1 * END OF WORK EXIT CODE=0 * END OF WORK EXIT CODE=16 */ const char* qemu_keyword="END OF WORK EXIT CODE="; /** create a sparse ext3 block device suitable for loop-mount. This code takes approx 7 seconds to run, should be cached? @returns -1 on error, 0 on success */ static int create_ext3_block_device(const char* filename, unsigned long int gigabyte) { int ret = 0; char *s = NULL; char *s2 = NULL; /* create 10GB sparse data */ if (create_sparse_file(filename, gigabyte*1UL<<30UL)) { ret=-1; goto out; } if ((ret=forkexeclp("mke2fs", "mke2fs", "-q", "-F", "-j", "-m1", "-O", "sparse_super", filename, NULL))) { ret=-1; goto out; } if ((ret=forkexeclp("tune2fs", "tune2fs", "-c", "0", "-i", "0", filename, NULL))) { ret=-1; } out: if(s) free(s); if(s2) free(s2); return ret; } /** loopback mount file system. @returns 0 on success */ static int loop_mount(const char* device, const char* mountpoint) { int ret=forkexeclp("mount", "mount", "-o", "loop", device, mountpoint, NULL); return ret; } /** loopback umount file system @returns 0 on success */ static int loop_umount(const char* device) { int ret=forkexeclp("umount", "umount", device, NULL); return ret; } /** create a script file. @returns NULL on failure, FILE* on success */ static FILE* create_script(const char* mountpoint, const char* relative_path) { char *s = NULL; FILE *f = NULL; FILE *ret = NULL; asprintf(&s, "%s/%s", mountpoint, relative_path); if(!(f=fopen(s, "w"))) goto fail; if(chmod(s, 0700)) { fclose(f); goto fail; } ret=f; fail: free(s); return ret; } /* minimally fix terminal I/O */ static void fix_terminal(void) { struct termios t; if (isatty(1)) { tcgetattr(1, &t); t.c_lflag |= ECHO; tcsetattr(1, TCSANOW, &t); } } static int copy_file_contents_through_temp(FILE* f, const char* orig, const char* temppath, const char* targetdir) { char* tempname; int ret; char* file_basename = basename(orig); asprintf(&tempname, "%s/%s", temppath, file_basename); ret=copy_file(orig, tempname); if (ret == -1) { fprintf(f, "E: Copy file error in %s to %s\n", orig, tempname); } free(tempname); fprintf(f, "echo \"I: copying %s/%s from temporary location\"\n" "cp $PBUILDER_MOUNTPOINT/%s %s/%s || echo \"E: Copy failed\"\n", targetdir, file_basename, file_basename, targetdir, file_basename); return ret; } /** run qemu until exit signal is received from within QEMU via serial console. exit code: -1: error 0..X: return code from inside qemu */ static int fork_qemu(const char* hda, const char* hdb, const struct pbuilderconfig* pc) { pid_t child; int sp[2]; fd_set readfds; int exit_code=-1; const int buffer_size=4096; char* buf=malloc(buffer_size); size_t count; if (-1==socketpair(AF_UNIX, SOCK_STREAM,0,sp)) { /* error handle? */ return -1; } fflush(NULL); if ((child=fork())) { /* this is parent process */ close(sp[1]); close(0); FD_ZERO(&readfds); while (1) { FD_SET(sp[0],&readfds); if (-1!=(select(sp[0]+1,&readfds, NULL, NULL, NULL))) { if (FD_ISSET(sp[0],&readfds)) { void* matchptr; /* data available from qemu */ /* sleep a bit to let it buffer-up a bit more. */ usleep(100000); count=read(sp[0],buf,buffer_size); /* this won't work sometimes, but this is a good best-effort thing. */ if ((matchptr=memmem(buf, count, qemu_keyword, strlen(qemu_keyword)))!=0) { int status; exit_code = atoi(matchptr + strlen(qemu_keyword)); printf("\n -> received termination message from inside qemu with exit-code %i, killing child process (qemu:%i)\n", exit_code, child); assert(child != 0);assert(child > 0); if (!kill(child, SIGTERM)) printf(" -> successfully killed qemu\n"); else perror(" -> failed to kill qemu? :"); if (-1==waitpid(child, &status, 0)) { perror("qemubuilder: waitpid"); } break; } write(1,buf,count); } } else { perror("select"); break; } } } else if(child == 0) { /* this is the child process */ const char* qemu = qemu_arch_qemu(pc->arch); const char* machine = qemu_arch_qemumachine(pc->arch); char* hda_command; char* hdb_command; char* append_command; const char* kernel_image = pc->kernel_image; const char* initrd = pc->initrd; char* mem; int argc = 0; const int MAX_ARGS = 30; char *argv[MAX_ARGS]; int i; if (qemu == NULL || machine == NULL) { fprintf(stderr, "Your architecture %s does not seem to be supported\n", pc->arch); exit(1); } asprintf(&mem, "%i", pc->memory_megs); asprintf(&hda_command, "file=%s,index=0,media=disk,cache=writeback", strdupa(hda)); asprintf(&hdb_command, "file=%s,index=1,media=disk,cache=writeback", strdupa(hdb)); asprintf(&append_command, "root=/dev/%sa quiet init=/pbuilder-run console=%s", qemu_arch_diskdevice(pc), qemu_arch_tty(pc->arch)); dup2(sp[1],1); dup2(sp[1],2); close(sp[0]); argv[argc++]=strdupa(qemu); argv[argc++]="-nodefaults"; argv[argc++]="-nographic"; argv[argc++]="-M"; argv[argc++]=strdupa(machine); argv[argc++]="-m"; argv[argc++]=mem; if (pc->smp) { argv[argc++]="-smp"; argv[argc++]=strdupa(pc->smp); } argv[argc++]="-kernel"; argv[argc++]=strdupa(kernel_image); if (initrd && strcmp(initrd, "")) { argv[argc++]="-initrd"; argv[argc++]=strdupa(initrd); } argv[argc++]="-drive"; argv[argc++]=hda_command; argv[argc++]="-drive"; argv[argc++]=hdb_command; argv[argc++]="-append"; argv[argc++]=append_command; argv[argc++]="-serial"; argv[argc++]="stdio"; argv[argc++]="-net"; argv[argc++]="user"; argv[argc++]="-net"; argv[argc++]="nic"; argv[argc]=NULL; assert(argc < MAX_ARGS); printf(" forking qemu: "); for (i=0; ibuildplace,0777)) { /* could not create the buildplace here. */ perror("mkdir"); goto out; } do_fsck(pc->basepath); timestring=get_current_time_string(); asprintf(&workblockdevicepath, "%s.dev", pc->buildplace); ret=create_ext3_block_device(workblockdevicepath, 1); loop_mount(workblockdevicepath, pc->buildplace); f = create_script(pc->buildplace, "pbuilder-run"); fprintf(f, "#!/bin/bash\n" /* define function to terminate qemu */ "function exit_from_qemu() {\n" "sync\n" "sync\n" "sleep 1s\n" /* sleep before sending dying message */ "echo ' -> qemu-pbuilder %s$1'\n" "sleep 1s\n" "halt -f -p\n" /* just halt myself if possible */ "}\n", qemu_keyword); fprintf(f, /* main code */ "echo \n" "echo ' -> qemu-pbuilder second-stage' \n" //TODO: copy hook scripts //"mount -n /proc /proc -t proc\n" // this is done in first stage. "echo ' -> setting time to %s' \n" "date --set=\"%s\"\n" "echo ' -> configuring network' \n" "ifconfig -a\n" "export IFNAME=`/sbin/ifconfig -a | grep eth | head -n1 | awk '{print $1}'`\n" "dhclient $IFNAME\n" "mkdir -p /tmp/buildd\n" "$PBUILDER_MOUNTPOINT/run-copyfiles\n" "hostname pbuilder-$(cat /etc/hostname)\n" //TODO: run G hook "%s\n" //TODO: I can mount /var/cache/apt/archives from some scratch space to not need this: "apt-get clean || true\n" "exit_from_qemu 0\n", timestring, timestring, commandline); fclose(f); /* copy files script */ f = create_script(pc->buildplace, "run-copyfiles"); copy_file_contents_through_temp(f, "/etc/hosts", pc->buildplace, "/etc"); copy_file_contents_through_temp(f, "/etc/hostname", pc->buildplace, "/etc"); /* copy inputfile */ for (i=0; pc->inputfile[i]; ++i) { copy_file_contents_through_temp(f, pc->inputfile[i], pc->buildplace, "/tmp/buildd"); } fclose(f); /* do I not need to copy /etc/pbuilderrc, and ~/.pbuilderrc to inside chroot? */ /* TODO: hooks probably need copying here. */ /* TODO: recover aptcache */ if(hostcommand1) { printf("running host command: %s\n", hostcommand1); system(hostcommand1); } loop_umount(pc->buildplace); asprintf(&cowdevpath, "%s.cowdev", pc->buildplace); ret=forkexeclp("qemu-img", "qemu-img", "create", "-f", "qcow2", "-b", pc->basepath, cowdevpath, NULL); fork_qemu(cowdevpath, workblockdevicepath, pc); /* this will always return 0. */ /* commit the change here */ if (save_result) { printf(" -> commit change to qemu image\n"); ret=forkexeclp("qemu-img", "qemu-img", "commit", cowdevpath, NULL); } /* after-run */ loop_mount(workblockdevicepath, pc->buildplace); printf(" -> running post-run process\n"); if(hostcommand2) { printf("running host command: %s\n", hostcommand2); system(hostcommand2); } loop_umount(pc->buildplace); rmdir(pc->buildplace); printf(" -> clean up COW device files\n"); unlink(workblockdevicepath); unlink(cowdevpath); ret=0; out: if(workblockdevicepath) free(workblockdevicepath); if(cowdevpath) free(cowdevpath); if(script) free(script); return ret; } /* @return shell command to copy the dsc file. */ static char* copy_dscfile(const char* dscfile_, const char* destdir) { int ret=1; size_t bufsiz=0; char* buf=NULL; char* filename=NULL; char* origdir=NULL; char* dscfile=canonicalize_file_name(dscfile_); FILE* f=fopen(dscfile,"r"); char* memstr=0; size_t len=0; FILE* fmem=open_memstream(&memstr, &len); int filelist=0; origdir=strdup(dscfile); assert(strrchr(origdir,'/') != 0); (*(strrchr(origdir,'/')))=0; fprintf(fmem, "cp %s %s/\n", dscfile, destdir); while (getline(&buf,&bufsiz,f)>0) { if (strrchr(buf,'\n')) { *(strrchr(buf,'\n'))=0; } if(filelist) { if(sscanf(buf, " %*s %*s %ms", &filename)!=1) filelist=0; else { fprintf(fmem, "cp %s/%s %s/\n", origdir, filename, destdir); assert(filename); free(filename); } } if (!(buf[0]==' ')&& !strcmp(buf,"Files: ")) { filelist=1; } } ret=0; assert(fmem); assert(f); fclose(fmem); fclose(f); if(buf) free(buf); if(origdir) free(origdir); if(dscfile) free(dscfile); return ret?NULL:memstr; } /* return 0 on success, nonzero on failure. variable ret holds the state. */ int cpbuilder_create(const struct pbuilderconfig* pc) { int ret=0; char* s=NULL; /* generic asprintf buffer */ char* workblockdevicepath=NULL; FILE* f; /* generic FILE pointer which is reused. */ char* t; char* timestring; /* remove existing file; it can be old qemu image, or a directory if it didn't exist before. */ unlink(pc->basepath); rmdir(pc->basepath); /* 3GB should be enough to install any Debian system; hopefully */ ret=create_ext3_block_device(pc->basepath, 3); if (ret) { goto out; } if (mkdir(pc->buildplace,0777)) { /* could not create the buildplace here. */ ret=1; perror("mkdir"); goto out; } ret=loop_mount(pc->basepath, pc->buildplace); if (ret) { goto out; } printf(" -> Invoking debootstrap\n"); ret=forkexeclp("debootstrap", "debootstrap", "--arch", pc->arch, "--foreign", pc->distribution, pc->buildplace, pc->mirror, NULL); if (ret) { fprintf(stderr, "debootstrap failed with %i\n", ret); goto umount_out; } /* arch-dependent code here. create required device files. ttyAMA0 is probably ARM-specific others are probably linux-portable as documented in linux/Documentation/devices.txt other OSes will require different, but hey, they probably don't even boot from ext3, we'll need think of other ways to work with them. */ printf(" -> Doing architecture-specific /dev population\n"); qemu_create_arch_devices(pc->buildplace, pc->arch); f = create_script(pc->buildplace, "pbuilder-run"); fprintf(f, "#!/bin/bash\n" "echo \n" "echo ' -> qemu-pbuilder first-stage' \n" "export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'\n" "mount -n /proc /proc -t proc\n" "mount -n -o rw,remount /\n" "cp /proc/mounts /etc/mtab\n" "export PBUILDER_MOUNTPOINT=/var/cache/pbuilder/pbuilder-mnt\n" "mkdir -p $PBUILDER_MOUNTPOINT\n" "mount -n -t ext3 /dev/%sb $PBUILDER_MOUNTPOINT \n" "$PBUILDER_MOUNTPOINT/pbuilder-run \n", qemu_arch_diskdevice(pc) ); fclose(f); f = NULL; if (pc->http_proxy != NULL) { f = create_script(pc->buildplace, "etc/apt/apt.conf.d/20pbuilder-proxy"); fprintf(f, "Acquire\n" "{\n" "http \n" "{\n" "Proxy \"%s\";\n" "};\n" "};\n", pc->http_proxy ); fclose(f); f = NULL; } free(s); s=0; ret=loop_umount(pc->buildplace); /* create the temporary device for command-execution */ asprintf(&workblockdevicepath, "%s.dev", pc->buildplace); ret=create_ext3_block_device(workblockdevicepath, 1); loop_mount(workblockdevicepath, pc->buildplace); timestring=get_current_time_string(); f = create_script(pc->buildplace, "pbuilder-run"); fprintf(f, "#!/bin/bash\n" /* define function to terminate qemu */ "function exit_from_qemu() {\n" "%s\n" "sync\n" "sync\n" "sleep 1s\n" /* sleep before sending dying message */ "echo ' -> qemu-pbuilder %s$1'\n" "sleep 1s\n" "halt -f -p\n" /* just halt myself if possible */ "}\n", pc->debug?"echo \"Debug shell\"; /bin/bash":"", qemu_keyword); fprintf(f, /* start of main code */ "export RET=0\n" "echo \n" "echo ' -> qemu-pbuilder second-stage' \n" "echo ' -> setting time to %s' \n" "date --set=\"%s\"\n" "echo ' -> Running debootstrap second-stage script' \n" "touch /etc/udev/disabled\n" // work-around for #520742 "/debootstrap/debootstrap --second-stage || ( " " echo dumping debootstrap log\n" " cat /debootstrap/debootstrap.log\n" " exit_from_qemu\n" "\n )\n" "rm /etc/udev/disabled\n" // work-around for #520742 "echo deb %s %s %s > /etc/apt/sources.list \n" "echo 'APT::Install-Recommends \"false\"; ' > /etc/apt/apt.conf.d/15pbuilder\n" //TODO: copy hook scripts "mount -n proc /proc -t proc\n" "mount -n sysfs /sys -t sysfs\n" "mkdir /dev/pts\n" "mount -n devpts /dev/pts -t devpts\n" "dhclient eth0\n" "$PBUILDER_MOUNTPOINT/run-copyfiles\n" "hostname pbuilder-$(cat /etc/hostname)\n" //TODO: installaptlines "echo '%s' > /etc/apt/sources.list.d/other.list\n" //TODO: run G hook "apt-get update || exit_from_qemu 1\n" //TODO: "dpkg --purge $REMOVEPACKAGES\n" //recover aptcache "apt-get -y --force-yes -o DPkg::Options::=--force-confnew dist-upgrade || exit_from_qemu 1\n" "apt-get install --force-yes -y build-essential dpkg-dev apt aptitude pbuilder || exit_from_qemu 1\n" //TODO: EXTRAPACKAGES handling //save aptcache //optionally autoclean aptcache //run E hook //TODO: I can mount /var/cache/apt/archives from some scratch space to not need this: "apt-get clean || true\n" "exit_from_qemu $RET\n" "bash\n", timestring, timestring, t=sanitize_mirror(pc->mirror), pc->distribution, pc->components, pc->othermirror?pc->othermirror:""); fclose(f); f = NULL; free(t); /* TODO: can I do 'date --set' from output of 'LC_ALL=C date' */ /* copy files script */ f = create_script(pc->buildplace, "run-copyfiles"); copy_file_contents_through_temp(f, "/etc/hosts", pc->buildplace, "/etc"); copy_file_contents_through_temp(f, "/etc/hostname", pc->buildplace, "/etc"); fclose(f); /* do I not need to copy /etc/pbuilderrc, and ~/.pbuilderrc to inside chroot? */ /* TODO: hooks probably need copying here. */ /* TODO: recover aptcache */ loop_umount(pc->buildplace); rmdir(pc->buildplace); // this will have wrong time. how to workaround? ret=fork_qemu(pc->basepath, workblockdevicepath, pc); unlink(workblockdevicepath); out: if(workblockdevicepath) { free(workblockdevicepath); } if(s) free(s); return ret; umount_out: loop_umount(pc->buildplace); if(s) free(s); return ret; } /* * @return: return code of pbuilder, or <0 on failure */ int cpbuilder_build(const struct pbuilderconfig* pc, const char* dscfile) { int ret; char* hoststr=NULL; char* hoststr2=NULL; char* commandline=NULL; const char* buildopt=NULL; const char* debbuildopts=NULL; char* debbuildopts_work=NULL; if (pc->binary_arch) { asprintf(&debbuildopts_work, "%s -B", pc->debbuildopts); debbuildopts=debbuildopts_work; buildopt="--binary-arch"; } else { debbuildopts=pc->debbuildopts; buildopt="--binary-all"; } hoststr=copy_dscfile(dscfile, pc->buildplace); asprintf(&commandline, /* TODO: executehooks D: */ "/usr/lib/pbuilder/pbuilder-satisfydepends --control $PBUILDER_MOUNTPOINT/*.dsc --internal-chrootexec 'chroot . ' %s \n" "cd $PBUILDER_MOUNTPOINT; /usr/bin/dpkg-source -x $(basename %s) \n" "echo ' -> Building the package'\n" /* TODO: executehooks A: */ "cd $PBUILDER_MOUNTPOINT/*-*/; dpkg-buildpackage -us -uc %s\n", buildopt, dscfile, debbuildopts); /* Obscure assumption!: assume _ is significant for package name and no other file will have _. */ asprintf(&hoststr2, "cp -p \"%s\"/*_* \"%s\" 2>/dev/null || true", pc->buildplace, pc->buildresult); ret=run_second_stage_script (0, commandline, pc, hoststr, hoststr2); if(debbuildopts_work) free(debbuildopts_work); if(hoststr2) free(hoststr2); if(hoststr) free(hoststr); if(commandline) free(commandline); return ret; } int cpbuilder_login(const struct pbuilderconfig* pc) { return run_second_stage_script(pc->save_after_login, "bash", pc, NULL, NULL); } /* Mostly a copy of pbuilder login, executes a script. */ int cpbuilder_execute(const struct pbuilderconfig* pc, char** av) { char* hostcommand; char* runcommandline; int ret; asprintf(&hostcommand, "cp %s %s/runscript\n", av[0], pc->buildplace); /* TODO: add options too */ asprintf(&runcommandline, "sh $PBUILDER_MOUNTPOINT/runscript"); ret=run_second_stage_script(pc->save_after_login, runcommandline, pc, hostcommand, NULL); free(hostcommand); free(runcommandline); return ret; } /** implement pbuilder update @return 0 on success, other values on failure. */ int cpbuilder_update(const struct pbuilderconfig* pc) { /* TODO: --override-config support, --othermirror support etc. There is no way to change distribution in this code-path... */ return run_second_stage_script (1, //TODO: installaptlines if required. //TODO: "dpkg --purge $REMOVEPACKAGES\n" //TODO: add error code handling. "apt-get update -o Acquire::PDiffs=false\n" "apt-get -y --force-yes -o DPkg::Options::=--force-confnew dist-upgrade\n" "apt-get install --force-yes -y build-essential dpkg-dev apt aptitude pbuilder\n" //TODO: EXTRAPACKAGES handling //optionally autoclean aptcache //run E hook , pc, NULL, NULL); } int cpbuilder_help(void) { printf("qemubuilder [operation] [options]\n" "operation:\n" " --build\n" " --create\n" " --update\n" " --login\n" " --execute\n" " --help\n" " --dumpconfig\n" "options:\n" " --basepath:\n" " --buildplace:\n" " --distribution:\n" " ... and other pbuilder options \n" ); return 0; } int app_main(int ac, char** av) { return parse_parameter(ac, av, "qemu"); } cowdancer-0.73/test_qemuarch.c0000755000000000000000000000266011234604470013316 0ustar /*BINFMTC: qemuarch.c file.c * test qemubuilder code */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include "qemuarch.h" int test_get_host_dpkg_arch() { /* just try to test x86_64 case */ #if defined(__x86_64__) assert (!strcmp(get_host_dpkg_arch(), "amd64")); #elif defined(__i386__) assert ((!strcmp(get_host_dpkg_arch(), "i386")) || (!strcmp(get_host_dpkg_arch(), "lpia"))); #else printf("W: no check for this architecture\n"); #endif return 0; } int test_qemu_create_arch_devices() { char* temp=strdupa("/tmp/dancerXXXXXX"); temp=mkdtemp(temp); printf("%s\n", temp); /* if you are running this in normal user, or running through fakeroot, you would (probably) get this */ if (getuid()!=0 || (getenv("FAKEROOTKEY") && strcmp(getenv("FAKEROOTKEY"),""))) { assert(qemu_create_arch_devices(temp, "x86_64") < 0); } else { /* if you are running this as root, this would be the tested codepath. */ struct stat s; umask(S_IWOTH); assert(qemu_create_arch_devices(temp, "x86_64") == 0); chdir(temp); assert(stat("./dev/ttyAMA0", &s)==0); assert(S_ISCHR(s.st_mode)); } return 0; } int main() { int val=0; val+=test_get_host_dpkg_arch(); val+=test_qemu_create_arch_devices(); return val; } cowdancer-0.73/forkexec.c0000644000000000000000000000640712124722164012260 0ustar /*BINFMTC: * fork/exec helper for pbuilder. * Copyright (C) 2007-2009 Junichi Uekawa * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #define _GNU_SOURCE #include #include #include #include #include #include "parameter.h" /* execvp that does fork. @return < 0 for failure, exit code for other cases. */ int forkexecvp (char *const argv[]) { int ret; pid_t pid; int status; /* DEBUG: */ { int i=0; printf(" forking: "); while(argv[i]) { printf("%s ", argv[i]); i++; } printf("\n"); } fflush(NULL); switch(pid=fork()) { case 0: execvp(argv[0], (char*const*)argv); perror("execvp"); fprintf(stderr, "Could not execute %s\n", argv[0]); exit(EXIT_FAILURE); case -1: /* error condition in fork(); something is really wrong */ perror("fork"); return -1; default: /* parent process, waiting for termination */ if (-1==waitpid(pid, &status, 0)) { perror("waitpid"); fprintf(stderr, "unexpected waitpid error when waiting for process %i with status %x\n", pid, status); return -1; } if (!WIFEXITED(status)) { /* something unexpected */ return -1; } ret = WEXITSTATUS(status); } return ret; } /* execlp that does fork. NULL-terminated list of parameters. cf. execl from FreeBSD sources, and glibc posix/execl.c, and cygwin exec.cc @return < 0 for failure, exit code for other cases. */ int forkexeclp (const char *path, const char *arg0, ...) { int i, ret; va_list args; const char *argv[1024]; pid_t pid; int status; va_start(args, arg0); argv[0] = arg0; i = 1; printf(" forking: %s ", argv[0]);/* debug message */ do { argv[i] = va_arg(args, const char *); if (argv[i]) printf("%s ", argv[i]); /* debug message */ if ( i >= 1023 ) { return -1; } } while (argv[i++] != NULL); va_end (args); printf("\n"); /* debug message */ fflush(NULL); switch(pid=fork()) { case 0: execvp(path, (char*const*)argv); perror("pbuilder: execlp"); fprintf(stderr, "Could not execute %s\n", path); exit(EXIT_FAILURE); case -1: /* error condition in fork(); something is really wrong */ perror("pbuilder: fork"); return -1; default: /* parent process, waiting for termination */ if (-1==waitpid(pid, &status, 0)) { perror("waitpid"); return -1; } if (!WIFEXITED(status)) { /* something unexpected */ return -1; } ret = WEXITSTATUS(status); } return ret; } cowdancer-0.73/debuild.sh0000755000000000000000000000012211220436222012232 0ustar # run debuild with .git ignore. debuild -us -uc -I.git git push --tags git push cowdancer-0.73/test_cowbuilder_util.c0000755000000000000000000000436112173440310014677 0ustar /*BINFMTC: cowbuilder_util.c */ #include "cowbuilder_util.h" #include #include #include void test_check_mountpoint() { // something is usually mounted under /. if(0 == check_mountpoint("/")) { fprintf(stderr, "*******************************************************************************\n" "* '/' is not mounted, something is wrong with the system or the code\n" "*******************************************************************************\n"); } // something is usually mounted under /run, but can't be sure. // assert(1 == check_mountpoint("/run")); // commented out so that I don't break automatic builds. // usually nothing is mounted under /tmp/nothing-is-mounted fprintf(stderr, "The following message is expected:\n"); assert(0 == check_mountpoint("/tmp/nothing-is-mounted")); } /** * make sure strings are equal, and return true when they are. Just to * save myself from strcmp being a macro. */ int verify_string_equal(const char* a, const char* b) { return !strcmp(a, b); } void test_canonicalize_doubleslash() { char dest[256]; canonicalize_doubleslash("/no/double/slash", dest); assert(verify_string_equal(dest, "/no/double/slash")); canonicalize_doubleslash("/trailing/slash/", dest); assert(verify_string_equal(dest, "/trailing/slash/")); canonicalize_doubleslash("//starting/double/slash/", dest); assert(verify_string_equal(dest, "/starting/double/slash/")); canonicalize_doubleslash("/double//slash", dest); assert(verify_string_equal(dest, "/double/slash")); canonicalize_doubleslash("/more//double//slash", dest); assert(verify_string_equal(dest, "/more/double/slash")); canonicalize_doubleslash("no/starting/slash//", dest); assert(verify_string_equal(dest, "no/starting/slash/")); canonicalize_doubleslash("///", dest); assert(verify_string_equal(dest, "/")); const char* test_buffer_overrun = "/some/string"; strcpy(dest, "-some-string+g"); canonicalize_doubleslash(test_buffer_overrun, dest); assert(verify_string_equal(dest, "/some/string")); assert(strlen(dest) == 12); assert(dest[12] == 0); assert(dest[13] == 'g'); } int main() { test_check_mountpoint(); test_canonicalize_doubleslash(); return 0; } cowdancer-0.73/qemuipsanitize.h0000644000000000000000000000043011220436222013505 0ustar /* QEMU local-IP-address fixer. Qemu guest OSs will think 127.0.0.1 is itself, and not the host OS. Fix that! */ #ifndef __QEMUIPSANITIZE_H__ #define __QEMUIPSANITIZE_H__ const char* sanitize_ipaddress(const char*addr); char* sanitize_mirror(const char*addr); #endif cowdancer-0.73/qemuipsanitize.c0000644000000000000000000000257111220436222013510 0ustar /*** IP address sanitization for qemu. */ #define _GNU_SOURCE #include #include #include #include #include #include "qemuipsanitize.h" const char* sanitize_ipaddress(const char*addr) { /* return 10.0.2.2 (qemu host OS address) if localhost */ const char* local_host="10.0.2.2"; struct hostent* h; h=gethostbyname(addr); if(h) { if (h->h_addr[0]==127) { return local_host; } } return addr; } static char* r_offstr(regmatch_t m, const char*s) { char*r; if(m.rm_so!=-1) { r=strdup(s+m.rm_so); r[m.rm_eo-m.rm_so]=0; return r; } else return strdup(""); } char* sanitize_mirror(const char*addr) { /* parse IP address string */ regex_t r; int e; regmatch_t m[5]; char*buf=NULL; char* a; char* b; char* c; char* d; if((e=regcomp(&r, "^([^:]*://)([^:/]*)(:[0-9]+)?(.*)$", REG_EXTENDED))) { /* error */ fprintf(stderr, "failed compiling regexp: %i\n", e); return strdup(addr); } if((e=regexec(&r, addr, 5, m, 0))) { fprintf(stderr, "failed regexp match: %i\n", e); return strdup(addr); } asprintf(&buf,"%s%s%s%s", a=r_offstr(m[1],addr), sanitize_ipaddress(b=r_offstr(m[2],addr)), c=r_offstr(m[3],addr), d=r_offstr(m[4],addr)); free(a); free(b); free(c); free(d); regfree(&r); return buf; } cowdancer-0.73/cowbuilder.80000644000000000000000000001132611243245676012543 0ustar .TH "cowbuilder" 8 "2007 Jun 17" "cowdancer" "cowdancer" .SH "NAME" cowbuilder \- a pbuilder wrapper for cowdancer. .SH SYNOPSIS .BI "cowbuilder [" "commands" "] [" "options" "]" .SH DESCRIPTION .B cowbuilder Executes the specified pbuilder operation with .B cowdancer .SH "COMMANDS" Most commands invoke pbuilder with the specified commands, see pbuilder manual for details. .TP .B "\-\-create" Create the base.cow image. The directory for base.cow should be empty, or this command will fail. .TP .B "\-\-update" Update the base.cow image. .TP .BI "\-\-build " ".dsc-file" Build a package given a .dsc file .TP .B "\-\-login" Start a session within the base.cow. .TP .B "\-\-execute" Execute a command within the base.cow. .TP .B "--dumpconfig" dump configuration information. .SH "OPTIONS" Most options are the same as pbuilder, except for the following which are handled specially .TP .B "\-\-buildplace" The place where COW operation takes place. .TP .B "\-\-basepath" has a very different meaning to .B basetgz option of pbuilder, since there is no tgz. This option specifies the directory in which the COW master data is stored, the default being .B "/var/cache/pbuilder/base.cow" .TP .BI "\-\-configfile [" "configuration file to load" "]" Additional configuration file to read after all other configuration files have been read. .TP .BI "\-\-no\-cowdancer\-update" Do not use cowdancer on cowbuilder --update. Please use this option when cowdancer is interfering with upgrade process, or cowdancer itself is being upgraded within chroot. .TP .BI "\-\-debian\-etch\-workaround" Work around on Debian etch compatibility. cow-shell will search for all files in chroot, but will work. .SH "CONFIGURATION FILES" cowbuilder reads the following configuration files per default. .TP .B "/usr/share/pbuilder/pbuilderrc" Application default, not to be changed. .TP .B "/etc/pbuilderrc" System-wide default. .TP .B "~/.pbuilderrc" User default .TP .I "anything specified with \-\-configfile option" Additional configuration at runtime. .SH "CONFIGURATION FILE OPTIONS" The possible configuration options are as follows. Others are ignored. .TP .BI "DISTRIBUTION=" "distribution" .TP .BI "BUILDRESULT=" "directory" .TP .BI "BUILDPLACE=" "directory" .TP .BI "BASEPATH=" "path" .TP .BI "MIRRORSITE=" "http://mirror" .TP .BI "NO_COWDANCER_UPDATE=" "1" See .B "--no-cowdancer-update" .TP .BI "DEBIAN_ETCH_WORKAROUND=" "1" See .B "--debian-etch-workaround" .SH "EXAMPLES" .TP .B "cowbuilder --create" Create a base.cow image. .nf # cowbuilder --create --hookdir /usr/share/doc/pbuilder/examples/workaround/ --distribution etch --debootstrap debootstrap --basepath /var/cache/pbuilder/base-test.cow bash: /root/.pbuilderrc: No such file or directory W: /home/dancer/.pbuilderrc does not exist -> Running in no-targz mode Distribution is etch. Building the build environment -> running debootstrap /usr/sbin/debootstrap I: Retrieving Release . . .hy .TP .B "cowbuilder --update" Update the base.cow image. .nf # cowbuilder --update bash: /root/.pbuilderrc: No such file or directory -> Copying COW directory -> Invoking pbuilder W: /home/dancer/.pbuilderrc does not exist -> Running in no-targz mode -> copying local configuration -> mounting /proc filesystem -> mounting /dev/pts filesystem -> policy-rc.d already exists Refreshing the base.tgz -> upgrading packages . . .hy .TP .B "cowbuilder --build test_0.1.dsc" Build the package specified in dsc file, with the base.cow image. .TP .B "pdebuild --pbuilder cowbuilder" Run .B "cowbuilder --build" against the current directory. The current directory should be an extracted Debian source package directory. Edit .B "/etc/pbuilderrc" to have .B "PDEBUILD_PBUILDER=cowbuilder" to make this the default behavior for .B pdebuild. .TP .B "cowbuilder --login --bindmounts /home/dancer" Start a cow-shell session inside base.cow, with .I "/home/dancer" being bind-mounted to within chroot. Note that cowbuilder will not cow-protect what is inside .B /home/ .nf # cowbuilder --login --bindmount ${HOME} bash: /root/.pbuilderrc: No such file or directory -> Copying COW directory -> Invoking pbuilder W: /home/dancer/.pbuilderrc does not exist -> Running in no-targz mode -> copying local configuration -> mounting /proc filesystem -> mounting /dev/pts filesystem -> Mounting /home/dancer -> policy-rc.d already exists -> entering the shell # .hy .TP .B "cowbuilder --create --distribution sid --basepath /var/cache/pbuilder/base-test.cow" Create a base.cow image with the path .B "/var/cache/pbuilder/base-test.cow" and distribution sid. .SH "AUTHOR" Junichi Uekawa (dancer@debian.org) .SH "SEE ALSO" .BR "/usr/share/doc/pbuilder/pbuilder-doc.html, " .BR "pbuilder (" 8 "), " .BR "pdebuild (" 1 ") " cowdancer-0.73/cow-shell.c0000755000000000000000000000513712125143443012347 0ustar /*BINFMTC: -DLIBDIR='"/usr/lib"' ilistcreate.c Copy-on-write filesystem invocation. GPL v2 or later Copyright 2005-2009 Junichi Uekawa. */ #define _GNU_SOURCE #include #include #include #include #include #include #include #include #include "ilist.h" const char* ilist_PRGNAME="cow-shell"; static const char* ilistpath="./.ilist"; /* * remove ilist after use. */ static void ilist_deleter(const char* ilistfile) { if(fork()==0) { /* I am the child process */ pid_t parent_pid=getppid(); if (daemon(0,1) < 0) { perror("cow-shell daemon"); exit (-1); } while (kill(parent_pid,0) >= 0) { sleep(1); } if (unlink(ilistfile)==-1) { perror("cow-shell unlink .ilist"); exit(1); } exit(0); } } /** * Set environment variables. */ static void set_env_vars() { char* buf; // For sending down as environment variable, use a canonicalized version. char* canonicalized_ilistpath=canonicalize_file_name(ilistpath); setenv("COWDANCER_ILISTFILE", canonicalized_ilistpath,1); unsetenv("COWDANCER_IGNORE"); free(canonicalized_ilistpath); asprintf(&buf, "%s%s%s", getenv("LD_PRELOAD")?:"", getenv("LD_PRELOAD")?" ":"", getenv("COWDANCER_SO") ?: LIBDIR "/cowdancer/libcowdancer.so"); setenv("LD_PRELOAD", buf, 1); free(buf); } /* give me a command-line to exec, and I will cow-keep what's under this directory. */ int main(int ac, char** av) { struct stat st; int cowdancer_reuse; cowdancer_reuse=getenv("COWDANCER_REUSE") && !strcmp(getenv("COWDANCER_REUSE"),"yes") ; if (cowdancer_reuse && !stat(ilistpath, &st)) { /* if reuse flag is on and file already exists do nothing */ } else { if (unlink(ilistpath)==-1) { if (errno == ENOENT) { /* expected */ } else { perror("cow-shell: unlink of .ilist failed"); return 1; } } if(ilistcreate(ilistpath, NULL)) { ilist_outofmemory(".ilist creation failed"); return 1; } } set_env_vars(); if (!cowdancer_reuse) { /* if reuse flag is not on, remove the file */ ilist_deleter(ilistpath); } if (ac>1) execvp(av[1], av+1); else { const char* myshell=getenv("SHELL")?:"/bin/sh"; fprintf(stderr, "Invoking %s\n", myshell); execlp(myshell, myshell, NULL); perror("cow-shell: exec"); fprintf(stderr, "Falling back to /bin/sh\n"); execlp("/bin/sh", "/bin/sh", NULL); } perror("cow-shell: exec"); return 1; } cowdancer-0.73/test_parameter.c0000755000000000000000000000223412126404663013471 0ustar /*BINFMTC: parameter.c */ #include #include #include #include "parameter.h" /* Mock functions */ int cpbuilder_build(const struct pbuilderconfig* pc, const char* dscfile) { return 0; } int cpbuilder_login(const struct pbuilderconfig* pc) { return 0; } int cpbuilder_execute(const struct pbuilderconfig* pc, char** av) { return 0; } int cpbuilder_update(const struct pbuilderconfig* pc) { return 0; } int cpbuilder_help(void) { return 0; } int cpbuilder_create(const struct pbuilderconfig* pc) { return 0; } /* end of mock functions */ /* Test size of Null Terminated String Array handling. */ void test_size_of_ntarray() { char* test[32]; test[0]="test1"; test[1]="test2"; test[2]=NULL; assert(size_of_ntarray(test)==2); } /* Test handling of quoted parameter string. */ void test_load_quoted_config() { pbuilderconfig pc; assert(0 == load_config_file("tests/102_test_cowbuilder_debbuildopts.config", &pc)); assert(!strcmp("-j2 -I", pc.debbuildopts)); assert(!strcmp("/boot/vmlinuz-x.y.z", pc.kernel_image)); } int main() { test_size_of_ntarray(); test_load_quoted_config(); return 0; } cowdancer-0.73/initrd/0000755000000000000000000000000012140646667011603 5ustar cowdancer-0.73/initrd/qemuinit.c0000644000000000000000000001104011304446061013561 0ustar /** qemuinit; init for quick boot inside qemu. Copyright 2009 Junichi Uekawa This init is dedicated for qemubuilder use, with goal of having a very fast boot time by only initializing the essential modules required for qemubuilder operation. */ #include #include #include #include #include #include #include #include #include #include #include "../parameter.h" #include "../file.h" #define PBUILDER_MOUNTPOINT "/var/cache/pbuilder/pbuilder-mnt" #define ROOT_MOUNTPOINT "/root" /* global variable to hold /proc/cmdline */ char* proc_cmdline = NULL; void read_proc_cmdline() { int fd = open("/proc/cmdline", O_RDONLY); char buf[BUFSIZ]; int len=read(fd, buf, sizeof(buf)-1); buf[len]=0; /* make sure it's NULL-terminated */ proc_cmdline=strdup(buf); close(fd); } /* parse the command-line option, and return a pointer to space-delimited option string */ const char* parse_option(const char* option) { const char* s = proc_cmdline; do { if (!strncmp(option, s, strlen(option)) && s[strlen(option)] == '=') return s; } while((s=strchr(s, ' '))); return NULL; } /* Return a strdup string, optionally NULL-terminating if it's space-delimited. */ char* strdup_spacedelimit(const char* str) { char* s = strdup(str); char* space = strchr(str, ' '); if (space) *space = 0; return s; } /* insert module and display error message when insmod returns an error. */ int insmod(const char* module) { int ret=forkexeclp("/bin/insmod", "/bin/insmod", module, NULL); if (ret) { fprintf(stderr, "W: insmod of %s returned %i\n", module, ret); } return ret; } int main(int argc, char** argv) { printf(" -> qemu-pbuilder first-stage(initrd version)\n"); umask(S_IWGRP | S_IWOTH); chdir("/"); setenv("PATH", "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", 1); setenv("PBUILDER_MOUNTPOINT", PBUILDER_MOUNTPOINT, 1); mkdir("/root", 0777); /* mountpoint */ mkdir("/proc", 0777); mkdir("/dev", 0777); mkdir("/dev/pts", 0777); if (mount("/proc", "/proc", "proc", MS_MGC_VAL, NULL) == -1) { perror("mount proc"); } if (mount("/dev/pts", "/dev/pts", "devpts", MS_MGC_VAL, NULL) == -1) { perror("mount devpts"); } read_proc_cmdline(); /* ext3 driver */ insmod("lib/modules/linux-live/kernel/drivers/ide/ide-core.ko"); insmod("lib/modules/linux-live/kernel/drivers/ide/ide-disk.ko"); insmod("lib/modules/linux-live/kernel/drivers/ide/ide-generic.ko"); insmod("lib/modules/linux-live/kernel/fs/mbcache.ko"); insmod("lib/modules/linux-live/kernel/fs/jbd/jbd.ko"); insmod("lib/modules/linux-live/kernel/fs/ext2/ext2.ko"); insmod("lib/modules/linux-live/kernel/fs/ext3/ext3.ko"); sleep(1); /* ne2k driver */ insmod("lib/modules/linux-live/kernel/drivers/net/8390.ko"); insmod("lib/modules/linux-live/kernel/drivers/net/ne2k-pci.ko"); /* ARM would need different driver... smc */ if (copy_file("/proc/mounts", "/etc/mtab")) { fprintf(stderr, "Cannot copy file /proc/mounts to /etc/mtab.\n"); } mknod_inside_chroot("", "dev/sda", S_IFBLK | 0660, makedev(8, 0)); mknod_inside_chroot("", "dev/sdb", S_IFBLK | 0660, makedev(8, 16)); mknod_inside_chroot("", "dev/hda", S_IFBLK | 0660, makedev(3, 0)); mknod_inside_chroot("", "dev/hdb", S_IFBLK | 0660, makedev(3, 64)); if (mount("/dev/sda", ROOT_MOUNTPOINT, "ext3", MS_MGC_VAL, NULL) == -1) { perror("mount root device try sda"); if (mount("/dev/hda", ROOT_MOUNTPOINT, "ext3", MS_MGC_VAL, NULL) == -1) { perror("mount root device try hda"); } } if (mount("/dev/sdb", ROOT_MOUNTPOINT PBUILDER_MOUNTPOINT, "ext3", MS_MGC_VAL, NULL) == -1) { perror("mount command device try sdb"); if (mount("/dev/hdb", ROOT_MOUNTPOINT PBUILDER_MOUNTPOINT, "ext3", MS_MGC_VAL, NULL) == -1) { perror("mount command device try hdb"); } } /* debug shell to see what's there. */ printf("command-line inside initrd, exit to continue\n"); forkexeclp("/bin/sh", "/bin/sh", NULL); if (chroot("root/")) { perror("chroot"); } if (chdir("/")) { perror("chdir"); } forkexeclp("bin/sh", "bin/sh", PBUILDER_MOUNTPOINT "/pbuilder-run", NULL); /* debug shell inside chroot. */ printf("command-line inside chroot, exit to continue\n"); forkexeclp("bin/sh", "bin/sh", NULL); /* turn the machine off */ sync(); sync(); reboot(RB_POWER_OFF); return 0; } cowdancer-0.73/initrd/Makefile0000644000000000000000000000502111220436222013217 0ustar KLCC=klcc all: qemuinit-static qemuinit-static-klibc initrd.gz %-static: %.o ../forkexec.o ../file.o $(CC) -static -O2 -Wall -o $@ $^ %.o: %.c $(CC) -c -O2 -Wall -o $@ $^ %-static-klibc: %.c ../forkexec.c ../file.c $(KLCC) -Wall -o $@ $^ initrd.gz: qemuinit-static-klibc Makefile -mkdir .initrd -mkdir .initrd/bin -mkdir .initrd/lib -mkdir .initrd/etc -mkdir -p .initrd/lib/modules/linux-live/kernel/drivers/ide/ -mkdir -p .initrd/lib/modules/linux-live/kernel/drivers/net/ -mkdir -p .initrd/lib/modules/linux-live/kernel/fs/ext2 -mkdir -p .initrd/lib/modules/linux-live/kernel/fs/ext3 -mkdir -p .initrd/lib/modules/linux-live/kernel/fs/jbd -ln -sf ../qemuinit-static-klibc .initrd/init -ln -sf /usr/lib/klibc/bin/insmod .initrd/bin/insmod -ln -sf /usr/lib/klibc/bin/sh.shared .initrd/bin/sh -ln -sf /lib/klibc*.so .initrd/lib/ -ln -sf /lib/klibc*.so .initrd/lib/ -ln -sf /lib/modules/$(shell uname -r)/kernel/drivers/ide/ide-core.ko .initrd/lib/modules/linux-live/kernel/drivers/ide/ -ln -sf /lib/modules/$(shell uname -r)/kernel/drivers/ide/ide-disk.ko .initrd/lib/modules/linux-live/kernel/drivers/ide/ -ln -sf /lib/modules/$(shell uname -r)/kernel/drivers/ide/ide-generic.ko .initrd/lib/modules/linux-live/kernel/drivers/ide/ -ln -sf /lib/modules/$(shell uname -r)/kernel/drivers/net/8390.ko .initrd/lib/modules/linux-live/kernel/drivers/net/ -ln -sf /lib/modules/$(shell uname -r)/kernel/drivers/net/ne2k-pci.ko .initrd/lib/modules/linux-live/kernel/drivers/net/ -ln -sf /lib/modules/$(shell uname -r)/kernel/fs/jbd/jbd.ko .initrd/lib/modules/linux-live/kernel/fs/jbd/ -ln -sf /lib/modules/$(shell uname -r)/kernel/fs/mbcache.ko .initrd/lib/modules/linux-live/kernel/fs/ -ln -sf /lib/modules/$(shell uname -r)/kernel/fs/ext2/ext2.ko .initrd/lib/modules/linux-live/kernel/fs/ext2/ -ln -sf /lib/modules/$(shell uname -r)/kernel/fs/ext3/ext3.ko .initrd/lib/modules/linux-live/kernel/fs/ext3/ cd .initrd && find . | cpio --dereference -H newc -o > ../$@.1.tmp gzip -9 -n < $@.1.tmp > $@.2.tmp rm $@.1.tmp mv $@.2.tmp $@ check: initrd.gz # this assumes you're running on amd64. [ $(shell uname -m) = x86_64 ] qemu-system-x86_64 -kernel /boot/vmlinuz-$(shell uname -r) \ -nographic \ -hda /var/cache/pbuilder/base-i386.qemu \ -hdb /dev/zero \ -initrd ./initrd.gz \ -serial stdio \ -append "quiet console=ttyS0 pbuilderarch=i386 " clean: rm -f qemuinit-static qemuinit-static-klibc *.o *~ initrd.gz rm -rf .initrd check-syntax: $(CC) -c -O2 -Wall $(CHK_SOURCES) -o/dev/null -D LIBDIR="\"${LIBDIR}\"" .PHONY: clean check cowdancer-0.73/initrd/make-arm-initrd.sh0000755000000000000000000000206011304446061015104 0ustar #!/bin/bash # prototype to create initrd for arm. set -o pipefail set -e rm -rf .initrd-arm mkdir .initrd-arm || true ( for DIR in etc root proc dev dev/pts mnt; do echo "mkdir .initrd-arm/$DIR" done for DEBS in arm/*.deb; do echo "dpkg -x $DEBS .initrd-arm" done for DEV in "dev/sda b 8 0" "dev/sdb b 8 16"; do echo "mknod .initrd-arm/${DEV}" done echo "cp ./quick-arm-init.sh .initrd-arm/init" echo "chmod a+x .initrd-arm/init" echo "mv .initrd-arm/lib/modules/{2.6.26-2-versatile,linux-live}" echo "touch .initrd-arm/etc/fstab" echo "(cd .initrd-arm && find . | cpio -H newc -o | gzip -9 > ../initrd.arm.gz.tmp)" # for debugging # echo "find .initrd-arm/ -ls" echo "ls -l .initrd-arm/dev" ) | fakeroot mv initrd.arm.gz.tmp initrd.arm.gz # this requires base-armel.qemu image accessible from user qemu-system-arm -kernel .initrd-arm/boot/vmlinuz-2.6.26-2-versatile \ -hda ~/tmp/base-armel.qemu \ -hdb /dev/zero \ -initrd ./initrd.arm.gz \ -serial stdio \ -append "console=ttyAMA0 pbuilderarch=armel init=/bin/bash" \ -M versatilepb cowdancer-0.73/initrd/quick-arm-init.sh0000755000000000000000000000234011304446061014756 0ustar #!/bin/bash # quick prototype init program for arm set -x cd / export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin mount /proc /proc -t proc mount /dev/pts /dev/pts -t devpts for MODULE in lib/modules/linux-live/kernel/drivers/ide/ide-core.ko \ lib/modules/linux-live/kernel/drivers/ide/ide-disk.ko \ lib/modules/linux-live/kernel/drivers/ide/ide-generic.ko \ lib/modules/linux-live/kernel/drivers/scsi/scsi_mod.ko \ lib/modules/linux-live/kernel/drivers/scsi/scsi_transport_spi.ko \ lib/modules/linux-live/kernel/drivers/scsi/sym53c8xx_2/sym53c8xx.ko \ lib/modules/linux-live/kernel/drivers/scsi/sd_mod.ko \ lib/modules/linux-live/kernel/fs/mbcache.ko \ lib/modules/linux-live/kernel/fs/jbd/jbd.ko \ lib/modules/linux-live/kernel/fs/ext2/ext2.ko \ lib/modules/linux-live/kernel/fs/ext3/ext3.ko \ lib/modules/linux-live/kernel/drivers/net/smc91x.ko; do insmod $MODULE done # this process is asynchronous, need to wait about 2 seconds until SCSI device is detected. echo "Try checking inside this initrd, exit to enter the chroot" /bin/bash echo "Entering chroot" mount /dev/sda /mnt -t ext3 chroot /mnt /sbin/ifconfig eth0 up chroot /mnt /sbin/dhclient eth0 chroot /mnt /usr/bin/apt-get update chroot /mnt /bin/bash cowdancer-0.73/initrd/README0000644000000000000000000000220111304446061012441 0ustar This directory contains support for experimental initrd support. initrd support will create initrd on-the-fly to allow use of Debian-stock kernel with ease. Hopefully qemubuilder will be fed a Debian package of a kernel from one architecture and start off it. There are multiple implementations; pros and cons on each implementation. 1. klibc implementation an initrd which uses klibc-linked binary to do everything 2. glibc implementation an initrd which uses glibc-static-linked binary to do everything 3. shell script implementation an initrd which is a bash script to do everything. Requires an initrd size of 40MB, out of which kernel modules is 24MB, and other binaries occupy 16MB. arm/ directory should contain: bash_4.0-7_armel.deb coreutils_7.4-2_armel.deb libacl1_2.2.48-1_armel.deb libattr1_2.4.44-1_armel.deb libblkid1_2.16.1-4_armel.deb libc6_2.10.1-5_armel.deb libgcc1_4.4.2-2_armel.deb libncurses5_5.7+20090803-2_armel.deb libselinux1_2.0.88-1_armel.deb libsepol1_2.0.39-1_armel.deb libuuid1_2.16.1-4_armel.deb linux-image-2.6.26-2-versatile_2.6.26-20_armel.deb module-init-tools_3.11-1_armel.deb mount_2.16.1-4_armel.deb cowdancer-0.73/cowdancer.spec0000644000000000000000000000246511220436222013120 0ustar Summary: Copy-on-write directory tree utility. Name: cowdancer Version: 0.25 Release: 1.%{_vendor} License: GPL Group: System Environment/Shells Source: http://www.netfort.gr.jp/~dancer/software/downloads/%{name}_%{version}.tar.gz Prefix: %{_prefix} BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %description Tries to make copy-on-write semantics upon hard-link copied directory trees generated with 'cp -la' 'cow-shell' command invokes a shell session. Within that session, under the directory cow-shell was invoked, cowdancer will create a new file when existing i-nodes are opened for write. Useful for quick scratch workspace and experimentation. 'cowbuilder' command is a wrapper for pbuilder which allows using pbuilder-like interface over cowdancer environment. %prep %setup -q -n %{name} %{__perl} -pi -e 's!/usr/lib!%{_libdir}!g;' Makefile cow-shell.[1c] tests/[0-9]* %build %{__make} LIBDIR="%{_libdir}" CFLAGS="%{?cflags:%{cflags}}%{!?cflags:$RPM_OPT_FLAGS}" %{?mflags} %install %{__mkdir_p} $RPM_BUILD_ROOT%{_bindir} %{__make} install DESTDIR=$RPM_BUILD_ROOT %{?mflags_install} %clean test "x$RPM_BUILD_ROOT" != "x" && rm -rf $RPM_BUILD_ROOT %files %defattr(-, root, root) %doc COPYING NEWS ChangeLog %{_bindir}/cow-shell %{_libdir}/%{name} %{_mandir}/man*/* %changelog 4 Mar 2007 initial specfile cowdancer-0.73/benchmarking/0000755000000000000000000000000011437371223012731 5ustar cowdancer-0.73/benchmarking/time-output.c0000755000000000000000000000173511220436222015371 0ustar /*BINFMTC: Pipe through this program to get time information on each line of text. Use it like: sudo cowbuilder --update | ./time-output.c [optional: file-to-tee] */ #include #include #include #include #include #include void fix_terminal() { struct termios t; if (isatty(1)) { tcgetattr(1, &t); t.c_lflag |= ECHO; tcsetattr(1, TCSANOW, &t); } } int main(int argc, char** argv) { time_t start = time(NULL); char b[4096]; FILE* f = NULL; if (argc == 2) { printf("Output tee to extra file %s\n", argv[1]); f = fopen(argv[1], "w"); } while(fgets(b,sizeof(b),stdin)!=0) { printf("[%i] %s", (int)difftime(time(NULL), start), b); fflush(stdout); if (f) { fprintf(f, "[%i] %s", (int)difftime(time(NULL), start), b); fflush(f); } } if (f) fclose(f); fix_terminal(); return 0; } cowdancer-0.73/benchmarking/time-output-diff.sh0000755000000000000000000000023211220436222016456 0ustar #!/bin/bash # compare file $1 and $2, ignoring the time difference. diff -u <( sed 's/^\[[0-9]\+\] //' < $1 ) <( sed 's/^\[[0-9]\+\] //' < $2 ) cowdancer-0.73/benchmarking/README0000644000000000000000000000013411220436222013576 0ustar This directory contains files which are useful when benchmarking cowdancer and qemubuilder. cowdancer-0.73/benchmarking/rebuild-apt-dpkg.sh0000755000000000000000000000042611220436222016414 0ustar set -e WORKDIR=/tmp/oprofwork rm -rf "$WORKDIR" || true mkdir "$WORKDIR" cd "$WORKDIR" sudo apt-get build-dep apt dpkg apt-get source apt apt-get source dpkg (cd apt-*; debuild -e DEB_BUILD_OPTIONS=nostrip) (cd dpkg-*; debuild -e DEB_BUILD_OPTIONS=nostrip) sudo dpkg -i *.deb cowdancer-0.73/benchmarking/README.PROFILE0000644000000000000000000000213111220436222014674 0ustar [Just a memo on how to profile stuff.] debuild -e DEB_BUILD_OPTIONS=nostrip,noopt opreport -lg #function level opreport -lgd #instruction level /* __builtin_expect(!initialized,0) 00001020 9 0.0061 cowdancer.c:134 libcowdancer.so find initialize_functions 00001021 1 11.1111 cowdancer.c:134 00001023 1 11.1111 cowdancer.c:134 00001024 1 11.1111 cowdancer.c:134 0000102b 1 11.1111 cowdancer.c:134 0000103d 1 11.1111 cowdancer.c:140 00001048 2 22.2222 cowdancer.c:187 00001051 2 22.2222 cowdancer.c:187 __builtin_expect(!initialized,1) 00001020 16 0.0131 cowdancer.c:134 libcowdancer.so find initialize_functions 00001021 1 6.2500 cowdancer.c:134 0000102b 3 18.7500 cowdancer.c:134 00001037 1 6.2500 cowdancer.c:140 0000103d 2 12.5000 cowdancer.c:140 000011d9 1 6.2500 cowdancer.c:187 000011df 7 43.7500 cowdancer.c:187 000011fa 1 6.2500 cowdancer.c:194 */ cowdancer-0.73/ilistcreate.c0000755000000000000000000000623511220436222012755 0ustar /*BINFMTC: -g -DILISTCREATEBENCH * cowdancer -- a Copy-on-write data-access; No-cow-easy-replacement * * Copyright 2007-2000 Junichi Uekawa * GPL v2 or later. */ #include #include #include #include #include "ilist.h" /* Output error message. You need to process the error result. */ void ilist_outofmemory(const char* msg) { fprintf (stderr, "E: %s: %s\n", ilist_PRGNAME, msg); } /* return 1 on error, 0 on success */ int ilistcreate(const char* ilistpath, const char* findcommandline) { int i=0; long dev, ino; FILE* inf; FILE* outf; struct ilist_struct* ilist=NULL; struct ilist_header header= { ILISTSIG, ILISTREVISION, sizeof (struct ilist_struct), 0 }; long ilist_len=0; if(!findcommandline) findcommandline="find . -xdev \\( -type l -o -type f \\) -a -links +1 -print0 | xargs -0 stat --format '%d %i '"; if (!(ilist=calloc(2000,sizeof(struct ilist_struct)))) { ilist_outofmemory("memory allocation failed"); return 1; } ilist_len=2000; if (NULL==(inf=popen(findcommandline, "r"))) { ilist_outofmemory("popen find failed"); return 1; } while (fscanf(inf,"%li %li", &dev, &ino)>0) { (ilist+i)->dev=(dev_t)dev; (ilist+i)->inode=(ino_t)ino; if (getenv("COWDANCER_DEBUG")) printf("%li %li \n ", (long int)dev, (long int)ino); i++; if (i>=ilist_len) { ilist=realloc(ilist, (ilist_len*=2)*sizeof(struct ilist_struct)); if (!ilist) { ilist_outofmemory("realloc failed"); pclose(inf); return 1; } } } ilist_len=i; if (pclose(inf)) { ilist_outofmemory("pclose returned non-zero, probably the directory contains no hardlinked file, don't bother using cow-shell here."); return 1; } /* sort the ilist */ qsort(ilist, ilist_len, sizeof(struct ilist_struct), compare_ilist); /* write out the ilist file */ if (NULL==(outf=fopen(ilistpath,"w"))) { ilist_outofmemory("cannot open .ilist file"); return 1; } if(1 != fwrite(&header, sizeof(struct ilist_header), 1, outf)) { ilist_outofmemory("failed writing header to .ilist file"); return 1; } if (ilist_len != fwrite(ilist, sizeof(struct ilist_struct), ilist_len, outf)) { ilist_outofmemory("failed writing to .ilist file"); return 1; } if (fclose (outf)) { ilist_outofmemory("error flushing to .ilist file"); return 1; } return 0; } /* comparison function for qsort/bsearch of ilist */ int compare_ilist (const void *a, const void *b) { const struct ilist_struct * ilista = (const struct ilist_struct*) a; const struct ilist_struct * ilistb = (const struct ilist_struct*) b; int ret; ret = ilista->inode - ilistb->inode; if (!ret) { ret = ilista->dev - ilistb->dev; } return ret; } #ifdef ILISTCREATEBENCH /* test code for performance tuning */ const char* ilist_PRGNAME="testbench"; int main() { int i; if (-1==chdir("/home/dancer/shared/git/linux-2.6/")) exit (1); for(i=0; i<100; ++i) ilistcreate("/home/dancer/shared/git/linux-2.6/.ilist", NULL); exit (0); } #endif cowdancer-0.73/test_ilistcreate.c0000755000000000000000000000043611220436222014011 0ustar /*BINFMTC: ilistcreate.c test code for ilistcreate.c */ #include #include #include #include #include #include "ilist.h" const char* ilist_PRGNAME="testcode"; int main() { ilist_outofmemory("hello world\n"); return 0; } cowdancer-0.73/ChangeLog0000644000000000000000000006211611220436222012050 0ustar No longer update Changelog, add more useful info in the git log, please. 2008-01-26 Junichi Uekawa * cowdancer-ilistdump.c (main): update for test. * cowdancer.c (verify_ilist_header, load_ilist): * ilist.h (ILISTSIG): * ilistcreate.c (ilistcreate): add header and signature checking. 2008-01-10 Junichi Uekawa * parameter.c (parse_parameter): add error checking. 2007-12-04 Junichi Uekawa * tests/900_test_pbuilder.sh: use debootstrap instead of cdebootstrap, which is currently broken. 2007-12-03 Junichi Uekawa * cow-shell.1: add a comment on ENOMEM 2007-11-02 Junichi Uekawa * cowbuilder.c (cpbuilder_build): write to "/.ilist" inside chroot, not ilistpath. 2007-10-28 Junichi Uekawa * parameter.c (parse_parameter): fix parameter passing for --debbuildopts. 2007-10-25 Junichi Uekawa * qemubuilder.c (cpbuilder_build): support debbuildopts * parameter.c (parse_parameter, load_config_file): * parameter.h: support debbuildopts * qemubuilder.c: add support for --components in qemubuilder. * parameter.c (parse_parameter): add --components option. (load_config_file): support COMPONENTS option 2007-10-15 Junichi Uekawa * debian/qemubuilder.files: install bash-completion file to qemubuilder * Makefile: install bash_completion. * bash_completion.qemubuilder: create (a start of) qemubuilder bash completion script. * bash_completion.cowbuilder: add cowbuilder bash completion script. 2007-09-10 Junichi Uekawa * cowbuilder.c (main): specify cowdancer-reuse (cpbuilder_internal_cowcopy): remove .ilist file here. (get_ilistfile_path, cpbuilder_internal_cowcopy) (cpbuilder_build): consolidate common code to get_ilistfile_path. * qemubuilder.c (run_second_stage_script): set date / time inside chroot with date command; it will be different by a few seconds. 2007-09-07 Junichi Uekawa * cow-shell.c: fix case where .ilist didn't exist before. * qemubuilder.c: fix typo from "Jean-Baptiste Note" (run_second_stage_script): get network device name with ifconfig and grep. Can I assume 'ethX' here? 2007-09-06 Junichi Uekawa * qemubuilder.c (fork_qemu): change 'termination signal' to 'termination message' so that it's not confusing. 2007-09-04 Junichi Uekawa * cow-shell.c: delete .ilist file if reuse flag is not set. * cowbuilder.c (cpbuilder_create): add cleanup code. * qemubuilder.c: cosmetic fixes. 2007-09-03 Junichi Uekawa * qemubuilder.c (create_ext3_block_device): use mke2fs -F instead of yes|mke2fs (fork_qemu): do not handle fd '0', so that tty control can be done. (fix_terminal): fix termios after exit from qemu, at least put echo on. (fork_qemu): Handle exit-codes. 2007-09-01 Junichi Uekawa * Makefile (check-syntax): add check-syntax target for flymake mode. Remove redundant #include statements. * cowbuilder.c: run cowdancer-ilistcreate within chroot if it exists. * parameter.c: * forkexec.c: move fork/exec code from parameter.c * tests/014_ilistdump_test.sh: rewrite testsuite to use the generic dumping code. * Makefile: install dumping code. * cowdancer-ilistdump.1: document * cowdancer-ilistdump.c: create dumping code, from testsuite data. 2007-08-31 Junichi Uekawa * cow-shell.1: add reference to cowdancer-ilistcreate * cowdancer-ilistcreate.1: document. * Makefile (install): install ilistcreate. * cowdancer-ilistcreate.c: create new command. 2007-08-29 Junichi Uekawa * qemubuilder.c (cpbuilder_create): add aptitude into chroot. 2007-08-21 Junichi Uekawa * parameter.c: config file parsing improved by patch from Jan-Marek Glogowski 2007-06-27 Junichi Uekawa * cowdancer.c (initialize_functions): work around glibc bug: dlvsym failure isn't setting dlerror. (load_ilist): close fd used for mmap after use. 2007-06-21 Junichi Uekawa * cowdancer.c (initialize_functions): try to load chown@@GLIBC_2.1 if it exists. It is translated to lchown on i386, if I try to load the unversioned symbol. 2007-06-19 Junichi Uekawa * parameter.c (load_config_file): support BUILDPLACE configuration. (parse_parameter): make it an error that BUILDPLACE is not set. Default is set in pbuilderrc. (parse_parameter): process --distribution command-line option properly. * qemubuilder.8: * cowbuilder.8: update documentation for dumpconfig. * qemubuilder.c (cpbuilder_help): * cowbuilder.c (cpbuilder_help): * parameter.c (parse_parameter): add dumpconfig command. 2007-06-17 Junichi Uekawa * cowbuilder.8: add examples * qemubuilder.c (qemu_arch_qemu): change x86_64/i386 logic. 2007-06-09 Junichi Uekawa * tests/014_ilistdump_test.sh: change deprecated sort +2 to -k 2 * tests/014_ilistdump_test.c: fix testsuite * Makefile: fix rules to include ilistcreate. * cowbuilder.c: ignore ./home * cow-shell.c: * ilistcreate.c (ilistcreate): move function, and reorganize code. 2007-06-06 Junichi Uekawa * qemubuilder.c: clean up code and generally initialize variables. * Makefile (install): qemubuilder installed to sbin, since it needs root privilege * qemubuilder.c (copy_dscfile): support signed .dsc file. * parameter.h: * parameter.c: new files, moved common code from cowbuilder/qemubuilder 2007-06-05 Junichi Uekawa * cowbuilder.c (load_config_file): * qemubuilder.c (load_config_file): set -e in sourcing configuration file. 2007-06-04 Junichi Uekawa * tests/902_test_cowbuilder_fail.sh, etc.: skip when ran inside cowbuilder. * qemubuilder.1: document ARCH= option, and add a sample pbuidlerrc 2007-05-28 Junichi Uekawa * qemubuilder.1: document buildresult. * cowbuilder.8: * cowbuilder.c: support buildresult * qemubuilder.c: support buildresult 2007-05-27 Junichi Uekawa * qemubuilder.c: sync twice before shutdown. * qemubuilder.1: create from cowbuilder doc. * cowbuilder.8: fix doc * qemubuilder.c: support INITRD config option. * Makefile (install): add install target for qemubuilder. 2007-04-18 Junichi Uekawa * Makefile: do not install qemubuilder for now. * qemubuilder.c (qemubuilder_create): fix deb source line. (qemu_arch_qemu): return kvm only when kvm is available. make this work with x86_64 host x86_64 target. 2007-04-05 Junichi Uekawa * qemubuilder.c: initial import to cowdancer repository. rename functions to 'qemubuilder_'. (qemubuilder_create): add mirror place to call to 'debootstrap --second-stage'. 2007-03-08 Junichi Uekawa * cowdancer.c(ctor): add constructor * tests/021_test_open.c (main): C source for testing it. (main): add check that initial open is the problem. * tests/021_test_open.sh (TESTCODE): create test for close(0);open(XXX,XXXX)=0; 2007-03-04 Junichi Uekawa * cow-shell.c (main): remove use of /usr/lib and use value of LIBDIR * cowdancer.spec: create specfile * Makefile (install): fix makefile 2006-12-31 Junichi Uekawa * Makefile (%.o): do not use strict aliasing for compiling cow-shell.c * cow-shell.c (ilistcreate): add debug hook. * tests/020_test_lchown.sh: add new test. * cow-shell.c (ilistcreate): include symbollic links to the list. * cowdancer.c (check_inode_and_copy, and others): do not canonicalize file name for lchown case. Add a new flag and change every function to use it. 2006-12-21 Junichi Uekawa * tests/900_test_pbuilder.sh: do not call pdebuild through sudo. 2006-10-29 Junichi Uekawa * tests/902_test_cowbuilder_fail.sh: use workaround hooks. * tests/901_test_pbuilder_create.sh: use workaround hooks. * tests/900_test_pbuilder.sh: use workaround hooks. 2006-08-31 Junichi Uekawa * cowbuilder.c (cpbuilder_update): fix to use command-line options. 2006-08-26 Junichi Uekawa * cowdancer.c: copyright update * debian/README.Debian: update * cowbuilder.8: add see-also. * cowbuilder.c (cpbuilder_help): add comment of other pbuilder options. * cowbuilder.8: fix up documentation to explain other options are passed through. * cowbuilder.c (main): fix up parameter handling 2006-08-20 Junichi Uekawa * cowbuilder.c (cpbuilder_build, cpbuilder_login) (cpbuilder_execute, cpbuilder_update): abort and do not clean up if return code is wrong. 2006-07-26 Junichi Uekawa * cowbuilder.c (cpbuilder_update): do not remove base.cow if update failed. 2006-06-24 Junichi Uekawa * cowbuilder.c (main): s/basepath/buildplace/ for -B. 2006-06-21 Junichi Uekawa * cowbuilder.c (cpbuilder_build): support COWDANCER_REUSE option in build target. pbuilder-satisfydepends seems faster now. 50 seconds -> 33 seconds to build pbuilder inside chroot. * tests/902_test_cowbuilder_fail.sh: fix thinko. * cow-shell.1: document. * cow-shell.c (main): COWDANCER_REUSE option; it is definitely faster. [08:23:25]dancer64:linux-2.6> time echo exit| cow-shell Invoking /bin/bash real 0m0.323s user 0m0.059s sys 0m0.256s [08:23:25]dancer64:linux-2.6> time echo exit| COWDANCER_REUSE=yes cow-shell Invoking /bin/bash real 0m0.006s user 0m0.004s sys 0m0.002s 2006-06-15 Junichi Uekawa * tests/901_test_pbuilder_create.sh: check for failure states in test. * tests/902_test_cowbuilder_fail.sh: check that exit code is processed properly; it seems like it isn't in some cases? * tests/010_test_noilistfile.sh: variable was wrong, it should be COWDANCER_ILISTFILE * cowbuilder.c (main): mkdir with 0777, not 777. 2006-06-11 Junichi Uekawa * cow-shell.c (ilistcreate): use find -links +1. (ilistcreate): fix the -type f location, it needs to be before -print0 (ilistcreate): error out with a message when there is no hardlinked file. [14:32:00]dancer64:test> touch 1 2-1 3-1 4-1 [14:32:07]dancer64:test> ln 2-1 2-2 [14:32:10]dancer64:test> ln 3-1 3-2 [14:32:13]dancer64:test> ln 3-1 3-3 [14:32:14]dancer64:test> ln 4-1 4-2 [14:32:18]dancer64:test> ln 4-1 4-3 [14:32:19]dancer64:test> ln 4-1 4-4 [14:32:20]dancer64:test> ls -li 242255 -rw-r--r-- 1 dancer dancer 0 2006-06-11 14:32 1 242258 -rw-r--r-- 2 dancer dancer 0 2006-06-11 14:32 2-1 242258 -rw-r--r-- 2 dancer dancer 0 2006-06-11 14:32 2-2 242262 -rw-r--r-- 3 dancer dancer 0 2006-06-11 14:32 3-1 242262 -rw-r--r-- 3 dancer dancer 0 2006-06-11 14:32 3-2 242262 -rw-r--r-- 3 dancer dancer 0 2006-06-11 14:32 3-3 242263 -rw-r--r-- 4 dancer dancer 0 2006-06-11 14:32 4-1 242263 -rw-r--r-- 4 dancer dancer 0 2006-06-11 14:32 4-2 242263 -rw-r--r-- 4 dancer dancer 0 2006-06-11 14:32 4-3 242263 -rw-r--r-- 4 dancer dancer 0 2006-06-11 14:32 4-4 [14:32:22]dancer64:test> find -links +2 ./3-1 ./4-1 ./3-2 ./3-3 ./4-2 ./4-3 ./4-4 [14:32:31]dancer64:test> find -links +1 . ./2-1 ./3-1 ./4-1 ./2-2 ./3-2 ./3-3 ./4-2 ./4-3 ./4-4 [14:32:34]dancer64:test> find -links +3 ./4-1 ./4-2 ./4-3 ./4-4 * cowdancer.c (check_inode_and_copy): test for regular files before investing too much. (check_inode_and_copy): check that st_nlink > 1, otherwise, it's not hardlinked at all. * tests/901_test_pbuilder_create.sh: fix test script to work around problem with debootstrap not supporting --debug 2006-06-06 Junichi Uekawa * tests/900_test_pbuilder.sh: add debug option * tests/901_test_pbuilder_create.sh: add a test for bootstrapping each distribution. 2006-05-29 Junichi Uekawa * tests/014_ilistdump_test.sh: sort both * tests/900_test_pbuilder.sh: use cowbuilder to test instead of hand-assembled stuff. * cowbuilder.c (cpbuilder_login): handle error (cpbuilder_execute, cpbuilder_update): handle error (main): create /var/cache/pbuilder/build/ directory if it doesn't already exist. (main): support --distribution option. (main): support --buildplace option. * cowbuilder.8: --basepath, not --basetgz. 2006-05-27 Junichi Uekawa * cowbuilder.c (main): help iplementation. (pbuilder_help): help message. (main): 2006-05-26 Junichi Uekawa * debian/control: update description. 2006-05-24 Junichi Uekawa * debian/TODO: update, note .ilist handling is a problem I have pondered and not reached any conclusions. I need to measure some timings and other stuff. * debian/changelog: fixed entry. * NEWS: added entry. * cowbuilder.c (main): implement save-after-login (cpbuilder_login, cpbuilder_execute) (cpbuilder_internal_saveupdate, cpbuilder_update): unify the replace-original routine. * debian/TODO: document more TODO items until cowbuilder becomes really usable. * cowbuilder.c: change default basepath and buildplace. basepath is in /var/cache/pbuilder/base.cow, and buildplace is in /var/cache/pbuilder/build. (cpbuilder_execute): effects of pbuilder --execute with -- seems sane. pbuilder documentation is updated with this insight. $ sudo pbuilder execute -- /bin/echo --world W: /home/dancer/.pbuilderrc does not exist Building the build Environment -> extracting base tarball [/var/cache/pbuilder/base.tgz] $ sudo ./cowbuilder.c --execute hello --world ./cowbuilder.c: unrecognized option `--world' Unhandled option [08:51:22]ibookg4:cowdancer> time sudo ./cowbuilder.c --execute -- /bin/echo hello --world -> Copying COW directory -> Invoking pbuilder DEBUG: 0: pbuilder DEBUG: 1: execute DEBUG: 2: --buildplace DEBUG: 3: /var/cache/pbuilder/build/cow9150 DEBUG: 4: --no-targz DEBUG: 5: --internal-chrootexec DEBUG: 6: chroot /var/cache/pbuilder/build/cow9150 cow-shell DEBUG: 7: /bin/echo DEBUG: 8: hello DEBUG: 9: --world W: /home/dancer/.pbuilderrc does not exist -> Running in no-targz mode -> copying local configuration -> mounting /proc filesystem ln: creating symbolic link `/var/cache/pbuilder/build/cow9150/etc/mtab' to `../proc/mounts': File exists -> mounting /dev/pts filesystem -> policy-rc.d already exists Obtaining the cached apt archive contents hello --world Copying back the cached apt archive contents -> unmounting dev/pts filesystem -> unmounting proc filesystem -> Cleaning COW directory real 0m5.646s user 0m2.165s sys 0m2.290s * debian/README.Debian (BUGS): update * Makefile (install): install manual and install cowbuilder in sbin. * cowbuilder.8: rough manual * cowbuilder.c: introduce generic argument passing mechanism, and support all reasonable options pbuilder currently supports. 2006-05-22 Junichi Uekawa * debian/TODO: update 2006-05-21 Junichi Uekawa * Makefile: install cowbuilder * cowbuilder.c: add cowbuilder code. 2006-04-29 Junichi Uekawa * cow-shell.c (ilistcreate, main): instead of hard-coding ".ilist", use ilistpath variable to specify the ilist location. 2006-03-05 Junichi Uekawa * cowdancer.c (check_inode_and_copy): make 'canonical' be always defined rather than conditionally using 's' * tests/019_test_filename_with_space.sh: test quote character also. * cowdancer.c (check_inode_and_copy): rewrite with exec. * tests/019_test_filename_with_space.sh: add test for filename with a space. * cowdancer.c (check_inode_and_copy): support filename with a space. Doesn't support filename with a "'" character, but that'll need to be handled in a completely different way. 2006-01-25 Junichi Uekawa * NEWS: update for 0.11 * cow-shell.1: update manual. It does cross device boundaries. Note that -I or -i option should be used on debuild. Note that hardlinks are broken all the time. * cowdancer.c (check_inode_and_copy): return int. (open): set errno=ENOMEM (fchmod,...): check for error condition returned from check_inode_and_copy 2006-01-14 Junichi Uekawa * cowdancer.c (initialize_functions): use mkstemp to create a temp file. (check_inode_and_copy): thinko. fix ~~ handling. * tests/017_tempfilecheck.sh: fix temp file handling. * tests/015_test_ilistdelete.c: update to be a pthread-based test. * tests/018_testcxx.cc (main): test for C++ code. * tests/018_testcxx.sh: add test for C++ code * debian/changelog: 0.10 preparation. * NEWS: 0.10 preparation * tests/016_memleakcheck.sh: use mcheck to see if memory leaks happen. Why does this not fail when check is failing? * tests/015_test_ilistdelete.sh: disabled the check since it's difficult to formulate the test yet. * tests/002_test_open.c (main): fix thinko. It was never tested, really. 2006-01-13 Junichi Uekawa * tests/015_test_ilistdelete.c (main): a preliminary implementation, this is wrong. I should also test pthread and doing something racy. * cowdancer.c (initialize_functions): logic error, if someone else is initializing and it has failed, we'd probably need to retry, not hang. * tests/015_test_ilistdelete.sh: test ilist delete code path. 2006-01-08 Junichi Uekawa * NEWS: update * debian/TODO: document the problem with ld.so overwrite * cowdancer.c (check_inode_and_copy): try to tackle the problem of ld.so overwrite while exec. This happens because we do rename before cp. before: rename a a~~ cp -a a~~ a (requires working libc) rm a~~ modified: cp -a a a~~ rename a~~ a 2006-01-07 Junichi Uekawa * tests/900_test_pbuilder.sh: skip this test unless it's a known working location * Makefile: make it easier to see test failure results. * debian/pbuilder-test/000_prepinstall: * debian/pbuilder-test/001_makecheck: testsuite to run make-check inside chroot. * tests/900_test_pbuilder.sh: * debian/TODO: note that cpbuilder test fails today, because it's probably forking when it should not be. * Makefile: use VERSION string without debian dependency. 2005-12-29 Junichi Uekawa * debian/TODO: update * debian/README.Debian (BUGS): add fchown/fchmod notes. * tests/014_ilistdump_test.sh: add a test to check for ilist dumping. * tests/014_ilistdump_test.c: add a test program for dumping ilist file contents. * cowdancer.c (load_ilist): add error checks. * Makefile (%.o): define _REENTRANT 2005-12-28 Junichi Uekawa * NEWS: update news file. * cowdancer.c: insert sched_yield in parts to make things look a bit more quasi-thread-safe. 2005-12-25 Junichi Uekawa * cowdancer.c (check_inode_and_copy): use bsearch (check_fd_inode_and_warn): use bsearch * ilist.h (compare_ilist): comparison function here. * cow-shell.c: move compare_ilist to header file. * tests/900_test_pbuilder.sh: ignore this test for now. * cowdancer.c (load_ilist): use mmap. * cow-shell.c: include ilist. * ilist.h (struct ilist_struct): create ilist struct separately. 2005-11-23 Junichi Uekawa * debian/changelog: 0.7 * tests/002_test_open.c: write(2) requires unistd.h * NEWS: add comments on what has been changed. * tests/900_test_pbuilder.sh (COWDEB): use a better algorithm for determining the deb package to use. * Makefile (DESTDIR): export VERSION * tests/013_test_chmod.sh (TESTCODE): * tests/012_test_chown.sh (NEWID): * tests/004_test_fopen64.sh (TESTCODE): * tests/003_test_fopen.sh (TESTCODE): * tests/002_test_open.sh (TESTCODE): * tests/001_test_symlink.sh (TESTDIR): * tests/000_test_basic.sh (TESTDIR): cp -al 1/ 2/ no longer works, change to cp -al 1/ 2 * cow-shell.c (main): work around new 'stat' feature, which doesn't add a newline after --format. Add a space after it so that scanf can read in. Tested with Debian sarge and sid. * cow-shell.1: add reference to COWDANCER_DEBUG environmental variable. * cowdancer.c (debug_cowdancer_2, debug_cowdancer): use COWDANCER_DEBUG environment variable for debug toggling. 2005-11-02 Junichi Uekawa * Makefile (VERSION): Change VERSION to be dpkg-parsechangelog-based * tests/012_test_chown.c (main): * tests/013_test_chmod.c (main): do not test fchmod, fchown. * cowdancer.c (check_fd_inode_and_warn): do not die even if fchown/fchmod is used; try allowing things to run albeit the warning... I am guessing test_pbuilder.sh is going to be non-functional. 2005-10-31 Junichi Uekawa * tests/900_test_pbuilder.sh: update for 0.6 test fails for pbuilder test since fchmod is used here: cowdancer-unsupported operation, read-only open and fchown/fchmod: 2049:274641 dpkg: error processing /var/cache/apt/archives/libc6-dev_2.3.5-7_amd64.deb (--unpack): error setting ownership of `./usr/bin/gencat': No such file or directory 2005-10-28 Junichi Uekawa * tests/013_test_chmod.c (main): * tests/012_test_chown.c (main): expect fchown and fchmod to fail. * cowdancer.c (initialize_functions): chown, fchown, and lchown implementation. they look like the following: chown("/tmp/1/a", 1000, 24) = 0 fchown(3, 1000, 24) = 0 lchown("/tmp/1/c", 1000, 24) = 0 fchown will be an unsupported operation, hopefully noone will use that. (check_fd_inode_and_warn, fchown, lchown, chown): implement. (chmod, fchmod): implement. chmod("/tmp/1/a", 0400) = 0 fchmod(3, 0400) = 0 * cowdancer.c (load_ilist): use calloc instead of malloc. (check_inode_and_copy): clear memory before match. Required to get working on my ibook. Probably the structs weren't packed. 2005-10-08 Junichi Uekawa * tests/012_test_chown.sh (TESTCODE): * tests/013_test_chmod.sh (TESTCODE): * tests/012_test_chown.c: * tests/013_test_chmod.c: test for chown/chmod functionality. 2005-09-21 Junichi Uekawa * cow-shell.c (main): SHELL may contain non-full path value. 'SHELL=bash', execlp instead of execl. Fall back to /bin/sh if SHELL is bogus. 2005-08-30 Junichi Uekawa * NEWS: 0.4 release. * tests/900_test_pbuilder.sh (COWDEB): update to 0.4; note that this test depends on local ../cowdancer. It will be updated when cowdancer package exists in Debian. 2005-08-29 Junichi Uekawa * cowdancer.c (load_ilist): add error checking for NULL. * tests/010_test_noilistfile.sh: new test to test error checking; the log is more significant. * Makefile (VERSION): 0.4 * cowdancer.c (load_ilist): errorcheck (outofmemory): do not kill myself. (initialize_functions): return 1 on error. (fopen, fopen64): return NULL on error (creat64, creat, open64, open): return -1 on error. 2005-08-20 Junichi Uekawa * NEWS: update NEWS * debian/changelog: update changelog * tests/900_test_pbuilder.sh: use dsh as example, not cowdancer itself. 2005-08-19 Junichi Uekawa * tests/900_test_pbuilder.sh: with fixed pbuilder 0.130, it works * cowdancer.c (likely_fopen_write, fopen, fopen64): implement fopen. (initialize_functions): implement fopen. * tests/004_test_fopen64.sh: * tests/004_test_fopen64.c: * tests/003_test_fopen.sh: * tests/003_test_fopen.c: * tests/002_test_open.sh: * tests/002_test_open.c: Add testsuite. fopen test fails. 2005-08-18 Junichi Uekawa * Makefile (check): fix redirect in testsuite. * cowdancer.c (check_inode_and_copy): use the canonical filename rather than the possible symbollic link. * tests/001_test_symlink.sh: create code to test symlink handling. * tests/README: add a readme. * tests/900_test_pbuilder.sh: rename to 900. 2005-08-17 Junichi Uekawa * cowdancer.c (check_inode_and_copy): add hook to avoid looping around; should not be a problem, but as a safety measure. (check_inode_and_copy): Fix free routine location. (check_inode_and_copy): add debugging error message (check_inode_and_copy): check that the file is a regular file before trying to do anything on it; directories and special files and sockets really don't want this. * cow-shell.c (main): -xdev to find. * tests/001_test_pbuilder.sh: cow working simulation * Makefile (check): create logfiles. 2005-08-16 Junichi Uekawa * tests/000_test_basic.sh: Created a basic test. 2005-08-13 Junichi Uekawa * Makefile (VERSION): 0.2 * cowdancer.c (load_ilist): buffer overflow. * Makefile: install manpage * cow-shell.1: create a manpage * cow-shell.c: unset COWDANCER_IGNORE * NEWS: create a NEWS file. * cowdancer.c: fix obscure messages. * cow-shell.c: fix a few thinko's * Makefile (clean): new target for cleaning. (BINARY): -ldl is required, some programs are not linked against -ldl. * cow-shell.c: created * Makefile: created. * cowdancer.c: Created. cowdancer -- a Copy-on-write data-access; No-cow-easy-replacement Copyright 2005 Junichi Uekawa GPL v2 or later.