-
Notifications
You must be signed in to change notification settings - Fork 523
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
Rewrite into more POSIX-compliant, portable, robust, composable and readable shell scripts #1908
base: master
Are you sure you want to change the base?
Conversation
prefCleaner works fine for me, however updater doesn't seem to be able to append overrides. |
Seems to be just a broken check? This fixes it and updater seems to work fine now. |
Error in both scripts - you were checking for the literal file named // from
SCRIPT_FILE=$(preadlink "$0") && [ -f SCRIPT_FILE ] || exit 1
// to
SCRIPT_FILE=$(preadlink "$0") && [ -f $SCRIPT_FILE ] || exit 1 and for your missing /bin/sh question - no it doesn't seem to work. |
@9ao9ai9ar Thoughts on using |
The POSIX way to do it is to write a program to overwrite the shebang with the path of |
Hey @9ao9ai9ar @MagicalDrizzle I've noticed that progress on this PR is slowing down, so I'm willing to create a checklist of things to ensure that the script is working properly, and then make a GitHub workflow to test the script on different platforms. Here are some things to be checked:
This will tick the GitHub available runners off the list of things that testers have to check manually. Manual tester can then copy the workflow to test locally. What do you think? An alternative would be splitting this PR into smaller PRs. |
The rewrite focuses on the following five areas of interest: 1. Portability. The scripts should be useable across a number of Unix operating systems and shells; goes hand in hand with POSIX- compliance. 2. Robustness. Fail early; borrow from more battle-tested open source code; pass all valid ShellCheck checks. 3. Composability. Put everything inside functions; make the scripts dot source friendly. 4. Consistency. Abstract away terminal color codes with tput; uniform diagnostic messages and standardized use of status codes and redirections. 5. Readability. Extensive comments and descriptive names; use here- docs to ease writing multiline messages. Known behavioral changes: 1. Changed the way the options are parsed and acted on. For example, when both the -p and -l options of updater.sh are specified, -l will be ignored. The old behavior would depend on the order of the options passed, where the last one wins, and the profile path passed as the argument to -p couldn't be named 'list' or it would be treated as if the option -l was specified. 2. All temporary files are created using mktemp, so users won't find them in the working directory anymore should an error occur and they were not removed as a result of that.
@9ao9ai9ar prefsCleaner works, updater only partly - works only if there's already an user.js file. It won't download a new user.js if doesn't exist, then will try to backup the nonexistent user.js file which fails.
|
Closes #1855 and fixes #1810.
The rewrite is mostly complete, but there are still some parts left to fix, mainly in prefsCleaner.sh. Although currently I have marked the pull request as draft, I consider it structurally stable enough for review. Once I have merged the changes in
9ao9ai9ar:posix-sh-bugfix
, I will mark this pull request as ready for review, or ready to be merged. Unfortunately, I can not tell when that will be, as I:This is not the first POSIX solution to have ever been requested or presented, though certainly the most comprehensive one yet, so I hope this time the pull request really gets merged back to upstream and not closed off due to circumstances.
Target Platforms for Modern Desktop Versions of Firefox
Tier-1
WindowsTier-2
Tier-3
Non-Tiered
POSIX-Compatible Shells
emulate sh
)