summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorCallum Parsey2023-03-07 20:48:44 +1030
committerCallum Parsey2023-03-07 20:48:44 +1030
commit83834916010f60024a22091f95ea15e7e98cdf95 (patch)
tree83029208ff6a14fc815ef4e0421a22af0530aa82
parent054f4057d6e2794161de31648dfbaa2c112bacf6 (diff)
downloadaur-83834916010f60024a22091f95ea15e7e98cdf95.tar.gz
Fix use of extended `--comment` argument
-rw-r--r--PKGBUILD35
-rw-r--r--arch-finger.patch23
2 files changed, 58 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
index d1cc138d2a07..0e473d34b844 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -40,9 +40,11 @@ makedepends=("po4a")
conflicts=("adduser")
backup=("etc/adduser.conf" "etc/deluser.conf")
source=("https://salsa.debian.org/debian/adduser/-/archive/debian/${pkgver}/${_pkgname}-${pkgver}.tar.gz"
+ "arch-finger.patch"
"arch-license-path.patch"
"arch-policy.patch")
sha256sums=('3ce6de32bce048d12429d9431b36d8437c1934266475b6a9f5235b3dff54f918'
+ '917d0f4733610e0fef9210728d1a11ac47574293c5c4c5e37d654e78f84dff85'
'2bb01846f0f3206796a817aacc65bef7d216ef7e0a89132661abb4182f0ba7d6'
'245e1fcd5baa0e85471ef92778bd429dedc094e02743d1a832217e116be3ccb1')
@@ -77,6 +79,39 @@ prepare() {
patch -Np0 -d . -i arch-license-path.patch
cd ${_pkgname}-${pkgver}
sed -i "s/my \$version = \"VERSION\"/my \$version = \"${pkgver}-arch${pkgrel}\"/" adduser deluser
+ cd ..
+
+ # On Arch, `chfn` comes from the `util-linux` package rather than `shadow`.
+ # Both packages have different interpretations of the GECOS/finger field in
+ # user definitions. The `shadow` or Debian version has the following format:
+ # * Full Name (`-f` argument)
+ # * Office Room Number (`-r` argument)
+ # * Work Phone Number (`-w` argument)
+ # * Home Phone Number (`-h` argument)
+ # * Other (`-o` argument)
+ # Whereas the `util-linux` or Arch version has the following format:
+ # * Full Name (`-f` argument)
+ # * Office Room Number (`-o` argument)
+ # * Office Phone Number (`-p` argument)
+ # * Home Phone Number (`-h` argument)
+ # So the differences are in the arguments which need to be passed to `chfn`,
+ # and that Arch does not have an "other" field.
+ #
+ # In the normal case (the user does not specify the `--comment` argument)
+ # there is no issue, as the script calls `chfn` with no arguments to prompt
+ # the user for the finger information. But if the `--comment` argument is
+ # specified, the script will try to call `chfn` with each of the above
+ # arguments. This will cause the script to fail once it reaches the Office
+ # Room Number field, because the `-r` flag doesn't exist.
+ #
+ # This patch resolves the issue by changing how the `--comment` argument is
+ # translated into `chfn` calls. These changes are internal and do not change
+ # the format of the arguments the user should use, i.e. a comma-separated
+ # list like `--comment "<name>,<room>,<work>,<home>"` is still correct. The
+ # user should note that there is no longer an "other" field, and if the user
+ # specifies one, e.g. `--comment "<name>,<room>,<work>,<home>,<other>"`, it
+ # will be ignored, like how the stock script ignores all additional fields.
+ patch -Np0 -d . -i arch-finger.patch
}
# Translated manpages have to be generated using `po4a`. A Makefile is provided
diff --git a/arch-finger.patch b/arch-finger.patch
new file mode 100644
index 000000000000..13e828cd096d
--- /dev/null
+++ b/arch-finger.patch
@@ -0,0 +1,23 @@
+diff '--color=auto' -rupN adduser-debian-3.131.orig/adduser adduser-debian-3.131/adduser
+--- adduser-debian-3.131.orig/adduser 2023-03-07 20:17:55.743091131 +1030
++++ adduser-debian-3.131/adduser 2023-03-07 20:19:16.165702456 +1030
+@@ -1185,16 +1185,14 @@ sub ch_comment {
+ my $chfn = &which('chfn');
+ my $comment = shift;
+ if($comment =~ /,/) {
+- my($comment_name,$comment_room,$comment_work,$comment_home,$comment_other)
++ my($comment_name,$comment_room,$comment_work,$comment_home)
+ = split(/,/,$comment);
+
+- &systemcall($chfn, '-f', $comment_name, '-r', $comment_room, $new_name);
+- &systemcall($chfn,'-w',$comment_work,$new_name)
++ &systemcall($chfn, '-f', $comment_name, '-o', $comment_room, $new_name);
++ &systemcall($chfn,'-p',$comment_work,$new_name)
+ if(defined($comment_work));
+ &systemcall($chfn,'-h',$comment_home,$new_name)
+ if(defined($comment_home));
+- &systemcall($chfn,'-o',$comment_other,$new_name)
+- if(defined($comment_other));
+ } else {
+ &systemcall($chfn, '-f', $comment, $new_name);
+ }