Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collation of stdout and stderr from a Plugin can Result in Output Corruption #246

Open
rmartin16 opened this issue Mar 20, 2023 · 2 comments

Comments

@rmartin16
Copy link

rmartin16 commented Mar 20, 2023

While using the GTK plugin, I found that the collation of stdout and stderr from the plugin can result in output corruption.

  1. The ordering of output between stdout and stderr may not be maintained.
    This is probably (at least in part) due to some levels of buffering but it's especially confusing when the plugin is a bash script with set -x applied; stderr will contain the commands being run and stdout will contain the output....but they aren't synced so it's difficult to follow what's happening.

  2. stdout can be interrupted by stderr and vice versa
    In the middle of a line of output from either stream, output from the other stream can start. I imagine this derives from printing output before an entire line is available to print; therefore, for example, part of stdout can be printed and the next output available to print is from stderr.

  3. Multibyte UTF-8 characters can be split
    This is an especially bad version of number 2. When enough multibyte characters are included in the output....one of them is eventually split in half creating issues for consumers trying to decode stdout from linuxdeploy as UTF-8.

@TheAssassin
Copy link
Member

TheAssassin commented Dec 5, 2023

I don't quite understand your problem. You mention you use a fork in your other issue. Are you sure it's linuxdeploy that is to blame? Also, I guess I need to see a log.

@rmartin16
Copy link
Author

Thanks for following up; I was able to replicate the same issue and dug a bit deeper.

linuxdeploy command:

PATH="/home/russell/.cache/briefcase/tools/linuxdeploy_plugins/gtk:$PATH" \
ARCH=x86_64 \
APPIMAGE_EXTRACT_AND_RUN=1 \
DISABLE_COPYRIGHT_FILES_DEPLOYMENT=1 \
LINUXDEPLOY_OUTPUT_VERSION=0.0.1 \
DEPLOY_GTK_VERSION=3 \
DEBUG=1 \
/home/russell/.cache/briefcase/tools/linuxdeploy-x86_64.AppImage \
	-v0 \
	--output appimage \
	--appdir '/home/russell/tmp/beeware/helloworld/build/helloworld/linux/appimage/Hello World.AppDir' \
	--desktop-file '/home/russell/tmp/beeware/helloworld/build/helloworld/linux/appimage/Hello World.AppDir/com.example.helloworld.desktop' \
	--deploy-deps-only '/home/russell/tmp/beeware/helloworld/build/helloworld/linux/appimage/Hello World.AppDir/usr/app_packages/cairo' \
	--deploy-deps-only '/home/russell/tmp/beeware/helloworld/build/helloworld/linux/appimage/Hello World.AppDir/usr/app_packages/gi' \
	--deploy-deps-only '/home/russell/tmp/beeware/helloworld/build/helloworld/linux/appimage/Hello World.AppDir/usr/lib' \
	--deploy-deps-only '/home/russell/tmp/beeware/helloworld/build/helloworld/linux/appimage/Hello World.AppDir/usr/lib/gdk-pixbuf-2.0/2.10.0/loaders' \
	--deploy-deps-only '/home/russell/tmp/beeware/helloworld/build/helloworld/linux/appimage/Hello World.AppDir/usr/lib/gtk-3.0/3.0.0/immodules' \
	--deploy-deps-only '/home/russell/tmp/beeware/helloworld/build/helloworld/linux/appimage/Hello World.AppDir/usr/lib/gtk-3.0/3.0.0/printbackends' \
	--deploy-deps-only '/home/russell/tmp/beeware/helloworld/build/helloworld/linux/appimage/Hello World.AppDir/usr/lib/gtk-3.0/modules' \
	--deploy-deps-only '/home/russell/tmp/beeware/helloworld/build/helloworld/linux/appimage/Hello World.AppDir/usr/python/lib' \
	--deploy-deps-only '/home/russell/tmp/beeware/helloworld/build/helloworld/linux/appimage/Hello World.AppDir/usr/python/lib/python3.10/lib-dynload' \
	--plugin gtk \
> build.log

build.log

Searching for gtk/stderr in that log file will show output from stdout and stderr being ostensibly clobbered together.

While my environment will likely be difficult to recreate without using BeeWare's Briefcase directly....I doubt it is of consequence and any use of the GTK plugin with similar settings is likely to re-create this issue.

This is using the latest version of linuxdeploy-plugin-gtk.sh: https://github.com/linuxdeploy/linuxdeploy-plugin-gtk/blob/3b67a1d1c1b0c8268f57f2bce40fe2d33d409cea/linuxdeploy-plugin-gtk.sh

linuxdeploy version:

linuxdeploy version 1-alpha (git commit ID 6a583d5), GitHub actions build 197 built on 2023-12-01 01:07:06 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants