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

Randomly shortcut to bash script produces blank screen #48

Open
brushless-glitch opened this issue Jan 21, 2021 · 10 comments
Open

Randomly shortcut to bash script produces blank screen #48

brushless-glitch opened this issue Jan 21, 2021 · 10 comments

Comments

@brushless-glitch
Copy link

brushless-glitch commented Jan 21, 2021

Android version: 9

Problem description
Randomly when I start bash script via shortcut, no script is run, but I am getting a blank screen.

I can type into said screen, but no reaction comes out of it. Ctrl+C, Ctrl+D, Ctrl+Z have no efect

Another session can be manually started and works normal

ps -e -F --forest produces following:

UID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD
u0_a233  30463  2968  0 980508 2572   0  1970 ?        00:00:00 com.termux.widget
u0_a233  29691  2968  0 990946 89808  2  1970 ?        00:00:03 com.termux
u0_a233  29953 29691  0 984302 22420  5  1970 ?        00:00:00  \_ com.termux
u0_a233  29975 29691  0  3018  4204   2  1970 pts/1    00:00:00  \_ /data/data/com.termux/files/usr/bin/bash -l
u0_a233  25360  2968  0 980888 18316  1  1970 ?        00:00:00 com.termux.tasker:background

PID 29953 is the process which was supposed to be a script. It is possible to kill the process and that would be shown in termux UI.

ps -e -F H reveals that 29953 has only one thread:

u0_a233  29953 29691  0 984302 22420  5  1970 ?        S<     0:00 com.termux

Steps to reproduce

  • Install termux + shortcut app
  • Create a shortcut on an android desktop to a bash script, can be anything (like: echo "hello world")
  • Start shortcut
  • Randomly observe blank screen

Expected behavior

script runs always

Additional information

Such problem happens randomly about 1 times out of 10; but only after device comes from idle. After 1st blank screen, the scripts are all starting up normally until device goes idle. Typically happens after device is idle for more than an hour. I have not found the way to reproduce the issue reliably.

I have seen this problem with previous versions as well

  • Termux application version: 0.101
  • Android OS version: 9
  • Device model: lg v35 lmv350ulm
@Grimler91
Copy link
Member

Does it work better if you add a shebang to the script, i.e #!/data/data/com.termux/files/usr/bin/bash? If you don't specify it then it is probably using /system/bin/sh, which might be broken for all termux knows

@brushless-glitch
Copy link
Author

brushless-glitch commented Jan 22, 2021

Does it work better if you add a shebang to the script, i.e #!/data/data/com.termux/files/usr/bin/bash? If you don't specify it then it is probably using /system/bin/sh, which might be broken for all termux knows

Script in question does have a shebang #!/bin/bash, however same issue happens once in a while even when I launch termux itself (e.g.: application, not a script shortcut): blank screen, no typical "Welcome to Termux!...", can type characters into window, no actual response. Killing this session fixes the problem

@ghost
Copy link

ghost commented Jan 22, 2021

By default, widget session is immediately terminated. Use statement sleep 10 or read -p "press enter" (last line in script) if you want script to wait until user intervention.

@ghost ghost closed this as completed Jan 22, 2021
@brushless-glitch
Copy link
Author

@xeffyr I believe you didn't understand the essence of a problem. There is no point putting anything in script. Nothing is actually launched. There seems to be some sort of a race condition that prevents session from starting

@ghost
Copy link

ghost commented Jan 22, 2021

@brushless-glitch What exactly you have? Session is immediately auto-closed/not-shown, or it is kept opened but nothing is printed?

@brushless-glitch
Copy link
Author

@brushless-glitch What exactly you have? Session is immediately auto-closed/not-shown, or it is kept opened but nothing is printed?

  • black screen, nothing on it
  • I can type characters into screen, they will echo but cause no meaningful reaction
  • Ctrl+C, Crrl+Z, Ctrl+D cause no effect
  • session is for all intents and purposes unusable
  • running second session works fine and using 2nd session I have produced some data for you to examine if you read original post

@ghost
Copy link

ghost commented Jan 22, 2021

Ok, re-opening.

@ghost ghost reopened this Jan 22, 2021
@Grimler91
Copy link
Member

Sidenote: #!/bin/bash does not work with termux-widget and termux-boot, libtermux-exec.so is not preloaded for the addon apps so the automatic translation #!/bin/bash -> #!/data/data/com.termux/files/usr/bin/bash does not happen. Not the reason for your issue but good to know.

@brushless-glitch
Copy link
Author

@xeffyr I am open to helping you debug the issue. It happens from time to time, and as I said, I can open 2nd session and poke the process which failed to start. My phone is not rooted, so I can't do everything, but I can do some limited debugging

@agnostic-apollo
Copy link
Member

agnostic-apollo commented Sep 22, 2021

Please confirm if its working for currently latest Termux app versions v0.117 as well, otherwise issue can be closed. You can install from F-Droid, check https://github.com/termux/termux-app#Installation.

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

3 participants