Commit f76d8a3f authored by Peter Korsgaard's avatar Peter Korsgaard
Browse files

busybox: bump 1.15.x version

parent f1a0066b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -41,7 +41,7 @@ config BR2_BUSYBOX_VERSION
	default "1.12.4"	if BR2_BUSYBOX_VERSION_1_12_X
	default "1.13.4"	if BR2_BUSYBOX_VERSION_1_13_X
	default "1.14.3"	if BR2_BUSYBOX_VERSION_1_14_X
	default "1.15.0"	if BR2_BUSYBOX_VERSION_1_15_X
	default "1.15.1"	if BR2_BUSYBOX_VERSION_1_15_X

config BR2_PACKAGE_BUSYBOX_FULLINSTALL
	bool "Run BusyBox's own full installation"
+0 −61
Original line number Diff line number Diff line
diff -urpN busybox-1.15.0/networking/httpd.c busybox-1.15.0-httpd/networking/httpd.c
--- busybox-1.15.0/networking/httpd.c	2009-08-21 00:26:14.000000000 +0200
+++ busybox-1.15.0-httpd/networking/httpd.c	2009-09-08 22:33:09.000000000 +0200
@@ -2101,8 +2101,12 @@ static void handle_incoming_and_exit(con
 		}
 		send_cgi_and_exit(urlcopy, prequest, length, cookie, content_type);
 	}
+#endif
+
+	if (urlp[-1] == '/')
+		strcpy(urlp, index_page);
+	if (stat(tptr, &sb) == 0) {
 #if ENABLE_FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
-	{
 		char *suffix = strrchr(tptr, '.');
 		if (suffix) {
 			Htaccess *cur;
@@ -2112,16 +2116,7 @@ static void handle_incoming_and_exit(con
 				}
 			}
 		}
-	}
 #endif
-	if (prequest != request_GET && prequest != request_HEAD) {
-		send_headers_and_exit(HTTP_NOT_IMPLEMENTED);
-	}
-#endif  /* FEATURE_HTTPD_CGI */
-
-	if (urlp[-1] == '/')
-		strcpy(urlp, index_page);
-	if (stat(tptr, &sb) == 0) {
 		file_size = sb.st_size;
 		last_mod = sb.st_mtime;
 	}
@@ -2135,19 +2130,18 @@ static void handle_incoming_and_exit(con
 			send_cgi_and_exit("/cgi-bin/index.cgi", prequest, length, cookie, content_type);
 		}
 	}
-#endif
-	/* else {
-	 *	fall through to send_file, it errors out if open fails
-	 * }
-	 */
+	/* else fall through to send_file, it errors out if open fails: */
 
+	if (prequest != request_GET && prequest != request_HEAD) {
+		/* POST for files does not make sense */
+		send_headers_and_exit(HTTP_NOT_IMPLEMENTED);
+	}
 	send_file_and_exit(tptr,
-#if ENABLE_FEATURE_HTTPD_CGI
 		(prequest != request_HEAD ? SEND_HEADERS_AND_BODY : SEND_HEADERS)
+	);
 #else
-		SEND_HEADERS_AND_BODY
+	send_file_and_exit(tptr, SEND_HEADERS_AND_BODY);
 #endif
