Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dead beef #1230

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

alejandro-colomar
Copy link
Collaborator

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

We didn't even have prototypes for these APIs since long ago, when the prototypes were removed, but misteriously the implementations remained.

Both glibc and musl provide getspnam(3), so this file was effectively being ignored by the compiler. Just remove it.

Also remove the check for getspnam, which isn't used elsewhere.

Fixes: 0ee095a (2007-10-07; "[svn-upgrade] Integrating new upstream version, shadow (4.0.7)")
Closes: #1228


Revisions:

v2
  • Remove other dead code found by @zeha
$ git range-diff master gh/sh sh
1:  22f49d87 = 1:  22f49d87 configure.ac, lib/shadow.c, po/: Remove dead file
-:  -------- > 2:  036f5d7e configure.ac, contrib/, src/: Remove obsolete check
-:  -------- > 3:  97856757 configure.ac: Remove unused check for futimes(3)
v2b
  • Remove dead code I forgot to remove in v2.
$ git range-diff master gh/sh sh
1:  22f49d87 = 1:  22f49d87 configure.ac, lib/shadow.c, po/: Remove dead file
2:  036f5d7e ! 2:  4bb6df21 configure.ac, contrib/, src/: Remove obsolete check
    @@ Metadata
     Author: Alejandro Colomar <[email protected]>
     
      ## Commit message ##
    -    configure.ac, contrib/, src/: Remove obsolete check
    +    configure.ac, contrib/, src/: Remove dead code
     
         Both glibc and musl provide getusershell(3).  It's an API from 4.3BSD,
         according to the manual page, so let's assume it exists everywhere that
    @@ Commit message
         Reported-by: Chris Hofstaedtler <[email protected]>
         Signed-off-by: Alejandro Colomar <[email protected]>
     
    +    f
    +
      ## configure.ac ##
     @@ configure.ac: dnl shadow now uses the libc's shadow implementation
      AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])])
    @@ src/chsh.c: static bool shell_is_listed (const char *sh)
        }
        endusershell ();
     -#else
    -+
    -   char *buf = NULL;
    -   FILE *fp;
    -   size_t n = 0;
    +-  char *buf = NULL;
    +-  FILE *fp;
    +-  size_t n = 0;
    + 
    +-  fp = fopen (SHELLS_FILE, "r");
    +-  if (NULL == fp) {
    +-          return false;
    +-  }
    +-
    +-  while (getline (&buf, &n, fp) != -1) {
    +-          if (buf[0] != '/') {
    +-                  continue;
    +-          }
    +-
    +-          if (streq(buf, sh)) {
    +-                  found = true;
    +-                  break;
    +-          }
    +-  }
    +-
    +-  free(buf);
    +-  fclose (fp);
    +-#endif
    +   return found;
    + }
    + #endif /* with HAVE_VENDORDIR */
3:  97856757 = 3:  9c7bd91a configure.ac: Remove unused check for futimes(3)
v2c
  • Remove stray 'f' in commit message (it was a glitch of rebasing). [@zeha]
$ git range-diff master gh/sh sh
1:  22f49d87 = 1:  22f49d87 configure.ac, lib/shadow.c, po/: Remove dead file
2:  4bb6df21 ! 2:  11addd70 configure.ac, contrib/, src/: Remove dead code
    @@ Commit message
         Reported-by: Chris Hofstaedtler <[email protected]>
         Signed-off-by: Alejandro Colomar <[email protected]>
     
    -    f
    -
      ## configure.ac ##
     @@ configure.ac: dnl shadow now uses the libc's shadow implementation
      AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])])
3:  9c7bd91a = 3:  239bfe65 configure.ac: Remove unused check for futimes(3)

We didn't even have prototypes for these APIs since long ago, when the
prototypes were removed, but misteriously the implementations remained.

Both glibc and musl provide getspnam(3), so this file was effectively
being ignored by the compiler.  Just remove it.

Also remove the check for getspnam, which isn't used elsewhere.

Fixes: 0ee095a (2007-10-07; "[svn-upgrade] Integrating new upstream version, shadow (4.0.7)")
Closes: <shadow-maint#1228>
Signed-off-by: Alejandro Colomar <[email protected]>
@alejandro-colomar alejandro-colomar changed the title configure.ac, lib/shadow.c: Remove dead file Remove dead beef Feb 24, 2025
@zeha
Copy link
Contributor

zeha commented Feb 25, 2025

4bb6df2 commit message has a stray "f" at the end

Both glibc and musl provide getusershell(3).  It's an API from 4.3BSD,
according to the manual page, so let's assume it exists everywhere that
we would care, even if it's not in POSIX.

Reported-by: Chris Hofstaedtler <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
Reported-by: Chris Hofstaedtler <[email protected]>
Signed-off-by: Alejandro Colomar <[email protected]>
@alejandro-colomar
Copy link
Collaborator Author

4bb6df2 commit message has a stray "f" at the end

Thanks! That was a glitch of squashing a commit with a dummy message, and forgetting to remove the name.

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.

lib/shadow.c is 0xDEADBEEF
2 participants