quoted null as the expansion of "$@", note that we saw it, but still
add a quoted null into the result string instead of short-circuiting.
Part of fix for bug report from Grisha Levit <grishalevit@gmail.com>
+
+ 3/1
+ ---
+examples/loadables/fdflags.c
+ - O_CLOEXEC: instead of not using it, synthesize a definition for it
+ from unused bits in the file status word. It's only used as a
+ placeholder anyway. Fix from code by Robert Elz <kre@bmunnari.oz.au>
+
+execute_cmd.c
+ - execute_connection: call optimize_fork on the rhs of a `;' connection
+ to attempt to optimize the last simple command in a list
isnum2()
{
case "$1" in
- '[-+]' | '') return 1;; # empty or bare `-' or `+'
+ [-+] | '') return 1;; # empty or bare `-' or `+'
[-+]*[!0-9]*) return 1;; # non-digit with leading sign
[-+]*) return 0;; # OK
*[!0-9]*) return 1;; # non-digit
shcat()
{
- while read -r line
+ while IFS= read -r line
do
echo "$line"
done
shcat()
{
- while read -r line
+ while read -r
do
- echo "$line"
+ echo "$REPLY"
done
}
#include "loadables.h"
+#ifndef FD_CLOEXEC
+# define FD_CLOEXEC 1
+#endif
+
static const struct
{
const char *name;
{
#ifdef O_APPEND
{ "append", O_APPEND },
+#else
+# define O_APPEND 0
#endif
#ifdef O_ASYNC
{ "async", O_ASYNC },
+#else
+# define O_ASYNC 0
#endif
#ifdef O_SYNC
{ "sync", O_SYNC },
+#else
+# define O_SYNC 0
#endif
#ifdef O_NONBLOCK
{ "nonblock", O_NONBLOCK },
+#else
+# define O_NONBLOCK 0
#endif
#ifdef O_FSYNC
{ "fsync", O_FSYNC },
+#else
+# define O_FSYNC 0
#endif
#ifdef O_DSYNC
{ "dsync", O_DSYNC },
+#else
+# define O_DSYNC 0
#endif
#ifdef O_RSYNC
{ "rsync", O_RSYNC },
+#else
+# define O_RSYNC 0
#endif
#ifdef O_ALT_IO
{ "altio", O_ALT_IO },
+#else
+# define O_ALT_IO 0
#endif
#ifdef O_DIRECT
{ "direct", O_DIRECT },
+#else
+# define O_DIRECT 0
#endif
#ifdef O_NOATIME
{ "noatime", O_NOATIME },
+#else
+# define O_NOATIME 0
#endif
#ifdef O_NOSIGPIPE
{ "nosigpipe", O_NOSIGPIPE },
+#else
+# define O_NOSIGPIPE 0
#endif
+
+#ifndef O_CLOEXEC
+# define ALLFLAGS (O_APPEND|O_ASYNC|O_SYNC|O_NONBLOCK|O_FSYNC|O_DSYNC|\
+ O_RSYNC|O_ALT_IO|O_DIRECT|O_NOATIME|O_NOSIGPIPE)
+
+/* An unsed bit in the file status flags word we can use to pass around the
+ state of close-on-exec. */
+# define O_CLOEXEC ((~ALLFLAGS) ^ ((~ALLFLAGS) & ((~ALLFLAGS) - 1)))
+#endif
+
#ifdef O_CLOEXEC
{ "cloexec", O_CLOEXEC },
#endif
return -1;
}
-#ifdef O_CLOEXEC
if (c)
f |= O_CLOEXEC;
-#endif
return f & getallflags();
}
parseflags(v, &pos, &neg);
cloexec = -1;
-#ifdef O_CLOEXEC
+
if ((pos & O_CLOEXEC) && (f & O_CLOEXEC) == 0)
cloexec = FD_CLOEXEC;
if ((neg & O_CLOEXEC) && (f & O_CLOEXEC))
cloexec = 0;
-#endif
+
if (cloexec != -1 && fcntl(fd, F_SETFD, cloexec) == -1)
builtin_error("can't set status for fd %d: %s", fd, strerror(errno));
-#ifdef O_CLOEXEC
pos &= ~O_CLOEXEC;
neg &= ~O_CLOEXEC;
f &= ~O_CLOEXEC;
-#endif
n = f;
n |= pos;
QUIT;
execute_command (command->value.Connection->first);
QUIT;
+ optimize_fork (command); /* XXX */
exec_result = execute_command_internal (command->value.Connection->second,
asynchronous, pipe_in, pipe_out,
fds_to_close);
if (builtin_is_special)
special_builtin_failed = 1; /* XXX - take command builtin into account? */
}
-
/* In POSIX mode, if there are assignment statements preceding
a special builtin, they persist after the builtin
completes. */
-BUILD_DIR=/usr/local/build/bash/bash-current
+BUILD_DIR=/usr/local/build/chet/bash/bash-current
THIS_SH=$BUILD_DIR/bash
PATH=$PATH:$BUILD_DIR
4
4
3
+argv[1] = <^?>
+argv[1] = <^?>
+argv[1] = <^?>
+argv[1] = <^?>
+argv[1] = <^?>
+argv[1] = <^?>
n ${x+"$@" "$@"}
n "$@" "$@"
n "$@""$@"
+
+# new tests
+unset -v x
+v=$'\177'
+
+recho ''$'\177'''
+recho $'\177'''
+recho ''$'\177'
+
+recho ''$v''
+recho ''$v
+recho $v''