termux / termux/termux-api-package

`termux-api` never returns if Android app is not installed

Open
#138 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
1.7k
Forks
523
PR merge metrics
No merged PRs in 30d

Description

Problem description
termux-api never returns if Android app is not installed. And atermux-api even does not report that maybe there is a problem.

Steps to reproduce
Uninstall Termux::API application in Android and try to send it command.

Expected behavior
It should report to stderr that there is a problem while trying to contact application and finish with error code.

Additional information

Application version:
0.117
Packages CPU architecture:
aarch64
Subscribed repositories:
# sources.list
deb https://termux.librehat.com/apt/termux-main/ stable main
# game-repo (sources.list.d/game.list)
deb https://packages.termux.org/apt/termux-games games stable
# science-repo (sources.list.d/science.list)
deb https://packages.termux.org/apt/termux-science science stable
Updatable packages:
All packages up to date
Android version:
11
Kernel build information:
Linux localhost 4.19.87-20970822 #1 SMP PREEMPT Fri Aug 6 19:16:20 KST 2021 aarch64 Android
Device manufacturer:
samsung
Device model:
SM-G780F

Way to fix
You can try poll a socket before trying to accept it. I mean you should start poll with timeout and then react on POLLIN or finish a program with error.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue by uninstalling the Termux:API Android application and invoking a termux-api command. Inspect termux-api.c around line 175 and the socket handling described in the issue; done means the command reports the communication failure to stderr and exits with an error code instead of waiting indefinitely.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, c, shell
Domain
cli, mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.