Closed AliShahabzadeh closed 7 months ago
Darn, I was really hoping we could leave #58 behind. Sigh...
Let's look into this.
Can you remove the stderr suppression and see if it does anything?
Delete 2>/dev/null
and retry your check to ensure execution stops at that precise line.
These are set near the start of amboso_parse_args()
:
target_awk
should expand to awk
bad_awk
should expand to mawk
After removing the specified portion and executing the program, the subsequent line appeared in the output.
awk: unknown option -W ignored
That's a burn. I expected to be able to use -W
to detect the actual version of the program symlinked to awk
on a system, to differenciate between a full awk
(we need some extensions) and mawk
.
If you look at this issue:
Near the bottom it says a version of mawk
which was on another machine and also had problems. Can you try something like:
awk --help
to get which flags you have at your disposalawk --version
to try to print your awk
version. I don't know which syntax the flag should have.When attempting the commands on a Mac M1, I observed that executing awk --help
, awk --h
, and awk -H
did not yield any response. However, awk --version
provided the output:
awk version 20200816
I'll try to look into this soon, I'm halfway through the release of invil
0.2.7
which ports the changes of 2.0.3
. Should provide a patch for this and the included najlo
bugs (see #99) in a couple of days.
Can you provide any more context about the problem? In particular:
bash
version you're usingdarwin
version you're using (or which macOS
release)awk
you're rockingI guess the "fix" is gonna end up being just checking for gawk
directly and bailing when it's missing.
Apparently, the awk
version provided by macOS
only supports --version
, while mawk
only supports -W version
.
See here for reference:
The current check should be fixed and a correct guess should be made. I guess calling gawk
directly may also work... I'll see.
Upon reviewing various developers' experiences, it became apparent to me that they resolved the issue by installing gawk. However, I remain uncertain whether MacOS utilizes a customized iteration of mawk under the guise of awk or employs an alternative version known as nawk.
@AliShahabzadeh We came to the same conclusion. Let me make some clarity:
First of all, this issue related to the new awk
script used to parse stego.lock
was found:
awk -W version
, which was successful on both my machine and the mentioned one. Grepping for "mawk"
in the output was to be used to determine if awk
was actually mawk
.I was assuming macOS
was also shipping mawk
.
Apparently, that's not the case, as macOS
is shipping the so-called one-true awk
. We all bow in respect.
The current issue is that nawk
, mawk
and gawk
don't support a common syntax to print their version.
I updated the title to better distinguish this issue from the other, even though they come out of the same code section, since they have different reasons and a proper fix would necessarily mean handling both nawk
and mawk
properly. Hanging is not an option.
On a side note, I'm still confused at why the line mentioned in the first post (1767) just hangs. A guess:
awk
call is being piped to grep, and the standard error is suppressed. But:
awk
doesn't recognize -W
, and quits with no output.grep
receives nothing and is stuck waiting for inputI'm not really sure if that's what's happening.
Now, onto fixing our issue:
Relying solely on the output grepping was a bad idea from the start, but for now we can just make the check sane (by trying both kind of version flags, checking the results of the command, and resolving which awk
we have).
awk
implementationawk
implementationawk
call to be explicitly for gawk
for the stego.lock
parsing script (the only problematic one, as 99% of the awk
usage in our program is portable)gawk
README
to add gawk
to the list of dependenciesI would start working on this in a few days, but if you want to have a stab at it, please fork and branch with any changes you'd like to contribute. In any case, I should be able to chop this when I have a little time, it's not too hard.
@AliShahabzadeh my tests seem to show that the revised check in 2.0.4
should correctly pick up the needed gawk
implementation for awk
. Furthermore, I updated the README
to better show that we actually need it.
Let me know if the new patch fixed your problem. Closed with the PR, for now.
https://github.com/jgabaut/amboso/blob/9d68d2fb3e80a4bbb17b35a4b0b269c827904d1c/amboso_fn.sh#L1767
The program fails to proceed beyond this point on
MacOS M1
.