Open cargilcm opened 2 weeks ago
without putting on my code inspector goggles my first guess is that the yd command calls a function that uses tiocsti like the exit with CD operation does
This is a pretty large-size screenshot image, but termux-clipboard-set could be a potential workaround for such a function call in the termux environment depending on what other packages are used and how. I'm glad if I can write some code to this end to help out
Thanks for the catch! I forgot to add that, here's the fix: https://github.com/GiorgosXou/TUIFIManager/commit/a4f79922fc9c47ff0d691acfabbab3ea087a6eb2
(Additional info for anyone coming across this issue, you do also need to install this and pkg install termux-api
)
The top most call in the execution stack is logged below: File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/TUIFIManager/TUItilities.py", line 49, in put_text_back_into_terminal_input_buffer for c in text: ioctl(1, TIOCSTI, c) ^^^^^^^^^^^^^^^^^^^^ PermissionError: [Errno 13] Permission denied
Yes, that's a trick only available for root devices, but I just found that it might be possible via this way https://github.com/gokcehan/lf/issues/140#issuecomment-464910159, too. Once I find the time I'll see what I can do, but...
I'm glad if I can write some code to this end to help out
... feel free to do so, if you like.
Awesome, I love tuifi and I especially love your passion for programming and keeping others on the up with your attention to their input etc
Thank you, Giorgios, really..as to the lf program's scripts I think this is what can be hoped for alternative to iocntl because I learned to you can't set environment variables that persist beyond the life of the process(& subprocesses) in Python so yes you have to do some bash scripting (and to tweak possibly main.py so that after endwin it prints os.getcwd() or maybe the selected file? I'll upload some code and share what I use for "-last-directory" with the autojump program.
Thank You, Giorgos
Instaed of tweaking main.py
I guess you could replace:
https://github.com/GiorgosXou/TUIFIManager/blob/a4f79922fc9c47ff0d691acfabbab3ea087a6eb2/TUIFIManager/__init__.py#L637-L638
from:
https://github.com/GiorgosXou/TUIFIManager/blob/a4f79922fc9c47ff0d691acfabbab3ea087a6eb2/TUIFIManager/__init__.py#L636-L642
with what you are trying to do.
Exit with CD function output messes up the terminal prompt display when cntl+e
is executed without root privileges.
It WOULD BE great if there was/is a way to test whether the tuifi program is being executed under root privilege. If you cntl+e
without su'ing before the program or without sudo'ing I would think you should see the behavior I'm describing. Screenshot available if not lol
I have no sysadmin experience but from an article on stack exchange I'd be curious if you can determine whether the process has root privileges by executing subprocess in Python with the command logname and testing for equality to "root"?
Exit with CD function output messes up the terminal prompt display when cntl+e is executed without root privileges.
I know.
It WOULD BE great if there was/is a way to test whether the tuifi program is being executed under root privilege.
There's no need for such a thing. if simply this works https://github.com/gokcehan/lf/issues/140#issuecomment-464910159, I'll ditch the root-trick completly. I just don't have the time to work on it, right now.
Lf's exit with CD directs the session location to the relevant directory but lf is written in go which I had wondered was there something special in the go binaries different from pythons that allowed their program to achieve this. I have some other quirks that are not meeting my needs with the documented behavior or tuifi not playing out as described (non rooted termux issues again I think) but I'll file those under different support tickets, appropriately. I had noticed other tui file managers writing the files to a file and currently that's my only way of knowing how to solve the issue and I had just finished my commit solving that way when I broke my termux by a faulty alias in bashrc back to coding at base level zero lol
Edit: tuifi inside termux when navigating from TERMUX_HOME to shared storage will only get you back to TERMUX_HOME via a previously set marker if you're not rooted ie backspace does not do it
Thanks Giorgos!
Edit: I was feeling frustrated with tuifi not functioning as I thought it would and was able to address some of those eccentricities by fixing a mistake I'd made by reinstalling termux and running pkg up before python setup.py install
Specifications
Android 12 aarch
termux
<!-- alacritty --version -->v.5.0.0
<!-- tuifi --version -->Describe the bug
The top most call in the execution stack is logged below:
File "/data/data/com.termux/files/usr/lib/python3.12/site-packages/TUIFIManager/TUItilities.py", line 49, in put_text_back_into_terminal_input_buffer for c in text: ioctl(1, TIOCSTI, c) ^^^^^^^^^^^^^^^^^^^^ PermissionError: [Errno 13] Permission denied
Additional context
I found a SO post that says the process must have root privileges for ioctl tiocsti operations to succeed. It would be nice if the cd path could be assigned to an variable that bash could call ie:
bash -c cd $cdpath
manually after tuifi exits if ioctl permissions are prohibitive. The error that is thrown by python crashes the terminal tab also so no further text can be displayed when typed after this type of exit. Let me know if you desire to see the whole stack trace from stderr.Thank you