← Commit list

54bef2a8e

Denys Vlasenko
Denys Vlasenko
2020-02-20
SUCCESS Duration: 155s

Subject

ash: eval: Fail immediately with redirections errors for simple command

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

shell/ash.c+16 -16
@@ -10253,6 +10253,17 @@ evalcommand(union node *cmd, int flags)
}
status = redirectsafe(cmd->ncmd.redirect, REDIR_PUSH | REDIR_SAVEFD2);
+ if (status) {
+ bail:
+ exitstatus = status;
+
+ /* We have a redirection error. */
+ if (spclbltin > 0)
+ raise_exception(EXERROR);
+
+ goto out;
+ }
+
for (argp = cmd->ncmd.assign; argp; argp = argp->narg.next) {
struct strlist **spp;
@@ -10304,28 +10315,17 @@ evalcommand(union node *cmd, int flags)
) {
find_command(argv[0], &cmdentry, cmd_flag | DO_ERR,
path ? path : pathval());
- if (cmdentry.cmdtype == CMDUNKNOWN) {
- status = 127;
- flush_stdout_stderr();
- goto bail;
- }
- }
-
- if (status) {
- bail:
- exitstatus = status;
-
- /* We have a redirection error. */
- if (spclbltin > 0)
- raise_exception(EXERROR);
-
- goto out;
}
jp = NULL;
/* Execute the command. */
switch (cmdentry.cmdtype) {
+ case CMDUNKNOWN:
+ status = 127;
+ flush_stdout_stderr();
+ goto bail;
+
default: {
#if ENABLE_FEATURE_SH_STANDALONE \
shell/ash_test/ash-redir/redir_exec1.right+0 -1
@@ -1,2 +1 @@
./redir_exec1.tests: line 1: can't create /cant/be/created: nonexistent directory
-First