-	);
 }
 
 /*
+0 −100
Original line number Diff line number Diff line
diff -urpN busybox-1.15.0/shell/hush.c busybox-1.15.0-hush/shell/hush.c
--- busybox-1.15.0/shell/hush.c	2009-08-21 00:26:14.000000000 +0200
+++ busybox-1.15.0-hush/shell/hush.c	2009-09-05 20:08:50.000000000 +0200
@@ -58,7 +58,7 @@
  * TODOs:
  *      grep for "TODO" and fix (some of them are easy)
  *      builtins: ulimit
- *      special variables (PWD etc)
+ *      special variables (done: PWD)
  *      follow IFS rules more precisely, including update semantics
  *      export builtin should be special, its arguments are assignments
  *          and therefore expansion of them should be "one-word" expansion:
@@ -1432,6 +1432,13 @@ static int set_local_var(char *str, int 
 	return 0;
 }
 
+/* Used at startup and after each cd */
+static void set_pwd_var(int exp)
+{
+	set_local_var(xasprintf("PWD=%s", get_cwd(/*force:*/ 1)),
+		/*exp:*/ exp, /*lvl:*/ 0, /*ro:*/ 0);
+}
+
 static int unset_local_var_len(const char *name, int name_len)
 {
 	struct variable *cur;
@@ -1604,6 +1611,9 @@ static const char* setup_prompt_string(i
 		/* Set up the prompt */
 		if (promptmode == 0) { /* PS1 */
 			free((char*)G.PS1);
+			/* bash uses $PWD value, even if it is set by user.
+			 * It uses current dir only if PWD is unset.
+			 * We always use current dir. */
 			G.PS1 = xasprintf("%s %c ", get_cwd(0), (geteuid() != 0) ? '$' : '#');
 			prompt_str = G.PS1;
 		} else
@@ -6432,8 +6442,49 @@ int hush_main(int argc, char **argv)
 		}
 		e++;
 	}
+	/* reinstate HUSH_VERSION */
 	debug_printf_env("putenv '%s'\n", hush_version_str);
-	putenv((char *)hush_version_str); /* reinstate HUSH_VERSION */
+	putenv((char *)hush_version_str);
+
+	/* Export PWD */
+	set_pwd_var(/*exp:*/ 1);
+	/* bash also exports SHLVL and _,
+	 * and sets (but doesn't export) the following variables:
+	 * BASH=/bin/bash
+	 * BASH_VERSINFO=([0]="3" [1]="2" [2]="0" [3]="1" [4]="release" [5]="i386-pc-linux-gnu")
+	 * BASH_VERSION='3.2.0(1)-release'
+	 * HOSTTYPE=i386
+	 * MACHTYPE=i386-pc-linux-gnu
+	 * OSTYPE=linux-gnu
+	 * HOSTNAME=<xxxxxxxxxx>
+	 * PPID=<NNNNN>
+	 * EUID=<NNNNN>
+	 * UID=<NNNNN>
+	 * GROUPS=()
+	 * LINES=<NNN>
+	 * COLUMNS=<NNN>
+	 * BASH_ARGC=()
+	 * BASH_ARGV=()
+	 * BASH_LINENO=()
+	 * BASH_SOURCE=()
+	 * DIRSTACK=()
+	 * PIPESTATUS=([0]="0")
+	 * HISTFILE=/<xxx>/.bash_history
+	 * HISTFILESIZE=500
+	 * HISTSIZE=500
+	 * MAILCHECK=60
+	 * PATH=/usr/gnu/bin:/usr/local/bin:/bin:/usr/bin:.
+	 * SHELL=/bin/bash
+	 * SHELLOPTS=braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor
+	 * TERM=dumb
+	 * OPTERR=1
+	 * OPTIND=1
+	 * IFS=$' \t\n'
+	 * PS1='\s-\v\$ '
+	 * PS2='> '
+	 * PS4='+ '
+	 */
+
 #if ENABLE_FEATURE_EDITING
 	G.line_input_state = new_line_input_t(FOR_SHELL);
 #endif
@@ -6816,7 +6867,11 @@ static int FAST_FUNC builtin_cd(char **a
 		bb_perror_msg("cd: %s", newdir);
 		return EXIT_FAILURE;
 	}
-	get_cwd(1);
+	/* Read current dir (get_cwd(1) is inside) and set PWD.
+	 * Note: do not enforce exporting. If PWD was unset or unexported,
+	 * set it again, but do not export. bash does the same.
+	 */
+	set_pwd_var(/*exp:*/ 0);
 	return EXIT_SUCCESS;
 }
 
