soimort / translate-shell

:speech_balloon: Command-line translator using Google Translate, Bing Translator, Yandex.Translate, etc.
https://www.soimort.org/translate-shell
The Unlicense
7k stars 392 forks source link

gawk: fatal: can't open source file `/dev/fd/63' for reading (No such file or directory) #516

Closed Baltazar500 closed 6 months ago

Baltazar500 commented 7 months ago

trans does not work and gives the error "gawk: fatal: can't open source file `/dev/fd/63' for reading (No such file or directory)" for any switch. Android (4.2) via ssh (dropbear) from entware. gawk (4.2.0) from entware

-bash-4.4# trans --help
gawk: fatal: can't open source file `/dev/fd/63' for reading (No such file or directory)
-bash-4.4# trans -V
gawk: fatal: can't open source file `/dev/fd/63' for reading (No such file or directory)
-bash-4.4# gawk -V
GNU Awk 4.2.0, API: 2.0
Copyright (C) 1989, 1991-2017 Free Software Foundation.

Under bash debugging :

gawk -f <(echo -E "$TRANS_PROGRAM") - "$@"
+ gawk -f /dev/fd/63 -
echo -E "$TRANS_PROGRAM"
gawk: fatal: can't open source file `/dev/fd/63' for reading (No such file or directory)
soimort commented 7 months ago

This seems like a similar bug to #463, but I'm not sure if trans is even compatible with the Entware port of gawk at all. The only thing I can guarantee is it works with the Termux repository.

Can you first upgrade to gawk 5.2.1 and see if you can reproduce the bug?

Baltazar500 commented 7 months ago

This seems like a similar bug to https://github.com/soimort/translate-shell/issues/463, but I'm not sure if trans is even compatible with the Entware port of gawk at all. The only thing I can guarantee is it works with the Termux repository.

Is this really a old gawk problem? Under an old x32 system with debian/antix and gawk 4.0.1 trans works without problems :)

gawk -V
GNU Awk 4.0.1
Copyright (C) 1989, 1991-2012 Free Software Foundation.

Under bash debugging :

gawk -f <(echo -E "$TRANS_PROGRAM") - "$@"
+ gawk -f /dev/fd/63 - --help
echo -E "$TRANS_PROGRAM"
++ echo -E 'BEGIN {

Can you first upgrade to gawk 5.2.1 and see if you can reproduce the bug?

Termux was not released under API level 17 (Android 4.2), I will have to find a static gawk arm binary (but I don’t know where yet) :/

soimort commented 7 months ago

Is this really a old gawk problem? Under an old x32 system with debian/antix and gawk 4.0.1 trans works without problems :)

I'm pretty sure it works on x32 / 64 platforms with gawk 4.0 or later (except for 5.2.0, which is known to be buggy). But for Android, I do not know. It looks like this particular port of gawk is not fully POSIX compatible -- could be some limitation I don't know of.

Termux was not released under API level 17 (Android 4.2), I will have to find a static gawk arm binary (but I don’t know where yet) :/

Probably you could cross-compile gawk for your Android? Otherwise I'd say it's a good time to retire that device (even Google itself stopped supporting Android 4.2 since 2021; I see no reason to support it either). Sometimes you just let old things go.

Baltazar500 commented 7 months ago

I'm pretty sure it works on x32 / 64 platforms with gawk 4.0 or later (except for 5.2.0, which is known to be buggy). But for Android, I do not know. It looks like this particular port of gawk is not fully POSIX compatible -- could be some limitation I don't know of.

I used the binary https://github.com/Zackptg5/Cross-Compiled-Binaries-Android/raw/master/gawk/gawk-arm (5.3.0) replacing gawk from entware and got the same thing

-bash-4.4# trans --help
gawk: fatal: cannot open source file `/dev/fd/63' for reading: No such file or directory
gawk -V
GNU Awk 5.3.0, API 4.0
Copyright (C) 1989, 1991-2023 Free Software Foundation.

Maybe it's not gawk's fault? Something other ?

Probably you could cross-compile gawk for your Android? Otherwise I'd say it's a good time to retire that device (even Google itself stopped supporting Android 4.2 since 2021; I see no reason to support it either). Sometimes you just let old things go.

It’s enough to use the shell, surf a number of sites and watch videos))) And I don’t need more)))

soimort commented 7 months ago

Maybe it's not gawk's fault? Something other ?

It could be bash-4.4 that is causing the problem. There are two alternative ways of running trans without the bash wrapper, but you need to git clone the whole repository first:

./translate -V

gawk -f translate.awk -- -V

Can you try these and report the result?

soimort commented 7 months ago

I've also found this answer might be relevant: https://askubuntu.com/questions/1086617/dev-fd-63-no-such-file-or-directory . TL;DR, don't use it under the root user.