Even then, chcon may still be useful.
[bug introduced in coreutils-8.0]
+ env -u A=B now fails, rather than silently adding A to the
+ environment. [the bug dates back to the initial implementation]
+
md5sum now prints checksums atomically so that concurrent
processes will not intersperse their output.
This also affected sum, sha1sum, sha224sum, sha384sum and sha512sum.
#include "system.h"
#include "error.h"
+#include "quote.h"
/* The official name of this program (e.g., no `g' prefix). */
#define PROGRAM_NAME "env"
optind = 0; /* Force GNU getopt to re-initialize. */
while ((optc = getopt_long (argc, argv, "+iu:", longopts, NULL)) != -1)
- if (optc == 'u')
- putenv (optarg); /* Requires GNU putenv. */
+ if (optc == 'u' && unsetenv (optarg))
+ error (EXIT_CANCELED, errno, _("cannot unset %s"), quote (optarg));
if (optind < argc && STREQ (argv[optind], "-"))
++optind;
while (optind < argc && strchr (argv[optind], '='))
- putenv (argv[optind++]);
+ if (putenv (argv[optind++]))
+ {
+ char *name = argv[optind - 1];
+ *(strchr (name, '=')) = '\0';
+ error (EXIT_CANCELED, errno, _("cannot set %s"), quote (name));
+ }
/* If no program is specified, print the environment and exit. */
if (argc <= optind)
test $? = 2 || fail=2
env . # invalid command
test $? = 126 || fail=1
-env ... # no such command
+env no_such # no such command
test $? = 127 || fail=1
# Cygwin requires a minimal environment to launch new processes, so a
# test "x`env c=d echo fail`" = xfail || fail=1
# test "x`env -- c=d echo fail`" = xpass || fail=1
-# FIXME - decide whether we like this behavior
-# test `env -i -u a=b` = a=b || fail=1
-# env -u '' true || fail=1
+# catch unsetenv failure, broken through coreutils 8.0
+env -u a=b true && fail=1
+test $? = 125 || fail=1
+env -u '' true && fail=1
+test $? = 125 || fail=1
Exit $fail