svn commit: branches/busybox_1_8_stable: archival archival/libunarchive coreutil etc...

vda at busybox.net vda at busybox.net
Sat Nov 24 04:38:00 UTC 2007


Author: vda
Date: 2007-11-23 20:37:59 -0800 (Fri, 23 Nov 2007)
New Revision: 20522

Log:
Apply all post-1.8.1 patches



Modified:
   branches/busybox_1_8_stable/Makefile
   branches/busybox_1_8_stable/archival/libunarchive/decompress_unzip.c
   branches/busybox_1_8_stable/archival/libunarchive/get_header_tar.c
   branches/busybox_1_8_stable/archival/tar.c
   branches/busybox_1_8_stable/coreutils/tr.c
   branches/busybox_1_8_stable/networking/inetd.c
   branches/busybox_1_8_stable/scripts/trylink
   branches/busybox_1_8_stable/shell/lash.c


Changeset:
Modified: branches/busybox_1_8_stable/Makefile
===================================================================
--- branches/busybox_1_8_stable/Makefile	2007-11-24 04:32:49 UTC (rev 20521)
+++ branches/busybox_1_8_stable/Makefile	2007-11-24 04:37:59 UTC (rev 20522)
@@ -1,6 +1,6 @@
 VERSION = 1
 PATCHLEVEL = 8
-SUBLEVEL = 1
+SUBLEVEL = 2
 EXTRAVERSION =
 NAME = Unnamed
 

Modified: branches/busybox_1_8_stable/archival/libunarchive/decompress_unzip.c
===================================================================
--- branches/busybox_1_8_stable/archival/libunarchive/decompress_unzip.c	2007-11-24 04:32:49 UTC (rev 20521)
+++ branches/busybox_1_8_stable/archival/libunarchive/decompress_unzip.c	2007-11-24 04:37:59 UTC (rev 20522)
@@ -1178,6 +1178,7 @@
 	ALLOC_STATE;
 	bytebuffer_max = 0x8000;
 	bytebuffer = xmalloc(bytebuffer_max);
+	gunzip_src_fd = in;
 
  again:
 	if (!check_header_gzip(PASS_STATE_ONLY)) {

Modified: branches/busybox_1_8_stable/archival/libunarchive/get_header_tar.c
===================================================================
--- branches/busybox_1_8_stable/archival/libunarchive/get_header_tar.c	2007-11-24 04:32:49 UTC (rev 20521)
+++ branches/busybox_1_8_stable/archival/libunarchive/get_header_tar.c	2007-11-24 04:37:59 UTC (rev 20522)
@@ -59,8 +59,9 @@
 		char chksum[8];     /* 148-155 */
 		char typeflag;      /* 156-156 */
 		char linkname[100]; /* 157-256 */
-		char magic[6];      /* 257-262 */
-		char version[2];    /* 263-264 */
+		/* POSIX:   "ustar" NUL "00" */
+		/* GNU tar: "ustar  " NUL */
+		char magic[8];      /* 257-264 */
 		char uname[32];     /* 265-296 */
 		char gname[32];     /* 297-328 */
 		char devmajor[8];   /* 329-336 */

Modified: branches/busybox_1_8_stable/archival/tar.c
===================================================================
--- branches/busybox_1_8_stable/archival/tar.c	2007-11-24 04:32:49 UTC (rev 20521)
+++ branches/busybox_1_8_stable/archival/tar.c	2007-11-24 04:37:59 UTC (rev 20522)
@@ -50,8 +50,9 @@
 	char chksum[8];           /* 148-155 */
 	char typeflag;            /* 156-156 */
 	char linkname[NAME_SIZE]; /* 157-256 */
-	char magic[6];            /* 257-262 */
-	char version[2];          /* 263-264 */
+	/* POSIX:   "ustar" NUL "00" */
+	/* GNU tar: "ustar  " NUL */
+	char magic[8];            /* 257-264 */
 	char uname[32];           /* 265-296 */
 	char gname[32];           /* 297-328 */
 	char devmajor[8];         /* 329-336 */

Modified: branches/busybox_1_8_stable/coreutils/tr.c
===================================================================
--- branches/busybox_1_8_stable/coreutils/tr.c	2007-11-24 04:32:49 UTC (rev 20521)
+++ branches/busybox_1_8_stable/coreutils/tr.c	2007-11-24 04:37:59 UTC (rev 20522)
@@ -173,7 +173,8 @@
 	int idx = 1;
 	int i;
 	smalluint flags = 0;
-	size_t read_chars = 0, in_index = 0, out_index = 0, c, coded, last = -1;
+	ssize_t read_chars = 0;
+	size_t in_index = 0, out_index = 0, c, coded, last = -1;
 	RESERVE_CONFIG_UBUFFER(output, BUFSIZ);
 	RESERVE_CONFIG_BUFFER(vector, ASCII+1);
 	RESERVE_CONFIG_BUFFER(invec,  ASCII+1);
@@ -223,8 +224,9 @@
 			}
 			read_chars = read(STDIN_FILENO, tr_buf, BUFSIZ);
 			if (read_chars <= 0) {
-				if (write(STDOUT_FILENO, (char *)output, out_index) != out_index)
-					bb_perror_msg(bb_msg_write_error);
+				xwrite(STDOUT_FILENO, (char *)output, out_index);
+				if (read_chars < 0)
+					bb_perror_msg_and_die(bb_msg_read_error);
 				exit(EXIT_SUCCESS);
 			}
 			in_index = 0;

