Skip to content
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

nix: fix purge.sh script on Darwin platform #13267

Merged
merged 1 commit into from
May 16, 2022
Merged

Conversation

jakubgs
Copy link
Member

@jakubgs jakubgs commented Apr 12, 2022

Darwin lacks userdel and Nix users don't appear in /etc/passwd.

@jakubgs jakubgs added the nix label Apr 12, 2022
@jakubgs jakubgs requested a review from a team April 12, 2022 09:55
@jakubgs jakubgs self-assigned this Apr 12, 2022
@status-github-bot status-github-bot bot added this to REVIEW in Pipeline for QA Apr 12, 2022
@status-im-auto
Copy link
Member

status-im-auto commented Apr 12, 2022

Jenkins Builds

Click to see older builds (62)
Commit #️⃣ Finished (UTC) Duration Platform Result
66b0e0b #1 2022-04-12 09:56:06 ~34 sec ios 📄log
✔️ 66b0e0b #1 2022-04-12 10:06:42 ~11 min android 📦apk 📲
✔️ 66b0e0b #1 2022-04-12 10:07:42 ~12 min android-e2e 📦apk 📲
986af1f #2 2022-04-12 09:57:26 ~21 sec ios 📄log
✔️ 986af1f #2 2022-04-12 10:09:32 ~12 min android 📦apk 📲
✔️ 986af1f #2 2022-04-12 10:09:50 ~12 min android-e2e 📦apk 📲
ec406e8 #3 2022-04-12 10:17:18 ~12 min android 📄log
✔️ ec406e8 #3 2022-04-12 10:17:29 ~12 min ios 📦ipa 📲
✔️ ec406e8 #3 2022-04-12 10:17:37 ~12 min android-e2e 📦apk 📲
✔️ d495fbf #4 2022-04-12 10:31:36 ~13 min android-e2e 📦apk 📲
✔️ d495fbf #4 2022-04-12 10:33:21 ~14 min android 📦apk 📲
✔️ d495fbf #4 2022-04-12 10:34:55 ~16 min ios 📦ipa 📲
6ba3f73 #5 2022-04-25 06:23:08 ~10 min android 📄log
✔️ 6ba3f73 #5 2022-04-25 06:23:27 ~10 min android-e2e 📦apk 📲
✔️ 6ba3f73 #5 2022-04-25 06:24:46 ~12 min ios 📦ipa 📲
✔️ 4498e1a #6 2022-04-25 06:39:08 ~11 min ios 📦ipa 📲
✔️ 4498e1a #6 2022-04-25 06:39:09 ~11 min android-e2e 📦apk 📲
✔️ 4498e1a #6 2022-04-25 06:39:13 ~11 min android 📦apk 📲
bc97f59 #7 2022-04-25 06:50:09 ~10 min android 📄log
✔️ bc97f59 #7 2022-04-25 06:50:36 ~10 min android-e2e 📦apk 📲
✔️ bc97f59 #7 2022-04-25 06:52:07 ~12 min ios 📦ipa 📲
5082cab #8 2022-04-25 07:02:07 ~10 min android 📄log
✔️ 5082cab #8 2022-04-25 07:02:17 ~10 min android-e2e 📦apk 📲
✔️ 5082cab #8 2022-04-25 07:04:25 ~12 min ios 📦ipa 📲
✔️ 568ebd3 #9 2022-04-25 07:03:54 ~10 min android 📦apk 📲
✔️ 568ebd3 #9 2022-04-25 07:04:18 ~11 min android-e2e 📦apk 📲
✔️ 568ebd3 #9 2022-04-25 07:04:59 ~11 min ios 📦ipa 📲
✔️ 7b9c0c2 #10 2022-04-25 07:06:54 ~9 min android-e2e 📦apk 📲
✔️ 7b9c0c2 #10 2022-04-25 07:09:30 ~12 min ios 📦ipa 📲
✔️ 7b9c0c2 #10 2022-04-25 07:11:37 ~14 min android 📦apk 📲
✔️ 339523f #11 2022-04-27 11:21:26 ~9 min android-e2e 📦apk 📲
✔️ 339523f #11 2022-04-27 11:21:56 ~9 min android 📦apk 📲
✔️ 339523f #11 2022-04-27 11:23:36 ~11 min ios 📦ipa 📲
✔️ 1450e9e #12 2022-04-27 12:21:01 ~11 min ios 📦ipa 📲
✔️ 1450e9e #12 2022-04-27 12:21:11 ~11 min android 📦apk 📲
✔️ 1450e9e #12 2022-04-27 12:21:15 ~11 min android-e2e 📦apk 📲
✔️ 5b487a3 #13 2022-05-05 13:19:49 ~9 min android 📦apk 📲
✔️ 5b487a3 #13 2022-05-05 13:20:19 ~9 min ios 📦ipa 📲
✔️ 5b487a3 #13 2022-05-05 13:23:04 ~12 min android-e2e 📦apk 📲
✔️ f3f1021 #14 2022-05-09 11:19:10 ~11 min android-e2e 📦apk 📲
✔️ f3f1021 #14 2022-05-09 11:19:42 ~11 min android 📦apk 📲
✔️ f3f1021 #14 2022-05-09 11:24:51 ~17 min ios 📦ipa 📲
✔️ 1744d95 #15 2022-05-09 13:50:14 ~10 min android 📦apk 📲
✔️ 1744d95 #15 2022-05-09 13:51:02 ~11 min android-e2e 📦apk 📲
✔️ 1744d95 #15 2022-05-09 13:54:20 ~14 min ios 📦ipa 📲
✔️ 1825274 #16 2022-05-11 13:14:45 ~14 min android-e2e 📦apk 📲
✔️ 1825274 #16 2022-05-11 13:18:16 ~18 min android 📦apk 📲
✔️ 1825274 #16 2022-05-11 13:44:43 ~44 min ios 📦ipa 📲
✔️ 70bca66 #17 2022-05-16 15:47:34 ~11 min android 📦apk 📲
✔️ 70bca66 #17 2022-05-16 15:47:34 ~11 min android-e2e 📦apk 📲
✔️ 70bca66 #17 2022-05-16 15:48:53 ~12 min ios 📦ipa 📲
✔️ fab7bd3 #18 2022-05-16 15:47:43 ~9 min android-e2e 📦apk 📲
✔️ fab7bd3 #18 2022-05-16 15:47:50 ~9 min android 📦apk 📲
✔️ fab7bd3 #18 2022-05-16 15:52:26 ~14 min ios 📦ipa 📲
✔️ ace4b14 #19 2022-05-16 16:43:21 ~9 min android-e2e 📦apk 📲
✔️ ace4b14 #19 2022-05-16 16:48:48 ~14 min ios 📦ipa 📲
✔️ 25cea2e #20 2022-05-16 16:45:28 ~10 min android 📦apk 📲
✔️ 25cea2e #20 2022-05-16 16:46:19 ~11 min android-e2e 📦apk 📲
✔️ 25cea2e #20 2022-05-16 16:55:51 ~21 min ios 📦ipa 📲
✔️ 1b117df #21 2022-05-16 16:58:14 ~11 min android-e2e 📦apk 📲
✔️ 1b117df #21 2022-05-16 16:58:19 ~11 min android 📦apk 📲
✔️ 1b117df #21 2022-05-16 17:05:28 ~18 min ios 📦ipa 📲
Commit #️⃣ Finished (UTC) Duration Platform Result
✔️ 589d9f5 #22 2022-05-16 17:23:52 ~9 min android-e2e 📦apk 📲
✔️ 589d9f5 #22 2022-05-16 17:24:13 ~9 min android 📦apk 📲
✔️ 589d9f5 #22 2022-05-16 17:31:57 ~17 min ios 📦ipa 📲
✔️ 337493e #23 2022-05-16 18:00:36 ~11 min android 📦apk 📲
✔️ 337493e #23 2022-05-16 18:00:41 ~11 min android-e2e 📦apk 📲
✔️ 337493e #23 2022-05-16 18:01:25 ~12 min ios 📦ipa 📲

