Skip to content

./tools/dope./sh fails for MacOS #416

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

Open
FranjoMindek opened this issue Apr 11, 2025 · 5 comments
Open

./tools/dope./sh fails for MacOS #416

FranjoMindek opened this issue Apr 11, 2025 · 5 comments
Assignees
Labels
bug Something isn't working question Further information is requested shouldfix

Comments

@FranjoMindek
Copy link

I've followed readme's MacOS instructions for opensaas-sh but running the patch.sh fails when it calls the dope.sh script.

Error message:

patch: unrecognized option `--merge'
usage: patch [-bCcEeflNnRstuv] [-B backup-prefix] [-D symbol] [-d directory]
             [-g vcs-option] [-F max-fuzz] [-i patchfile] [-o out-file]
             [-p strip-count] [-r rej-name] [-T | -Z]
             [-V t | nil | never | none] [-x number] [-Y prefix]
             [-z backup-ext] [--quoting-style style] [--posix]
             [origfile [patchfile]]
       patch <patchfile

[Failed with exit code 1]

On my latests favicon changes PR I'm doing I tried to just remove the flag, it didn't break anything:

        patch_output=$(patch --no-backup-if-mismatch --merge "${DERIVED_DIR}/${derived_filepath}" < "${diff_filepath}")

->

        patch_output=$(patch --no-backup-if-mismatch "${DERIVED_DIR}/${derived_filepath}" < "${diff_filepath}")

Though, that might not be case for all situations.
We need to explore an alternative.

@Martinsos
Copy link
Member

@vincanger uses dope.sh a lot on Mac and had some trouble but fixed it, he will know more probably! Or you should at least compare your setups, to see what is the difference.

@FranjoMindek FranjoMindek added bug Something isn't working question Further information is requested shouldfix labels Apr 16, 2025
@infomiho
Copy link
Collaborator

@FranjoMindek did you follow the README and installed the Mac specific packages? What versions do you have for those packages?

Here are mine:

gpatch --version
GNU patch 2.8
diff -version
diff (GNU diffutils) 3.10
realpath --version
realpath (GNU coreutils) 9.5

@FranjoMindek
Copy link
Author

Yep, followed all of them:

➜  ~ gpatch --version
GNU patch 2.8
➜  ~ diff -version
diff (GNU diffutils) 3.12
➜  ~ realpath --version
realpath (GNU coreutils) 9.7

@infomiho
Copy link
Collaborator

For it broke down as well. I diagnosed it to be because the script didn't pick up my alias defined in .zshrc. I verified that by running patch --version from the script. It said that I'm using the built in patch and not GNU patch.

Doing something like this helped:

PATCH_CMD="patch"
if [[ "$(uname)" == "Darwin" ]]; then
    # We're on macOS, check if gpatch exists
    if command -v gpatch &> /dev/null; then
        PATCH_CMD="gpatch"
    fi
fi

@FranjoMindek
Copy link
Author

Explore a bit and confirmed "Aliases and functions do not propagate to shell scripts. This is by design".
We will need to handle OS differences in the script itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested shouldfix
Projects
None yet
Development

No branches or pull requests

4 participants