Modified: branches/busybox_1_8_stable/networking/inetd.c
===================================================================
--- branches/busybox_1_8_stable/networking/inetd.c	2007-11-24 04:32:49 UTC (rev 20521)
+++ branches/busybox_1_8_stable/networking/inetd.c	2007-11-24 04:37:59 UTC (rev 20522)
@@ -813,7 +813,7 @@
 		sep->se_bi = NULL;
 #endif
 	argc = 0;
-	for (; cp; arg = skip(&cp)) {
+	for (arg = skip(&cp); cp; arg = skip(&cp)) {
 		if (argc < MAXARGV)
 			sep->se_argv[argc++] = xxstrdup(arg);
 	}

Modified: branches/busybox_1_8_stable/scripts/trylink
===================================================================
--- branches/busybox_1_8_stable/scripts/trylink	2007-11-24 04:32:49 UTC (rev 20521)
+++ branches/busybox_1_8_stable/scripts/trylink	2007-11-24 04:37:59 UTC (rev 20522)
@@ -46,6 +46,14 @@
     return $exitcode
 }
 
+check_cc() {
+    if $CC $1 -shared -o /dev/null -xc /dev/null > /dev/null 2>&1; then
+        echo "$1";
+    else
+        echo "$2";
+    fi
+}
+
 EXE="$1"
 CC="$2"
 LDFLAGS="$3"
@@ -53,6 +61,9 @@
 A_FILES="$5"
 LDLIBS="$6"
 
+# The -Wl,--sort-section option is not supported by older versions of ld
+SORT_SECTION=`check_cc "-Wl,--sort-section -Wl,alignment" ""`
+
 # Sanitize lib list (dups, extra spaces etc)
 LDLIBS=`echo "$LDLIBS" | xargs -n1 | sort | uniq | xargs`
 
@@ -64,7 +75,7 @@
 try $CC $LDFLAGS \
 	-o $EXE \
 	-Wl,--sort-common \
-	-Wl,--sort-section -Wl,alignment \
+	$SORT_SECTION \
 	-Wl,--gc-sections \
 	-Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
 	$l_list \
@@ -88,7 +99,7 @@
 	try $CC $LDFLAGS \
 		-o $EXE \
 		-Wl,--sort-common \
-		-Wl,--sort-section -Wl,alignment \
+		$SORT_SECTION \
 		-Wl,--gc-sections \
 		-Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
 		$l_list
@@ -117,7 +128,7 @@
     try $CC $LDFLAGS \
 	    -o $EXE \
 	    -Wl,--sort-common \
-	    -Wl,--sort-section -Wl,alignment \
+	    $SORT_SECTION \
 	    -Wl,--gc-sections \
 	    -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
 	    $l_list \
@@ -139,7 +150,7 @@
     try $CC $LDFLAGS \
 	    -o $EXE \
 	    -Wl,--sort-common \
-	    -Wl,--sort-section -Wl,alignment \
+	    $SORT_SECTION \
 	    -Wl,--gc-sections \
 	    -Wl,-T -Wl,busybox_ldscript \
 	    -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \
@@ -174,7 +185,7 @@
 	    -Wl,-soname="libbusybox.so.$BB_VER" \
 	    -Wl,--undefined=lbb_main \
 	    -Wl,--sort-common \
-	    -Wl,--sort-section -Wl,alignment \
+	    $SORT_SECTION \
 	    -Wl,--start-group $A_FILES -Wl,--end-group \
 	    $l_list \
 	    -Wl,--warn-common \