@jakubgs jakubgs force-pushed the nix/purge-macos branch 3 times, most recently from ec406e8 to d495fbf Compare April 12, 2022 10:18
@jakubgs jakubgs force-pushed the nix/purge-macos branch 8 times, most recently from 339523f to 1450e9e Compare April 27, 2022 12:09
@audriu
Copy link
Contributor

audriu commented May 3, 2022

I tried to use this purge script:

audriusmolis@Audriuss-MacBook-Pro status-react % git checkout nix/purge-macos
Already on 'nix/purge-macos'
Your branch is up to date with 'origin/nix/purge-macos'.
audriusmolis@Audriuss-MacBook-Pro status-react % nix/scripts/purge.sh        
Unknown Nix installtion type!
Purged all Nix files from your system.
audriusmolis@Audriuss-MacBook-Pro status-react % make run-clojure            
yarn shadow-cljs watch mobile
Unknown Nix installtion type!
make: *** [run-clojure] Error 1
audriusmolis@Audriuss-MacBook-Pro status-react % 

This is on m1 mac

@jakubgs
Copy link
Member Author

jakubgs commented May 4, 2022

@audriu can you try editing nix/scripts/lib.sh to add set -x to nix_install_type function and then source it and use it?

source nix/scripts/lib.sh
nix_install_type

Should show you how exactly it fails, then you could maybe put it in a Gist so I can debug that.

@audriu
Copy link
Contributor

audriu commented May 4, 2022

@audriu can you try editing nix/scripts/lib.sh to add set -x to nix_install_type function and then source it and use it?

source nix/scripts/lib.sh
nix_install_type

Should show you how exactly it fails, then you could maybe put it in a Gist so I can debug that.

I will when next time work on this. Now everything works finally and I don't want to touch it.

@jakubgs
Copy link
Member Author

jakubgs commented May 4, 2022

