#131 MacOS intel can't build project
Closed: Fixed by polcak. Opened by tomeryav.

Summary

Executing make debug in MacOS zsh or bash 5.2 terminal doesn't work.

Setup

I am using a MacOS 13.2.1
used standard terminal and also downloaded bash terminal 5.3, building didn't work.

JShelter Version: 0.17

OS: MacOS 13.2.1

How to reproduce

  1. Follow instruction from https://jshelter.org/build/

Expected result

Builds project

Actual result

Terminal output:

wget -q -N https://www.iana.org/assignments/locally-served-dns-zones/ipv4.csv
cp ipv4.csv common/ipv4.dat
wget -q -N https://www.iana.org/assignments/locally-served-dns-zones/ipv6.csv
cp ipv6.csv common/ipv6.dat
git submodule init
git submodule update
up to date, audited 4 packages in 550ms
1 package is looking for funding
  run `npm fund` for details
found 0 vulnerabilities
> wasm_farble@1.0.0 debug
> asc assembly/farble.ts --target debug
up to date, audited 4 packages in 584ms
1 package is looking for funding
  run `npm fund` for details
found 0 vulnerabilities
> wasm_farble@1.0.0 release
> asc assembly/farble.ts --target release
sed: 1: "/.*\/\/DEF_FPD_FILES_S. ...": extra characters at the end of d command
sed: 1: "/.*\/\/DEF_FPD_FILES_S. ...": command a expects \ followed by text
make: *** [jshelter_firefox.zip] Error 1

Workaround

  1. MacOS user should install gnu-sed: https://formulae.brew.sh/formula/gnu-sed
  2. Replace all sed commands in Make and generate_fpd.sh with gsed.

Maybe you should give devs a head up in the installation instruction. I know it is not a huge issue. But took me a while to find the root of the problem.

gsed seems to be a MacOS specific naming system to not conflict with the system version and replacing all instances would break all other operating systems that do not expect the BSD sed.

Not sure how to programmatically handle this without a warning for MacOS users suggesting the workaround. There could be a sed check that checks that sed is correct and uses gsed if available. This would not scale well if there were many calls in different parts of a script. Any suggestions? This must come up often for MacOS.

Actually, I am lacking expertise in this case.
My first guess (tested it and it works) would be to make something like:

if [ "$(uname)" == "Darwin" ]; then
    if command -v gsed &> /dev/null; then
        PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
    fi
fi
...
# REST OF SCRIPT

This would check if os is macOS and in case it is and gnu-sed is installed, trying to export it as sed. Then no other modification has to take place but the change also stays temporary.
I would put it in the beginning of generate_fdp.sh.

But as mentioned in the beginning, I am not an expert there might be a smoother way to implement it.

That seems reasonable to me. If it works after a test, I'll add it. If you make a Pull Request, you can become a contributor or I could add it.

I would love to become a contributor. Actually, planning to add more in the upcoming months during my master thesis work.

If you have any feature in mind that increases anti-fingerprinting effectivness, webtracking blocking or preserving privacy in any form I would be glad to tackle it.

I will try to reach out to somebody, maybe that issue is the wrong place for that :)

Please see https://pagure.io/JShelter/webextension/c/78bf17f62c63278ec11f2667ff370b052f28bc24?branch=issue131

@tomeryav If you want to spent time in your master thesis on working on JShelter, please, subscribe to https://lists.nongnu.org/mailman/listinfo/js-shield. Please sent to the list or to me an e-mail explaining what exactly is your topic, University, supervisor, your plans or any other information that you think is relevant. We will try to help you but we need these details to provide relevant help.

For inspiration on relevant topics, have a look at https://pagure.io/JShelter/webextension/issues and https://github.com/polcak/jsrestrictor/issues. Also, have a look at https://arxiv.org/abs/2204.01392 and https://doi.org/10.5220/0011965600003555 (if possible cite this paper in your thesis).

Fixed in 6d7c0526

Metadata Update from @polcak:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

Metadata