@@ -195,7 +206,7 @@
     try $CC $LDFLAGS \
 	    -o $EXE \
 	    -Wl,--sort-common \
-	    -Wl,--sort-section -Wl,alignment \
+	    $SORT_SECTION \
 	    -Wl,--gc-sections \
 	    -Wl,--start-group $O_FILES -Wl,--end-group \
 	    -L"$sharedlib_dir" -lbusybox \
@@ -234,7 +245,7 @@
 	try $CC $LDFLAGS "$sharedlib_dir/applet.c" \
 		-o $EXE \
 		-Wl,--sort-common \
-		-Wl,--sort-section -Wl,alignment \
+		$SORT_SECTION \
 		-Wl,--gc-sections \
 		-L"$sharedlib_dir" -lbusybox \
 		-Wl,--warn-common \

Modified: branches/busybox_1_8_stable/shell/lash.c
===================================================================
--- branches/busybox_1_8_stable/shell/lash.c	2007-11-24 04:32:49 UTC (rev 20521)
+++ branches/busybox_1_8_stable/shell/lash.c	2007-11-24 04:37:59 UTC (rev 20522)
@@ -157,8 +157,8 @@
 static char *cwd;
 static char *local_pending_command;
 static struct jobset job_list = { NULL, NULL };
-static int argc;
-static char **argv;
+static int global_argc;
+static char **global_argv;
 static llist_t *close_me_list;
 static int last_return_code;
 static int last_bg_pid;
@@ -810,16 +810,16 @@
 				var = itoa(getpid());
 				break;
 			case '#':
-				var = itoa(argc-1);
+				var = itoa(global_argc - 1);
 				break;
 			case '0':case '1':case '2':case '3':case '4':
 			case '5':case '6':case '7':case '8':case '9':
 				{
 					int ixx = *(dst+1)-48+1;
-					if (ixx >= argc) {
+					if (ixx >= global_argc) {
 						var = '\0';
 					} else {
-						var = argv[ixx];
+						var = global_argv[ixx];
 					}
 				}
 				break;
@@ -1492,13 +1492,14 @@
 #endif
 
 int lash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
-int lash_main(int argc_l, char **argv_l)
+int lash_main(int argc, char **argv)
 {
 	unsigned opt;
 	FILE *input = stdin;
-	argc = argc_l;
-	argv = argv_l;
 
+	global_argc = argc;
+	global_argv = argv;
+
 #if ENABLE_FEATURE_EDITING
 	line_input_state = new_line_input_t(FOR_SHELL);
 #endif
@@ -1510,7 +1511,7 @@
 	job_list.fg = NULL;
 	last_return_code = 1;
 
-	if (argv[0] && argv[0][0] == '-') {
+	if (global_argv[0] && global_argv[0][0] == '-') {
 		FILE *prof_input;
 		prof_input = fopen("/etc/profile", "r");
 		if (prof_input) {
@@ -1522,13 +1523,13 @@
 		}
 	}
 
-	opt = getopt32(argv_l, "+ic:", &local_pending_command);
+	opt = getopt32(argv, "+ic:", &local_pending_command);
 #define LASH_OPT_i (1<<0)
 #define LASH_OPT_c (1<<1)
 	if (opt & LASH_OPT_c) {
 		input = NULL;
 		optind++;
-		argv += optind;
+		global_argv += optind;
 	}
 	/* A shell is interactive if the `-i' flag was given, or if all of
 	 * the following conditions are met:
@@ -1537,7 +1538,7 @@
 	 *    standard input is a terminal
 	 *    standard output is a terminal
 	 *    Refer to Posix.2, the description of the `sh' utility. */
-	if (argv[optind] == NULL && input == stdin
+	if (global_argv[optind] == NULL && input == stdin
 	 && isatty(STDIN_FILENO) && isatty(STDOUT_FILENO)
 	) {
 		opt |= LASH_OPT_i;
@@ -1550,9 +1551,9 @@
 					"Enter 'help' for a list of built-in commands.\n\n",
 					bb_banner);
 		}
-	} else if (!local_pending_command && argv[optind]) {
+	} else if (!local_pending_command && global_argv[optind]) {
 		//printf( "optind=%d  argv[optind]='%s'\n", optind, argv[optind]);
-		input = xfopen(argv[optind], "r");
+		input = xfopen(global_argv[optind], "r");
 		/* be lazy, never mark this closed */
 		llist_add_to(&close_me_list, (void *)(long)fileno(input));
 	}




More information about the busybox-cvs mailing list