From fea713992dea5a332fe18b8b1e3aa6c1c5cb897f Mon Sep 17 00:00:00 2001 From: Chris Hofstaedtler Date: Mon, 17 Feb 2025 18:20:49 +0100 Subject: [PATCH] Warn about future --badname removal Upstream PR 1158 plans to remove this flag, probably in the forky timeframe. Warn users now. Gbp-Dch: full --- ...-when-badname-and-variants-are-given.patch | 104 ++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 105 insertions(+) create mode 100644 debian/patches/Warn-when-badname-and-variants-are-given.patch diff --git a/debian/patches/Warn-when-badname-and-variants-are-given.patch b/debian/patches/Warn-when-badname-and-variants-are-given.patch new file mode 100644 index 00000000..956b05f4 --- /dev/null +++ b/debian/patches/Warn-when-badname-and-variants-are-given.patch @@ -0,0 +1,104 @@ +From: Chris Hofstaedtler +Date: Mon, 17 Feb 2025 18:17:15 +0100 +Subject: Warn when --badname (and variants) are given + +Upstream PR 1158 will remove them, probably in the forky timeframe. +--- + src/newusers.c | 5 ++++- + src/pwck.c | 5 ++++- + src/useradd.c | 5 ++++- + src/usermod.c | 5 ++++- + 4 files changed, 16 insertions(+), 4 deletions(-) + +diff --git a/src/newusers.c b/src/newusers.c +index 5e78dd9..964e668 100644 +--- a/src/newusers.c ++++ b/src/newusers.c +@@ -125,7 +125,7 @@ static void usage (int status) + "\n" + "Options:\n"), + Prog); +- (void) fputs (_(" -b, --badname allow bad names\n"), usageout); ++ (void) fputs (_(" -b, --badname allow bad names (DEPRECATED)\n"), usageout); + #ifndef USE_PAM + (void) fprintf (usageout, + _(" -c, --crypt-method METHOD the crypt method (one of %s)\n"), +@@ -658,6 +658,9 @@ static void process_flags (int argc, char **argv) + switch (c) { + case 'b': + allow_bad_names = true; ++ fprintf (stderr, ++ _("%s: WARNING: -b and --badname are deprecated and will be removed\n"), ++ Prog); + break; + #ifndef USE_PAM + case 'c': +diff --git a/src/pwck.c b/src/pwck.c +index ae7ddad..8805422 100644 +--- a/src/pwck.c ++++ b/src/pwck.c +@@ -133,7 +133,7 @@ usage (int status) + "Options:\n"), + Prog); + } +- (void) fputs (_(" -b, --badname allow bad names\n"), usageout); ++ (void) fputs (_(" -b, --badname allow bad names (DEPRECATED)\n"), usageout); + (void) fputs (_(" -h, --help display this help message and exit\n"), usageout); + (void) fputs (_(" -q, --quiet report errors only\n"), usageout); + (void) fputs (_(" -r, --read-only display errors and warnings\n" +@@ -175,6 +175,9 @@ static void process_flags (int argc, char **argv) + switch (c) { + case 'b': + allow_bad_names = true; ++ fprintf (stderr, ++ _("%s: WARNING: --badname is deprecated and will be removed\n"), ++ Prog); + break; + case 'h': + usage (E_SUCCESS); +diff --git a/src/useradd.c b/src/useradd.c +index 92f8054..f5169b3 100644 +--- a/src/useradd.c ++++ b/src/useradd.c +@@ -894,7 +894,7 @@ static void usage (int status) + "\n" + "Options:\n"), + Prog, Prog, Prog); +- (void) fputs (_(" --badname do not check for bad names\n"), usageout); ++ (void) fputs (_(" --badname do not check for bad names (DEPRECATED)\n"), usageout); + (void) fputs (_(" -b, --base-dir BASE_DIR base directory for the home directory of the\n" + " new account\n"), usageout); + #ifdef WITH_BTRFS +@@ -1240,6 +1240,9 @@ static void process_flags (int argc, char **argv) + break; + case 201: + allow_bad_names = true; ++ fprintf (stderr, ++ _("%s: WARNING: --badname is deprecated and will be removed\n"), ++ Prog); + break; + case 'c': + if (!VALID (optarg)) { +diff --git a/src/usermod.c b/src/usermod.c +index 24c5a4d..a06f2dc 100644 +--- a/src/usermod.c ++++ b/src/usermod.c +@@ -383,7 +383,7 @@ usage (int status) + (void) fputs (_(" -a, --append append the user to the supplemental GROUPS\n" + " mentioned by the -G option without removing\n" + " the user from other groups\n"), usageout); +- (void) fputs (_(" -b, --badname allow bad names\n"), usageout); ++ (void) fputs (_(" -b, --badname allow bad names (DEPRECATED)\n"), usageout); + (void) fputs (_(" -c, --comment COMMENT new value of the GECOS field\n"), usageout); + (void) fputs (_(" -d, --home HOME_DIR new home directory for the user account\n"), usageout); + (void) fputs (_(" -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE\n"), usageout); +@@ -1043,6 +1043,9 @@ process_flags(int argc, char **argv) + break; + case 'b': + allow_bad_names = true; ++ fprintf (stderr, ++ _("%s: WARNING: -b, --badname and --badnames are deprecated and will be removed\n"), ++ Prog); + break; + case 'c': + if (!VALID (optarg)) { diff --git a/debian/patches/series b/debian/patches/series index 3b3e9765..0164cd4a 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -11,3 +11,4 @@ upstream/man-useradd.8.xml-Document-new-exit-code-19-E_BAD_NAME.patch upstream/Revert-lib-src-Use-local-time-for-human-readable-dates.patch Revert-lib-strtoday.c-strtoday-Fix-calculation.patch Partially-revert-lib-src-Use-strsep-3-instead-of-its-patt.patch +Warn-when-badname-and-variants-are-given.patch