public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libstdc++: Check if getent is available in git config script [PR111359]
@ 2023-09-11 11:06 Jonathan Wakely
  2023-09-11 11:14 ` Jakub Jelinek
  0 siblings, 1 reply; 2+ messages in thread
From: Jonathan Wakely @ 2023-09-11 11:06 UTC (permalink / raw)
  To: gcc-patches

Tested x86_64-linux, powerpc-aix, and minimally tested on macOS 12.6
(darwin 21.6.0).

OK for trunk?

-- >8 --

contrib/ChangeLog:

	PR other/111359
	* gcc-git-customization.sh: Check for getent before using it.
	Use id on macOS.
---
 contrib/gcc-git-customization.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/contrib/gcc-git-customization.sh b/contrib/gcc-git-customization.sh
index 914d868f7bd..2e173e859d7 100755
--- a/contrib/gcc-git-customization.sh
+++ b/contrib/gcc-git-customization.sh
@@ -46,7 +46,11 @@ set_email=$(git config --get "user.email")
 if [ "x$set_user" = "x" ]
 then
     # Try to guess the user's name by looking it up in the password file
-    new_user=$(getent passwd $(whoami) | awk -F: '{ print $5 }')
+    if type getent >/dev/null 2>&1; then
+      new_user=$(getent passwd $(whoami) | awk -F: '{ print $5 }')
+    elif [ $(uname -s) = Darwin ]; then
+      new_user=$(id -F 2>/dev/null)
+    fi
     if [ "x$new_user" = "x" ]
     then
        new_user="(no default)"
-- 
2.41.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libstdc++: Check if getent is available in git config script [PR111359]
  2023-09-11 11:06 [PATCH] libstdc++: Check if getent is available in git config script [PR111359] Jonathan Wakely
@ 2023-09-11 11:14 ` Jakub Jelinek
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Jelinek @ 2023-09-11 11:14 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc-patches

On Mon, Sep 11, 2023 at 12:06:19PM +0100, Jonathan Wakely via Gcc-patches wrote:
> Tested x86_64-linux, powerpc-aix, and minimally tested on macOS 12.6
> (darwin 21.6.0).
> 
> OK for trunk?
> 
> -- >8 --
> 
> contrib/ChangeLog:
> 
> 	PR other/111359
> 	* gcc-git-customization.sh: Check for getent before using it.
> 	Use id on macOS.

Ok, thanks.

	Jakub


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-09-11 11:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-11 11:06 [PATCH] libstdc++: Check if getent is available in git config script [PR111359] Jonathan Wakely
2023-09-11 11:14 ` Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).