-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change xxd dependency from hard to soft #181
Conversation
4226ba8
to
054adb3
Compare
I would very much like to remove the dependency on However For example, the I'm interested in exploring alternatives and the To that end, can you describe in more detail what the |
That's really good to know. I now tested locally with 3.3.1 and got these failing:
But since the tests are not properly sandboxed, I checked out master (at af3bb46 ) and ran the tests again, only to find the exact same tests failing... Which tests are failing on your side?
π― And how do you suggest we reach enough certainty then? Run more granular matrix tests with different arch/openssl/etc versions? Which would those be? |
I don't know if there's wider support for the longer but maybe more common usage with 2 capture groups: printf interprets the escape sequences into binary |
The problem on MacOS seems to be that $ echo -n "deadbeaf00000bad" | sed "s/../\\\\x&/g"
\xde\xad\xbe\xaf\x00\x00\x0b\xad%
$ echo -n "deadbeaf00000bad" | sed "s/../\\\\x&/g" | xargs -0 printf '%b'
xdexadxbexafx00x00x0bxad% This happens on MacOS for shell versions:
Other times I have looked into an alternative to |
Bingo! My printf is the GNU version from homebrew's coreutils, not the macos /usr/bin/printf. I confirm. Same with Github is not showing anymore the pre-git-push-force commits (runs here), but I was also aiming for a bash-only solution based on https://stackoverflow.com/questions/42828273/bash-hex-to-ascii-is-possible-without-xxd-or-perl/42828523#42828523. Couldn't get it to work, but I bet the problem is between the chair and the keyboard (actually now that I tested I did also look into https://stackoverflow.com/questions/4614775/converting-hex-to-decimal-in-awk-or-sed After lots of trial and error, I cannot get a success run. Even my friends Google and ChatGPT are dry. Could we say that we have a bash function that works with a case statement checking if xxd is available, uses that, checks if perl is available, uses that, otherwise checks if sed+printf are reliable and uses that, otherwise it errors ? That would still mean that in a lot of cases xxd is not needed. Maybe we don't even need perl. Check if sed+printf (actually only printf or even echo) is reliable to convert PS: |
8fb82db
to
82fa2fe
Compare
82fa2fe
to
29ee59f
Compare
@jmurty See the new changeset |
β¦rintf` or `perl` instead commit e514010 Author: James Murty <[email protected]> Date: Sun Oct 6 22:52:33 2024 +1100 Tweaks Remove hard dependency on `xxd` which is often a heavy requirement because it is only available with Vim on some platforms. Fall back to using `printf` (provided it has full %b support) or `perl` when either of these are available, and only require that `xxd` be installed and available when that is the only viable option. Adapted from #181. Thanks @andreineculau!
I really like this approach, thanks! I've merged it to Encryption speed is a real casualty of our need to force OpenSSL 3+ to include the |
β¦rintf` or `perl` instead Remove hard dependency on `xxd` which is often a heavy requirement because it is only available with Vim on some platforms. Fall back to using `printf` (provided it has full %b support) or `perl` when either of these are available, and only require that `xxd` be installed and available when that is the only viable option. Adapted from #181. Thanks @andreineculau!
@jmurty I can't help but take notice that this approach of incorporating a PR is akin to appropriating intellectual property! A human error for sure (and one that can be corrected as well!) but such practices have no place in the OSS world built on contributions and attributions. I do not take offence, but I want to clearly delimit myself from such practices. |
Hi @andreineculau I'm truly sorry, I didn't mean to take your contribution in an underhand way. I'm happy to remedy this in whatever way you think best. I would like to keep the final merge/commit to |
Hi @andreineculau I have reset the How would you like me to merge this PR? Would a "Squash and merge" done with the button in GitHub be okay, or would you prefer a different approach? |
Hey @jmurty ! I really had no intention to cause this much fuss. I should have been clearer it's about doing different next time π That said, now I feel I need to bring myself up to meet you. I don't know if there are other techniques, but here's 4 alternatives to take a PR "home" in a quick fashion i.e. without holding a contributor's hand
Squash/fixup is an orthogonal matter - locally or in the github UI, you can choose to have 1 commit/PR. One could argue that the history is part of the contribution, but if we are to think of "accepting a changeset", than how the changeset is delivered - in 1 or 100 commits - is secondary. All of the above alternatives attribute the changeset to the author=contributor, while ticking boxes like: squash and move fast. Apologies if I came in hard, but again it's not about this PR. You didn't need to revert etc. |
Hi @andreineculau it's not really a fuss, I just want to get this right. This project and I have benefitted a lot from your contributions over the years, I don't want to spoil that. I have now squash-merged using GitHub's button. My mistake was not realising β or noticing β that doing a squash merge of this PR branch locally using the git CLI made me the author of the entire commit, not just its committer. As I've now learned, if you squash merge using the CLI you need to then follow up with a The GitHub button does a much better job of keeping attribution for squash merges, and also knows that the PR itself has been merged, so that's the smart option. |
xxd is a dependency for openssl 3+ environments,
but xxd is packaged with vim,
which basically translates to
"transcrypt has a dependency on vim" ππ€¦ββοΈ
In order to keep the dependencies slim, and vim is not slim,
here's an attempt to replace xxd with sed and xargs.
Alternatively, perl also seems to work
perl -pe "s/([0-9A-Fa-f]{2})/chr(hex(\$1))/eg"
instead ofxxd -r -p
. Maybe there are other/better ways.sed+xargs, and even perl, are much more easily available, if not readily available, than xxd (vim). Think automation (CI/CD, docker) - you don't install a full-blown editor, but if you need to decrypt with transcrypt, currently you need to install one...
NOTE I am not π― sure this is safe and that there's no edge cases, but it looks alright e.g.