+0 −58
Original line number Diff line number Diff line
diff -urpN busybox-1.15.0/networking/inetd.c busybox-1.15.0-inetd/networking/inetd.c
--- busybox-1.15.0/networking/inetd.c	2009-08-21 00:26:14.000000000 +0200
+++ busybox-1.15.0-inetd/networking/inetd.c	2009-09-04 03:50:03.000000000 +0200
@@ -1031,10 +1031,10 @@ static void reap_child(int sig UNUSED_PA
 				continue;
 			/* One of our "wait" services */
 			if (WIFEXITED(status) && WEXITSTATUS(status))
-				bb_error_msg("%s: exit status 0x%x",
+				bb_error_msg("%s: exit status %u",
 						sep->se_program, WEXITSTATUS(status));
 			else if (WIFSIGNALED(status))
-				bb_error_msg("%s: exit signal 0x%x",
+				bb_error_msg("%s: exit signal %u",
 						sep->se_program, WTERMSIG(status));
 			sep->se_wait = 1;
 			add_fd_to_set(sep->se_fd);
@@ -1119,7 +1119,12 @@ int inetd_main(int argc UNUSED_PARAM, ch
 	else
 		bb_sanitize_stdio();
 	if (!(opt & 4)) {
-		openlog(applet_name, LOG_PID, LOG_DAEMON);
+		/* LOG_NDELAY: connect to syslog daemon NOW.
+		 * Otherwise, we may open syslog socket
+		 * in vforked child, making opened fds and syslog()
+		 * internal state inconsistent.
+		 * This was observed to leak file descriptors. */
+		openlog(applet_name, LOG_PID | LOG_NDELAY, LOG_DAEMON);
 		logmode = LOGMODE_SYSLOG;
 	}
 
@@ -1355,17 +1360,23 @@ int inetd_main(int argc UNUSED_PARAM, ch
 			if (rlim_ofile.rlim_cur != rlim_ofile_cur)
 				if (setrlimit(RLIMIT_NOFILE, &rlim_ofile) < 0)
 					bb_perror_msg("setrlimit");
-			closelog();
+
+			/* closelog(); - WRONG. we are after vfork,
+			 * this may confuse syslog() internal state.
+			 * Let's hope libc sets syslog fd to CLOEXEC...
+			 */
 			xmove_fd(ctrl, STDIN_FILENO);
 			xdup2(STDIN_FILENO, STDOUT_FILENO);
 			/* manpages of inetd I managed to find either say
 			 * that stderr is also redirected to the network,
 			 * or do not talk about redirection at all (!) */
-			xdup2(STDIN_FILENO, STDERR_FILENO);
-			/* NB: among others, this loop closes listening socket
+			if (!sep->se_wait) /* only for usual "tcp nowait" */
+				xdup2(STDIN_FILENO, STDERR_FILENO);
+			/* NB: among others, this loop closes listening sockets
 			 * for nowait stream children */
 			for (sep2 = serv_list; sep2; sep2 = sep2->se_next)
-				maybe_close(sep2->se_fd);
+				if (sep2->se_fd != ctrl)
+					maybe_close(sep2->se_fd);
 			sigaction_set(SIGPIPE, &saved_pipe_handler);
 			restore_sigmask(&omask);
 			BB_EXECVP(sep->se_program, sep->se_argv);
+0 −11
Original line number Diff line number Diff line
diff -urpN busybox-1.15.0/modutils/modprobe-small.c busybox-1.15.0-modprobe/modutils/modprobe-small.c
--- busybox-1.15.0/modutils/modprobe-small.c	2009-08-21 00:26:14.000000000 +0200
+++ busybox-1.15.0-modprobe/modutils/modprobe-small.c	2009-09-07 02:43:01.000000000 +0200
@@ -218,6 +218,7 @@ static void parse_module(module_info *in
 	bksp(); /* remove last ' ' */
 	appendc('\0');
 	info->aliases = copy_stringbuf();
+	replace(info->aliases, '-', '_');
 
 	/* "dependency1 depandency2" */
 	reset_stringbuf();
Loading