public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/111359] New: contrib/gcc-git-customization.sh uses getent, which is non-portable
@ 2023-09-10  9:34 egallager at gcc dot gnu.org
  2023-09-10  9:37 ` [Bug other/111359] " egallager at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-09-10  9:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111359

            Bug ID: 111359
           Summary: contrib/gcc-git-customization.sh uses getent, which is
                    non-portable
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
          Assignee: unassigned at gcc dot gnu.org
          Reporter: egallager at gcc dot gnu.org
  Target Milestone: ---

On both darwin and AIX, running contrib/gcc-git-customization.sh will print
messages like this:

contrib/gcc-git-customization.sh[49]: getent:  not found.

Running `which getent` confirms:

which: 0652-141 There is no getent in /usr/bin /etc /usr/sbin /usr/ucb
/home/egallager/bin /usr/bin/X11 /sbin ..

Suggest switching to a different sort of test when getent isn't available.

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

* [Bug other/111359] contrib/gcc-git-customization.sh uses getent, which is non-portable
  2023-09-10  9:34 [Bug other/111359] New: contrib/gcc-git-customization.sh uses getent, which is non-portable egallager at gcc dot gnu.org
@ 2023-09-10  9:37 ` egallager at gcc dot gnu.org
  2023-09-11 10:32 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: egallager at gcc dot gnu.org @ 2023-09-10  9:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111359

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rearnsha at gcc dot gnu.org

--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
git blame says Richard Earnshaw added the line in r10-6003-g545f5fad17ff0d;
adding to cc

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

* [Bug other/111359] contrib/gcc-git-customization.sh uses getent, which is non-portable
  2023-09-10  9:34 [Bug other/111359] New: contrib/gcc-git-customization.sh uses getent, which is non-portable egallager at gcc dot gnu.org
  2023-09-10  9:37 ` [Bug other/111359] " egallager at gcc dot gnu.org
@ 2023-09-11 10:32 ` redi at gcc dot gnu.org
  2023-09-11 11:09 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2023-09-11 10:32 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111359

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-09-11
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #0)
> Suggest switching to a different sort of test when getent isn't available.

For macOS:

dscacheutil -q user -a name $(whoami) | awk -F, '/^gecos:/ { sub("gecos: ", "",
$1); print $1}'

or much simpler:

id -F

For AIX we could extract it from /etc/passwd, or just not bother and require
the user to provide it.


--- 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>/dev/null; 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)"

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

* [Bug other/111359] contrib/gcc-git-customization.sh uses getent, which is non-portable
  2023-09-10  9:34 [Bug other/111359] New: contrib/gcc-git-customization.sh uses getent, which is non-portable egallager at gcc dot gnu.org
  2023-09-10  9:37 ` [Bug other/111359] " egallager at gcc dot gnu.org
  2023-09-11 10:32 ` redi at gcc dot gnu.org
@ 2023-09-11 11:09 ` redi at gcc dot gnu.org
  2023-09-11 11:36 ` cvs-commit at gcc dot gnu.org
  2023-09-11 11:37 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2023-09-11 11:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111359

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Patch submitted:
https://gcc.gnu.org/pipermail/gcc-patches/2023-September/629822.html

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

* [Bug other/111359] contrib/gcc-git-customization.sh uses getent, which is non-portable
  2023-09-10  9:34 [Bug other/111359] New: contrib/gcc-git-customization.sh uses getent, which is non-portable egallager at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-09-11 11:09 ` redi at gcc dot gnu.org
@ 2023-09-11 11:36 ` cvs-commit at gcc dot gnu.org
  2023-09-11 11:37 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-09-11 11:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111359

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:5c3c04960d773f47ba5b1da592b6f1e013efe3ea

commit r14-3838-g5c3c04960d773f47ba5b1da592b6f1e013efe3ea
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Sep 11 11:36:04 2023 +0100

    contrib: Check if getent is available in git setup script [PR111359]

    contrib/ChangeLog:

            PR other/111359
            * gcc-git-customization.sh: Check for getent before using it.
            Use id on macOS.

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

* [Bug other/111359] contrib/gcc-git-customization.sh uses getent, which is non-portable
  2023-09-10  9:34 [Bug other/111359] New: contrib/gcc-git-customization.sh uses getent, which is non-portable egallager at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-09-11 11:36 ` cvs-commit at gcc dot gnu.org
@ 2023-09-11 11:37 ` redi at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2023-09-11 11:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111359

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-10  9:34 [Bug other/111359] New: contrib/gcc-git-customization.sh uses getent, which is non-portable egallager at gcc dot gnu.org
2023-09-10  9:37 ` [Bug other/111359] " egallager at gcc dot gnu.org
2023-09-11 10:32 ` redi at gcc dot gnu.org
2023-09-11 11:09 ` redi at gcc dot gnu.org
2023-09-11 11:36 ` cvs-commit at gcc dot gnu.org
2023-09-11 11:37 ` redi at gcc dot gnu.org

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).