@audriu that's fine, you don't have to purge things. I just want to test how the specific nix_install_type function works, which only detects the type of Nix installation, and doesn't actually remove anything, so it's safe.

@audriu
Copy link
Contributor

audriu commented May 4, 2022

@audriu that's fine, you don't have to purge things. I just want to test how the specific nix_install_type function works, which only detects the type of Nix installation, and doesn't actually remove anything, so it's safe.

audriusmolis@Audriuss-MacBook-Pro status-react % make run-clojure
2022-05-04 20:09:18.705 xcodebuild[830:10122] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-05-04 20:09:18.705 xcodebuild[830:10122] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
yarn shadow-cljs watch mobile
++++ file_group /nix/store
+++++ uname -s
++++ UNAME=Darwin
++++ [[ Darwin == \L\i\n\u\x ]]
++++ [[ Darwin == \D\a\r\w\i\n ]]
++++ stat -Lf %Sg /nix/store
+++ NIX_STORE_DIR_GROUP='(30000)'
++++ os_name
++++ source /etc/os-release
++++ echo ''
+++ [[ '' =~ NixOS ]]
+++ case "${NIX_STORE_DIR_GROUP}" in
+++ echo 'Unknown Nix installtion type!'
Unknown Nix installtion type!
+++ exit 1
make: *** [run-clojure] Error 1

This may be some ZSH problem.
elif [[ "${UNAME}" == "Darwin" ]]; then doesn't match
elif [[ "${UNAME}" == $(echo "Darwin") ]]; then and this does

@status-im status-im deleted a comment from audriu May 4, 2022
@jakubgs
Copy link
Member Author

jakubgs commented May 4, 2022

Thanks, but ZSH should't affect it when it's being used by another script like nix/scripts/source.sh which explicitly uses Bash.
Could you also try it in a Bash shell?

Also, why do you keep quoting comments? That only makes sense if you're referring to an older comment.
Otherwise you're just adding noise to the conversation.

@audriu
Copy link
Contributor

audriu commented May 5, 2022

After you added Bash Shebang to the scripts all works.
Although something is wrong with other scripts and make does not install Nix automatically...

audriusmolis@Audriuss-MacBook-Pro status-react % make run-clojure 
2022-05-05 09:09:48.147 xcodebuild[870:10890] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
2022-05-05 09:09:48.147 xcodebuild[870:10890] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
yarn shadow-cljs watch mobile
No Nix installtion detected!
Nix not available, sourcing profile failed!
make: *** [run-clojure] Error 1

@jakubgs
Copy link
Member Author

jakubgs commented May 5, 2022

What? But all script already have a shebang. Which script specifically?

@audriu
Copy link
Contributor

audriu commented May 5, 2022

Which script specifically?

You added it to lib.sh. It did not have it yesterday when I saw it.

@audriu
Copy link
Contributor

audriu commented May 5, 2022

Even if this script runs without errors, it looks like some residue is still left from nix after running it.
If I remove Nix with these steps https://gist.github.com/chriselsner/3ebe962a4c4bd1f14d39897fc5619732 then it all works fine.

@jakubgs
Copy link
Member Author

jakubgs commented May 5, 2022

But nix/scripts/lib.sh already has a shebang:
https://github.com/status-im/status-react/blob/411fd843cae47cb67e17d12dde2819b63d9b5221/nix/scripts/lib.sh#L1
So not sure why yours was missing it. Besides, that's a library and should only be sourced anyway.

I really would like to understand why you got the Unknown Nix installtion type! error.

@audriu
Copy link
Contributor

audriu commented May 5, 2022

it had Unknown Nix installation type! before you added the shebang. and now error disappeared of course.

@jakubgs
Copy link
Member Author

jakubgs commented May 5, 2022

There hasn't been changes to scripts since few months back in 03119837.

And this PR doesn't add any shebangs either. I don't really know why your case is so special, but we need to figure it out.

@jakubgs jakubgs force-pushed the nix/purge-macos branch 2 times, most recently from 5b487a3 to f3f1021 Compare May 9, 2022 11:07
@jakubgs
Copy link
Member Author

jakubgs commented May 9, 2022

I've added some extra cases to the switch to handle a case when users/group was deleted but the folder remains:
https://github.com/status-im/status-react/blob/f3f102196d01da94ee937f4b8508ca9fb2be23e9/nix/scripts/lib.sh#L28-L30
Because stat -Lf "%Sg" will return the GID when group does not exit, and it should always be 30000.

@jakubgs jakubgs force-pushed the nix/purge-macos branch 2 times, most recently from 1744d95 to 1825274 Compare May 11, 2022 12:59
@jakubgs jakubgs force-pushed the nix/purge-macos branch 6 times, most recently from 1b117df to 589d9f5 Compare May 16, 2022 17:14
Darwin lacks `userdel` and Nix users don't appear in `/etc/passwd`.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
@jakubgs jakubgs merged commit b2695e0 into develop May 16, 2022
@jakubgs jakubgs deleted the nix/purge-macos branch May 16, 2022 18:18
Pipeline for QA automation moved this from REVIEW to DONE May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants