Skip to content

Conversation

@alejandro-colomar
Copy link
Collaborator

@alejandro-colomar alejandro-colomar commented Jan 24, 2025


Revisions:

v1b
  • Rebase
$ git range-diff master..gh/shadow shadow/master..shadow
 1:  ca7fc68d !  1:  5882c687 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
    @@ lib/shadow/gshadow/putsgent.c (new)
     + * writes the result to the given stream.  This is the logical
     + * opposite of fgetsgent.
     + */
    -+#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    ++#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +int
     +putsgent(const struct sgrp *sgrp, FILE *fp)
     +{
    @@ lib/shadow/gshadow/putsgent.h (new)
     +#include "gshadow_.h"
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +int putsgent(const struct sgrp *sgrp, FILE *fp);
 2:  900eddbd =  2:  0c2830e3 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  9e533b79 !  3:  c243ddd9 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
    @@ lib/shadow/gshadow/endsgent.c (new)
     +#include "shadow/gshadow/gshadow.h"
     +
     +
    -+#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    ++#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +void
     +endsgent(void)
     +{
    @@ lib/shadow/gshadow/endsgent.h (new)
     +#include <config.h>
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +void endsgent(void);
 4:  ed05446b =  4:  02fc437b lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  ce49f474 !  5:  8aa68871 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
    @@ lib/shadow/gshadow/setsgent.c (new)
     +#include "shadow/gshadow/gshadow.h"
     +
     +
    -+#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    ++#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +void
     +setsgent(void)
     +{
    @@ lib/shadow/gshadow/setsgent.h (new)
     +#include <config.h>
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +void setsgent(void);
 6:  72dab352 !  6:  2aa3f65d lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
    @@ lib/shadow/gshadow/putsgent.h
     +#include "shadow/gshadow/sgrp.h"
      
      
    - #if defined(HAVE_GSHADOW_H)
    + #if __has_include(<gshadow.h>)
     
      ## lib/shadow/gshadow/sgrp.c (new) ##
     @@
    @@ lib/shadow/gshadow/sgrp.h (new)
     +#define SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_SGRP_H_
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +struct sgrp {
 7:  b0d63a72 !  7:  66b0763d lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
    @@ lib/shadow/gshadow/fgetsgent.c (new)
     + * fgetsgent() reads the next line from the provided stream and
     + * converts it to a (struct sgrp).  NULL is returned on EOF.
     + */
    -+#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    ++#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +struct sgrp *
     +fgetsgent(FILE *fp)
     +{
    @@ lib/shadow/gshadow/fgetsgent.h (new)
     +#include "shadow/gshadow/sgrp.h"
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +struct sgrp *fgetsgent(FILE *stream);
 8:  a7822d17 !  8:  51c7ad87 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +#define FIELDS    4
     +
     +
    -+#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    ++#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +static struct sgrp  sgroup = {};
     +
     +
    @@ lib/shadow/gshadow/sgetsgent.h (new)
     +#include "shadow/gshadow/sgrp.h"
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +struct sgrp *sgetsgent(const char *);
 9:  1f7b88f4 !  9:  b3a67122 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
    @@ lib/shadow/gshadow/getsgnam.c (new)
     +/*
     + * getsgnam - get a shadow group entry by name
     + */
    -+#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    ++#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +struct sgrp *
     +getsgnam(const char *name)
     +{
    @@ lib/shadow/gshadow/getsgnam.h (new)
     +#include "shadow/gshadow/sgrp.h"
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +struct sgrp *getsgnam(const char *);
10:  f3b9c46e ! 10:  c3ea1881 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
    @@ lib/gshadow.c (deleted)
     -
     -#include <config.h>
     -
    --#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    +-#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     -
     -#ident "$Id$"
     -
    @@ lib/shadow/gshadow/getsgent.c (new)
     +#include "shadow/gshadow/sgrp.h"
     +
     +
    -+#if defined(SHADOWGRP) && !defined(HAVE_GSHADOW_H)
    ++#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +/*
     + * getsgent - get a single shadow group entry
     + */
    @@ lib/shadow/gshadow/getsgent.h (new)
     +#include "shadow/gshadow/sgrp.h"
     +
     +
    -+#if defined(HAVE_GSHADOW_H)
    ++#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
     +struct sgrp *getsgent(void);
11:  f1216144 ! 11:  2b373a55 lib/: GSHADOW: Remove unused macro
    @@ lib/gshadow_.h (deleted)
     -#define SHADOW_INCLUDE_LIB_GSHADOW__H_
     -
     -
    --#if defined(HAVE_GSHADOW_H)
    +-#if __has_include(<gshadow.h>)
     -# include <gshadow.h>
     -#else
     -
    @@ lib/gshadow_.h (deleted)
     -#define   GSHADOW "/etc/gshadow"
     -
     -
    --#endif  // !HAVE_GSHADOW_H
    +-#endif  // !__has_include(<gshadow.h>)
     -#endif  // include guard
12:  64dc60fc = 12:  ca661d7e lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  819db775 = 13:  e7293129 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
v1c
  • Rebase
$ git range-diff master..gh/shadow shadow/master..shadow
 1:  5882c687 =  1:  4389741a lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  0c2830e3 =  2:  a2792533 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  c243ddd9 =  3:  df19bcf0 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  02fc437b =  4:  e612ae79 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  8aa68871 =  5:  aa4588ff lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  2aa3f65d =  6:  188b75be lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  66b0763d =  7:  dd092a8f lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  51c7ad87 =  8:  84ca3b10 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  b3a67122 =  9:  13c382c7 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  c3ea1881 = 10:  b453908b lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  2b373a55 = 11:  bb9fb4cb lib/: GSHADOW: Remove unused macro
12:  ca661d7e = 12:  08c1562e lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  e7293129 = 13:  a5079cb6 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
v2
  • Add comments expanding the meaning of the letter soup API names. [@hallyn ]
$ git range-diff shadow/master gh/shadow shadow
 1:  4389741a !  1:  4777704a lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
    @@ lib/shadow/gshadow/putsgent.c (new)
     + * opposite of fgetsgent.
     + */
     +#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
    ++// put shadow group entry
     +int
     +putsgent(const struct sgrp *sgrp, FILE *fp)
     +{
 2:  a2792533 =  2:  1fc9be8a lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  df19bcf0 !  3:  15cbe6a7 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
    @@ lib/shadow/gshadow/endsgent.c (new)
     +
     +
     +#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
    ++// end-working-with shadow group entries
     +void
     +endsgent(void)
     +{
 4:  e612ae79 =  4:  5105aeae lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  aa4588ff !  5:  df996ad3 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
    @@ lib/shadow/gshadow/setsgent.c (new)
     +
     +
     +#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
    ++// set-resources-for-working-with shadow group entries
     +void
     +setsgent(void)
     +{
 6:  188b75be =  6:  de18a731 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  dd092a8f !  7:  694d0ada lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
    @@ lib/shadow/gshadow/fgetsgent.c (new)
     + * converts it to a (struct sgrp).  NULL is returned on EOF.
     + */
     +#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
    ++// from-FILE get-next shadow group entry
     +struct sgrp *
     +fgetsgent(FILE *fp)
     +{
 8:  84ca3b10 !  8:  6818c7cf lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +static char **build_list(char *s);
     +
     +
    ++// from-string get shadow group entry
     +struct sgrp *
     +sgetsgent(const char *string)
     +{
 9:  13c382c7 !  9:  5803f452 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
    @@ lib/shadow/gshadow/getsgnam.c (new)
     + * getsgnam - get a shadow group entry by name
     + */
     +#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
    ++// get shadow group entry-by-name
     +struct sgrp *
     +getsgnam(const char *name)
     +{
10:  b453908b ! 10:  b4391be0 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
    @@ lib/shadow/gshadow/getsgent.c (new)
     +
     +
     +#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
    -+/*
    -+ * getsgent - get a single shadow group entry
    -+ */
    ++// get-next shadow group entry
     +struct sgrp *
     +getsgent(void)
     +{
11:  bb9fb4cb = 11:  8684b300 lib/: GSHADOW: Remove unused macro
12:  08c1562e ! 12:  bca9fbc3 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
    @@ lib/shadow/group/sgetgrent.c: list(char *s)
      
      
     -struct group *sgetgrent (const char *buf)
    ++// from-string get group entry
     +struct group *
     +sgetgrent(const char *buf)
      {
13:  a5079cb6 ! 13:  9ad790d4 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
    @@ lib/sgetpwent.c => lib/shadow/passwd/sgetpwent.c
      /*
       * sgetpwent - convert a string to a (struct passwd)
       *
    +@@
    +  *        performance reasons.  I am going to come up with some conditional
    +  *        compilation glarp to improve on this in the future.
    +  */
    ++// from-string get pasword entry
    + struct passwd *
    + sgetpwent(const char *buf)
    + {
     @@ lib/shadow/passwd/sgetpwent.c: sgetpwent(const char *buf)
      
        return &pwent;
v2b
  • Rebase
$ git range-diff master..gh/shadow shadow/master..shadow
 1:  4777704a =  1:  dab65d54 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  1fc9be8a =  2:  533f0178 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  15cbe6a7 =  3:  b58f9ff0 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  5105aeae =  4:  c8b50d36 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  df996ad3 =  5:  a0e09b71 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  de18a731 =  6:  1ede63f4 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  694d0ada =  7:  a0a2759f lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  6818c7cf =  8:  b3877b2e lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  5803f452 =  9:  a3eddb96 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  b4391be0 = 10:  b1ed4aa9 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  8684b300 = 11:  a2b77599 lib/: GSHADOW: Remove unused macro
12:  bca9fbc3 = 12:  2d04f252 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  9ad790d4 = 13:  c27bde07 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
v2c
  • Rebase
$ git range-diff master..gh/shadow shadow/master..shadow
 1:  dab65d54 =  1:  ed28fd33 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  533f0178 =  2:  9ed6e910 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  b58f9ff0 =  3:  840b6e7d lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  c8b50d36 =  4:  b513d1ab lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  a0e09b71 =  5:  203913cc lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  1ede63f4 =  6:  6c395e63 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  a0a2759f =  7:  47fbfb56 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  b3877b2e =  8:  fcecd00d lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  a3eddb96 =  9:  ba24dac1 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  b1ed4aa9 = 10:  3648d73f lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  a2b77599 = 11:  70923d56 lib/: GSHADOW: Remove unused macro
12:  2d04f252 = 12:  d52ffeb1 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  c27bde07 = 13:  dd9501d7 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
v3
  • Move another API.
$ git range-diff master gh/shadow shadow
 1:  ed28fd33 =  1:  ed28fd33 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  9ed6e910 =  2:  9ed6e910 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  840b6e7d =  3:  840b6e7d lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  b513d1ab =  4:  b513d1ab lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  203913cc =  5:  203913cc lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  6c395e63 =  6:  6c395e63 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  47fbfb56 =  7:  47fbfb56 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  fcecd00d =  8:  fcecd00d lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  ba24dac1 =  9:  ba24dac1 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  3648d73f = 10:  3648d73f lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  70923d56 = 11:  70923d56 lib/: GSHADOW: Remove unused macro
12:  d52ffeb1 = 12:  d52ffeb1 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  dd9501d7 = 13:  dd9501d7 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
 -:  -------- > 14:  01ef2eba lib/shadow/shadow/, lib/: sgetspent(): Move to under lib/shadow/shadow/
v3b
  • Remove reference to the file in po/.
$ git range-diff master gh/shadow shadow
 1:  ed28fd33 =  1:  ed28fd33 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  9ed6e910 =  2:  9ed6e910 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  840b6e7d =  3:  840b6e7d lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  b513d1ab =  4:  b513d1ab lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  203913cc =  5:  203913cc lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  6c395e63 =  6:  6c395e63 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  47fbfb56 =  7:  47fbfb56 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  fcecd00d =  8:  fcecd00d lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  ba24dac1 =  9:  ba24dac1 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  3648d73f = 10:  3648d73f lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  70923d56 = 11:  70923d56 lib/: GSHADOW: Remove unused macro
12:  d52ffeb1 = 12:  d52ffeb1 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  dd9501d7 = 13:  dd9501d7 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  01ef2eba ! 14:  430d7dcd lib/shadow/shadow/, lib/: sgetspent(): Move to under lib/shadow/shadow/
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/shadow/shadow/, lib/: sgetspent(): Move to under lib/shadow/shadow/
    +    lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     
    @@ lib/shadowio.c
      #include "shadowio.h"
      #ifdef WITH_TCB
      #include <tcb.h>
    +
    + ## po/POTFILES.in ##
    +@@ po/POTFILES.in: lib/selinux.c
    + lib/semanage.c
    + lib/setugid.c
    + lib/setupenv.c
    +-lib/sgetspent.c
    + lib/sgroupio.c
    + lib/shadow.c
    + lib/shadow/group/sgetgrent.c
v3c
  • Rebase
$ git range-diff master..gh/shadow shadow/master..shadow
 1:  ed28fd33 =  1:  c3332329 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  9ed6e910 =  2:  c9a10a88 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  840b6e7d =  3:  1811620d lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  b513d1ab =  4:  42b2c2c9 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  203913cc =  5:  9f4bd4d3 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  6c395e63 =  6:  fce2744e lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  47fbfb56 =  7:  352b4f78 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  fcecd00d =  8:  948bdcaa lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  ba24dac1 =  9:  79e9d3df lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  3648d73f = 10:  21947186 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  70923d56 = 11:  b5acda59 lib/: GSHADOW: Remove unused macro
12:  d52ffeb1 = 12:  7cebadf7 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  dd9501d7 = 13:  fa284dd0 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  430d7dcd = 14:  3813478c lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v3e
  • Rebase
$ git rd
 1:  c3332329 =  1:  2964608e lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  c9a10a88 =  2:  cd5dcb4b lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  1811620d =  3:  7e7918d2 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  42b2c2c9 =  4:  0371b900 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  9f4bd4d3 =  5:  734bba06 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  fce2744e =  6:  06201ed8 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  352b4f78 =  7:  4267f485 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  948bdcaa =  8:  14159986 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  79e9d3df =  9:  e7bda68a lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  21947186 = 10:  5817ff29 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  b5acda59 = 11:  ce8dbb7e lib/: GSHADOW: Remove unused macro
12:  7cebadf7 = 12:  fe126315 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  fa284dd0 = 13:  1e6067da lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  3813478c = 14:  5a19e0a4 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v3f
  • Rebase
$ git rd
 1:  2964608e =  1:  b05808a4 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  cd5dcb4b =  2:  3aff37a4 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  7e7918d2 =  3:  abfef439 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  0371b900 =  4:  8278a8c9 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  734bba06 =  5:  ddb24ced lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  06201ed8 =  6:  77734f84 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  4267f485 =  7:  780f208a lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  14159986 =  8:  bcd4d3c0 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  e7bda68a =  9:  ecc5d7f1 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  5817ff29 = 10:  695abb44 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  ce8dbb7e = 11:  0f2fa2ae lib/: GSHADOW: Remove unused macro
12:  fe126315 = 12:  3ba94bc3 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  1e6067da = 13:  87f20fc1 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  5a19e0a4 = 14:  039ece70 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v3g
  • Rebase
$ git rd
 1:  b05808a4 =  1:  3e7a0be8 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  3aff37a4 =  2:  dba3d88f lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  abfef439 =  3:  300f40c0 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  8278a8c9 =  4:  23510daa lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  ddb24ced =  5:  b05c67f5 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  77734f84 =  6:  67d1e585 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  780f208a =  7:  0765ec0b lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  bcd4d3c0 =  8:  0f9d121a lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  ecc5d7f1 =  9:  9b877ba3 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  695abb44 = 10:  692fd0db lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  0f2fa2ae = 11:  14f3190e lib/: GSHADOW: Remove unused macro
12:  3ba94bc3 = 12:  36cd3aa8 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  87f20fc1 = 13:  3cbe652b lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  039ece70 = 14:  932160fe lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v3h
  • Rebase
$ git rd
 1:  3e7a0be8 !  1:  ff103594 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
    @@ lib/Makefile.am: libshadow_la_SOURCES = \
        sgroupio.c \
     -  sgroupio.h\
     +  sgroupio.h \
    -   shadow.c \
        shadow/grp/agetgroups.c \
        shadow/grp/agetgroups.h \
     +  shadow/gshadow/putsgent.c \
 2:  dba3d88f !  2:  27528248 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
    @@ Commit message
     
      ## lib/Makefile.am ##
     @@ lib/Makefile.am: libshadow_la_SOURCES = \
    -   shadow.c \
    +   sgroupio.h \
        shadow/grp/agetgroups.c \
        shadow/grp/agetgroups.h \
     +  shadow/gshadow/gshadow.c \
 3:  300f40c0 !  3:  4ad33bbe lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
    @@ Commit message
     
      ## lib/Makefile.am ##
     @@ lib/Makefile.am: libshadow_la_SOURCES = \
    -   shadow.c \
    +   sgroupio.h \
        shadow/grp/agetgroups.c \
        shadow/grp/agetgroups.h \
     +  shadow/gshadow/endsgent.c \
 4:  23510daa =  4:  3c95d7ef lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  b05c67f5 =  5:  a2e7bb34 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  67d1e585 =  6:  8da1146a lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  0765ec0b =  7:  5c220086 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  0f9d121a =  8:  71cf1bee lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  9b877ba3 =  9:  4c498212 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  692fd0db = 10:  dcf85320 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  14f3190e = 11:  5af09e5a lib/: GSHADOW: Remove unused macro
12:  36cd3aa8 ! 12:  e72596bf lib/, po/: sgetgrent(): Move to under lib/shadow/group/
    @@ lib/Makefile.am: libshadow_la_SOURCES = \
        sgetspent.c \
        sgroupio.c \
        sgroupio.h \
    -   shadow.c \
     +  shadow/group/sgetgrent.c \
     +  shadow/group/sgetgrent.h \
        shadow/grp/agetgroups.c \
    @@ po/POTFILES.in: lib/selinux.c
      lib/sgetpwent.c
      lib/sgetspent.c
      lib/sgroupio.c
    - lib/shadow.c
     +lib/shadow/group/sgetgrent.c
      lib/shadowio.c
      lib/shadowmem.c
13:  3cbe652b ! 13:  4f0a8554 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
    @@ po/POTFILES.in: lib/selinux.c
     -lib/sgetpwent.c
      lib/sgetspent.c
      lib/sgroupio.c
    - lib/shadow.c
      lib/shadow/group/sgetgrent.c
     +lib/shadow/passwd/sgetpwent.c
      lib/shadowio.c
14:  932160fe ! 14:  18be16bc lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
    @@ lib/Makefile.am: libshadow_la_SOURCES = \
     -  sgetspent.c \
        sgroupio.c \
        sgroupio.h \
    -   shadow.c \
    +   shadow/group/sgetgrent.c \
     @@ lib/Makefile.am: libshadow_la_SOURCES = \
        shadow/gshadow/sgrp.h \
        shadow/passwd/sgetpwent.c \
    @@ po/POTFILES.in: lib/selinux.c
      lib/setupenv.c
     -lib/sgetspent.c
      lib/sgroupio.c
    - lib/shadow.c
      lib/shadow/group/sgetgrent.c
    + lib/shadow/passwd/sgetpwent.c
v4
  • Rebase
$ git rd
 1:  ff103594 !  1:  e34a6822 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
    @@ lib/Makefile.am: libshadow_la_SOURCES = \
        shadowlog.c \
     
      ## lib/gshadow.c ##
    -@@ lib/gshadow.c: sgetsgent(const char *string)
    +@@ lib/gshadow.c: sgetsgent(const char *s)
        }
        return sgrp;
      }
 2:  27528248 !  2:  843e53b3 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
    @@ lib/gshadow.c: build_list(char *s)
      }
      
      /*@observer@*//*@null@*/struct sgrp *
    -@@ lib/gshadow.c: sgetsgent(const char *string)
    +@@ lib/gshadow.c: sgetsgent(const char *s)
      
      /*@observer@*//*@null@*/struct sgrp *getsgent (void)
      {
 3:  4ad33bbe !  3:  7d78fb77 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
    @@ lib/gshadow.c: void setsgent (void)
     -}
     -
      /*@observer@*//*@null@*/struct sgrp *
    - sgetsgent(const char *string)
    + sgetsgent(const char *s)
      {
     
      ## lib/gshadow_.h ##
 4:  3c95d7ef =  4:  de0811d6 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  a2e7bb34 !  5:  82a2665a lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
    @@ lib/gshadow.c: build_list(char *s)
     -}
     -
      /*@observer@*//*@null@*/struct sgrp *
    - sgetsgent(const char *string)
    + sgetsgent(const char *s)
      {
     
      ## lib/gshadow_.h ##
 6:  8da1146a =  6:  9273061c lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  5c220086 !  7:  3c313a42 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
    @@ lib/gshadow.c
      #include "shadow/gshadow/gshadow.h"
      #include "shadow/gshadow/setsgent.h"
      #include "shadow/gshadow/sgrp.h"
    -@@ lib/gshadow.c: sgetsgent(const char *string)
    +@@ lib/gshadow.c: sgetsgent(const char *s)
        return &sgroup;
      }
      
 8:  71cf1bee !  8:  8385f091 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
    @@ lib/gshadow.c
     -}
     -
     -/*@observer@*//*@null@*/struct sgrp *
    --sgetsgent(const char *string)
    +-sgetsgent(const char *s)
     -{
    --  static char *sgrbuf = NULL;
    --  static size_t sgrbuflen = 0;
    +-  static char  *dup = NULL;
     -
    --  char *fields[FIELDS];
    +-  char  *fields[FIELDS];
     -  char *cp;
     -  int i;
    --  size_t len = strlen (string) + 1;
     -
    --  if (len > sgrbuflen) {
    --          char *buf = REALLOC(sgrbuf, len, char);
    --          if (NULL == buf)
    --                  return NULL;
    +-  free(dup);
    +-  dup = strdup(s);
    +-  if (dup == NULL)
    +-          return NULL;
     -
    --          sgrbuf = buf;
    --          sgrbuflen = len;
    --  }
    --
    --  strcpy (sgrbuf, string);
    --  stpsep(sgrbuf, "\n");
    +-  stpsep(dup, "\n");
     -
     -  /*
     -   * There should be exactly 4 colon separated fields.  Find
     -   * all 4 of them and save the starting addresses in fields[].
     -   */
     -
    --  for (cp = sgrbuf, i = 0; (i < FIELDS) && (NULL != cp); i++)
    +-  for (cp = dup, i = 0; (i < FIELDS) && (NULL != cp); i++)
     -          fields[i] = strsep(&cp, ":");
     -
     -  /*
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +
     +// from-string get shadow group entry
     +struct sgrp *
    -+sgetsgent(const char *string)
    ++sgetsgent(const char *s)
     +{
    -+  static char *sgrbuf = NULL;
    -+  static size_t sgrbuflen = 0;
    ++  static char    *dup = NULL;
     +
    -+  char *fields[FIELDS];
    ++  char  *fields[FIELDS];
     +  char *cp;
     +  int i;
    -+  size_t len = strlen (string) + 1;
     +
    -+  if (len > sgrbuflen) {
    -+          char *buf = REALLOC(sgrbuf, len, char);
    -+          if (NULL == buf)
    -+                  return NULL;
    ++  free(dup);
    ++  dup = strdup(s);
    ++  if (dup == NULL)
    ++          return NULL;
     +
    -+          sgrbuf = buf;
    -+          sgrbuflen = len;
    -+  }
    -+
    -+  strcpy (sgrbuf, string);
    -+  stpsep(sgrbuf, "\n");
    ++  stpsep(dup, "\n");
     +
     +  /*
     +   * There should be exactly 4 colon separated fields.  Find
     +   * all 4 of them and save the starting addresses in fields[].
     +   */
     +
    -+  for (cp = sgrbuf, i = 0; (i < FIELDS) && (NULL != cp); i++)
    ++  for (cp = dup, i = 0; (i < FIELDS) && (NULL != cp); i++)
     +          fields[i] = strsep(&cp, ":");
     +
     +  /*
 9:  4c498212 =  9:  f521a66d lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  dcf85320 ! 10:  77a86e0f lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
    @@ lib/gshadow.c (deleted)
     -
     -#include <stddef.h>
     -#include <stdio.h>
    +-#include <stdlib.h>
     -#include <string.h>
     -
     -#include "alloc/malloc.h"
11:  5af09e5a = 11:  f0144738 lib/: GSHADOW: Remove unused macro
12:  e72596bf ! 12:  49809700 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
    @@ lib/sgetgrent.c => lib/shadow/group/sgetgrent.c
     -#ident "$Id$"
     +#include "shadow/group/sgetgrent.h"
      
    + #include <grp.h>
      #include <stdio.h>
    - #include <sys/types.h>
     @@
      
      #define   NFIELDS 4
    @@ lib/shadow/group/sgetgrent.c: list(char *s)
      }
      
      
    --struct group *sgetgrent (const char *buf)
     +// from-string get group entry
    -+struct group *
    -+sgetgrent(const char *buf)
    + struct group *
    + sgetgrent(const char *s)
      {
    -   static char *grpbuf = NULL;
    -   static size_t size = 0;
    -@@ lib/shadow/group/sgetgrent.c: struct group *sgetgrent (const char *buf)
    - 
    -   return &grent;
    - }
    --
     
      ## lib/shadow/group/sgetgrent.h (new) ##
     @@
13:  4f0a8554 ! 13:  d36c24f7 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
    @@ lib/sgetpwent.c => lib/shadow/passwd/sgetpwent.c
     -#ident "$Id$"
     +#include "shadow/passwd/sgetpwent.h"
      
    - #include <sys/types.h>
    + #include <pwd.h>
      #include <stdio.h>
     @@
      
    @@ lib/sgetpwent.c => lib/shadow/passwd/sgetpwent.c
       */
     +// from-string get pasword entry
      struct passwd *
    - sgetpwent(const char *buf)
    + sgetpwent(const char *s)
      {
    -@@ lib/shadow/passwd/sgetpwent.c: sgetpwent(const char *buf)
    +@@ lib/shadow/passwd/sgetpwent.c: sgetpwent(const char *s)
      
        return &pwent;
      }
14:  18be16bc ! 14:  a70d6b7d lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
    @@ lib/sgetspent.c => lib/shadow/shadow/sgetspent.c
     -
      #include <stddef.h>
      #include <stdio.h>
    - #include <sys/types.h>
    + #include <stdlib.h>
     
      ## lib/shadow/shadow/sgetspent.h (new) ##
     @@
v4b
  • Rebase
$ git rd
 1:  e34a6822 =  1:  618e372d lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  843e53b3 =  2:  5bb8da5c lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  7d78fb77 =  3:  2826bacc lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  de0811d6 =  4:  648e26ee lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  82a2665a =  5:  276cd0b6 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  9273061c =  6:  9e26fdad lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  3c313a42 =  7:  5ac994b5 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  8385f091 =  8:  0fe029f9 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  f521a66d =  9:  894ed755 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  77a86e0f = 10:  4fb96120 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  f0144738 = 11:  16ff5c0f lib/: GSHADOW: Remove unused macro
12:  49809700 = 12:  652e5655 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  d36c24f7 = 13:  18246bbe lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  a70d6b7d = 14:  87699a61 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v4c
  • Rebase
$ git rd
 1:  618e372d =  1:  28d630c8 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  5bb8da5c =  2:  26a44a8d lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  2826bacc =  3:  65d3e775 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  648e26ee =  4:  86992f3f lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  276cd0b6 =  5:  cee76ec7 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  9e26fdad =  6:  a3f7be42 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  5ac994b5 =  7:  02f84581 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  0fe029f9 =  8:  1b30a921 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  894ed755 =  9:  a5a560aa lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  4fb96120 = 10:  5fb01c5a lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  16ff5c0f = 11:  24c8429e lib/: GSHADOW: Remove unused macro
12:  652e5655 = 12:  b76638ee lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  18246bbe = 13:  bcbb3e9c lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  87699a61 = 14:  fb6f4e1f lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v4d
  • Rebase
$ git rd 
 1:  28d630c8 !  1:  00c8d066 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
    @@ lib/gshadow_.h: struct sgrp {
     
      ## lib/sgroupio.c ##
     @@
    - #include "commonio.h"
    + #include "fields.h"
      #include "getdef.h"
      #include "sgroupio.h"
     +#include "shadow/gshadow/putsgent.h"
 2:  26a44a8d =  2:  42b7c0f8 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  65d3e775 =  3:  6b8ebf9e lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  86992f3f !  4:  2995d9b0 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
    @@ lib/prefix_flag.c: extern const char* process_prefix_flag (const char* short_opt
     
      ## lib/sgroupio.c ##
     @@
    - #include "commonio.h"
    + #include "fields.h"
      #include "getdef.h"
      #include "sgroupio.h"
     +#include "shadow/gshadow/gshadow.h"
 5:  cee76ec7 =  5:  e8db6ece lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  a3f7be42 =  6:  51be03cd lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  02f84581 =  7:  c5449fe1 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  1b30a921 =  8:  11bec2ad lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  a5a560aa =  9:  3c92bc5f lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  5fb01c5a = 10:  aea1dd2e lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  24c8429e = 11:  70e5b9f1 lib/: GSHADOW: Remove unused macro
12:  b76638ee = 12:  f1f54f3c lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  bcbb3e9c ! 13:  daa3e80f lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
    @@ lib/prototypes.h: extern void setup (struct passwd *);
     
      ## lib/pwio.c ##
     @@
    - #include <stdio.h>
    - #include "commonio.h"
    + #include "fields.h"
    + #include "prototypes.h"
      #include "pwio.h"
     +#include "shadow/passwd/sgetpwent.h"
     +
14:  fb6f4e1f ! 14:  064c6c96 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
    @@ lib/shadow/shadow/sgetspent.h (new)
     
      ## lib/shadowio.c ##
     @@
    - 
    - #ident "$Id$"
    - 
    --#include "prototypes.h"
    --#include "defines.h"
    - #include <shadow.h>
    - #include <stdio.h>
    -+
    - #include "commonio.h"
    -+#include "defines.h"
    + #include "fields.h"
      #include "getdef.h"
    -+#include "prototypes.h"
    + #include "prototypes.h"
     +#include "shadow/shadow/sgetspent.h"
      #include "shadowio.h"
    + 
      #ifdef WITH_TCB
    - #include <tcb.h>
     
      ## po/POTFILES.in ##
     @@ po/POTFILES.in: lib/selinux.c
v4e
  • Rebase
$ git rd 
 1:  00c8d066 =  1:  84ec3820 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  42b7c0f8 =  2:  3c80dee8 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  6b8ebf9e =  3:  7ecd3049 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  2995d9b0 !  4:  d2ff47b9 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
    @@ lib/prefix_flag.c
      #include "getdef.h"
     +#include "shadow/gshadow/gshadow.h"
      #include "shadowlog.h"
    - #include "string/sprintf/xasprintf.h"
    + #include "string/sprintf/xaprintf.h"
      #include "string/strcmp/streq.h"
     @@ lib/prefix_flag.c: extern const char* process_prefix_flag (const char* short_opt, int argc, char **
                gr_setdbname(group_db_file);
      
      #ifdef  SHADOWGRP
    --          xasprintf(&sgroup_db_file, "%s/%s", prefix, SGROUP_FILE);
    -+          xasprintf(&sgroup_db_file, "%s/%s", prefix, GSHADOW_FILE);
    +-          sgroup_db_file = xaprintf("%s/%s", prefix, SGROUP_FILE);
    ++          sgroup_db_file = xaprintf("%s/%s", prefix, GSHADOW_FILE);
                sgr_setdbname(sgroup_db_file);
      #endif
      
 5:  e8db6ece =  5:  8c08d206 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  51be03cd !  6:  1d182683 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
    @@ src/userdel.c
      #endif                            /* ENABLE_SUBIDS */
     +#include "shadow/gshadow/sgrp.h"
      #include "shadowlog.h"
    - #include "string/sprintf/xasprintf.h"
    - #include "string/strcmp/streq.h"
    + #include "string/sprintf/aprintf.h"
    + #include "string/sprintf/xaprintf.h"
     
      ## src/usermod.c ##
     @@
 7:  c5449fe1 =  7:  8a4a1a9c lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  11bec2ad =  8:  23c52cc5 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  3c92bc5f =  9:  783d1904 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  aea1dd2e = 10:  43c4081e lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  70e5b9f1 = 11:  981e83b3 lib/: GSHADOW: Remove unused macro
12:  f1f54f3c ! 12:  52de5866 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
    @@ lib/groupio.c
      #include "groupio.h"
      #include "prototypes.h"
     +#include "shadow/group/sgetgrent.h"
    + #include "string/sprintf/aprintf.h"
      #include "string/strcmp/streq.h"
      
    - 
     
      ## lib/prototypes.h ##
     @@ lib/prototypes.h: extern void setup (struct passwd *);
13:  daa3e80f = 13:  da71a92f lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  064c6c96 = 14:  a634b541 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v5
  • Rebase
$ git rd 
 1:  84ec3820 =  1:  235199e5 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  3c80dee8 !  2:  00bc6130 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
    @@ lib/Makefile.am: libshadow_la_SOURCES = \
     
      ## lib/gshadow.c ##
     @@
    - #include "alloc/x/xmalloc.h"
    + #include "alloc/realloc.h"
      #include "defines.h"
      #include "prototypes.h"
     +#include "shadow/gshadow/gshadow.h"
    - #include "string/strchr/strchrcnt.h"
      #include "string/strcmp/streq.h"
      #include "string/strtok/stpsep.h"
    + #include "string/strtok/strsep2arr.h"
    + #include "string/strtok/xastrsep2ls.h"
      
      
     -static /*@null@*/FILE *shadow;
      static struct sgrp  sgroup = {};
      
    - #define   FIELDS  4
    + 
     @@ lib/gshadow.c: build_list(char *s)
      
      void setsgent (void)
 3:  7ecd3049 =  3:  d013f7fe lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  d2ff47b9 =  4:  079893e0 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  8c08d206 !  5:  5cc54c56 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
    @@ lib/gshadow.c
      #include "prototypes.h"
      #include "shadow/gshadow/gshadow.h"
     +#include "shadow/gshadow/setsgent.h"
    - #include "string/strchr/strchrcnt.h"
      #include "string/strcmp/streq.h"
      #include "string/strtok/stpsep.h"
    + #include "string/strtok/strsep2arr.h"
     @@ lib/gshadow.c: build_list(char *s)
        return l;
      }
 6:  1d182683 !  6:  d885ae8d lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
    @@ lib/gshadow.c
      #include "shadow/gshadow/gshadow.h"
      #include "shadow/gshadow/setsgent.h"
     +#include "shadow/gshadow/sgrp.h"
    - #include "string/strchr/strchrcnt.h"
      #include "string/strcmp/streq.h"
      #include "string/strtok/stpsep.h"
    + #include "string/strtok/strsep2arr.h"
     
      ## lib/gshadow_.h ##
     @@
 7:  8a4a1a9c !  7:  c03c7b59 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
    @@ lib/Makefile.am: libshadow_la_SOURCES = \
     
      ## lib/gshadow.c ##
     @@
    - #include "alloc/x/xmalloc.h"
    + #include "alloc/realloc.h"
      #include "defines.h"
      #include "prototypes.h"
     +#include "shadow/gshadow/fgetsgent.h"
 8:  23c52cc5 !  8:  438428c2 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
    @@ lib/Makefile.am: libshadow_la_SOURCES = \
     
      ## lib/gshadow.c ##
     @@
    - #include "string/strtok/stpsep.h"
    + #include <stdlib.h>
    + #include <string.h>
    + 
    +-#include "alloc/malloc.h"
    +-#include "alloc/realloc.h"
    + #include "defines.h"
    + #include "prototypes.h"
    + #include "shadow/gshadow/fgetsgent.h"
    +@@
    + #include "shadow/gshadow/setsgent.h"
    + #include "shadow/gshadow/sgrp.h"
    + #include "string/strcmp/streq.h"
    +-#include "string/strtok/stpsep.h"
    +-#include "string/strtok/strsep2arr.h"
    +-#include "string/strtok/xastrsep2ls.h"
      
      
     -static struct sgrp  sgroup = {};
     -
    --#define   FIELDS  4
    --
     -
     -static /*@null@*/char **
     -build_list(char *s)
     -{
     -  char    **l;
    --  size_t  i;
    +-  size_t  n;
     -
    --  l = XMALLOC(strchrcnt(s, ',') + 2, char *);
    +-  l = xastrsep2ls(s, ",", &n);
     -
    --  for (i = 0; s != NULL && !streq(s, ""); i++)
    --          l[i] = strsep(&s, ",");
    --
    --  l[i] = NULL;
    +-  if (streq(l[n-1], ""))
    +-          l[n-1] = NULL;
     -
     -  return l;
     -}
    @@ lib/gshadow.c
     -{
     -  static char  *dup = NULL;
     -
    --  char  *fields[FIELDS];
    --  char *cp;
    --  int i;
    +-  char  *fields[4];
     -
     -  free(dup);
     -  dup = strdup(s);
    @@ lib/gshadow.c
     -
     -  stpsep(dup, "\n");
     -
    --  /*
    --   * There should be exactly 4 colon separated fields.  Find
    --   * all 4 of them and save the starting addresses in fields[].
    --   */
    --
    --  for (cp = dup, i = 0; (i < FIELDS) && (NULL != cp); i++)
    --          fields[i] = strsep(&cp, ":");
    --
    --  /*
    --   * If there was an extra field somehow, or perhaps not enough,
    --   * the line is invalid.
    --   */
    --
    --  if (NULL != cp || i != FIELDS)
    +-  if (STRSEP2ARR(dup, ":", fields) == -1)
     -          return NULL;
     -
     -  sgroup.sg_namp = fields[0];
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +// SPDX-FileCopyrightText: 1996-1998, Marek Michałkiewicz
     +// SPDX-FileCopyrightText: 2005, Tomasz Kłoczko
     +// SPDX-FileCopyrightText: 2008-2009, Nicolas François
    -+// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
    ++// SPDX-FileCopyrightText: 2024-2025, Alejandro Colomar <alx@kernel.org>
     +// SPDX-License-Identifier: BSD-3-Clause
     +
     +
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +#include <stddef.h>
     +#include <string.h>
     +
    -+#include "alloc/realloc.h"
    -+#include "alloc/x/xmalloc.h"
     +#include "shadow/gshadow/sgrp.h"
    -+#include "string/strchr/strchrcnt.h"
    ++#include "string/strcmp/streq.h"
     +#include "string/strtok/stpsep.h"
    ++#include "string/strtok/strsep2arr.h"
    ++#include "string/strtok/xastrsep2ls.h"
     +
     +
     +#define FIELDS    4
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +struct sgrp *
     +sgetsgent(const char *s)
     +{
    -+  static char    *dup = NULL;
    ++  static char  *dup = NULL;
     +
    -+  char  *fields[FIELDS];
    -+  char *cp;
    -+  int i;
    ++  char  *fields[4];
     +
     +  free(dup);
     +  dup = strdup(s);
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +
     +  stpsep(dup, "\n");
     +
    -+  /*
    -+   * There should be exactly 4 colon separated fields.  Find
    -+   * all 4 of them and save the starting addresses in fields[].
    -+   */
    -+
    -+  for (cp = dup, i = 0; (i < FIELDS) && (NULL != cp); i++)
    -+          fields[i] = strsep(&cp, ":");
    -+
    -+  /*
    -+   * If there was an extra field somehow, or perhaps not enough,
    -+   * the line is invalid.
    -+   */
    -+
    -+  if (NULL != cp || i != FIELDS)
    ++  if (STRSEP2ARR(dup, ":", fields) == -1)
     +          return NULL;
     +
     +  sgroup.sg_namp = fields[0];
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +build_list(char *s)
     +{
     +  char    **l;
    -+  size_t  i;
    ++  size_t  n;
     +
    -+  l = XMALLOC(strchrcnt(s, ',') + 2, char *);
    ++  l = xastrsep2ls(s, ",", &n);
     +
    -+  for (i = 0; s != NULL && !streq(s, ""); i++)
    -+          l[i] = strsep(&s, ",");
    -+
    -+  l[i] = NULL;
    ++  if (streq(l[n-1], ""))
    ++          l[n-1] = NULL;
     +
     +  return l;
     +}
 9:  783d1904 =  9:  73278ca3 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  43c4081e ! 10:  0f2bee75 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
    @@ lib/gshadow.c (deleted)
     -#include <stdlib.h>
     -#include <string.h>
     -
    --#include "alloc/malloc.h"
    --#include "alloc/realloc.h"
    --#include "alloc/x/xmalloc.h"
     -#include "defines.h"
     -#include "prototypes.h"
     -#include "shadow/gshadow/fgetsgent.h"
     -#include "shadow/gshadow/gshadow.h"
     -#include "shadow/gshadow/setsgent.h"
     -#include "shadow/gshadow/sgrp.h"
    --#include "string/strchr/strchrcnt.h"
     -#include "string/strcmp/streq.h"
    --#include "string/strtok/stpsep.h"
     -
     -
     -/*
11:  981e83b3 = 11:  f1aa9a91 lib/: GSHADOW: Remove unused macro
12:  52de5866 ! 12:  bfdd9d78 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
    @@ lib/sgetgrent.c => lib/shadow/group/sgetgrent.c
      
      #include <grp.h>
      #include <stdio.h>
    -@@
    - 
    - #define   NFIELDS 4
    - 
    -+
    - /*
    -  * list - turn a comma-separated string into an array of (char *)'s
    -  *
     @@ lib/shadow/group/sgetgrent.c: list(char *s)
      }
      
13:  da71a92f ! 13:  6f4d7e73 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
    @@ lib/sgetpwent.c => lib/shadow/passwd/sgetpwent.c
      #include <pwd.h>
      #include <stdio.h>
     @@
    - 
    - #define   NFIELDS 7
    - 
    -+
    - /*
    -  * sgetpwent - convert a string to a (struct passwd)
    -  *
    -@@
       *        performance reasons.  I am going to come up with some conditional
       *        compilation glarp to improve on this in the future.
       */
14:  a634b541 = 14:  aa04acb2 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v5b
  • Rebase
$ git rd 
 1:  235199e5 =  1:  1e2281d1 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  00bc6130 =  2:  3f174a86 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  d013f7fe =  3:  e9a6f6b2 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  079893e0 =  4:  af08fd3f lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  5cc54c56 =  5:  3730d350 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  d885ae8d =  6:  41d6231a lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  c03c7b59 =  7:  e68f6341 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  438428c2 =  8:  ddf4868b lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  73278ca3 =  9:  2b66e9f3 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  0f2bee75 = 10:  211bae55 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  f1aa9a91 = 11:  8a8dabbb lib/: GSHADOW: Remove unused macro
12:  bfdd9d78 = 12:  80213ca7 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  6f4d7e73 = 13:  68132d40 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  aa04acb2 = 14:  de785d52 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v6
  • Rebase
  • #include "config.h" with quotes.
$ git rd
 1:  1e2281d1 !  1:  4d809ee7 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
    @@ lib/shadow/gshadow/putsgent.c (new)
     +// SPDX-License-Identifier: BSD-3-Clause
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include "shadow/gshadow/putsgent.h"
     +
    @@ lib/shadow/gshadow/putsgent.h (new)
     +#define SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_PUTSGENT_H_
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include <stdio.h>
     +
 2:  3f174a86 !  2:  5b8ca911 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
    @@ lib/shadow/gshadow/gshadow.c (new)
     +// SPDX-License-Identifier: BSD-3-Clause
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include "shadow/gshadow/gshadow.h"
     +
    @@ lib/shadow/gshadow/gshadow.h (new)
     +#define SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_GSHADOW_H_
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include <stdio.h>
     +
 3:  e9a6f6b2 !  3:  1e709cc3 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
    @@ lib/shadow/gshadow/endsgent.c (new)
     +// SPDX-License-Identifier: BSD-3-Clause
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include "shadow/gshadow/endsgent.h"
     +
    @@ lib/shadow/gshadow/endsgent.h (new)
     +#define SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_ENDSGENT_H_
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +
     +#if __has_include(<gshadow.h>)
 4:  af08fd3f =  4:  e2d67d65 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  3730d350 !  5:  d93780a0 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
    @@ lib/shadow/gshadow/setsgent.c (new)
     +// SPDX-License-Identifier: BSD-3-Clause
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include "shadow/gshadow/setsgent.h"
     +
    @@ lib/shadow/gshadow/setsgent.h (new)
     +#define SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_SETSGENT_H_
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +
     +#if __has_include(<gshadow.h>)
 6:  41d6231a !  6:  e7676401 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
    @@ lib/sgroupio.h
      #define _SGROUPIO_H
      
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include "shadow/gshadow/sgrp.h"
     +
    @@ lib/shadow/gshadow/sgrp.c (new)
     +// SPDX-License-Identifier: BSD-3-Clause
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include "shadow/gshadow/sgrp.h"
     
    @@ lib/shadow/gshadow/sgrp.h (new)
     +#define SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_SGRP_H_
     +
     +
    ++#include "config.h"
    ++
    ++
     +#if __has_include(<gshadow.h>)
     +# include <gshadow.h>
     +#else
 7:  e68f6341 !  7:  5cda42f9 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
    @@ lib/shadow/gshadow/fgetsgent.c (new)
     +// SPDX-License-Identifier: BSD-3-Clause
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include "shadow/gshadow/fgetsgent.h"
     +
    @@ lib/shadow/gshadow/fgetsgent.h (new)
     +#define SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_FGETSGENT_H_
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include <stdio.h>
     +
 8:  ddf4868b !  8:  c709cc80 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +// SPDX-License-Identifier: BSD-3-Clause
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include "shadow/gshadow/sgetsgent.h"
     +
    @@ lib/shadow/gshadow/sgetsgent.h (new)
     +#define SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_SGETSGENT_H_
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include "shadow/gshadow/sgrp.h"
     +
 9:  2b66e9f3 !  9:  170d598f lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
    @@ lib/shadow/gshadow/getsgnam.c (new)
     +// SPDX-License-Identifier: BSD-3-Clause
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include "shadow/gshadow/getsgnam.h"
     +
    @@ lib/shadow/gshadow/getsgnam.h (new)
     +#define SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_GETSGNAM_H_
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include "shadow/gshadow/sgrp.h"
     +
10:  211bae55 ! 10:  2bd32fc2 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
    @@ lib/shadow/gshadow/getsgent.c (new)
     +// SPDX-License-Identifier: BSD-3-Clause
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include "shadow/gshadow/getsgent.h"
     +
    @@ lib/shadow/gshadow/getsgent.h (new)
     +#define SHADOW_INCLUDE_LIB_SHADOW_GSHADOW_GETSGENT_H_
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include "shadow/gshadow/sgrp.h"
     +
11:  8a8dabbb = 11:  6db2f17a lib/: GSHADOW: Remove unused macro
12:  80213ca7 ! 12:  016abc80 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
    @@ lib/shadow/group/sgetgrent.h (new)
     +#define SHADOW_INCLUDE_LIB_SHADOW_GROUP_SGETGRENT_H_
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include <grp.h>
     +
13:  68132d40 ! 13:  2a90a85a lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
    @@ lib/shadow/passwd/sgetpwent.h (new)
     +#define SHADOW_INCLUDE_LIB_SHADOW_PASSWD_SGETPWENT_H_
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include <pwd.h>
     +
14:  de785d52 ! 14:  5f243af5 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
    @@ lib/shadow/shadow/sgetspent.h (new)
     +#define SHADOW_INCLUDE_LIB_SHADOW_SHADOW_SGETSPENT_H_
     +
     +
    -+#include <config.h>
    ++#include "config.h"
     +
     +#include <shadow.h>
     +
v6b
  • Rebase
$ git rd 
 1:  4d809ee7 =  1:  a76d5fb8 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  5b8ca911 =  2:  c0d3b9aa lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  1e709cc3 =  3:  462cc726 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  e2d67d65 =  4:  3c0a3c79 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  d93780a0 =  5:  97f0762d lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  e7676401 =  6:  006e8495 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  5cda42f9 =  7:  147ea31c lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  c709cc80 =  8:  431c0acb lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  170d598f =  9:  30650314 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  2bd32fc2 ! 10:  ccd4fec0 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
    @@ lib/gshadow.c (deleted)
     - * SPDX-License-Identifier: BSD-3-Clause
     - */
     -
    --#include <config.h>
    +-#include "config.h"
     -
     -#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     -
11:  6db2f17a = 11:  f7d894e0 lib/: GSHADOW: Remove unused macro
12:  016abc80 ! 12:  dc24f303 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
    @@ lib/sgetgrent.c => lib/shadow/group/sgetgrent.c
     +// SPDX-License-Identifier: BSD-3-Clause
     +
      
    - #include <config.h>
    + #include "config.h"
      
     -#ident "$Id$"
     +#include "shadow/group/sgetgrent.h"
13:  2a90a85a ! 13:  2840c837 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
    @@ lib/sgetpwent.c => lib/shadow/passwd/sgetpwent.c
     +// SPDX-License-Identifier: BSD-3-Clause
     +
      
    - #include <config.h>
    + #include "config.h"
      
     -#ident "$Id$"
     +#include "shadow/passwd/sgetpwent.h"
14:  5f243af5 ! 14:  0ace75ac lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
    @@ lib/sgetspent.c => lib/shadow/shadow/sgetspent.c
     +// SPDX-License-Identifier: BSD-3-Clause
     +
      
    - #include <config.h>
    + #include "config.h"
      
     -/* Newer versions of Linux libc already have shadow support.  */
      #ifndef HAVE_SGETSPENT
v6c
  • Rebase
$ git rd 
 1:  a76d5fb8 =  1:  3b80c403 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  c0d3b9aa =  2:  f9809978 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  462cc726 =  3:  26251e62 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  3c0a3c79 =  4:  4a247ad5 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  97f0762d =  5:  3b1d9c36 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  006e8495 =  6:  3cb1c688 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  147ea31c =  7:  7178a8a2 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  431c0acb =  8:  cf2b2c44 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  30650314 !  9:  a702da40 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
    @@ lib/gshadow.c
     -
     -  setsgent ();
     -
    --  while ((sgrp = getsgent ()) != NULL) {
    +-  while (NULL != (sgrp = getsgent())) {
     -          if (streq(name, sgrp->sg_namp)) {
     -                  break;
     -          }
    @@ lib/shadow/gshadow/getsgnam.c (new)
     +
     +  setsgent ();
     +
    -+  while ((sgrp = getsgent ()) != NULL) {
    ++  while (NULL != (sgrp = getsgent ())) {
     +          if (strcmp (name, sgrp->sg_namp) == 0) {
     +                  break;
     +          }
10:  ccd4fec0 = 10:  1e2d3d33 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  f7d894e0 = 11:  5630a379 lib/: GSHADOW: Remove unused macro
12:  dc24f303 = 12:  6f3b2d44 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  2840c837 = 13:  efec85f1 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  0ace75ac = 14:  252a5a1f lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v6d
  • Rebase
$ git rd 
 1:  3b80c403 =  1:  e6fa1e7e lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  f9809978 =  2:  e37c8358 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  26251e62 =  3:  d85abdfe lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  4a247ad5 =  4:  076d3fbf lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
 5:  3b1d9c36 =  5:  1a16f84c lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  3cb1c688 =  6:  045328fd lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  7178a8a2 =  7:  a8107e77 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  cf2b2c44 =  8:  ffd3dfee lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  a702da40 =  9:  deee98da lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  1e2d3d33 = 10:  f0979841 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  5630a379 = 11:  0f18ff25 lib/: GSHADOW: Remove unused macro
12:  6f3b2d44 = 12:  121f0443 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  efec85f1 = 13:  56b32295 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  252a5a1f = 14:  8fcd75d4 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v7
  • Remove incorrect include.
  • Use _FILE_GSHADOW from libc instead of our own macro.
$ git range-diff shadow/master gh/shadow shadow
warning: refname 'shadow' is ambiguous.
warning: refname 'shadow' is ambiguous.
 1:  e6fa1e7e =  1:  e6fa1e7e lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  e37c8358 !  2:  c834a6a6 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
    @@ lib/shadow/gshadow/gshadow.h (new)
     +
     +#include <stdio.h>
     +
    -+#include "shadow/gshadow/gshadow.h"
    -+
     +
     +extern FILE  *gshadow;
     +
 3:  d85abdfe =  3:  80f598e0 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  076d3fbf !  4:  0c1cd567 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
    @@ Metadata
      ## Commit message ##
         lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
     
    -    Rename it for consistency with the file name itself, and with the FILE*
    -    variable that holds the handle to the open file.
    -
    -    Also, we don't need to wrap it in conditionals.  Just define it
    -    unconditionally, and let it be unused if we don't need it.
    +    This macro is provided by glibc (but not musl) as _FILE_GSHADOW in
    +    <paths.h>.  Let's use that macro, and define it only if libc doesn't
    +    provide it.
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     
    @@ lib/gshadow.c: void setsgent (void)
                rewind(gshadow);
        } else {
     -          gshadow = fopen(SGROUP_FILE, "re");
    -+          gshadow = fopen(GSHADOW_FILE, "re");
    ++          gshadow = fopen(_FILE_GSHADOW, "re");
        }
      }
      
    @@ lib/prefix_flag.c: extern const char* process_prefix_flag (const char* short_opt
      
      #ifdef  SHADOWGRP
     -          sgroup_db_file = xaprintf("%s/%s", prefix, SGROUP_FILE);
    -+          sgroup_db_file = xaprintf("%s/%s", prefix, GSHADOW_FILE);
    ++          sgroup_db_file = xaprintf("%s/%s", prefix, _FILE_GSHADOW);
                sgr_setdbname(sgroup_db_file);
      #endif
      
    @@ lib/sgroupio.c: static struct commonio_ops gshadow_ops = {
      
      static struct commonio_db gshadow_db = {
     -  SGROUP_FILE,            /* filename */
    -+  GSHADOW_FILE,           /* filename */
    ++  _FILE_GSHADOW,          /* filename */
        &gshadow_ops,           /* ops */
        NULL,                   /* fp */
      #ifdef WITH_SELINUX
     
      ## lib/shadow/gshadow/gshadow.h ##
     @@
    - #include "shadow/gshadow/gshadow.h"
    + 
    + #include "config.h"
    + 
    ++#include <paths.h>
    + #include <stdio.h>
      
      
    -+#define GSHADOW_FILE  "/etc/gshadow"
    ++#ifndef _FILE_GSHADOW
    ++# define _FILE_GSHADOW  "/etc/gshadow"
    ++#endif
     +
     +
      extern FILE  *gshadow;
    @@ src/grpck.c: static const char *grp_file = GROUP_FILE;
      
      #ifdef    SHADOWGRP
     -static const char *sgr_file = SGROUP_FILE;
    -+static const char  *sgr_file = GSHADOW_FILE;
    ++static const char  *sgr_file = _FILE_GSHADOW;
      static bool use_system_sgr_file = true;
      static bool is_shadow = false;
      static bool sgr_locked = false;
    @@ src/grpunconv.c: int main (int argc, char **argv)
        }
      
     -  if (unlink (SGROUP_FILE) != 0) {
    -+  if (unlink(GSHADOW_FILE) != 0) {
    ++  if (unlink(_FILE_GSHADOW) != 0) {
                fprintf (stderr,
                         _("%s: cannot delete %s\n"),
     -                   Prog, SGROUP_FILE);
     -          SYSLOG ((LOG_ERR, "cannot delete %s", SGROUP_FILE));
    -+                   Prog, GSHADOW_FILE);
    -+          SYSLOG((LOG_ERR, "cannot delete %s", GSHADOW_FILE));
    ++                   Prog, _FILE_GSHADOW);
    ++          SYSLOG((LOG_ERR, "cannot delete %s", _FILE_GSHADOW));
                fail_exit (3);
        }
      
 5:  1a16f84c !  5:  d1b3c08e lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
    @@ lib/gshadow.c: build_list(char *s)
     -  if (NULL != gshadow) {
     -          rewind(gshadow);
     -  } else {
    --          gshadow = fopen(GSHADOW_FILE, "re");
    +-          gshadow = fopen(_FILE_GSHADOW, "re");
     -  }
     -}
     -
    @@ lib/shadow/gshadow/setsgent.c (new)
     +  if (NULL != gshadow) {
     +          rewind(gshadow);
     +  } else {
    -+          gshadow = fopen(GSHADOW_FILE, "re");
    ++          gshadow = fopen(_FILE_GSHADOW, "re");
     +  }
     +}
     +#endif
 6:  045328fd =  6:  4640d201 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  a8107e77 =  7:  fc223dd1 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  ffd3dfee =  8:  f76fbd24 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  deee98da =  9:  ab0127b0 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  f0979841 = 10:  d0abd266 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  0f18ff25 = 11:  d3fc6de7 lib/: GSHADOW: Remove unused macro
12:  121f0443 = 12:  f091c7bb lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  56b32295 = 13:  0866331b lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  8fcd75d4 = 14:  0409eff2 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
v8
  • Add missing include.
  • Retitle commit.
  • Use _FILE_SHADOW from <paths.h>.
$ git range-diff shadow/master gh/shadow shadow
warning: refname 'shadow' is ambiguous.
warning: refname 'shadow' is ambiguous.
 1:  e6fa1e7e =  1:  e6fa1e7e lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  c834a6a6 =  2:  c834a6a6 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  80f598e0 =  3:  80f598e0 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  0c1cd567 !  4:  791516e0 lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/shadow/gshadow/gshadow.h, lib/, src/: GSHADOW_FILE: Move definition and rename it
    +    lib/shadow/gshadow/gshadow.h, lib/, src/: Use _PATH_GSHADOW from <paths.h>
     
         This macro is provided by glibc (but not musl) as _FILE_GSHADOW in
         <paths.h>.  Let's use that macro, and define it only if libc doesn't
    @@ lib/gshadow.c: void setsgent (void)
     
      ## lib/prefix_flag.c ##
     @@
    + 
    + #ident "$Id$"
    + 
    ++#include <paths.h>
    + #include <stdio.h>
    ++
    + #include <assert.h>
    + 
    + #include "atoi/getnum.h"
    +@@
      #include "subordinateio.h"
      #endif                            /* ENABLE_SUBIDS */
      #include "getdef.h"
    @@ lib/prefix_flag.c: extern const char* process_prefix_flag (const char* short_opt
     
      ## lib/sgroupio.c ##
     @@
    + 
    + #ifdef SHADOWGRP
    + 
    +-#ident "$Id$"
    ++#include <paths.h>
    + 
    + #include "alloc/calloc.h"
    + #include "alloc/malloc.h"
    +@@
      #include "fields.h"
      #include "getdef.h"
      #include "sgroupio.h"
    @@ lib/shadow/gshadow/gshadow.h
     
      ## src/grpck.c ##
     @@
    + 
    + #include <fcntl.h>
    + #include <grp.h>
    ++#include <paths.h>
    + #include <pwd.h>
    + #include <stdio.h>
    + #include <getopt.h>
    +@@
      #include "groupio.h"
      #include "nscd.h"
      #include "prototypes.h"
    @@ src/grpck.c: static const char *grp_file = GROUP_FILE;
     
      ## src/grpunconv.c ##
     @@
    + 
    + #include "config.h"
    + 
    +-#ident "$Id$"
    +-
    ++#include <paths.h>
    + #include <stdio.h>
    + #include <stdlib.h>
    + #include <string.h>
    +@@
      #ifdef SHADOWGRP
      #include "groupio.h"
      #include "sgroupio.h"
 5:  d1b3c08e !  5:  1367bdbe lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
    @@ lib/shadow/gshadow/setsgent.c (new)
     +
     +#include "shadow/gshadow/setsgent.h"
     +
    ++#include <paths.h>
     +#include <stddef.h>
     +#include <stdio.h>
     +
 6:  4640d201 =  6:  2b3901e4 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  fc223dd1 =  7:  66a7a33d lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  f76fbd24 =  8:  18d33b18 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  ab0127b0 =  9:  a5c40201 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  d0abd266 = 10:  0df5664d lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  d3fc6de7 = 11:  c5370ccc lib/: GSHADOW: Remove unused macro
12:  f091c7bb = 12:  6bbe02c9 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  0866331b = 13:  d7d4d5b5 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  0409eff2 = 14:  c0ba0601 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
 -:  -------- > 15:  a45f67f1 lib/: Use libc _FILE_SHADOW from <paths.h>
v8b
  • Fix macro name.
$ git range-diff shadow/master gh/shadow shadow
warning: refname 'shadow' is ambiguous.
warning: refname 'shadow' is ambiguous.
 1:  e6fa1e7e =  1:  e6fa1e7e lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  c834a6a6 =  2:  c834a6a6 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  80f598e0 =  3:  80f598e0 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  791516e0 !  4:  8a91c39f lib/shadow/gshadow/gshadow.h, lib/, src/: Use _PATH_GSHADOW from <paths.h>
    @@ lib/gshadow.c: void setsgent (void)
                rewind(gshadow);
        } else {
     -          gshadow = fopen(SGROUP_FILE, "re");
    -+          gshadow = fopen(_FILE_GSHADOW, "re");
    ++          gshadow = fopen(_PATH_GSHADOW, "re");
        }
      }
      
    @@ lib/prefix_flag.c: extern const char* process_prefix_flag (const char* short_opt
      
      #ifdef  SHADOWGRP
     -          sgroup_db_file = xaprintf("%s/%s", prefix, SGROUP_FILE);
    -+          sgroup_db_file = xaprintf("%s/%s", prefix, _FILE_GSHADOW);
    ++          sgroup_db_file = xaprintf("%s/%s", prefix, _PATH_GSHADOW);
                sgr_setdbname(sgroup_db_file);
      #endif
      
    @@ lib/sgroupio.c: static struct commonio_ops gshadow_ops = {
      
      static struct commonio_db gshadow_db = {
     -  SGROUP_FILE,            /* filename */
    -+  _FILE_GSHADOW,          /* filename */
    ++  _PATH_GSHADOW,          /* filename */
        &gshadow_ops,           /* ops */
        NULL,                   /* fp */
      #ifdef WITH_SELINUX
    @@ lib/shadow/gshadow/gshadow.h
      #include <stdio.h>
      
      
    -+#ifndef _FILE_GSHADOW
    -+# define _FILE_GSHADOW  "/etc/gshadow"
    ++#ifndef _PATH_GSHADOW
    ++# define _PATH_GSHADOW  "/etc/gshadow"
     +#endif
     +
     +
 5:  1367bdbe !  5:  2deea428 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
    @@ lib/gshadow.c: build_list(char *s)
     -  if (NULL != gshadow) {
     -          rewind(gshadow);
     -  } else {
    --          gshadow = fopen(_FILE_GSHADOW, "re");
    +-          gshadow = fopen(_PATH_GSHADOW, "re");
     -  }
     -}
     -
    @@ lib/shadow/gshadow/setsgent.c (new)
     +  if (NULL != gshadow) {
     +          rewind(gshadow);
     +  } else {
    -+          gshadow = fopen(_FILE_GSHADOW, "re");
    ++          gshadow = fopen(_PATH_GSHADOW, "re");
     +  }
     +}
     +#endif
 6:  2b3901e4 =  6:  87fa6552 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  66a7a33d =  7:  22fd7884 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  18d33b18 =  8:  7eaf4476 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  a5c40201 =  9:  7ae283a6 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  0df5664d = 10:  c1d647b3 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  c5370ccc = 11:  61080645 lib/: GSHADOW: Remove unused macro
12:  6bbe02c9 = 12:  9b032675 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  d7d4d5b5 = 13:  437ecf1d lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  c0ba0601 = 14:  9eb5ee7e lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
15:  a45f67f1 ! 15:  07dc45d2 lib/: Use libc _FILE_SHADOW from <paths.h>
    @@ lib/prefix_flag.c: extern const char* process_prefix_flag (const char* short_opt
      #endif
      
     -          spw_db_file = xaprintf("%s/%s", prefix, SHADOW_FILE);
    -+          spw_db_file = xaprintf("%s/%s", prefix, _FILE_SHADOW);
    ++          spw_db_file = xaprintf("%s/%s", prefix, _PATH_SHADOW);
                spw_setdbname(spw_db_file);
      
      #ifdef ENABLE_SUBIDS
    @@ lib/shadowio.c: static struct commonio_ops shadow_ops = {
      
      static struct commonio_db shadow_db = {
     -  SHADOW_FILE,            /* filename */
    -+  _FILE_SHADOW,           /* filename */
    ++  _PATH_SHADOW,           /* filename */
        &shadow_ops,            /* ops */
        NULL,                   /* fp */
      #ifdef WITH_SELINUX
v8c
  • Fix macro name in a few more places.
$ git range-diff shadow/master gh/shadow shadow
warning: refname 'shadow' is ambiguous.
warning: refname 'shadow' is ambiguous.
 1:  e6fa1e7e =  1:  e6fa1e7e lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  c834a6a6 =  2:  c834a6a6 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  80f598e0 =  3:  80f598e0 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  8a91c39f !  4:  c646cf9d lib/shadow/gshadow/gshadow.h, lib/, src/: Use _PATH_GSHADOW from <paths.h>
    @@ Metadata
      ## Commit message ##
         lib/shadow/gshadow/gshadow.h, lib/, src/: Use _PATH_GSHADOW from <paths.h>
     
    -    This macro is provided by glibc (but not musl) as _FILE_GSHADOW in
    +    This macro is provided by glibc (but not musl) as _PATH_GSHADOW in
         <paths.h>.  Let's use that macro, and define it only if libc doesn't
         provide it.
     
    @@ src/grpck.c: static const char *grp_file = GROUP_FILE;
      
      #ifdef    SHADOWGRP
     -static const char *sgr_file = SGROUP_FILE;
    -+static const char  *sgr_file = _FILE_GSHADOW;
    ++static const char  *sgr_file = _PATH_GSHADOW;
      static bool use_system_sgr_file = true;
      static bool is_shadow = false;
      static bool sgr_locked = false;
    @@ src/grpunconv.c: int main (int argc, char **argv)
        }
      
     -  if (unlink (SGROUP_FILE) != 0) {
    -+  if (unlink(_FILE_GSHADOW) != 0) {
    ++  if (unlink(_PATH_GSHADOW) != 0) {
                fprintf (stderr,
                         _("%s: cannot delete %s\n"),
     -                   Prog, SGROUP_FILE);
     -          SYSLOG ((LOG_ERR, "cannot delete %s", SGROUP_FILE));
    -+                   Prog, _FILE_GSHADOW);
    -+          SYSLOG((LOG_ERR, "cannot delete %s", _FILE_GSHADOW));
    ++                   Prog, _PATH_GSHADOW);
    ++          SYSLOG((LOG_ERR, "cannot delete %s", _PATH_GSHADOW));
                fail_exit (3);
        }
      
 5:  2deea428 =  5:  7c3f659c lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  87fa6552 =  6:  24fef3d1 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  22fd7884 =  7:  9d7b7cef lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  7eaf4476 =  8:  64a12b07 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  7ae283a6 =  9:  79a4bc18 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  c1d647b3 = 10:  082ec604 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  61080645 = 11:  1f15c5e7 lib/: GSHADOW: Remove unused macro
12:  9b032675 = 12:  f598ee57 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  437ecf1d = 13:  0af3ff34 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  9eb5ee7e = 14:  67071c1b lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
15:  07dc45d2 = 15:  eeb5a1d2 lib/: Use libc _FILE_SHADOW from <paths.h>
v8d
  • Add missing include.
$ git range-diff shadow/master gh/shadow shadow
warning: refname 'shadow' is ambiguous.
warning: refname 'shadow' is ambiguous.
 1:  e6fa1e7e =  1:  e6fa1e7e lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  c834a6a6 =  2:  c834a6a6 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  80f598e0 =  3:  80f598e0 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  c646cf9d =  4:  c646cf9d lib/shadow/gshadow/gshadow.h, lib/, src/: Use _PATH_GSHADOW from <paths.h>
 5:  7c3f659c =  5:  7c3f659c lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  24fef3d1 =  6:  24fef3d1 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  9d7b7cef =  7:  9d7b7cef lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  64a12b07 =  8:  64a12b07 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
 9:  79a4bc18 =  9:  79a4bc18 lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  082ec604 = 10:  082ec604 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  1f15c5e7 = 11:  1f15c5e7 lib/: GSHADOW: Remove unused macro
12:  f598ee57 = 12:  f598ee57 lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  0af3ff34 = 13:  0af3ff34 lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  67071c1b ! 14:  5cd393a7 lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
    @@ lib/sgetspent.c => lib/shadow/shadow/sgetspent.c
      #include "config.h"
      
     -/* Newer versions of Linux libc already have shadow support.  */
    - #ifndef HAVE_SGETSPENT
    +-#ifndef HAVE_SGETSPENT
    ++#include "shadow/shadow/sgetspent.h"
      
     -#ident "$Id$"
    --
    ++#ifndef HAVE_SGETSPENT
    + 
      #include <stddef.h>
      #include <stdio.h>
    - #include <stdlib.h>
     
      ## lib/shadow/shadow/sgetspent.h (new) ##
     @@
15:  eeb5a1d2 = 15:  88570629 lib/: Use libc _FILE_SHADOW from <paths.h>
v8e
  • Add missing include.
$ git range-diff shadow/master gh/shadow shadow
warning: refname 'shadow' is ambiguous.
warning: refname 'shadow' is ambiguous.
 1:  e6fa1e7e =  1:  e6fa1e7e lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
 2:  c834a6a6 =  2:  c834a6a6 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
 3:  80f598e0 =  3:  80f598e0 lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
 4:  c646cf9d =  4:  c646cf9d lib/shadow/gshadow/gshadow.h, lib/, src/: Use _PATH_GSHADOW from <paths.h>
 5:  7c3f659c =  5:  7c3f659c lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
 6:  24fef3d1 =  6:  24fef3d1 lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
 7:  9d7b7cef =  7:  9d7b7cef lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
 8:  64a12b07 !  8:  dfc830f6 lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +#include "shadow/gshadow/sgetsgent.h"
     +
     +#include <stddef.h>
    ++#include <stdlib.h>
     +#include <string.h>
     +
     +#include "shadow/gshadow/sgrp.h"
 9:  79a4bc18 =  9:  96b7408a lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
10:  082ec604 = 10:  ad8d884a lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
11:  1f15c5e7 = 11:  f35c1158 lib/: GSHADOW: Remove unused macro
12:  f598ee57 = 12:  8a941ebb lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  0af3ff34 = 13:  acaecf0e lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  5cd393a7 = 14:  a8c1113e lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
15:  88570629 = 15:  36e65e23 lib/: Use libc _FILE_SHADOW from <paths.h>
v8f
  • Unify commit message subjects.
$ git range-diff shadow/master gh/shadow shadow
warning: refname 'shadow' is ambiguous.
warning: refname 'shadow' is ambiguous.
 1:  e6fa1e7e !  1:  291514e3 lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/shadow/gshadow/, lib/: putsgent(): Move to separate file
    +    lib/shadow/, lib/: putsgent(): Move to separate file
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     
 2:  c834a6a6 !  2:  426570e8 lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/shadow/gshadow/, lib/: gshadow: Move to separate file and rename
    +    lib/shadow/, lib/: gshadow: Move to separate file and rename
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     
 3:  80f598e0 !  3:  9fe9529d lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/shadow/gshadow/, lib/, src/: endsgent(): Move to separate file
    +    lib/shadow/, lib/, src/: endsgent(): Move to separate file
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     
 4:  c646cf9d !  4:  d93a0612 lib/shadow/gshadow/gshadow.h, lib/, src/: Use _PATH_GSHADOW from <paths.h>
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/shadow/gshadow/gshadow.h, lib/, src/: Use _PATH_GSHADOW from <paths.h>
    +    lib/shadow/, lib/, src/: Use _PATH_GSHADOW from <paths.h>
     
         This macro is provided by glibc (but not musl) as _PATH_GSHADOW in
         <paths.h>.  Let's use that macro, and define it only if libc doesn't
 5:  7c3f659c !  5:  dc2b56f7 lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/shadow/gshadow/, lib/: setsgent(): Move to separate file
    +    lib/shadow/, lib/: setsgent(): Move to separate file
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     
 6:  24fef3d1 !  6:  14e0357b lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/shadow/gshadow/, lib/, src/: struct sgrp: Move to separate file
    +    lib/shadow/, lib/, src/: struct sgrp: Move to separate file
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     
 7:  9d7b7cef !  7:  8f8e82f6 lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/shadow/gshadow/, lib/: fgetsgent(): Move to separate file
    +    lib/shadow/, lib/: fgetsgent(): Move to separate file
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     
 8:  dfc830f6 !  8:  16289f8a lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/shadow/gshadow/, lib/: sgetsgent(): Move to separate file
    +    lib/shadow/, lib/: sgetsgent(): Move to separate file
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     
 9:  96b7408a !  9:  3db96e0d lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/shadow/gshadow/, lib/, src/: getsgnam(): Move to separate file
    +    lib/shadow/, lib/, src/: getsgnam(): Move to separate file
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     
10:  ad8d884a ! 10:  c49a7f49 lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/shadow/gshadow/, lib/: getsgent(): Move to separate file
    +    lib/shadow/, lib/: getsgent(): Move to separate file
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     
11:  f35c1158 = 11:  c606a97f lib/: GSHADOW: Remove unused macro
12:  8a941ebb ! 12:  4ab3228a lib/, po/: sgetgrent(): Move to under lib/shadow/group/
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/, po/: sgetgrent(): Move to under lib/shadow/group/
    +    lib/shadow/, lib/, po/: sgetgrent(): Move to under lib/shadow/group/
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     
13:  acaecf0e ! 13:  dc0e5c1c lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
    +    lib/shadow/, lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     
14:  a8c1113e ! 14:  c2a3062b lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
    @@ Metadata
     Author: Alejandro Colomar <alx@kernel.org>
     
      ## Commit message ##
    -    lib/shadow/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
    +    lib/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
     
         Signed-off-by: Alejandro Colomar <alx@kernel.org>
     
15:  36e65e23 = 15:  d3b6d8e2 lib/: Use libc _FILE_SHADOW from <paths.h>
v8g
$ git range-diff shadow/master gh/shadow shadow
warning: refname 'shadow' is ambiguous.
warning: refname 'shadow' is ambiguous.
 1:  291514e3 =  1:  291514e3 lib/shadow/, lib/: putsgent(): Move to separate file
 2:  426570e8 =  2:  426570e8 lib/shadow/, lib/: gshadow: Move to separate file and rename
 3:  9fe9529d =  3:  9fe9529d lib/shadow/, lib/, src/: endsgent(): Move to separate file
 4:  d93a0612 =  4:  d93a0612 lib/shadow/, lib/, src/: Use _PATH_GSHADOW from <paths.h>
 5:  dc2b56f7 =  5:  dc2b56f7 lib/shadow/, lib/: setsgent(): Move to separate file
 6:  14e0357b =  6:  14e0357b lib/shadow/, lib/, src/: struct sgrp: Move to separate file
 7:  8f8e82f6 =  7:  8f8e82f6 lib/shadow/, lib/: fgetsgent(): Move to separate file
 8:  16289f8a !  8:  26d6363f lib/shadow/, lib/: sgetsgent(): Move to separate file
    @@ lib/shadow/gshadow/sgetsgent.c (new)
     +#include "string/strtok/xastrsep2ls.h"
     +
     +
    -+#define FIELDS    4
    -+
    -+
     +#if defined(SHADOWGRP) && !__has_include(<gshadow.h>)
     +static struct sgrp  sgroup = {};
     +
 9:  3db96e0d =  9:  41293267 lib/shadow/, lib/, src/: getsgnam(): Move to separate file
10:  c49a7f49 = 10:  dc9af055 lib/shadow/, lib/: getsgent(): Move to separate file
11:  c606a97f = 11:  7448d8bb lib/: GSHADOW: Remove unused macro
12:  4ab3228a = 12:  f0a38019 lib/shadow/, lib/, po/: sgetgrent(): Move to under lib/shadow/group/
13:  dc0e5c1c = 13:  b6d5ce1a lib/shadow/, lib/, po/: sgetpwent(): Move to under lib/shadow/passwd/
14:  c2a3062b = 14:  29da8905 lib/shadow/, lib/, po/: sgetspent(): Move to under lib/shadow/shadow/
15:  d3b6d8e2 = 15:  8a20518a lib/: Use libc _FILE_SHADOW from <paths.h>

@alejandro-colomar

This comment was marked as outdated.

@alejandro-colomar alejandro-colomar force-pushed the shadow branch 3 times, most recently from 824137b to f8cd3eb Compare January 27, 2025 11:57
@alejandro-colomar alejandro-colomar marked this pull request as ready for review January 27, 2025 12:04
@alejandro-colomar alejandro-colomar force-pushed the shadow branch 4 times, most recently from c27bde0 to dd9501d Compare February 16, 2025 23:26
@alejandro-colomar alejandro-colomar force-pushed the shadow branch 2 times, most recently from 430d7dc to 3813478 Compare March 3, 2025 20:57
@alejandro-colomar alejandro-colomar force-pushed the shadow branch 4 times, most recently from a70d6b7 to 87699a6 Compare June 2, 2025 09:15
@alejandro-colomar alejandro-colomar force-pushed the shadow branch 4 times, most recently from a634b54 to aa04acb Compare June 7, 2025 17:59
@alejandro-colomar alejandro-colomar mentioned this pull request Jun 10, 2025
@alejandro-colomar alejandro-colomar force-pushed the shadow branch 2 times, most recently from 5f243af to 0ace75a Compare July 20, 2025 14:38
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This macro is provided by glibc (but not musl) as _PATH_GSHADOW in
<paths.h>.  Let's use that macro, and define it only if libc doesn't
provide it.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
@ikerexxe
Copy link
Collaborator

ikerexxe commented Oct 6, 2025

Some comments inline.

Beyond the great win for modularity and internal code structure, are there any strategic future goals for this move?

Specifically, is this change a prerequisite for a new feature, or does it pave the way for other PRs?

@alejandro-colomar
Copy link
Collaborator Author

Some comments inline.

Beyond the great win for modularity and internal code structure, are there any strategic future goals for this move?

Specifically, is this change a prerequisite for a new feature, or does it pave the way for other PRs?

Yes, there are several PRs that depend on this one already:

Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
And with it, the file that defines it, which does nothing else.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
Copy link
Collaborator

@ikerexxe ikerexxe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, even though they create a lot of files with a single function and add some complexity to the build system, I like these changes because they pave the way for the improvements that are proposed later

@ikerexxe ikerexxe merged commit 3ea6df8 into shadow-maint:master Oct 7, 2025
11 checks passed
@alejandro-colomar
Copy link
Collaborator Author

Thanks!

@alejandro-colomar alejandro-colomar deleted the shadow branch October 7, 2025 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants