Bug 14405

Summary: Currently running task's carriage return disabled at specified situation. Is there any workaround?
Product: [Build System, Metadata & Runtime] BitBake Reporter: kouheiaoki
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: Undecided CC: JPEWhacker, poky.bs.watcher, poky.watcher, randy.macleod
Version: unspecified   
Target Milestone: ---   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description kouheiaoki 2021-05-22 01:06:24 UTC
I'd like to get maximum used thread number,
so I guess bitbake showing log is useful for me,
but I have a trouble on getting bitbake log output.
Could you tell me workaround of this?

I executed the script below.
I use a docker container based Ubuntu16.04 for bitbake.
I'd like to run bitbake as a general user(not root user) in the container.

sudo docker run --rm -v /work:/work -it -w /work vaddio/yocto-16.04:16.04-latest /bin/bash -c "adduser --disabled-password --gecos \"\" general && \
su general <<EOF
cd /work/poky
. oe-init-build-env
time bitbake core-image-minimal
EOF"

And I got the output below.
This seems CR(Carriage return) is disabled.

NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
NOTE: Running task 79 of 2470 (virtual:native:/work/poky/meta/recipes-support/gmp/gmp_6.1.2.bb:do_configure)
NOTE: Running task 100 of 2470 (virtual:native:/work/poky/meta/recipes-devtools/bison/bison_3.0.4.bb:do_configure)
NOTE: Running task 120 of 2470 (virtual:native:/work/poky/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb:do_configure)
NOTE: Running task 228 of 2470 (virtual:native:/work/poky/meta/recipes-core/gettext/gettext_0.19.8.1.bb:do_configure)
NOTE: Running task 249 of 2470 (virtual:native:/work/poky/meta/recipes-support/db/db_5.3.28.bb:do_configure)
NOTE: Running task 278 of 2470 (virtual:native:/work/poky/meta/recipes-devtools/file/file_5.31.bb:do_configure)
NOTE: Running task 284 of 2470 (virtual:native:/work/poky/meta/recipes-support/nspr/nspr_4.16.bb:do_compile)
NOTE: Running task 286 of 2470 (virtual:native:/work/poky/meta/recipes-support/popt/popt_1.16.bb:do_configure)
NOTE: recipe gmp-native-6.1.2-r0: task do_configure: Started
NOTE: recipe pkgconfig-native-0.29.2+gitAUTOINC+edf8e6f0ea-r0: task do_configure: Started
NOTE: recipe bison-native-3.0.4-r0: task do_configure: Started

I expect the output like below.
Currently running task number on the top and running tasks on the bottom.

Initialising tasks: 100% |###############################################################################| Time: 0:00:03
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
Currently  8 running tasks (574 of 2470)  23% |################                                                        |
0: bison-native-3.0.4-r0 do_configure - 6s (pid 129)
1: pkgconfig-native-0.29.2+gitAUTOINC+edf8e6f0ea-r0 do_configure - 6s (pid 130)
2: gettext-native-0.19.8.1-r0 do_configure - 6s (pid 131)
3: cross-localedef-native-2.26-r0 do_configure - 5s (pid 136)
4: shadow-native-4.2.1-r0 do_configure - 5s (pid 132)
5: gdbm-native-1.13-r0 do_configure - 5s (pid 142)
6: perl-5.24.1-r0 do_patch - 3s (pid 2185)
7: mpfr-native-3.1.5-r0 do_configure - 0s (pid 757

When I typed commands below manually, I got the output above.

sudo docker run --rm -v /work:/work -it -w /work vaddio/yocto-16.04:16.04-latest /bin/bash
adduser --disabled-password --gecos "" general
su general
cd /work/poky
. oe-init-build-env
time bitbake core-image-minimal
Comment 1 Randy MacLeod 2021-05-27 14:53:02 UTC
bitbake is trying to figure out if it's being run interactively.
You can figure out what is causing the confusion in your container.

The problem could be fixed by piping output to 'cat' but that doesn't address your request.
Comment 2 Joshua Watt 2021-05-27 14:56:00 UTC
bitbake is doing what it is supposed to in this case. Because you are using a HEREDOC to pipe a script into su, it's running as a non-interactive shell, which causes bitbake to show the "non-interactive" output (this is not a bug, it's on purpose for e.g. when scripting). When you run the commands manually, you're running them from an interactive shell, which makes bitbake show the interactive shell output (e.g. progress bars).