POSIX compliant stream redirection #1
No reviewers
Labels
No Label
API CHANGE
BUG
DUPLICATE
ENHANCEMENT
HELP WANTED
IDEA
INVALID
MODDING
QUESTION
REFACTORING
SYNC
TRANSLATION
UPSTREAM
WONTFIX
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: xt-sys/exectos#1
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch ":fix-img-generation-bug"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Avoid background processing for "dash" shell race condition bug.
Purpose
On certain systems a race condition can happen when using & (background).
This is because CMake won't wait until the command finishes as & will just let it run on background and ignore finishing.
Proposed changes
These tweaks
This command is NOT terminated by the control operator '&', so the shell does NOT execute the command in the background in a subshell.
Modified command line contains originally '&>' at the end. This construction redirects STDOUT and STDERR to /dev/null, so that there is no output from 'dd' command shown. Please check manual: https://www.gnu.org/software/bash/manual/bash.html#Redirecting-Standard-Output-and-Standard-Error
You can add
echo "$SHELL"
orps -p $$
somewhere to check if this is really a dash. If it is, then I would check what launches it and think how to prevent that, because XTChain build environment should startup in bash (what you can confirm or deny with same command). It is possible, that CMake spawns dash as it is your default shell.@belliash This is indeed an issue of dash, as the
&>/dev/null
statement isn't POSIX compliant.This is true, the issue is in the target recipe itself.
Some commands in the diskimg target are prepended with
sh -c
, wheresh
is a symlink to another shell binary (dash is the default symlink on Debian-based distributions, whereas Gentoo/Arch have bash linked as default).Possible fixes are to either switch to a POSIX-compliant output redirection (1>/dev/null) or remove the
sh
invokation.This is true as sh is just a symlink to 'some' shell frequently.
This is true again, but I believe this should be
1>/dev/null 2>/dev/null
as&>
redirects both stdout and stderr and the meaning of this PR is to fix disk image creation under dash, not to change script behavior.Tweak disk image creation in qemu.cmaketo POSIX compliant stream redirection744e4e30cc
to4c7d23000e