termux-tasker icon indicating copy to clipboard operation
termux-tasker copied to clipboard

Working directory doesn't seem to work if there are spaces in the name

Open unalignedcoder opened this issue 1 year ago • 0 comments

Problem description

When there are spaces in the working directory, the action fails silently. When the same command is ran in Termux, everything works fine.

Steps to reproduce

  • Install zip package
  • From a MacroDroid macro, call the Termux plugin
  • Point to the zip executable in the bin directory: /data/data/com.termux/files/usr/bin/zip
  • add the following arguments: -u Archive.zip *.txt or -c Archive.zip *.txt
  • In the Working directory path, add a path with spaces, such as: /storage/emulated/0/Android/media/com.seafile.seadroid2/Seafile/[email protected] (domain.com)/archives

As such, the script fails silently. No stdout not stderr

If I add quotes around the space name, such as this: /storage/emulated/0/Android/media/com.seafile.seadroid2/Seafile/'[email protected] (domain.com)'/archives Termux-tasker warns "The working directory not found at path". Same if I include escape characters, such as: /storage/emulated/0/Android/media/com.seafile.seadroid2/Seafile/\'[email protected] (domain.com)\'/archives

If I ignore the warning and save the action, the action fails with this stdout: zip warning Archive.zip not found or empty zip warning: name not matched: *.txt

However, the files are there. In fact, if I try this in Termux, by doing: cd /storage/emulated/0/Android/media/com.seafile.seadroid2/Seafile/'[email protected] (domain.com)'/archives (notice the quotes around the part of the name with spaces) and then: zip -u Archive.zip *.txt

everything works correctly. The zip file is updated.

As far as I can tell, permissions are correctly set.

Expected Behavior Unless this is caused by a different issue altogether, I expect Termux-tasker to handle spaces in names on its own, or to understand the standard use of single quotes around the parts with spaces.

Additional information

  • Termux application version: 0.118.0
  • Android OS version: 10
  • Device model: Ulefone 9

unalignedcoder avatar Feb 27 '23 08:02 unalignedcoder